Code

Imported upstream version 1.2.26 upstream/1.2.26
authorBernd Zeimetz <bzed@debian.org>
Fri, 8 Feb 2008 21:13:27 +0000 (22:13 +0100)
committerBernd Zeimetz <bzed@debian.org>
Fri, 8 Feb 2008 21:13:27 +0000 (22:13 +0100)
246 files changed:
CHANGES [new file with mode: 0644]
CONTRIBUTORS [new file with mode: 0644]
COPYING [new file with mode: 0644]
COPYRIGHT [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]
THREADS [new file with mode: 0644]
TODO [new file with mode: 0644]
WIN32-BUILD-TIPS.txt [new file with mode: 0644]
acinclude.m4 [new file with mode: 0644]
aclocal.m4 [new file with mode: 0644]
bindings/Makefile.am [new file with mode: 0644]
bindings/Makefile.in [new file with mode: 0644]
bindings/perl-piped/MANIFEST [new file with mode: 0644]
bindings/perl-piped/Makefile.PL [new file with mode: 0644]
bindings/perl-piped/README [new file with mode: 0644]
bindings/perl-piped/RRDp.pm [new file with mode: 0644]
bindings/perl-piped/t/base.t [new file with mode: 0755]
bindings/perl-shared/MANIFEST [new file with mode: 0644]
bindings/perl-shared/Makefile.PL [new file with mode: 0644]
bindings/perl-shared/README [new file with mode: 0644]
bindings/perl-shared/RRDs.pm [new file with mode: 0644]
bindings/perl-shared/RRDs.xs [new file with mode: 0644]
bindings/perl-shared/ntmake.pl [new file with mode: 0644]
bindings/perl-shared/t/base.t [new file with mode: 0755]
bindings/python/ACKNOWLEDGEMENT [new file with mode: 0644]
bindings/python/AUTHORS [new file with mode: 0644]
bindings/python/COPYING [new file with mode: 0644]
bindings/python/README [new file with mode: 0644]
bindings/python/rrd_extra.h [new file with mode: 0644]
bindings/python/rrdtoolmodule.c [new file with mode: 0644]
bindings/python/setup.py [new file with mode: 0644]
bindings/ruby/CHANGES [new file with mode: 0644]
bindings/ruby/README [new file with mode: 0644]
bindings/ruby/extconf.rb [new file with mode: 0644]
bindings/ruby/main.c [new file with mode: 0644]
bindings/ruby/test.rb [new file with mode: 0755]
bindings/tcl/Makefile.am [new file with mode: 0644]
bindings/tcl/Makefile.in [new file with mode: 0644]
bindings/tcl/README [new file with mode: 0644]
bindings/tcl/ifOctets.tcl.in [new file with mode: 0644]
bindings/tcl/tclrrd.c [new file with mode: 0644]
compile [new file with mode: 0755]
config.guess [new file with mode: 0755]
config.sub [new file with mode: 0755]
configure [new file with mode: 0755]
configure.ac [new file with mode: 0644]
depcomp [new file with mode: 0755]
doc/Makefile.am [new file with mode: 0644]
doc/Makefile.in [new file with mode: 0644]
doc/RRDp.html [new file with mode: 0644]
doc/RRDs.html [new file with mode: 0644]
doc/bin_dec_hex.1 [new file with mode: 0644]
doc/bin_dec_hex.html [new file with mode: 0644]
doc/bin_dec_hex.pod [new file with mode: 0644]
doc/bin_dec_hex.txt [new file with mode: 0644]
doc/cdeftutorial.1 [new file with mode: 0644]
doc/cdeftutorial.html [new file with mode: 0644]
doc/cdeftutorial.pod [new file with mode: 0644]
doc/cdeftutorial.txt [new file with mode: 0644]
doc/rpntutorial.1 [new file with mode: 0644]
doc/rpntutorial.html [new file with mode: 0644]
doc/rpntutorial.pod [new file with mode: 0644]
doc/rpntutorial.txt [new file with mode: 0644]
doc/rrd-beginners.1 [new file with mode: 0644]
doc/rrd-beginners.html [new file with mode: 0644]
doc/rrd-beginners.pod [new file with mode: 0644]
doc/rrd-beginners.txt [new file with mode: 0644]
doc/rrdbuild.1 [new file with mode: 0644]
doc/rrdbuild.html [new file with mode: 0644]
doc/rrdbuild.pod [new file with mode: 0644]
doc/rrdbuild.txt [new file with mode: 0644]
doc/rrdcgi.1 [new file with mode: 0644]
doc/rrdcgi.html [new file with mode: 0644]
doc/rrdcgi.pod [new file with mode: 0644]
doc/rrdcgi.txt [new file with mode: 0644]
doc/rrdcreate.1 [new file with mode: 0644]
doc/rrdcreate.html [new file with mode: 0644]
doc/rrdcreate.pod [new file with mode: 0644]
doc/rrdcreate.txt [new file with mode: 0644]
doc/rrddump.1 [new file with mode: 0644]
doc/rrddump.html [new file with mode: 0644]
doc/rrddump.pod [new file with mode: 0644]
doc/rrddump.txt [new file with mode: 0644]
doc/rrdfetch.1 [new file with mode: 0644]
doc/rrdfetch.html [new file with mode: 0644]
doc/rrdfetch.pod [new file with mode: 0644]
doc/rrdfetch.txt [new file with mode: 0644]
doc/rrdfirst.1 [new file with mode: 0644]
doc/rrdfirst.html [new file with mode: 0644]
doc/rrdfirst.pod [new file with mode: 0644]
doc/rrdfirst.txt [new file with mode: 0644]
doc/rrdgraph.1 [new file with mode: 0644]
doc/rrdgraph.html [new file with mode: 0644]
doc/rrdgraph.pod [new file with mode: 0644]
doc/rrdgraph.txt [new file with mode: 0644]
doc/rrdgraph_data.1 [new file with mode: 0644]
doc/rrdgraph_data.html [new file with mode: 0644]
doc/rrdgraph_data.pod [new file with mode: 0644]
doc/rrdgraph_data.txt [new file with mode: 0644]
doc/rrdgraph_examples.1 [new file with mode: 0644]
doc/rrdgraph_examples.html [new file with mode: 0644]
doc/rrdgraph_examples.pod [new file with mode: 0644]
doc/rrdgraph_examples.txt [new file with mode: 0644]
doc/rrdgraph_graph.1 [new file with mode: 0644]
doc/rrdgraph_graph.html [new file with mode: 0644]
doc/rrdgraph_graph.pod [new file with mode: 0644]
doc/rrdgraph_graph.txt [new file with mode: 0644]
doc/rrdgraph_rpn.1 [new file with mode: 0644]
doc/rrdgraph_rpn.html [new file with mode: 0644]
doc/rrdgraph_rpn.pod [new file with mode: 0644]
doc/rrdgraph_rpn.txt [new file with mode: 0644]
doc/rrdinfo.1 [new file with mode: 0644]
doc/rrdinfo.html [new file with mode: 0644]
doc/rrdinfo.pod [new file with mode: 0644]
doc/rrdinfo.txt [new file with mode: 0644]
doc/rrdlast.1 [new file with mode: 0644]
doc/rrdlast.html [new file with mode: 0644]
doc/rrdlast.pod [new file with mode: 0644]
doc/rrdlast.txt [new file with mode: 0644]
doc/rrdlastupdate.1 [new file with mode: 0644]
doc/rrdlastupdate.html [new file with mode: 0644]
doc/rrdlastupdate.pod [new file with mode: 0644]
doc/rrdlastupdate.txt [new file with mode: 0644]
doc/rrdresize.1 [new file with mode: 0644]
doc/rrdresize.html [new file with mode: 0644]
doc/rrdresize.pod [new file with mode: 0644]
doc/rrdresize.txt [new file with mode: 0644]
doc/rrdrestore.1 [new file with mode: 0644]
doc/rrdrestore.html [new file with mode: 0644]
doc/rrdrestore.pod [new file with mode: 0644]
doc/rrdrestore.txt [new file with mode: 0644]
doc/rrdthreads.1 [new file with mode: 0644]
doc/rrdthreads.html [new file with mode: 0644]
doc/rrdthreads.pod [new file with mode: 0644]
doc/rrdthreads.txt [new file with mode: 0644]
doc/rrdtool-dump.dtd [new file with mode: 0644]
doc/rrdtool-xport.dtd [new file with mode: 0644]
doc/rrdtool.1 [new file with mode: 0644]
doc/rrdtool.html [new file with mode: 0644]
doc/rrdtool.pod [new file with mode: 0644]
doc/rrdtool.txt [new file with mode: 0644]
doc/rrdtune.1 [new file with mode: 0644]
doc/rrdtune.html [new file with mode: 0644]
doc/rrdtune.pod [new file with mode: 0644]
doc/rrdtune.txt [new file with mode: 0644]
doc/rrdtutorial.1 [new file with mode: 0644]
doc/rrdtutorial.html [new file with mode: 0644]
doc/rrdtutorial.pod [new file with mode: 0644]
doc/rrdtutorial.txt [new file with mode: 0644]
doc/rrdupdate.1 [new file with mode: 0644]
doc/rrdupdate.html [new file with mode: 0644]
doc/rrdupdate.pod [new file with mode: 0644]
doc/rrdupdate.txt [new file with mode: 0644]
doc/rrdxport.1 [new file with mode: 0644]
doc/rrdxport.html [new file with mode: 0644]
doc/rrdxport.pod [new file with mode: 0644]
doc/rrdxport.txt [new file with mode: 0644]
examples/4charts.pl.in [new file with mode: 0755]
examples/Makefile.am [new file with mode: 0644]
examples/Makefile.in [new file with mode: 0644]
examples/bigtops.pl.in [new file with mode: 0755]
examples/cgi-demo.cgi.in [new file with mode: 0755]
examples/minmax.pl.in [new file with mode: 0755]
examples/perftest.pl.in [new file with mode: 0755]
examples/piped-demo.pl.in [new file with mode: 0755]
examples/shared-demo.pl.in [new file with mode: 0755]
examples/stripes.pl.in [new file with mode: 0755]
favicon.ico [new file with mode: 0644]
install-sh [new file with mode: 0755]
ltmain.sh [new file with mode: 0644]
missing [new file with mode: 0755]
netware/Makefile [new file with mode: 0644]
rrd_config.h.in [new file with mode: 0644]
rrdtool.spec [new file with mode: 0644]
src/DejaVuSansMono-Roman.ttf [new file with mode: 0644]
src/Makefile.am [new file with mode: 0644]
src/Makefile.in [new file with mode: 0644]
src/art_rgba_svp.c [new file with mode: 0644]
src/art_rgba_svp.h [new file with mode: 0644]
src/fnv.h [new file with mode: 0644]
src/get_ver.awk [new file with mode: 0644]
src/hash_32.c [new file with mode: 0644]
src/parsetime.c [new file with mode: 0644]
src/parsetime.h [new file with mode: 0644]
src/pngsize.c [new file with mode: 0644]
src/rrd.h [new file with mode: 0644]
src/rrd_afm.c [new file with mode: 0644]
src/rrd_afm.h [new file with mode: 0644]
src/rrd_afm_data.c [new file with mode: 0644]
src/rrd_afm_data.h [new file with mode: 0644]
src/rrd_cgi.c [new file with mode: 0644]
src/rrd_create.c [new file with mode: 0644]
src/rrd_diff.c [new file with mode: 0644]
src/rrd_dump.c [new file with mode: 0644]
src/rrd_error.c [new file with mode: 0644]
src/rrd_fetch.c [new file with mode: 0644]
src/rrd_first.c [new file with mode: 0644]
src/rrd_format.c [new file with mode: 0644]
src/rrd_format.h [new file with mode: 0644]
src/rrd_getopt.c [new file with mode: 0644]
src/rrd_getopt.h [new file with mode: 0644]
src/rrd_getopt1.c [new file with mode: 0644]
src/rrd_gfx.c [new file with mode: 0644]
src/rrd_gfx.h [new file with mode: 0644]
src/rrd_graph.c [new file with mode: 0644]
src/rrd_graph.h [new file with mode: 0644]
src/rrd_graph_helper.c [new file with mode: 0644]
src/rrd_hw.c [new file with mode: 0644]
src/rrd_hw.h [new file with mode: 0644]
src/rrd_info.c [new file with mode: 0644]
src/rrd_is_thread_safe.h [new file with mode: 0644]
src/rrd_last.c [new file with mode: 0644]
src/rrd_lastupdate.c [new file with mode: 0644]
src/rrd_nan_inf.c [new file with mode: 0644]
src/rrd_nan_inf.h [new file with mode: 0644]
src/rrd_not_thread_safe.c [new file with mode: 0644]
src/rrd_open.c [new file with mode: 0644]
src/rrd_resize.c [new file with mode: 0644]
src/rrd_restore.c [new file with mode: 0644]
src/rrd_rpncalc.c [new file with mode: 0644]
src/rrd_rpncalc.h [new file with mode: 0644]
src/rrd_thread_safe.c [new file with mode: 0644]
src/rrd_thread_safe_nt.c [new file with mode: 0644]
src/rrd_tool.c [new file with mode: 0644]
src/rrd_tool.h [new file with mode: 0644]
src/rrd_tune.c [new file with mode: 0644]
src/rrd_update.c [new file with mode: 0644]
src/rrd_version.c [new file with mode: 0644]
src/rrd_xport.c [new file with mode: 0644]
src/rrd_xport.h [new file with mode: 0644]
src/rrdupdate.c [new file with mode: 0644]
src/strftime.c [new file with mode: 0644]
src/strftime.h [new file with mode: 0644]
src/unused.h [new file with mode: 0644]
src/win32comp.c [new file with mode: 0644]
win32/Makefile [new file with mode: 0644]
win32/config.h [new file with mode: 0644]
win32/rrd.dsp [new file with mode: 0644]
win32/rrd.vcproj [new file with mode: 0644]
win32/rrd_config.h.msvc [new file with mode: 0644]
win32/rrdtool.dsp [new file with mode: 0644]
win32/rrdtool.dsw [new file with mode: 0644]
win32/rrdtool.vcproj [new file with mode: 0644]

diff --git a/CHANGES b/CHANGES
new file mode 100644 (file)
index 0000000..56bf7d0
--- /dev/null
+++ b/CHANGES
@@ -0,0 +1,3369 @@
+2007-11-20 00:15  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/Makefile.am,
+         src/gdpng.c, src/pngsize.c, src/rrd.h, src/rrd_afm.c,
+         src/rrd_afm.h, src/rrd_afm_data.c, src/rrd_afm_data.h,
+         src/rrd_cgi.c, src/rrd_create.c, src/rrd_datalang.c,
+         src/rrd_diff.c, src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c,
+         src/rrd_first.c, src/rrd_format.c, src/rrd_format.h,
+         src/rrd_gfx.c, src/rrd_gfx.h, src/rrd_graph.c,
+         src/rrd_graph_helper.c, src/rrd_hw.c, src/rrd_hw.h,
+         src/rrd_info.c, src/rrd_is_thread_safe.h, src/rrd_last.c,
+         src/rrd_lastupdate.c, src/rrd_not_thread_safe.c, src/rrd_open.c,
+         src/rrd_resize.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_rpncalc.h, src/rrd_stat.c, src/rrd_thread_safe.c,
+         src/rrd_thread_safe_nt.c, src/rrd_tool.c, src/rrd_tool.h,
+         src/rrd_tune.c, src/rrd_update.c, src/rrd_version.c,
+         src/rrd_xport.c, src/rrd_xport.h, src/rrdupdate.c: prepare for the
+         release of rrdtool-1.2.26
+
+2007-11-19 23:40  oetiker
+
+       * src/rrd_graph.c: when checking if min and max were equal, the
+         action aplied was not working for negative values of min and max.
+
+2007-11-19 23:40  oetiker
+
+       * configure.ac, src/rrd_tool.h: strings was not included ev if it
+         was around
+
+2007-11-19 16:50  oetiker
+
+       * src/rrd_gfx.c: fix pointer in png image
+
+2007-11-14 13:53  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/gdpng.c,
+         src/rrd.h, src/rrd_afm.c, src/rrd_afm.h, src/rrd_afm_data.c,
+         src/rrd_afm_data.h, src/rrd_cgi.c, src/rrd_create.c,
+         src/rrd_datalang.c, src/rrd_diff.c, src/rrd_dump.c,
+         src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_lastupdate.c, src/rrd_not_thread_safe.c,
+         src/rrd_resize.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_rpncalc.h, src/rrd_stat.c, src/rrd_thread_safe.c,
+         src/rrd_thread_safe_nt.c, src/rrd_tool.c, src/rrd_tool.h,
+         src/rrd_tune.c, src/rrd_update.c, src/rrd_version.c,
+         src/rrd_xport.c, src/rrd_xport.h, src/rrdupdate.c: prepare for the
+         release of rrdtool-1.2.25
+
+2007-11-14 13:53  oetiker
+
+       * src/pngsize.c: make aix users happy and compile there too
+
+2007-11-14 13:53  oetiker
+
+       * src/rrd_open.c: don't exit when fadvise does not work .. after all
+         we can live without it ...
+
+2007-11-13 02:21  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         doc/rrdbuild.pod, rrdtool.spec, src/gdpng.c, src/pngsize.c,
+         src/rrd.h, src/rrd_afm.c, src/rrd_afm.h, src/rrd_afm_data.c,
+         src/rrd_afm_data.h, src/rrd_cgi.c, src/rrd_create.c,
+         src/rrd_datalang.c, src/rrd_diff.c, src/rrd_dump.c,
+         src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_lastupdate.c, src/rrd_not_thread_safe.c,
+         src/rrd_open.c, src/rrd_resize.c, src/rrd_restore.c,
+         src/rrd_rpncalc.c, src/rrd_rpncalc.h, src/rrd_stat.c,
+         src/rrd_thread_safe.c, src/rrd_thread_safe_nt.c, src/rrd_tool.c,
+         src/rrd_tool.h, src/rrd_tune.c, src/rrd_update.c,
+         src/rrd_version.c, src/rrd_xport.c, src/rrd_xport.h,
+         src/rrdupdate.c: prepare for the release of rrdtool-1.2.24
+
+2007-11-13 02:18  oetiker
+
+       * configure.ac: updated for 1.2.24
+
+2007-11-13 02:16  oetiker
+
+       * src/rrd_create.c: revert the dontneed fadvise patch this is only
+         for 1.3
+
+2007-11-13 02:13  oetiker
+
+       * src/rrd_fetch.c: revert the dontneed patch ... this is for 1.3
+         exclusively
+
+2007-11-08 10:13  oetiker
+
+       * bindings/ruby/main.c: must use int2num to prevent overflows --
+         Mike Perham mperham gmail.com
+
+2007-09-02 16:47  oetiker
+
+       * doc/rrdgraph_graph.pod: horizontal is the correct spelling
+
+2007-08-01 15:25  oetiker
+
+       * src/rrd_xport.c: fixed 64bit portability error ... unigned long is
+         not equal to int
+
+2007-07-25 20:32  oetiker
+
+       * src/rrd_update.c: check if intput is integer in any case not only
+         when the previouse value wave != U
+
+2007-07-16 06:34  oetiker
+
+       * bindings/ruby/main.c: fixed rrd_featch and added rrd_info to ruby
+         bindings
+
+2007-07-12 20:33  oetiker
+
+       * doc/rrdtutorial.pod: improved wording
+
+2007-07-11 23:06  oetiker
+
+       * src/rrd_create.c: stop rrd_create from leaking on failure ... vito
+         caputo
+
+2007-07-05 15:14  oetiker
+
+       * src/rrd_graph_helper.c: fix potential segfault ... if time_t is
+         not a %li 5~
+
+2007-07-05 15:14  oetiker
+
+       * bindings/tcl/Makefile.am: fix tcl build system
+
+2007-06-15 21:41  oetiker
+
+       * rrdtool.spec: rrdtool.spec from Jarod "redhat" Wilson
+
+2007-06-13 16:50  oetiker
+
+       * bindings/ruby/main.c: be more helpful when raising rb_eTypeError
+         in string_arr string_arr_new(VALUE rb_strings). This patch
+         indicates which index is in error as well as the type you are
+         erroneously passing. --anonymous
+
+2007-05-30 11:26  oetiker
+
+       * src/rrd_update.c: dropping cache after update does not help (in
+         this implementation)
+
+2007-05-22 20:46  oetiker
+
+       * configure.ac: fixed spelling
+
+2007-05-22 20:44  oetiker
+
+       * configure.ac, src/rrd_tool.c, src/rrd_tool.h, src/rrd_update.c: *
+         better tests for madvise, fadvise and fdatasync * fix inclusion of
+         fcntl.h * clenups for configure.ac -- Bernhard Fischer rep dot nop
+         gmail com
+
+2007-05-19 05:47  oetiker
+
+       * configure.ac: update defines according to manual pageentry
+
+2007-05-18 16:40  oetiker
+
+       * configure.ac, src/rrd_update.c: added madvise MADV_RANDOM is
+         rrd_update uses mmap
+
+2007-05-18 11:56  oetiker
+
+       * configure.ac, src/rrd_create.c, src/rrd_fetch.c, src/rrd_update.c:
+         * dropping in rrd_update is probably overkill since we may be
+         dropping too much. * in create we have to flush before dropping. *
+         read fcntl.h after defining the __USE_XOPEN2K * fix drop code in
+         fetch ...
+
+2007-05-17 11:38  oetiker
+
+       * configure.ac, src/rrd_create.c, src/rrd_fetch.c, src/rrd_open.c,
+         src/rrd_update.c: now the fadvise code actually compiles ... let
+         the testing begin.
+
+2007-05-17 08:44  oetiker
+
+       * examples/perftest.pl.in: new better ? performance test ... work in
+         progress
+
+2007-05-17 08:44  oetiker
+
+       * configure.ac, src/Makefile.am, src/rrd_create.c, src/rrd_fetch.c,
+         src/rrd_open.c, src/rrd_update.c: added posix_fadvise support
+         (untested) ... this should help performance by stopping read-ahead
+         and droping buffer cache for all rrd data except the file header
+         portion. Newly created files are fdsynced to disk and released
+         from cache after creation, to soften the blow on buffer cache by
+         creating new rrds.
+
+2007-05-16 20:35  oetiker
+
+       * src/rrd_open.c: remove tabs and replace with 8 spaces
+
+2007-05-15 08:39  oetiker
+
+       * bindings/Makefile.am: use libdir instead of exec_prefix/lib ...
+         maybe someone wants their libraries in another place
+
+2007-05-15 08:36  oetiker
+
+       * bindings/Makefile.am, bindings/python/setup.py: yet another
+         attempt to make the python build environment REALY cool
+
+2007-05-09 15:26  oetiker
+
+       * bindings/Makefile.am, bindings/python/setup.py: make sure the
+         python extension gets the final resting place of the rrdlibrary
+         compiled in ...
+
+2007-05-08 15:10  oetiker
+
+       * bindings/Makefile.am: ruby complained about finding a previous
+         copy of the rrdtool extension ... very odd thing actually ...
+         adding RUBYARCHDIR= seems to help ...
+
+2007-05-06 19:38  oetiker
+
+       * src/rrd_graph.c: don't use round since it is c99 ... use
+         floor(x+0.5) for positive numbers instead.
+
+2007-05-06 08:50  oetiker
+
+       * src/rrd_hw.c: print the name of the HW cf in debug mode -- Helge
+         Oldach
+
+2007-05-03 12:49  oetiker
+
+       * src/rrd_graph.c: added some more rounding for int to float
+         comparisons
+
+2007-05-03 12:43  oetiker
+
+       * src/rrd_graph.c: Testing an double and an integer for equality is
+         bound to produce odd results on times. Don't do it! --
+         rrdtool@oldach.net
+
+2007-05-02 18:06  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/gdpng.c,
+         src/pngsize.c, src/rrd.h, src/rrd_afm.c, src/rrd_afm.h,
+         src/rrd_afm_data.c, src/rrd_afm_data.h, src/rrd_cgi.c,
+         src/rrd_create.c, src/rrd_datalang.c, src/rrd_diff.c,
+         src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_lastupdate.c, src/rrd_not_thread_safe.c,
+         src/rrd_open.c, src/rrd_resize.c, src/rrd_restore.c,
+         src/rrd_rpncalc.c, src/rrd_rpncalc.h, src/rrd_stat.c,
+         src/rrd_thread_safe.c, src/rrd_thread_safe_nt.c, src/rrd_tool.c,
+         src/rrd_tool.h, src/rrd_tune.c, src/rrd_update.c,
+         src/rrd_version.c, src/rrd_xport.c, src/rrd_xport.h,
+         src/rrdupdate.c: prepare for the release of rrdtool-1.2.23
+
+2007-05-02 18:05  oetiker
+
+       * bindings/Makefile.am: fix python install for virgin systems
+
+2007-05-02 15:31  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/gdpng.c,
+         src/pngsize.c, src/rrd.h, src/rrd_afm.c, src/rrd_afm.h,
+         src/rrd_afm_data.c, src/rrd_afm_data.h, src/rrd_cgi.c,
+         src/rrd_create.c, src/rrd_datalang.c, src/rrd_diff.c,
+         src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_lastupdate.c, src/rrd_not_thread_safe.c,
+         src/rrd_open.c, src/rrd_resize.c, src/rrd_restore.c,
+         src/rrd_rpncalc.c, src/rrd_rpncalc.h, src/rrd_stat.c,
+         src/rrd_thread_safe.c, src/rrd_thread_safe_nt.c, src/rrd_tool.c,
+         src/rrd_tool.h, src/rrd_tune.c, src/rrd_update.c,
+         src/rrd_version.c, src/rrd_xport.c, src/rrd_xport.h,
+         src/rrdupdate.c: prepare for the release of rrdtool-1.2.22
+
+2007-05-02 15:31  oetiker
+
+       * README, bindings/perl-shared/RRDs.ppd,
+         bindings/perl-shared/ntmake.pl, debian/copyright, debian/watch,
+         doc/rrdtutorial.es.pod, doc/rrdtutorial.pod, doc/see_also.inc:
+         fixed old urls in code
+
+2007-05-02 15:23  oetiker
+
+       * bindings/Makefile.am: fix python for staged installs
+
+2007-05-02 05:08  oetiker
+
+       * bindings/tcl/tclrrd.c: fixed path to rrd_format.h in tcl bindings
+
+2007-05-01 20:41  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/gdpng.c,
+         src/pngsize.c, src/rrd.h, src/rrd_afm.c, src/rrd_afm.h,
+         src/rrd_afm_data.c, src/rrd_afm_data.h, src/rrd_cgi.c,
+         src/rrd_create.c, src/rrd_datalang.c, src/rrd_diff.c,
+         src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_lastupdate.c, src/rrd_not_thread_safe.c,
+         src/rrd_open.c, src/rrd_resize.c, src/rrd_restore.c,
+         src/rrd_rpncalc.c, src/rrd_rpncalc.h, src/rrd_stat.c,
+         src/rrd_thread_safe.c, src/rrd_thread_safe_nt.c, src/rrd_tool.c,
+         src/rrd_tool.h, src/rrd_tune.c, src/rrd_update.c,
+         src/rrd_version.c, src/rrd_xport.c, src/rrd_xport.h,
+         src/rrdupdate.c: prepare for the release of rrdtool-1.2.21
+
+2007-05-01 20:40  oetiker
+
+       * src/rrd_graph.c: if the graph goes 'down' minval must be hanged
+         instead
+
+2007-05-01 16:36  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/Makefile.am,
+         src/gdpng.c, src/pngsize.c, src/rrd.h, src/rrd_afm.c,
+         src/rrd_afm.h, src/rrd_afm_data.c, src/rrd_afm_data.h,
+         src/rrd_cgi.c, src/rrd_create.c, src/rrd_datalang.c,
+         src/rrd_diff.c, src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c,
+         src/rrd_first.c, src/rrd_format.c, src/rrd_format.h,
+         src/rrd_gfx.c, src/rrd_gfx.h, src/rrd_graph.c,
+         src/rrd_graph_helper.c, src/rrd_hw.c, src/rrd_hw.h,
+         src/rrd_info.c, src/rrd_is_thread_safe.h, src/rrd_last.c,
+         src/rrd_lastupdate.c, src/rrd_not_thread_safe.c, src/rrd_open.c,
+         src/rrd_resize.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_rpncalc.h, src/rrd_stat.c, src/rrd_thread_safe.c,
+         src/rrd_thread_safe_nt.c, src/rrd_tool.c, src/rrd_tool.h,
+         src/rrd_tune.c, src/rrd_update.c, src/rrd_version.c,
+         src/rrd_xport.c, src/rrd_xport.h, src/rrdupdate.c: prepare for the
+         release of rrdtool-1.2.20
+
+2007-05-01 16:24  oetiker
+
+       * netware/Makefile, win32/Makefile: updated win32 and netware
+         Makefiles -- Guenter Knauf
+
+2007-05-01 16:23  oetiker
+
+       * src/rrd_create.c, src/rrd_update.c: added some const casts
+
+2007-05-01 16:19  oetiker
+
+       * doc/rrdgraph.pod, src/rrd_graph.c, src/rrd_graph.h: added
+         --alt-autoscale-min (see --alt-autoscale-max) -- Helge Oldach
+
+2007-04-10 05:43  oetiker
+
+       * src/rrd_graph.c: untabified rrd_graph.c
+
+2007-04-10 05:41  oetiker
+
+       * src/rrd_graph.c: use the shorthand for vidx ...
+
+2007-04-10 05:27  oetiker
+
+       * src/rrd_graph.c, src/rrd_graph.h: the rrd_graph_check_vname
+         function is not used anywhere in the code ...
+
+2007-04-06 07:28  oetiker
+
+       * src/rrd_gfx.c: release font resources after thy have been used ...
+         -- Travis Spencer
+
+2007-04-02 06:21  oetiker
+
+       * doc/rrdthreads.pod, src/fnv.h, src/hash_32.c, src/rrd.h,
+         src/rrd_create.c, src/rrd_fetch.c, src/rrd_format.c,
+         src/rrd_rpncalc.c, src/rrd_rpncalc.h, src/rrd_tool.h,
+         src/rrd_update.c: new function rrd_fetch_r() (and make the strings
+         const char* instead of char*). The only difference between
+         rrd_fetch_r() and rrd_fetch_fn() is that rrd_fetch_r() receives
+         the consolidation function as a string (instead of an enum cf_en)
+         and is thread-safe -- Sam Umbach
+
+2007-04-02 06:18  oetiker
+
+       * src/rrd_restore.c: make xml2rrd more robust on invalid input --
+         Florian Forster
+
+2007-03-29 19:08  oetiker
+
+       * doc/rrdruby.pod: added vardef
+
+2007-03-15 21:10  oetiker
+
+       * src/rrd_tool.c: fix the snprintf call for vtag ... it was using
+         the wrong size -- kili
+
+2007-03-15 21:03  oetiker
+
+       * src/rrd_thread_safe.c: fixed strerror_r usage ... #85
+
+2007-03-11 13:08  oetiker
+
+       * Makefile.am, bindings/Makefile.am, doc/Makefile.am,
+         examples/Makefile.am, netware/Makefile, win32/Makefile,
+         win32/rrd.dsp, win32/rrdtool.dsp: fix netware and win32 makefiles
+         for new getopt names
+
+2007-03-11 13:04  oetiker
+
+       * src/art_rgba_svp.h, src/fnv.h, src/gdpng.c, src/hash_32.c,
+         src/parsetime.c, src/parsetime.h, src/pngsize.c, src/rrd.h,
+         src/rrd_afm.c, src/rrd_afm.h, src/rrd_afm_data.c,
+         src/rrd_afm_data.h, src/rrd_cgi.c, src/rrd_create.c,
+         src/rrd_datalang.c, src/rrd_diff.c, src/rrd_dump.c,
+         src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_getopt.c,
+         src/rrd_getopt.h, src/rrd_getopt1.c, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph.h, src/rrd_graph_helper.c,
+         src/rrd_hw.c, src/rrd_hw.h, src/rrd_info.c,
+         src/rrd_is_thread_safe.h, src/rrd_last.c, src/rrd_lastupdate.c,
+         src/rrd_nan_inf.c, src/rrd_nan_inf.h, src/rrd_not_thread_safe.c,
+         src/rrd_open.c, src/rrd_resize.c, src/rrd_restore.c,
+         src/rrd_rpncalc.c, src/rrd_rpncalc.h, src/rrd_stat.c,
+         src/rrd_thread_safe.c, src/rrd_thread_safe_nt.c, src/rrd_tool.c,
+         src/rrd_tool.h, src/rrd_tune.c, src/rrd_update.c,
+         src/rrd_version.c, src/rrd_xport.c, src/rrd_xport.h,
+         src/rrdupdate.c, src/strftime.c, src/strftime.h, src/unused.h,
+         src/win32comp.c: enable ID keyword in all source files
+
+2007-03-11 12:57  oetiker
+
+       * examples/Makefile.am: do not use gnuisms in Makefile rules ($<)
+
+2007-03-11 12:41  oetiker
+
+       * netware/Makefile: use Guenters latest Netware Makefile ...
+
+2007-03-10 17:44  oetiker
+
+       * configure.ac: axe the double quotes on $perlcc in configure to
+         allow for program names with arguments.
+
+2007-03-10 17:36  oetiker
+
+       * src/rrd_update.c: integers can be negative ... fixed the test for
+         this in rrd_update -- rians cc usu edu
+
+2007-03-03 11:03  oetiker
+
+       * Makefile.am, bindings/ruby/extconf.rb, configure.ac: * build
+         extensions last since this seems to be most likely to fail * do
+         more testing before building the ruby extension
+
+2007-02-24 17:23  oetiker
+
+       * src/rrd_dump.c, src/rrd_info.c, src/rrd_tune.c: fix memmory
+         problem in rrd_dump.c
+
+2007-02-14 18:54  oetiker
+
+       * doc/rrdgraph_rpn.pod, src/rrd_rpncalc.c, src/rrd_rpncalc.h: new
+         operator ABS added --
+
+2007-02-14 18:48  oetiker
+
+       * src/Makefile.am, src/getopt.c, src/getopt.h, src/getopt1.c,
+         src/rrd_getopt.c, src/rrd_getopt.h, src/rrd_getopt1.c,
+         src/rrd_tool.h: renamed getopt to rrd_getopt to avoid confusion on
+         some systems ...
+
+2007-02-14 18:47  oetiker
+
+       * src/rrd_tool.c: cosmetic fix for usage message -- günter knauff
+
+2007-02-14 18:46  oetiker
+
+       * Makefile.am: added new win32 component to the release tarball
+
+2007-02-14 18:46  oetiker
+
+       * src/get_ver.awk, win32/rrd.dsp, win32/rrd_config.h.msvc,
+         win32/rrdtool.dsp: updates to the windows build system by guenter
+         knauff
+
+2007-02-14 06:53  oetiker
+
+       * doc/rrdgraph.pod, src/rrd_graph.c, src/rrd_graph.h: allow
+         --units-length to reserve label space even when --y-grid=none is
+         in effect [#75], tobi
+
+2007-02-14 06:33  oetiker
+
+       * src/parsetime.c: parsing absolute time should not send us 30,000
+         years into the future -- Tatsuki Makino tatsuki_makino hotmail.com
+
+2007-02-14 06:31  oetiker
+
+       * src/rrd_cgi.c: Printstrftime on rrd_cgi.c returns an illegal
+         value. It causes segmentation fault error. -- Tatsuki Makino
+         tatsuki_makino hotmail.com
+
+2007-02-09 22:19  oetiker
+
+       * netware/Makefile, src/rrd_tool.h, win32/Makefile: more build
+         patches from Günter Knauf
+
+2007-02-08 06:01  oetiker
+
+       * netware/Makefile, win32/Makefile: updates for Win32 and NW
+         Makefiles -- Guenter Knauf
+
+2007-02-08 05:54  oetiker
+
+       * src/Makefile.am: added get_ver.awk to release
+
+2007-02-08 05:51  oetiker
+
+       * configure.ac: there is no Makefile.in for python anymore!
+
+2007-02-07 21:35  oetiker
+
+       * src/rrd_gfx.c: DPRINTF may not be the ideal define ... use
+         something more RRDish ... like RRDPRINTF
+
+2007-02-07 21:35  oetiker
+
+       * Makefile.am, configure.ac: use setup.py for python install and
+         build work instad of trying todo it on our own
+
+2007-02-07 21:31  oetiker
+
+       * bindings/Makefile.am: added Makefile targets for python
+
+2007-02-07 21:30  oetiker
+
+       * bindings/python/Makefile.am, bindings/python/Setup.in,
+         bindings/python/setup.py: python does no get built externally
+
+2007-02-02 18:22  oetiker
+
+       * COPYRIGHT: added IBM Public License to the list of Exceptions
+
+2007-02-02 12:19  oetiker
+
+       * src/rrd_gfx.c, src/rrd_rpncalc.c: increasse portability (no //
+         comment, no ... arguments for cpp)
+
+2007-02-01 22:00  oetiker
+
+       * bindings/tcl/tclrrd.c: we should use the headers from the local
+         rrdtool setup and not the system ones!
+
+2007-02-01 05:51  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool-1.2-release, rrdtool.spec,
+         src/gdpng.c, src/pngsize.c, src/rrd.h, src/rrd_afm.c,
+         src/rrd_afm.h, src/rrd_afm_data.c, src/rrd_afm_data.h,
+         src/rrd_cgi.c, src/rrd_create.c, src/rrd_datalang.c,
+         src/rrd_diff.c, src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c,
+         src/rrd_first.c, src/rrd_format.c, src/rrd_format.h,
+         src/rrd_gfx.c, src/rrd_gfx.h, src/rrd_graph.c,
+         src/rrd_graph_helper.c, src/rrd_hw.c, src/rrd_hw.h,
+         src/rrd_info.c, src/rrd_is_thread_safe.h, src/rrd_last.c,
+         src/rrd_lastupdate.c, src/rrd_not_thread_safe.c, src/rrd_open.c,
+         src/rrd_resize.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_rpncalc.h, src/rrd_stat.c, src/rrd_thread_safe.c,
+         src/rrd_thread_safe_nt.c, src/rrd_tool.c, src/rrd_tool.h,
+         src/rrd_tune.c, src/rrd_update.c, src/rrd_version.c,
+         src/rrd_xport.c, src/rrd_xport.h, src/rrdupdate.c: prepare for the
+         release of rrdtool-1.2.19
+
+2007-02-01 05:45  oetiker
+
+       * bindings/python/Makefile.am: libtool builds shared libraries
+         anyway, no need for extra LDFLAGS that bite non GNU ld versions
+
+2007-01-29 16:47  oetiker
+
+       * src/rrd_tool.c: resolve snprintf overflow warning by using sizeof
+         -- Anna Bernathova suse cz
+
+2007-01-23 20:54  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/gdpng.c,
+         src/pngsize.c, src/rrd.h, src/rrd_afm.c, src/rrd_afm.h,
+         src/rrd_afm_data.c, src/rrd_afm_data.h, src/rrd_cgi.c,
+         src/rrd_create.c, src/rrd_datalang.c, src/rrd_diff.c,
+         src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_lastupdate.c, src/rrd_not_thread_safe.c,
+         src/rrd_open.c, src/rrd_resize.c, src/rrd_restore.c,
+         src/rrd_rpncalc.c, src/rrd_rpncalc.h, src/rrd_stat.c,
+         src/rrd_thread_safe.c, src/rrd_thread_safe_nt.c, src/rrd_tool.c,
+         src/rrd_tool.h, src/rrd_tune.c, src/rrd_update.c,
+         src/rrd_version.c, src/rrd_xport.c, src/rrd_xport.h,
+         src/rrdupdate.c: prepare for the release of rrdtool-1.2.18
+
+2007-01-23 20:52  oetiker
+
+       * src/rrd_fetch.c: the change from R920 to fetch was not helping ...
+         no low res got prefered in non full coverage situations ..
+
+2007-01-23 17:30  oetiker
+
+       * src/rrd_graph.c: another control sequence that got lost ...
+
+2007-01-23 08:28  oetiker
+
+       * src/rrd_graph_helper.c: read up to full potential length of
+         gdp->rrd
+
+2007-01-22 16:34  oetiker
+
+       * doc/rrdgraph_graph.pod: added missing B formatting instruction
+
+2007-01-22 10:49  oetiker
+
+       * rrdtool-1.2-release: create non version link
+
+2007-01-22 10:33  oetiker
+
+       * src/rrd_graph.c: prepare for the release of rrdtool-1.2.17
+
+2007-01-22 10:29  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/gdpng.c,
+         src/pngsize.c, src/rrd.h, src/rrd_afm.c, src/rrd_afm.h,
+         src/rrd_afm_data.c, src/rrd_afm_data.h, src/rrd_cgi.c,
+         src/rrd_create.c, src/rrd_datalang.c, src/rrd_diff.c,
+         src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_lastupdate.c, src/rrd_not_thread_safe.c,
+         src/rrd_open.c, src/rrd_resize.c, src/rrd_restore.c,
+         src/rrd_rpncalc.c, src/rrd_rpncalc.h, src/rrd_stat.c,
+         src/rrd_thread_safe.c, src/rrd_thread_safe_nt.c, src/rrd_tool.c,
+         src/rrd_tool.h, src/rrd_tune.c, src/rrd_update.c,
+         src/rrd_version.c, src/rrd_xport.c, src/rrd_xport.h,
+         src/rrdupdate.c: prepare for the release of rrdtool-1.2.17
+
+2007-01-22 10:28  oetiker
+
+       * doc/rrdgraph_graph.pod, src/rrd_graph.c: introduced \n as an alias
+         for \l since people seem to be using it despite the documentation
+         not talking about this ... so now it is official and I bet there
+         will soon be people asking why this was only working at the end of
+         a line. -- tobi
+
+2007-01-21 22:22  oetiker
+
+       * doc/rrdgraph_examples.pod: removed mentiones of \n ...
+
+2007-01-20 22:54  oetiker
+
+       * bindings/Makefile.am: prepare for the release of rrdtool-1.2.16
+
+2007-01-20 22:48  oetiker
+
+       * bindings/Makefile.am: prepare for the release of rrdtool-1.2.16
+
+2007-01-20 22:22  oetiker
+
+       * bindings/Makefile.am: prepare for the release of rrdtool-1.2.16
+
+2007-01-20 20:19  oetiker
+
+       * rrdtool-1.2-release: prepare for the release of rrdtool-1.2.16
+
+2007-01-20 20:17  oetiker
+
+       * rrdtool-1.2-release: prepare for the release of rrdtool-1.2.16
+
+2007-01-20 20:16  oetiker
+
+       * rrdtool-1.2-release: prepare for the release of rrdtool-1.2.16
+
+2007-01-20 20:03  oetiker
+
+       * bindings/tcl/tclrrd.c: this did not compile after integrating the
+         new fetchlast command -- Andy Riebs
+
+2007-01-20 16:41  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool-1.2-release, rrdtool.spec,
+         src/Makefile.am, src/gdpng.c, src/pngsize.c, src/rrd.h,
+         src/rrd_afm.c, src/rrd_afm.h, src/rrd_afm_data.c,
+         src/rrd_afm_data.h, src/rrd_cgi.c, src/rrd_create.c,
+         src/rrd_datalang.c, src/rrd_diff.c, src/rrd_dump.c,
+         src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_lastupdate.c, src/rrd_not_thread_safe.c,
+         src/rrd_open.c, src/rrd_resize.c, src/rrd_restore.c,
+         src/rrd_rpncalc.c, src/rrd_rpncalc.h, src/rrd_stat.c,
+         src/rrd_thread_safe.c, src/rrd_thread_safe_nt.c, src/rrd_tool.c,
+         src/rrd_tool.h, src/rrd_tune.c, src/rrd_update.c,
+         src/rrd_version.c, src/rrd_xport.c, src/rrd_xport.h,
+         src/rrdupdate.c: prepare for the release of rrdtool-1.2.16
+
+2007-01-20 16:39  oetiker
+
+       * Makefile.am, configure.ac, rrdtool-1.2-release: get ready for
+         1.2.16 release
+
+2007-01-18 23:43  oetiker
+
+       * doc/rrdlastupdate.pod: aargh another missing bit from lastupdate
+         added ...
+
+2007-01-17 23:35  oetiker
+
+       * netware/Makefile, src/rrd_lastupdate.c, win32/Makefile: finish
+         integration of lastupdate commmand ...
+
+2007-01-17 21:31  oetiker
+
+       * acinclude.m4, bindings/tcl/tclrrd.c, doc/Makefile.am,
+         src/Makefile.am, src/rrd_tool.c, src/rrd_tool.h, src/rrd_update.c:
+         New functions lastupdate to efficiently get the last values fed
+         into the rrd ... this also changes that the last values get stored
+         even for ABSOLUTE and GAUGE data sources ... -- andy.riebs hp.com
+
+2006-12-16 16:14  oetiker
+
+       * src/rrd_error.c, src/rrd_thread_safe.c, src/rrd_thread_safe_nt.c:
+         add missing \0 to the end of several strncpy strings
+
+2006-12-16 16:13  oetiker
+
+       * src/rrd_update.c: replace malloc/strncpy by strdup add \0 to the
+         end of several strncpy strings add missing free fix error string
+         rendering :... makes no sense here
+
+2006-12-16 16:11  oetiker
+
+       * src/rrd.h: move headers around to make more sense
+
+2006-12-16 16:10  oetiker
+
+       * src/rrd_not_thread_safe.c: init the context on first call
+
+2006-12-16 16:05  oetiker
+
+       * src/rrd_graph.h: make sure there is ample space in the static
+         strings
+
+2006-12-16 16:04  oetiker
+
+       * src/rrd_graph.c: oops 99 is the last item
+
+2006-12-16 16:02  oetiker
+
+       * src/rrd_graph.c: it is sufficient to set the last item to 0
+
+2006-12-16 16:02  oetiker
+
+       * src/Makefile.am: getopt is required for rrdupdate too (there are
+         platforms where this is not in libc ... eg solaris)
+
+2006-12-16 16:01  oetiker
+
+       * src/rrdupdate.c: we have 2006 now
+
+2006-12-16 15:56  oetiker
+
+       * src/rrd_not_thread_safe.c: it makes no sense allocating an array
+         and then asiging it to a fixed string ... this caused stuff to
+         crash badly as long error strings were assigned.
+
+2006-12-11 19:11  oetiker
+
+       * doc/rrdbuild.pod: added note on alternate CFLAGS for Forte
+
+2006-12-07 19:51  oetiker
+
+       * src/rrd_graph.c: c is a valid formatting character
+
+2006-11-19 11:15  oetiker
+
+       * src/rrd_graph.c: fixed typo
+
+2006-11-06 06:53  oetiker
+
+       * src/rrd_fetch.c: when fetching, don't pick a higher res rra just
+         because it's coverage at the 'end' of the requested range is
+         better ... -- Sebastian Pachuta seba123 seba123.webd.pl
+
+2006-10-27 14:03  oetiker
+
+       * examples/perftest.pl.in: use integer time
+
+2006-10-26 22:26  oetiker
+
+       * configure.ac, examples/Makefile.am, examples/perftest.pl.in: added
+         perftest tool
+
+2006-10-25 17:19  oetiker
+
+       * src/Makefile.am: do not distribute windows files anymore ...
+
+2006-10-25 17:18  oetiker
+
+       * Makefile.am: distribute win32 and netware build files too
+
+2006-10-25 17:17  oetiker
+
+       * MakeMakefile: do not remove Makefiles from win32 and netware build
+         dirs
+
+2006-10-25 17:12  oetiker
+
+       * MakeMakefile, bindings/Makefile.am, bindings/ruby/main.c: fix
+         build procedure for ruby (clean target) don't run autoreconf at
+         the end of MakeMakefiles as this has a tendency todo the wrong
+         things
+
+2006-10-25 16:39  oetiker
+
+       * MakeMakefile: added path to sepp
+
+2006-10-25 16:30  oetiker
+
+       * MakeMakefile: aclocal expects a space after -I ...
+
+2006-10-25 16:24  oetiker
+
+       * MakeMakefile: tell aclocal where to find its config ...
+
+2006-10-25 16:11  oetiker
+
+       * MakeMakefile: aclocal show know where it's stuff is ...
+
+2006-10-22 21:20  oetiker
+
+       * src/parsetime.c: make time paring more robust ... it can now deal
+         with time date date time time date + xxx date time + xxx
+
+2006-10-22 21:09  oetiker
+
+       * src/rrd_graph.c: check if valid control codes are in use
+
+2006-10-22 16:01  oetiker
+
+       * bindings/ruby/test.rb: fixed ruby demo
+
+2006-10-22 16:01  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm: fixed
+         address
+
+2006-10-03 07:52  oetiker
+
+       * src/rrdupdate.c: added missing file
+
+2006-09-28 12:38  oetiker
+
+       * doc/rrdruby.pod: fixed doc regarding site install
+
+2006-09-27 21:48  oetiker
+
+       * bindings/Makefile.am, bindings/ruby, bindings/ruby/CHANGES,
+         bindings/ruby/README, bindings/ruby/extconf.rb,
+         bindings/ruby/main.c, bindings/ruby/test.rb, configure.ac: added
+         ruby bindings ... thanks to Loïs LHERBIER lois.lherbier covadis.ch
+
+2006-09-27 21:46  oetiker
+
+       * src/Makefile.am, src/rrd_update.c: make rrdupdate realy light as
+         it was intended in the first place -- Peter Breitenlohner peb
+         mppmu.mpg.de
+
+2006-09-27 21:45  oetiker
+
+       * src/parsetime.c: tod can come after the date as well as before the
+         date
+
+2006-09-18 05:45  oetiker
+
+       * netware/Makefile: fix faild netware makefile merge -- Guenter
+         Knauf
+
+2006-09-17 21:08  oetiker
+
+       * src/rrd_update.c: make mvs stop complaining about uninitialized
+         variables ... -- norman wheeler bigpond.com
+
+2006-09-17 21:05  oetiker
+
+       * doc/rrd-beginners.pod: fixed spelling -- Peter Breitenlohner
+
+2006-09-17 20:46  oetiker
+
+       * configure.ac, examples/Makefile.am: fix generation of cgi-demo.cgi
+         -- Peter Breitenlohner peb mppmu.mpg.de
+
+2006-09-17 20:31  oetiker
+
+       * MakeMakefile, bindings/Makefile.am, bindings/perl-shared/RRDs.xs,
+         configure.ac, netware/Makefile, src/getopt.c, src/getopt1.c,
+         src/rrd_afm.c, src/rrd_tool.h, win32/Makefile: make rrdtool use
+         rrd_config.h instead of config.h since this is just bound to lead
+         to confusion when the wrong config.h gets sourced -- Guenter Knauf
+         fix clean target in bindings directory
+
+2006-09-10 19:30  oetiker
+
+       * win32/rrd.dsp, win32/rrd.vcproj, win32/rrdtool.dsp,
+         win32/rrdtool.dsw, win32/rrdtool.plg: the msvc files need dos file
+         endings ...
+
+2006-09-10 19:26  oetiker
+
+       * src/rrd_rpncalc.c: we want an int, so lets tell the compiler to
+         make it not complain
+
+2006-09-10 19:20  oetiker
+
+       * netware/Makefile, win32/Makefile: netware und win32 fixes from
+         guenter
+
+2006-09-05 19:55  oetiker
+
+       * doc/rrdfetch.pod: we do not need an extra echo there
+
+2006-09-05 18:34  oetiker
+
+       * confignt, netware, netware/Makefile, src/Makefile.NetWare,
+         src/Makefile.Win32, src/rrd.dsp, src/rrd.vcproj, src/rrd_afm.c,
+         src/rrd_dump.c, src/rrd_gfx.c, src/rrd_graph.c, src/rrd_tool.h,
+         src/rrdtool.dsp, src/rrdtool.dsw, src/rrdtool.sln,
+         src/rrdtool.vcproj, src/win32comp.c, win32, win32/Makefile,
+         win32/config.h, win32/rrd.dsp, win32/rrd.vcproj,
+         win32/rrdtool.dsp, win32/rrdtool.dsw, win32/rrdtool.plg,
+         win32/rrdtool.vcproj: put all the architecture specific stuff in
+         separate subdirectories ... one for netwara and one for win32 --
+         Guenter Knauf
+
+2006-09-05 18:19  oetiker
+
+       * src/gifsize.c: noone needs this anymore
+
+2006-09-04 21:10  oetiker
+
+       * src/rrd_graph.c: in logarithmic mode minval must not be <= 0
+
+2006-08-24 04:14  oetiker
+
+       * doc/cdeftutorial.pod: add more submission encuragement -- alex
+
+2006-08-21 11:41  oetiker
+
+       * NT-BUILD-TIPS.txt, WIN32-BUILD-TIPS.txt, src/Makefile.NetWare,
+         src/Makefile.Win32: updated windows build instructions from
+         guenter
+
+2006-08-16 06:07  oetiker
+
+       * src/rrd_graph.c: contain a potential problem with log grid
+         painting Bug #54
+
+2006-08-15 05:51  oetiker
+
+       * src/rrd_first.c: do not loose filedescriptors when rrd_first
+         errors out
+
+2006-08-15 05:44  oetiker
+
+       * src/rrd_graph_helper.c: catch empty XXXX: commands in graph
+
+2006-08-15 05:24  oetiker
+
+       * Makefile.am, WIN32-BUILD-TIPS.txt: windows is not NT anymore ...
+         lets call it WIN32
+
+2006-08-13 16:41  oetiker
+
+       * src/get_ver.awk: use unix fileendings here!
+
+2006-08-13 16:40  oetiker
+
+       * src/Makefile.NetWare, src/Makefile.Win32: new version added by
+         Guenter Knauf
+
+2006-08-13 16:25  oetiker
+
+       * src/rrd.h, src/rrd_version.c: added new rrdstrversion function --
+         Guenter Knauf
+
+2006-08-13 16:22  oetiker
+
+       * src/rrd_graph.c, src/strftime.c, src/strftime.h: use th OS
+         provided timezone names for %Z this should make things more
+         flexile will only work on windows, but since we are using
+         strftime.c on windows only this should not be a problem -- Guenter
+         Knauf
+
+2006-08-13 16:13  oetiker
+
+       * src/rrd_graph.c: include strftime.h for windows builds -- Guenter
+         Knauff
+
+2006-08-13 16:10  oetiker
+
+       * src/rrd_tool.h: removed mscv defines to confignt/config.h
+         completely -- Guenter Knauf
+
+2006-08-13 16:09  oetiker
+
+       * confignt/config.h: working windows config.h
+
+2006-08-13 16:07  oetiker
+
+       * src/rrd_tool.c: can't define new variables in the middle of the
+         code (unless everyone was using c99 which is not the case)
+
+2006-08-13 15:21  oetiker
+
+       * src/rrd_graph.c: added special labeling for LONGTERM graphs --
+         Paul Boven p.boven sara.nl
+
+2006-08-10 07:46  oetiker
+
+       * acinclude.m4: it seems some headers have nan predefined ... so
+         lets just use other variable names
+
+2006-08-04 15:06  oetiker
+
+       * acinclude.m4: copy of the solaris isnan hack from configure.ac
+
+2006-08-03 22:21  oetiker
+
+       * configure.ac: solaris 10 has isnan defined as a sun forte builtin
+         ... gcc can not deal with this this will replace isnan with an
+         fpclass expression hopefully working around the problem
+
+2006-08-02 15:05  oetiker
+
+       * bindings/python/rrdtoolmodule.c: fixing python bindings ... Jarod
+         Wilson jwilson redhat.com
+
+2006-08-01 13:08  oetiker
+
+       * doc/rrdxport.pod, src/rrd_tool.c, src/rrd_xport.c: unknownaszero
+         was not a good idea ... bye bye
+
+2006-07-31 22:48  oetiker
+
+       * doc/rrdxport.pod, src/rrd_tool.c, src/rrd_xport.c: new options
+         --enumds and --unknwonaszero for xport
+
+2006-07-14 12:11  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/gdpng.c,
+         src/gifsize.c, src/pngsize.c, src/rrd.h, src/rrd_afm.c,
+         src/rrd_afm.h, src/rrd_afm_data.c, src/rrd_afm_data.h,
+         src/rrd_cgi.c, src/rrd_create.c, src/rrd_datalang.c,
+         src/rrd_diff.c, src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c,
+         src/rrd_first.c, src/rrd_format.c, src/rrd_format.h,
+         src/rrd_gfx.c, src/rrd_gfx.h, src/rrd_graph.c,
+         src/rrd_graph_helper.c, src/rrd_hw.c, src/rrd_hw.h,
+         src/rrd_info.c, src/rrd_is_thread_safe.h, src/rrd_last.c,
+         src/rrd_not_thread_safe.c, src/rrd_open.c, src/rrd_resize.c,
+         src/rrd_restore.c, src/rrd_rpncalc.c, src/rrd_rpncalc.h,
+         src/rrd_stat.c, src/rrd_thread_safe.c, src/rrd_thread_safe_nt.c,
+         src/rrd_tool.c, src/rrd_tool.h, src/rrd_tune.c, src/rrd_update.c,
+         src/rrd_version.c, src/rrd_xport.c, src/rrd_xport.h: prepare for
+         the release of rrdtool-1.2.15
+
+2006-07-14 12:06  oetiker
+
+       * src/rrd_tool.c: we were leaking directory handles ...
+
+2006-07-14 11:34  oetiker
+
+       * doc/rrdbuild.pod: remove an excess =over
+
+2006-07-14 11:32  oetiker
+
+       * doc/rrdbuild.pod: added missing =over
+
+2006-07-14 11:12  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/Makefile.am,
+         src/gdpng.c, src/gifsize.c, src/pngsize.c, src/rrd.h,
+         src/rrd_afm.c, src/rrd_afm.h, src/rrd_afm_data.c,
+         src/rrd_afm_data.h, src/rrd_cgi.c, src/rrd_create.c,
+         src/rrd_datalang.c, src/rrd_diff.c, src/rrd_dump.c,
+         src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_not_thread_safe.c, src/rrd_open.c,
+         src/rrd_resize.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_rpncalc.h, src/rrd_stat.c, src/rrd_thread_safe.c,
+         src/rrd_thread_safe_nt.c, src/rrd_tool.c, src/rrd_tool.h,
+         src/rrd_tune.c, src/rrd_update.c, src/rrd_version.c,
+         src/rrd_xport.c, src/rrd_xport.h: prepare for the release of
+         rrdtool-1.2.14
+
+2006-07-14 09:47  oetiker
+
+       * src/rrd_graph.c: do not reset im->gdes[i].step blindly. We
+         initialize it to im->step at allocation time already ... the fix
+         in r291 was over the top. -- niels weaklogic.com
+
+2006-07-14 08:56  oetiker
+
+       * doc/rrdtool.pod, src/rrd_tool.c: added pwd command for remote
+         server reset errno to zero before each loop -- Damien.Stuart
+         usi.net
+
+2006-07-13 08:44  oetiker
+
+       * src/Makefile.NetWare, src/Makefile.Win32: fixed makefiles without
+         libcgi ... guenter knauf
+
+2006-07-07 22:37  oetiker
+
+       * CONTRIBUTORS, bindings/python/rrdtoolmodule.c: added first
+         function to python bindings ... -- Ulf Lilleengen lulf pvv.ntnu.no
+
+2006-07-05 22:00  oetiker
+
+       * src/Makefile.NetWare, src/Makefile.Win32: we have no cgilib
+         anymore ....
+
+2006-07-04 21:04  oetiker
+
+       * src/rrd_restore.c: let rrdtool understand <?xml ...?> headers in
+         rrdtool restore input
+
+2006-06-18 21:21  oetiker
+
+       * doc/rrdgraph_rpn.pod, src/rrd_rpncalc.c, src/rrd_rpncalc.h: Added
+         AVG function to CDEF language. Martin Sperl martin sperl.org
+
+2006-06-15 22:16  oetiker
+
+       * doc/rrdbuild.pod: fixed libpng link
+
+2006-06-15 07:44  oetiker
+
+       * doc/rrdbuild.pod: added hint for RHEL
+
+2006-06-13 21:20  oetiker
+
+       * rrdtool.spec: added missing tcl files
+
+2006-06-07 21:01  oetiker
+
+       * doc/cdeftutorial.pod: fix calc of fahrenheit ...
+
+2006-06-06 13:25  oetiker
+
+       * doc/rrdbuild.pod: additional AIX hints from zoran.majcenic inet.hr
+
+2006-06-06 08:16  oetiker
+
+       * rrdtool.spec: new, working rrdtool.spec file from Jarod Wilson
+         jwilson redhat.com
+
+2006-05-27 05:44  oetiker
+
+       * bindings/python/rrdtoolmodule.c: python uses the name of the
+         module for loding, so this should better match up -- Duncan Webb
+         duncan dwebb ch
+
+2006-05-25 15:13  oetiker
+
+       * doc/rrdbuild.pod: addeed AIX instructions
+
+2006-05-23 06:52  oetiker
+
+       * src/rrd_graph.c: adjust label spacing to make sure labels don't
+         overlap for the default font.
+
+2006-05-21 22:14  oetiker
+
+       * doc/rrdgraph_data.pod: add note about variable name picking as
+         suggested by alex
+
+2006-05-21 22:07  oetiker
+
+       * src/Makefile.NetWare, src/Makefile.Win32: another Makefile update
+         from guenter
+
+2006-05-21 22:06  oetiker
+
+       * src/Makefile.NetWare, src/Makefile.Win32: tiny updates to netware
+         and win32 makefiles -- Guenter Knauf
+
+2006-05-21 21:53  oetiker
+
+       * doc/rrd-beginners.pod: fixed type hte->the
+
+2006-05-21 21:47  oetiker
+
+       * src/rrd_graph.c: make vdef time part available in the data_calc
+         stage so that the legend printer can decide properly
+
+2006-05-21 21:15  oetiker
+
+       * doc/rrdgraph_graph.pod, src/rrd_graph.c, src/rrd_graph.h,
+         src/rrd_graph_helper.c: new GPRINT option :strftime to print time
+         associated with a VDEF value
+
+2006-05-21 20:20  oetiker
+
+       * configure.ac: make configure test which flags gcc actually accepts
+         ...
+
+2006-05-21 13:08  oetiker
+
+       * doc/rrdgraph_graph.pod: don't deprecate HRULE anymore
+
+2006-05-21 12:37  oetiker
+
+       * src/rrd_rpncalc.c: allow DS names starting with the same letters
+         as operators
+
+2006-05-12 13:26  oetiker
+
+       * src/Makefile.am: we wan't to dist thread_save_nt too
+
+2006-05-11 11:11  oetiker
+
+       * src/rrd_nan_inf.c: make DNAN and DINF faster by caching the result
+         of the first calculation -- pascal.gloor spale.com
+
+2006-05-11 07:37  oetiker
+
+       * bindings/perl-shared/Makefile.PL: tell Makefile.PL how to store an
+         rpath under aix
+
+2006-05-10 20:51  oetiker
+
+       * src/rrd_graph.c: improved scaling for --logarithmic mode ... --
+         beat.zahnd space.unibe.ch
+
+2006-05-09 18:46  oetiker
+
+       * src/rrd_create.c: don't panic if the user forgets to specify the
+         name of the rrd file
+
+2006-05-07 10:46  oetiker
+
+       * src/rrd_graph.c: make legend spacing more reliable. handle the
+         fact that some graph comands do not contribute to the legend --
+         tobi
+
+2006-05-06 13:29  oetiker
+
+       * doc/Makefile.am: lets have index.html -- Peter Breitenlohner <peb
+         mppmu.mpg.de>
+
+2006-05-06 13:28  oetiker
+
+       * src/rrd.h, src/rrd_dump.c: Avoid gcc warning (discards qualifier)
+         in tclrrd.c -- Peter Breitenlohner <peb mppmu.mpg.de>
+
+2006-05-06 13:28  oetiker
+
+       * src/rrd_graph.c: Avoid gcc warning ("static not first") -- Peter
+         Breitenlohner <peb mppmu.mpg.de>
+
+2006-05-06 13:24  oetiker
+
+       * configure.ac: Avoid gcc warnings about use of "long long" -- Peter
+         Breitenlohner <peb mppmu.mpg.de>
+
+2006-05-06 13:21  oetiker
+
+       * bindings/tcl/Makefile.am: Use tclpkgdir instead of pkglibdir in
+         order to avoid automake warning -- Peter Breitenlohner <peb
+         mppmu.mpg.de>
+
+2006-05-06 13:20  oetiker
+
+       * bindings/python/Makefile.am: The rrdtoolmodule.so should be
+         installed in pyexecdir instead of pythondir (they differ if
+         prefix!=exec_prefix) -- Peter Breitenlohner <peb mppmu.mpg.de>
+
+2006-05-04 20:41  oetiker
+
+       * src/Makefile.am, src/rrd_error.c, src/rrd_restore.c,
+         src/rrd_rpncalc.c: fix for debian bug 359071 ... reporting the
+         long cdef in the error message was too much ... plus some other
+         small cleanups in this context
+
+2006-05-04 13:26  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/Makefile.am,
+         src/gdpng.c, src/gifsize.c, src/pngsize.c, src/rrd.h,
+         src/rrd_afm.c, src/rrd_afm.h, src/rrd_afm_data.c,
+         src/rrd_afm_data.h, src/rrd_cgi.c, src/rrd_create.c,
+         src/rrd_datalang.c, src/rrd_diff.c, src/rrd_dump.c,
+         src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_not_thread_safe.c, src/rrd_open.c,
+         src/rrd_resize.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_rpncalc.h, src/rrd_stat.c, src/rrd_thread_safe.c,
+         src/rrd_thread_safe_nt.c, src/rrd_tool.c, src/rrd_tool.h,
+         src/rrd_tune.c, src/rrd_update.c, src/rrd_version.c,
+         src/rrd_xport.c, src/rrd_xport.h: prepare for the release of
+         rrdtool-1.2.13
+
+2006-05-04 13:24  oetiker
+
+       * PROJECTS, README, acinclude.m4, configure.ac, doc/rrdbuild.pod,
+         doc/rrdcgi.pod, doc/rrdcreate.pod, doc/rrddump.pod,
+         doc/rrdfetch.pod, doc/rrdgraph-old.pod, doc/rrdgraph.pod,
+         doc/rrdgraph_data.pod, doc/rrdgraph_examples.pod,
+         doc/rrdgraph_graph.pod, doc/rrdgraph_rpn.pod, doc/rrdinfo.pod,
+         doc/rrdrestore.pod, doc/rrdtool.pod, doc/rrdtune.pod,
+         doc/rrdtutorial.pod, doc/rrdupdate.pod, doc/rrdxport.pod: fix my
+         mail address
+
+2006-05-04 13:12  oetiker
+
+       * src/rrd_create.c, src/rrd_open.c, src/rrd_restore.c: fewer double
+         frees ... -- slamb slamb.org
+
+2006-05-04 13:02  oetiker
+
+       * src/rrd_restore.c: * fixed argument parsing for long options * no
+         more doublefree on abort * enable restore of xml dumps created
+         with rrdtool 1.0.x
+
+2006-05-04 12:11  oetiker
+
+       * src/rrd_fetch.c: if end % step == 0 we should still fetch a full
+         step ... no need for special handling
+
+2006-05-04 07:48  oetiker
+
+       * src/rrd_update.c: updated handling of subsecond resolution in
+         connection with unknown data ... bugreport #38 pointed out that
+         the old handling where the seconds were rounded could lead to
+         cases where the data stored was higher than the data input ... now
+         I always floor the unknown seconds and this will lead to the same
+         or lower data but not higher ... -- tobi
+
+2006-05-02 20:52  oetiker
+
+       * src/rrd_graph.c: variables should be defined at the bein of the
+         block ... else we loose portability!
+
+2006-04-29 08:57  oetiker
+
+       * doc/rrdbuild.pod: fixed spelling
+
+2006-04-27 06:37  oetiker
+
+       * CONTRIBUTORS, doc/rrdgraph.pod, src/rrd_graph.c, src/rrd_graph.h:
+         new units=si option -- wim.heirmann elis.urgent.be
+
+2006-04-25 21:00  oetiker
+
+       * src/rrd_gfx.c: compile without multibyte support
+
+2006-04-25 20:59  oetiker
+
+       * src/Makefile.am: lets have proper dependencies
+
+2006-04-24 15:14  oetiker
+
+       * src/rrd_graph.c: make sure things are initialised ...
+
+2006-04-18 05:29  oetiker
+
+       * rrdtool.spec: shared should be share !
+
+2006-04-17 20:25  oetiker
+
+       * src/rrd_graph.c: Add a second label to the Y axis if there is only
+         going to be one -- Jason A. Smith smithj4 X bnl.gov
+
+2006-04-14 10:17  oetiker
+
+       * acinclude.m4, doc/rrdbuild.pod: no more people links!
+
+2006-04-14 09:22  oetiker
+
+       * bindings/python/setup.py, debian/copyright, rrdtool.spec: remove
+         people references
+
+2006-04-07 14:37  oetiker
+
+       * doc/rrdbuild.pod: add solaris hint to bild procedure
+
+2006-04-04 18:46  oetiker
+
+       * CONTRIBUTORS, src/rrd_tool.c: allow for input lines of arbitrary
+         length in rrdtool pipe mode -- roger.meier terreactive.ch
+
+2006-04-01 15:36  oetiker
+
+       * CONTRIBUTORS, doc/rrdgraph.pod, src/rrd_graph.c, src/rrd_graph.h,
+         src/rrd_tool.c: watermartk feature for rrdgraph by Ronan Mullally
+
+2006-03-26 14:36  oetiker
+
+       * src/rrd_rpncalc.c: vnames can be up to MAX_VNAME_LEN long ... not
+         only 30 chars ... -- Ulf Harnhammar metaur telia.com
+
+2006-03-26 14:29  oetiker
+
+       * src/rrd_graph.c: potential bufferoverflow throught large windir
+         avoided
+
+2006-03-14 14:59  oetiker
+
+       * NEWS: added note on the fact that no OK will be printed in rrdtool
+         pipe mode if an error occures.
+
+2006-03-14 07:11  oetiker
+
+       * doc/rrdtool.pod: RRDtool in remote mode will either print an ERROR
+         line or an OK line not both.
+
+2006-03-13 23:21  oetiker
+
+       * src/rrd_tool.c: in pipe mode, make rrd_tool send errors to STDOUT
+         (most of the time) -- tobi
+
+2006-03-06 07:15  oetiker
+
+       * src/rrd_graph.c: at least freebsd will not do utf8 bits properly
+         without this
+
+2006-03-03 23:11  oetiker
+
+       * doc/rrdgraph_graph.pod, src/rrd_graph.c, src/rrd_graph_helper.c: *
+         simplify code for STACK function ... there were two code paths
+         (new as well as legacy from 1.0.x) * make TICK work for negative
+         fractions
+
+2006-03-03 23:10  oetiker
+
+       * configure.ac: remove ~ from my wishlist address ...
+
+2006-03-03 23:10  oetiker
+
+       * src/rrd_gfx.c: make this compile even when HAVE_MBSTOWCS is not
+         set
+
+2006-02-23 07:26  oetiker
+
+       * src/rrd_fetch.c: separate matching of full and partial match
+         evaluation for better result stability. The fetch result was
+         dependent on the RRA ordering before. -- Jo Rhett jrhett
+         svcolo.com
+
+2006-02-20 06:20  oetiker
+
+       * doc/rrdgraph_examples.pod, doc/rrdgraph_graph.pod: YYYYMMDDhhmm is
+         not supported ... only YYYYMMDD
+
+2006-02-08 11:35  oetiker
+
+       * doc/rrdcgi.pod, src/rrd_cgi.c: OS and COPYRIGHT removed from the
+         rrdcgi INTERNAL function since we do not have this info
+
+2006-02-06 19:49  oetiker
+
+       * doc/rrdcgi.pod, src/rrd_cgi.c: new rrdcgi function RRD::INTERNAL
+         for accessing VERSION, COPYRIGHT, COMPILETIME, OS -- Guenter Knauf
+         gk gknw.de
+
+2006-02-06 19:46  oetiker
+
+       * COPYRIGHT, rrdtool-1.2-release, src/rrd_tool.c: we have 2006 now
+         so let's show it
+
+2006-01-29 23:28  oetiker
+
+       * src/Makefile.NetWare, src/Makefile.Win32: more makefile cleanup
+         from Guenter Knauf gk gknw.de
+
+2006-01-25 19:09  oetiker
+
+       * bindings/perl-piped/RRDp.pm: allow RRDp to catch errors
+
+2006-01-22 12:02  oetiker
+
+       * doc/rrdcreate.pod: clarified the documentation of xff -- Michael
+         Bunk mb computer-leipzig.com
+
+2006-01-22 11:00  oetiker
+
+       * doc/rrdgraph_rpn.pod: the operator in the example is * not + --
+         Nick Sharp njsharp bigpond.net.au
+
+2006-01-15 13:31  oetiker
+
+       * bindings/perl-shared/RRDs.xs: make sure we pickup the correct
+         config.h ... -- Blair Zajac blair orcaware.com
+
+2006-01-15 12:31  oetiker
+
+       * src/rrd_tool.c: make sure the image size only gets printed from
+         rrd_tool when --imageinfo is NOT set.
+
+2006-01-15 12:25  oetiker
+
+       * src/rrd_graph.c: make sure gcc does not thing gridind may be
+         undefined
+
+2006-01-15 11:12  oetiker
+
+       * doc/rrdcreate.pod: HWPREDICT without reference number will
+         implicitly create the other Holt-Winters RRAs.
+
+2006-01-15 09:03  oetiker
+
+       * src/Makefile.NetWare, src/Makefile.Win32, src/rrd_tool.h: updated
+         NetWare and Cygwin Builds
+
+2006-01-15 08:55  oetiker
+
+       * src/rrd_graph.c: make sure gridind is defined under all conditions
+
+2006-01-14 09:10  oetiker
+
+       * CONTRIBUTORS, bindings/perl-shared/RRDs.pm, bindings/tcl/tclrrd.c,
+         doc/rrddump.pod, src/rrd.h, src/rrd_dump.c: add perlbindings and
+         optional export filename to rrd_dump -- Nicola Worthington nicolaw
+         arwen.tfb.net
+
+2006-01-05 20:39  oetiker
+
+       * bindings/Makefile.am, bindings/perl-shared/Makefile.PL: let the
+         building of the perl extension be more reliable ...
+
+2006-01-05 20:07  oetiker
+
+       * src/rrd_gfx.c: remove redundant if statement in rrd_gfx pdf code
+         ... -- NormW
+
+2006-01-04 22:07  oetiker
+
+       * src/Makefile.NetWare, src/Makefile.Win32, src/get_ver.awk,
+         src/rrd_tool.h: Compile time improvments for NetWare and Win32 --
+         Guenter Knauf gk.gknw.de
+
+2006-01-04 20:12  oetiker
+
+       * src/rrd_gfx.c: make sure this actually compiles with HAVE_MBSTOWCS
+         is not defined
+
+2005-12-30 14:36  oetiker
+
+       * src/rrd_tool.c: only use getuid if it is actually available ...
+
+2005-12-26 16:01  oetiker
+
+       * doc/rrdcreate.pod: added heartbeat grahics
+
+2005-12-19 12:28  oetiker
+
+       * bindings/tcl/Makefile.am, bindings/tcl/tclrrd.c, configure.ac: fix
+         tcl issues ... build with pre tcl8.4 ... do not try to install
+         into the tcl tree unless --enable-tcl-site is given -- tobi
+
+2005-12-18 20:30  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/gdpng.c,
+         src/gifsize.c, src/pngsize.c, src/rrd.h, src/rrd_afm.c,
+         src/rrd_afm.h, src/rrd_afm_data.c, src/rrd_afm_data.h,
+         src/rrd_cgi.c, src/rrd_create.c, src/rrd_datalang.c,
+         src/rrd_diff.c, src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c,
+         src/rrd_first.c, src/rrd_format.c, src/rrd_format.h,
+         src/rrd_gfx.c, src/rrd_gfx.h, src/rrd_graph.c,
+         src/rrd_graph_helper.c, src/rrd_hw.c, src/rrd_hw.h,
+         src/rrd_info.c, src/rrd_is_thread_safe.h, src/rrd_last.c,
+         src/rrd_not_thread_safe.c, src/rrd_open.c, src/rrd_resize.c,
+         src/rrd_restore.c, src/rrd_rpncalc.c, src/rrd_rpncalc.h,
+         src/rrd_stat.c, src/rrd_thread_safe.c, src/rrd_thread_safe_nt.c,
+         src/rrd_tool.c, src/rrd_tool.h, src/rrd_tune.c, src/rrd_update.c,
+         src/rrd_version.c, src/rrd_xport.c, src/rrd_xport.h: prepare for
+         the release of rrdtool-1.2.12
+
+2005-12-18 20:29  oetiker
+
+       * COPYRIGHT: added FLOSS exception from
+         http://www.mysql.com/company/legal/licensing/foss-exception.html
+         in order to not end up in license incompatibility hell -- tobi
+
+2005-11-30 09:19  oetiker
+
+       * src/rrd_graph_helper.c: if called with --lazy we still want to
+         PRINT ... -- Bartek Szady bszx from bszx.eu.org
+
+2005-11-28 21:59  oetiker
+
+       * src/rrd_update.c: we should still consider the mrhb ...
+
+2005-11-20 10:16  oetiker
+
+       * src/Makefile.Win32: improve win32 compilation -- Norm
+
+2005-11-18 20:38  oetiker
+
+       * src/get_ver.awk: deal with versions ending in letters
+
+2005-11-16 13:14  oetiker
+
+       * configure.ac: have indivitudal lines for generating output files,
+         so that cygwin does not choke
+
+2005-11-14 23:07  oetiker
+
+       * configure.ac: make mmap test a little saver
+
+2005-11-14 11:46  oetiker
+
+       * configure.ac: cygwin can actually do mmap ... -- larryjadams with
+         comcast.net
+
+2005-11-14 07:32  oetiker
+
+       * src/rrd_update.c: guess the option should still be called template
+         :-)
+
+2005-11-13 18:32  oetiker
+
+       * acinclude.m4, configure.ac: improve screen apperance of configure
+         output as suggested by Dale -- tobi
+
+2005-11-13 18:31  oetiker
+
+       * bindings/python/Makefile.am: don't use clean: target ... automake
+         wants this to be clean-local:
+
+2005-11-12 23:36  oetiker
+
+       * src/rrd_gfx.c: add xmlns declaration to svg output -- R.P. Aditya
+         <aditya with grot.org>
+
+2005-11-12 23:30  oetiker
+
+       * bindings/Makefile.am: clean target was broken
+
+2005-11-12 23:10  oetiker
+
+       * configure.ac, doc/rrdbuild.pod, src/Makefile.am, src/rrd_cgi.c: *
+         integrate necessary cgi functionality into rrd_cgi.c so that
+         libcgi is not required anymore ... -- D. Walsh <buildsmart at
+         daleenterprise.com> * check if we have to include malloc/malloc.h
+         to make malloc work ... -- tobi
+
+2005-11-07 19:12  oetiker
+
+       * src/rrd_update.c: the variable template has to generic a name, it
+         clashes with other things in some environments.
+
+2005-10-28 05:55  oetiker
+
+       * doc/rrdbuild.pod: added openbsd note
+
+2005-10-24 20:55  oetiker
+
+       * bindings/tcl/Makefile.am, bindings/tcl/tclrrd.c: use multithreded
+         version of librrd -- Oleg Derevenetz <oleg with vsi.ru>
+
+2005-10-11 17:09  oetiker
+
+       * src/rrd_graph.c, src/rrd_graph.h, src/rrd_graph_helper.c,
+         src/rrd_rpncalc.c, src/rrd_rpncalc.h: improved error messages for
+         rrd_graph commandline parsing -- Alex
+
+2005-10-11 16:51  oetiker
+
+       * examples/minmax.pl.in: fix file generation
+
+2005-10-11 16:41  oetiker
+
+       * examples/4charts.pl.in, examples/bigtops.pl.in,
+         examples/minmax.pl.in, examples/shared-demo.pl.in,
+         examples/stripes.pl.in: die on error! -- Alex
+
+2005-10-11 16:37  oetiker
+
+       * examples/4charts.pl.in, examples/bigtops.pl.in,
+         examples/minmax.pl.in: the images should be written to the current
+         directory ... -- Alex
+
+2005-10-11 16:32  oetiker
+
+       * configure.ac: do not complain about strict aliasing issues -- Alex
+
+2005-10-08 21:58  oetiker
+
+       * bindings/tcl/tclrrd.c: allow rrd::graph to write directly to a tcl
+         stream ... by Dave Bodenstab <dave with bodenstab.org>
+
+2005-10-07 07:48  oetiker
+
+       * CONTRIBUTORS, bindings/tcl/Makefile.am, bindings/tcl/tclrrd.c,
+         configure.ac: updates for tcl bindings by -- Dave Bodenstab <dave
+         on bodenstab.org>
+
+2005-10-07 07:48  oetiker
+
+       * Makefile.am, favicon.ico: included favicon in distro
+
+2005-09-26 20:33  oetiker
+
+       * src/rrd_gfx.c: plugged two memmory leaks happening when a
+         requested font is not found.
+
+2005-09-23 23:06  oetiker
+
+       * src/rrd_graph.c: hmpf its the gdef step we are talking about not
+         the image step !
+
+2005-09-22 20:18  oetiker
+
+       * src/rrd_graph.c, src/rrd_graph.h, src/rrd_graph_helper.c: do not
+         'reload' data if you already have it!
+
+2005-09-22 20:17  oetiker
+
+       * src/rrd_restore.c: the -r option should not expect an argument
+
+2005-09-19 07:42  oetiker
+
+       * src/rrd_restore.c: do not free stuff that gets freed later anyway
+
+2005-09-18 18:28  oetiker
+
+       * src/Makefile.NetWare: Netware Build Updates --- Guenter Knauf <gk
+         with gknw.de>
+
+2005-09-18 16:59  oetiker
+
+       * src/rrd_fetch.c: allocate memory for one more row ... fetch can
+         not return 0 reows ...
+
+2005-09-18 15:39  oetiker
+
+       * src/rrd_graph.c: comparing floating point numbers is dangerouse
+         ... don't do this directly!
+
+2005-09-01 21:23  oetiker
+
+       * src/rrd_tool.c: since we use firstdir even without CHROOT it
+         should better be defined in any case -- Guenter Knauf
+
+2005-08-30 05:52  oetiker
+
+       * src/rrd_graph.c, src/rrd_graph.h: When selecting the x-axis label
+         take the length of the time shown in the graph into consideration
+         just showing %H:%M in a two day presentation is a problem ... --
+         LAUKENS Niels <Niels.LAUKENS .. VRT.BE>
+
+2005-08-28 07:33  oetiker
+
+       * doc/rrdbuild.pod: fixed location of example scripts
+
+2005-08-27 21:29  oetiker
+
+       * src/rrd_update.c: resolve subsecond resolution logging and
+         handling of unknown values by starting off with an unknown value
+         when building a pdp instead of starting out with 0 and then
+         turning it into unknown later on if the number of uknown seconds
+         is equal or larger than the interval ...
+
+2005-08-27 20:55  oetiker
+
+       * examples/piped-demo.pl.in: the rrdtool binary one more level up
+         the path ...
+
+2005-08-27 20:52  oetiker
+
+       * examples/piped-demo.pl.in: update for new prefix setting
+
+2005-08-25 20:43  oetiker
+
+       * src/rrd_resize.c: when resize converts a v1 rrd to v3 it should
+         also change the version number in the head ...
+
+2005-08-23 21:18  oetiker
+
+       * Makefile.am, src/Makefile.NetWare, src/Makefile.Win32,
+         src/Makefile.am, src/get_ver.awk, src/rrd_afm.c, src/rrd_dump.c,
+         src/rrd_tool.c, src/rrd_tool.h, src/rrd_update.c, src/rrdtool.dsp,
+         src/rrdtool.vcproj: fixes for compiling rrdtool with win32 mingw
+         and netware -- Guenter Knauf <gk with gknw.de>
+
+2005-08-16 05:30  oetiker
+
+       * doc/rrdgraph_data.pod, doc/rrdgraph_examples.pod,
+         doc/rrdgraph_rpn.pod: added notes about VDEF expressions not being
+         general purpose
+
+2005-08-11 19:18  oetiker
+
+       * src/rrd_tool.c: only bomb is there is no chroot and someone tries
+         to use it.
+
+2005-08-04 05:08  oetiker
+
+       * doc/rrdgraph_rpn.pod, src/rrd_graph.c, src/rrd_graph.h: New VDEF
+         functions for least squares slope, intercept & correlation for
+         simple forecasting -- Trent Burkard <tburkard with tangentis.com>
+
+2005-08-04 04:59  oetiker
+
+       * src/rrd_update.c: fix rounding issues that prevented UNKNOWN to
+         work as soon as subsecond resolution was used
+
+2005-08-04 04:58  oetiker
+
+       * src/rrd_graph.c: avoid drawing lines where two points are in the
+         same spot. this mai be confusing libart
+
+2005-08-02 15:54  oetiker
+
+       * bindings/Makefile.am: make sure clean works even when the perl
+         Makefile is broken
+
+2005-07-26 09:13  oetiker
+
+       * src/rrd_graph.c: initialize font to empty string for deault font
+         case.
+
+2005-07-25 14:12  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         doc/rrdbuild.pod, rrdtool.spec, src/gdpng.c, src/gifsize.c,
+         src/pngsize.c, src/rrd.h, src/rrd_afm.c, src/rrd_afm.h,
+         src/rrd_afm_data.c, src/rrd_afm_data.h, src/rrd_cgi.c,
+         src/rrd_create.c, src/rrd_datalang.c, src/rrd_diff.c,
+         src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_not_thread_safe.c, src/rrd_open.c,
+         src/rrd_resize.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_rpncalc.h, src/rrd_stat.c, src/rrd_thread_safe.c,
+         src/rrd_thread_safe_nt.c, src/rrd_tool.c, src/rrd_tool.h,
+         src/rrd_tune.c, src/rrd_update.c, src/rrd_version.c,
+         src/rrd_xport.c, src/rrd_xport.h: prepare for the release of
+         rrdtool-1.2.11
+
+2005-07-25 14:07  oetiker
+
+       * configure.ac, src/Makefile.am: prepared for release
+
+2005-07-22 13:16  oetiker
+
+       * src/rrd_tool.c: do not quit so easily when runing in interactive
+         mode
+
+2005-07-22 13:16  oetiker
+
+       * src/rrd_graph.c: init ytr after all the changes have happened
+
+2005-07-22 13:10  oetiker
+
+       * src/rrd_graph.c: make --no-gridfit with --only-graph work
+
+2005-07-21 22:23  oetiker
+
+       * src/rrd_graph.c: when stacking known on unknown, then we asume
+         unknown was zero ...
+
+2005-07-20 07:20  oetiker
+
+       * configure.ac: make sure gcc-4.0 does not optimize our tests away
+         :-)
+
+2005-07-19 10:00  oetiker
+
+       * src/rrd_graph.c: fixed some corner cases in drawing code to get
+         the same results as before with way more performance
+
+2005-07-11 22:49  oetiker
+
+       * src/rrd_graph.c: optimized drawing routines ... up to 6 times
+         faster (in the case of smokeping)
+
+2005-07-07 10:27  oetiker
+
+       * doc/rrdgraph.pod: colors start with # not :
+
+2005-07-04 18:49  oetiker
+
+       * src/rrd_graph.c: make setting just the size and not the font work
+         -- Havard Eidnes <he from uninett.no>
+
+2005-06-28 21:03  oetiker
+
+       * bindings/Makefile.am, bindings/python/Makefile.am,
+         bindings/tcl/Makefile.am, configure.ac, doc/Makefile.am,
+         examples/Makefile.am: * the makefiles should not depend on gnumake
+         features * make the perl module compilation environement
+         configurable -- Stan Sinyagin ssinyagin on yahoo.com
+
+2005-06-25 05:24  oetiker
+
+       * doc/rrdbuild.pod: added GNUMAKE and EGREP hints
+
+2005-06-20 09:15  oetiker
+
+       * src/rrd_graph.c: x-axis labels should be aligned to their baseline
+         alt-y-grid labels without fractionals should have no fractionals
+         when printed
+
+2005-06-17 09:05  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/gdpng.c,
+         src/gifsize.c, src/pngsize.c, src/rrd.h, src/rrd_afm.c,
+         src/rrd_afm.h, src/rrd_afm_data.c, src/rrd_afm_data.h,
+         src/rrd_cgi.c, src/rrd_create.c, src/rrd_datalang.c,
+         src/rrd_diff.c, src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c,
+         src/rrd_first.c, src/rrd_format.c, src/rrd_format.h,
+         src/rrd_gfx.c, src/rrd_gfx.h, src/rrd_graph.c,
+         src/rrd_graph_helper.c, src/rrd_hw.c, src/rrd_hw.h,
+         src/rrd_info.c, src/rrd_is_thread_safe.h, src/rrd_last.c,
+         src/rrd_not_thread_safe.c, src/rrd_open.c, src/rrd_resize.c,
+         src/rrd_restore.c, src/rrd_rpncalc.c, src/rrd_rpncalc.h,
+         src/rrd_stat.c, src/rrd_thread_safe.c, src/rrd_thread_safe_nt.c,
+         src/rrd_tool.c, src/rrd_tool.h, src/rrd_tune.c, src/rrd_update.c,
+         src/rrd_version.c, src/rrd_xport.c, src/rrd_xport.h: prepare for
+         the release of rrdtool-1.2.10
+
+2005-06-16 22:09  oetiker
+
+       * src/rrd_graph.c: when building the sgridstep in alt-y-grid mode,
+         take the --base into consideration.
+
+2005-06-13 21:56  oetiker
+
+       * src/rrd_graph.c: simplify code for generating y axis labels a bit.
+
+2005-06-13 13:20  oetiker
+
+       * src/rrd_gfx.c: wide chars should better be unsigned
+
+2005-06-13 12:56  oetiker
+
+       * src/rrd_gfx.c: fall back to assuming latin1 encoding if mbtowchar
+         conversion fails
+
+2005-06-13 05:43  oetiker
+
+       * doc/rrdgraph_data.pod, src/rrd_graph_helper.c: allow for VNAMES
+         starting with a number and add documentation -- Alex
+
+2005-06-13 05:43  oetiker
+
+       * doc/rrdgraph.pod: add notes about small numbers for --alt-y-grid
+
+2005-06-12 20:01  oetiker
+
+       * src/rrd_update.c: kill the last stored counter value if the
+         updates comes after mrhb to make sure it does not get taken into
+         account accedenly later on.
+
+2005-06-12 20:00  oetiker
+
+       * src/rrd_graph.c: make --alt-y-grid work properly in many more
+         cases than before
+
+2005-06-11 19:03  oetiker
+
+       * src/rrd_open.c: be more careful when checking if a file is an
+         rrdfile
+
+2005-06-11 06:17  oetiker
+
+       * doc/Makefile.am: distribute all generated documentation install in
+         share and not shared drop index.html link
+
+2005-06-11 06:14  oetiker
+
+       * examples/Makefile.am: install examples in an rrdtool specific
+         subdirectory if the prefix does not contain rrd -- Peter
+         Breitenlohner
+
+2005-06-11 05:41  oetiker
+
+       * bindings/Makefile.am, bindings/perl-piped/t/base.t: avoid problems
+         when building with VPATH set and --disable-perl fix make test for
+         perl-piped -- Peter Breitenlohner
+
+2005-06-11 05:40  oetiker
+
+       * bindings/python/Makefile.am, doc/Makefile.am: let 'out-of tree'
+         builds work for everythin but the perl module -- Peter
+         Breitenlohner
+
+2005-06-11 05:37  oetiker
+
+       * src/rrd_gfx.c: defined DPRINTF in a more compatible way -- Peter
+         Breitenlohner
+
+2005-06-11 05:31  oetiker
+
+       * acinclude.m4, configure.ac, src/Makefile.am: link libcgi only
+         against rrd_cgi since it is only needed there -- Peter
+         Breitenlohner
+
+2005-06-11 05:29  oetiker
+
+       * acinclude.m4, configure.ac: Make sure librrd_th properly depends
+         on libpthread. -- Peter Breitenlohner
+
+2005-06-11 05:27  oetiker
+
+       * src/rrd_create.c: avoid gcc (3.4.3) warnings char format,
+         different type arg -- Peter Breitenlohner
+
+2005-06-11 05:26  oetiker
+
+       * bindings/tcl/Makefile.am, bindings/tcl/ifOctets.tcl,
+         bindings/tcl/ifOctets.tcl.in, bindings/tcl/tclrrd.c, configure.ac:
+         fix various problems with the tcl bindings -- Peter Breitenlohner
+
+2005-06-11 05:22  oetiker
+
+       * CONTRIBUTORS: added peter breitenlohner
+
+2005-06-11 05:20  oetiker
+
+       * src/rrd_cgi.c: remove various gcc (3.4.3) warnings such as
+         discards qualifier all due to 'char **' vs. 'const char **'
+         discrepancies. -- Peter Breitenlohner peb with mppmu.mpg.de
+
+2005-06-11 05:15  oetiker
+
+       * src/rrd_first.c: re-innitializing sort of defeats the purpose
+
+2005-06-11 05:03  oetiker
+
+       * src/rrd_open.c: be more carefull in checking for sucessful open
+
+2005-06-10 19:25  oetiker
+
+       * doc/rrdgraph_data.pod: vnames MUST start with a letter
+
+2005-06-10 19:24  oetiker
+
+       * src/rrd_gfx.c: kill another warning
+
+2005-06-10 18:44  oetiker
+
+       * doc/rrdgraph.pod, src/rrd_graph.c: make --font more flexible: *
+         TITLE:30: just alter the size of the title *
+         DEFAULT:0:/tmp/funfont.ttf alter the font but not the size
+
+2005-06-10 08:42  oetiker
+
+       * doc/rrdbuild.pod: added missing cd and replace one path with a
+         variable
+
+2005-06-07 22:10  oetiker
+
+       * src/rrd_afm.c, src/rrd_afm.h, src/rrd_gfx.c: make pdf/eps/svg
+         formats utf8 aware too -- Peter Speck
+
+2005-06-06 05:32  oetiker
+
+       * rrdtool.spec: sync up with Dag Wieers version from
+         http://dag.wieers.com/packages/rrdtool/rrdtool.spec
+
+2005-06-05 22:23  oetiker
+
+       * doc/rrdgraph_rpn.pod, src/rrd_rpncalc.c, src/rrd_rpncalc.h: New
+         functions for CDEF ATAN2 RAD2DEG and DEG2RAD -- Simon Melhuish
+         <simon mailing from melhuish.info>
+
+2005-05-31 06:22  oetiker
+
+       * doc/rrd-beginners.pod: fixed epoch
+
+2005-05-28 13:01  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool-1.2-release, rrdtool.spec,
+         src/Makefile.am, src/gdpng.c, src/gifsize.c, src/pngsize.c,
+         src/rrd.h, src/rrd_afm.c, src/rrd_afm.h, src/rrd_afm_data.c,
+         src/rrd_afm_data.h, src/rrd_cgi.c, src/rrd_create.c,
+         src/rrd_datalang.c, src/rrd_diff.c, src/rrd_dump.c,
+         src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_not_thread_safe.c, src/rrd_open.c,
+         src/rrd_resize.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_rpncalc.h, src/rrd_stat.c, src/rrd_thread_safe.c,
+         src/rrd_thread_safe_nt.c, src/rrd_tool.c, src/rrd_tool.h,
+         src/rrd_tune.c, src/rrd_update.c, src/rrd_version.c,
+         src/rrd_xport.c, src/rrd_xport.h: prepare for the release of
+         rrdtool-1.2.9
+
+2005-05-28 12:53  oetiker
+
+       * doc/rrdbuild.pod: add notes on building on Mac OS X
+
+2005-05-28 12:52  oetiker
+
+       * src/rrd_gfx.c, src/rrd_update.c: kill a few warnings
+
+2005-05-28 12:52  oetiker
+
+       * bindings/perl-shared/Makefile.PL: make the bindings work on os x
+
+2005-05-27 19:17  oetiker
+
+       * doc/rrdgraph_data.pod: add note on variable names
+
+2005-05-27 19:12  oetiker
+
+       * src/rrd_graph_helper.c: remove one more warning
+
+2005-05-27 19:12  oetiker
+
+       * src/rrd_graph.h: there is realy no reason to have the vnames
+         constraind so much
+
+2005-05-27 19:01  oetiker
+
+       * src/rrd_gfx.c: only print ttf font errors when compiled with
+         -DDEBUG
+
+2005-05-22 22:29  oetiker
+
+       * src/rrd_gfx.c: don't go into an endless loop upon finding a bad
+         character in a truetype font
+
+2005-05-20 06:20  oetiker
+
+       * doc/rrdbuild.pod: go into rrdbuild too if we use tcsh
+
+2005-05-20 05:48  oetiker
+
+       * rrdtool-1.2-release: initial checking
+
+2005-05-20 05:46  oetiker
+
+       * doc/bin_dec_hex.pod, doc/cdeftutorial.pod, doc/rpntutorial.pod,
+         doc/rrd-beginners.pod, doc/rrdbuild.pod, doc/rrdcgi.pod,
+         doc/rrdcreate.pod, doc/rrddump.pod, doc/rrdfetch.pod,
+         doc/rrdfirst.pod, doc/rrdgraph-old.pod, doc/rrdgraph.pod,
+         doc/rrdgraph_data.pod, doc/rrdgraph_graph.pod,
+         doc/rrdgraph_rpn.pod, doc/rrdpython.pod, doc/rrdresize.pod,
+         doc/rrdthreads.pod, doc/rrdtool.pod, doc/rrdtune.pod,
+         doc/rrdtutorial.es.pod, doc/rrdtutorial.pod, doc/rrdupdate.pod,
+         doc/rrdxport.pod: remove extra whitespace at the end of lines
+
+2005-05-20 05:43  oetiker
+
+       * doc/rrdbuild.pod: introduce builddir
+
+2005-05-20 05:14  oetiker
+
+       * configure.ac: iconf is not needed so to not check for it
+
+2005-05-19 23:21  oetiker
+
+       * src/Makefile.am, src/rrd_tool.c: added propper numeric version
+         number to version
+
+2005-05-19 23:21  oetiker
+
+       * configure.ac, src/rrd_gfx.c: add multibyte to wide char conversion
+         ability. Now every string users input should should be handled
+         propperly by rrdtool, whatever your locale says will work.
+
+2005-05-19 23:19  oetiker
+
+       * src/rrd_create.c: windows at least stores null terminated char
+         strings in dummychar1 -- Philippe
+
+2005-05-18 20:20  oetiker
+
+       * bindings/tcl/Makefile.am, bindings/tcl/tclrrd.c: make tcl compile
+         again ... don't know if it will work though
+
+2005-05-18 19:43  oetiker
+
+       * src/rrd.h: fix rrd_version prototype
+
+2005-05-18 19:41  oetiker
+
+       * configure.ac, src/Makefile.am, src/rrd.h, src/rrd_gfx.c,
+         src/rrd_is_thread_safe.h, src/rrd_tool.c, src/rrd_update.c,
+         src/rrd_version.c: cleaned up version number code and added new
+         function rrd_version -- partly by Burton Strauss
+
+2005-05-18 19:18  oetiker
+
+       * bindings/perl-shared/Makefile.PL: help building perl on hpux
+
+2005-05-16 20:56  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/gdpng.c,
+         src/gifsize.c, src/pngsize.c, src/rrd.h, src/rrd_afm.c,
+         src/rrd_afm.h, src/rrd_afm_data.c, src/rrd_afm_data.h,
+         src/rrd_cgi.c, src/rrd_create.c, src/rrd_datalang.c,
+         src/rrd_diff.c, src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c,
+         src/rrd_first.c, src/rrd_format.c, src/rrd_format.h,
+         src/rrd_gfx.c, src/rrd_gfx.h, src/rrd_graph.c,
+         src/rrd_graph_helper.c, src/rrd_hw.c, src/rrd_hw.h,
+         src/rrd_info.c, src/rrd_is_thread_safe.h, src/rrd_last.c,
+         src/rrd_not_thread_safe.c, src/rrd_open.c, src/rrd_resize.c,
+         src/rrd_restore.c, src/rrd_rpncalc.c, src/rrd_rpncalc.h,
+         src/rrd_stat.c, src/rrd_thread_safe.c, src/rrd_thread_safe_nt.c,
+         src/rrd_tool.c, src/rrd_tool.h, src/rrd_tune.c, src/rrd_update.c,
+         src/rrd_xport.c, src/rrd_xport.h: prepare for the release of
+         rrdtool-1.2.8
+
+2005-05-16 20:55  oetiker
+
+       * bindings/Makefile.am, bindings/python/Makefile.am,
+         bindings/tcl/Makefile.am, configure.ac: redo --disable-* options
+         for python and tcl add some more quotes to protect potentially
+         empty variables in tests which should make configure more robust.
+
+2005-05-16 20:04  oetiker
+
+       * bindings/Makefile.am, configure.ac: if python stuff does not work,
+         do not die, just do not compile python
+
+2005-05-16 20:02  oetiker
+
+       * configure.ac: fix extra argument when testing for PERLCC problem
+         -- Simon Leinen
+
+2005-05-16 12:18  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/gdpng.c,
+         src/gifsize.c, src/pngsize.c, src/rrd.h, src/rrd_afm.c,
+         src/rrd_afm.h, src/rrd_afm_data.c, src/rrd_afm_data.h,
+         src/rrd_cgi.c, src/rrd_create.c, src/rrd_datalang.c,
+         src/rrd_diff.c, src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c,
+         src/rrd_first.c, src/rrd_format.c, src/rrd_format.h,
+         src/rrd_gfx.c, src/rrd_gfx.h, src/rrd_graph.c,
+         src/rrd_graph_helper.c, src/rrd_hw.c, src/rrd_hw.h,
+         src/rrd_info.c, src/rrd_is_thread_safe.h, src/rrd_last.c,
+         src/rrd_not_thread_safe.c, src/rrd_open.c, src/rrd_resize.c,
+         src/rrd_restore.c, src/rrd_rpncalc.c, src/rrd_rpncalc.h,
+         src/rrd_stat.c, src/rrd_thread_safe.c, src/rrd_thread_safe_nt.c,
+         src/rrd_tool.c, src/rrd_tool.h, src/rrd_tune.c, src/rrd_update.c,
+         src/rrd_xport.c, src/rrd_xport.h: prepare for the release of
+         rrdtool-1.2.7
+
+2005-05-16 12:14  oetiker
+
+       * NEWS: added note about --alt-y-mrtg
+
+2005-05-16 10:12  oetiker
+
+       * src/rrd_graph.c, src/rrd_graph_helper.c: fix the color square
+         spacing so that it works regardles of the fontsize and with
+         transparend backgrounds.
+
+2005-05-16 09:01  oetiker
+
+       * src/rrd_graph.c: added alt-y-mrtg option as a dummy so that old
+         apps who use it do not crash when doing so.
+
+2005-05-16 06:33  oetiker
+
+       * doc/rrdgraph.pod, src/rrd_graph.c, src/rrd_graph.h: reintroduced
+         the FRAME color ... somehow it was lost from 1.0.x
+
+2005-05-15 14:16  oetiker
+
+       * src/rrd_graph.c: make transparent backgrounds work propperly
+
+2005-05-14 21:57  oetiker
+
+       * src/getopt.c, src/rrd_afm.c, src/rrd_cgi.c, src/rrd_graph.c,
+         src/rrd_nan_inf.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_tool.c, src/rrd_tool.h, src/rrd_update.c, src/rrd_xport.c:
+         it seems that _WIN32 is more commonly defined thatn WIN32 on win32
+         ... (gifford.hesketh on gmail.com)
+
+2005-05-14 17:32  oetiker
+
+       * src/rrd_restore.c: added a note to dump old rrd files with a
+         current rrdtool dump to get the upgraded on the fly. Adding 001
+         support should not be all that tough though. Any takers ?
+
+2005-05-14 15:07  oetiker
+
+       * src/rrd_open.c: check cookie read for success
+
+2005-05-14 09:35  oetiker
+
+       * src/rrd_graph.c: if the y value is out of bounds, make it just a
+         wee bit larger or smaller than the bound so that the code can
+         detect this by comparing it with the bound, but make it so small
+         that it is not visible.
+
+2005-05-12 22:27  oetiker
+
+       * acinclude.m4: one sed is quite enough
+
+2005-05-12 22:22  oetiker
+
+       * acinclude.m4: [ must be quoted by [ ...
+
+2005-05-12 22:12  oetiker
+
+       * acinclude.m4: add global option
+
+2005-05-12 22:06  oetiker
+
+       * acinclude.m4: fox sed line for unsetting header cache
+
+2005-05-12 22:03  oetiker
+
+       * acinclude.m4, configure.ac: make sure the header gets tested twice
+
+2005-05-12 22:03  oetiker
+
+       * doc/rrdpython.pod: add notes on python error, and install location
+
+2005-05-12 11:32  oetiker
+
+       * src/rrd_graph.c: allow 3/4 component color rrdtool graph --color
+         too -- Alex
+
+2005-05-12 11:28  oetiker
+
+       * src/rrd_graph.c: make the areas a little bigger still for propper
+         overlapping
+
+2005-05-12 11:22  oetiker
+
+       * src/rrd_create.c: make parsing of DS arguments more robust and
+         give more sensible error messages. -- Alex
+
+2005-05-12 08:38  oetiker
+
+       * src/rrd_graph.c: make the areas that makeup the graphs a little
+         larger, so that they overlap a bit and do not exhibit white lines
+         when touching each other.
+
+2005-05-12 05:48  oetiker
+
+       * bindings/python/Makefile.am, bindings/python/Makefile.in,
+         bindings/python/rrdtoolmodule.c: some more warning fixes
+
+2005-05-12 05:41  oetiker
+
+       * bindings/python/rrd_format.h, bindings/python/rrdtoolmodule.c: add
+         unused to prevent warnings about self
+
+2005-05-11 18:31  oetiker
+
+       * doc/rrdpython.pod: intial python bindings documentation
+
+2005-05-11 12:09  oetiker
+
+       * doc/rrdcreate.pod: fix wording for min/max ... they are not
+         optional
+
+2005-05-10 20:19  oetiker
+
+       * bindings/python/rrdtoolmodule.c: second installment with warning
+         fixes from alan
+
+2005-05-10 18:52  oetiker
+
+       * CONTRIBUTORS, Makefile.am, acinclude.m4, bindings/Makefile.am,
+         bindings/python, bindings/python/ACKNOWLEDGEMENT,
+         bindings/python/AUTHORS, bindings/python/COPYING,
+         bindings/python/Makefile.am, bindings/python/Makefile.in,
+         bindings/python/README, bindings/python/Setup.in,
+         bindings/python/rrd_extra.h, bindings/python/rrd_format.h,
+         bindings/python/rrdtoolmodule.c, bindings/python/setup.py,
+         configure.ac, rrdtool.spec: python bindings add -- Alan Milligan
+         alan from balclutha.org
+
+2005-05-10 18:35  oetiker
+
+       * src/rrd_gfx.c: fix for character escaping in EPS -- Peter Speck
+
+2005-05-10 06:07  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/gdpng.c,
+         src/gifsize.c, src/pngsize.c, src/rrd.h, src/rrd_afm.c,
+         src/rrd_afm.h, src/rrd_afm_data.c, src/rrd_afm_data.h,
+         src/rrd_cgi.c, src/rrd_create.c, src/rrd_datalang.c,
+         src/rrd_diff.c, src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c,
+         src/rrd_first.c, src/rrd_format.c, src/rrd_format.h,
+         src/rrd_gfx.h, src/rrd_graph.c, src/rrd_graph_helper.c,
+         src/rrd_hw.c, src/rrd_hw.h, src/rrd_info.c,
+         src/rrd_is_thread_safe.h, src/rrd_last.c,
+         src/rrd_not_thread_safe.c, src/rrd_open.c, src/rrd_resize.c,
+         src/rrd_restore.c, src/rrd_rpncalc.c, src/rrd_rpncalc.h,
+         src/rrd_stat.c, src/rrd_thread_safe.c, src/rrd_thread_safe_nt.c,
+         src/rrd_tool.c, src/rrd_tool.h, src/rrd_tune.c, src/rrd_update.c,
+         src/rrd_xport.c, src/rrd_xport.h: prepare for the release of
+         rrdtool-1.2.6
+
+2005-05-10 06:06  oetiker
+
+       * src/rrd_gfx.c: I guess the pdf entities want to be escaped chars
+         not just control caracters with a prepended backslash ...
+
+2005-05-10 05:18  oetiker
+
+       * src/rrd_afm.c: we should not use C++ comments in c files
+
+2005-05-10 04:14  oetiker
+
+       * src/Makefile.am: we should distribute unused.h if we use it :-)
+
+2005-05-09 20:15  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/Makefile.am,
+         src/gdpng.c, src/gifsize.c, src/pngsize.c, src/rrd.h,
+         src/rrd_afm.c, src/rrd_afm.h, src/rrd_afm_data.c,
+         src/rrd_afm_data.h, src/rrd_cgi.c, src/rrd_create.c,
+         src/rrd_datalang.c, src/rrd_diff.c, src/rrd_dump.c,
+         src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_not_thread_safe.c, src/rrd_open.c,
+         src/rrd_resize.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_rpncalc.h, src/rrd_stat.c, src/rrd_thread_safe.c,
+         src/rrd_thread_safe_nt.c, src/rrd_tool.c, src/rrd_tool.h,
+         src/rrd_tune.c, src/rrd_update.c, src/rrd_xport.c,
+         src/rrd_xport.h: prepare for the release of rrdtool-1.2.5
+
+2005-05-09 20:13  oetiker
+
+       * src/art_rgba_svp.c, src/rrd_afm.c, src/rrd_gfx.c,
+         src/rrd_update.c, src/rrd_xport.c, src/unused.h: silence warnings
+         for UNUSED variables without changeing the funtion interfaces --
+         Alex
+
+2005-05-09 19:32  oetiker
+
+       * src/rrd_graph.c: allow decimal positions y axis labels as soon as
+         the max entry is < 10
+
+2005-05-09 19:11  oetiker
+
+       * src/rrd_graph.c, src/rrd_graph_helper.c: fix rendering of the
+         color spots especially when proportional fonts are in use.
+
+2005-05-09 14:01  oetiker
+
+       * src/rrd_afm.c, src/rrd_afm.h, src/rrd_gfx.c: EPS/SVG/PDF code ...
+         more comments and better font finder including removal of
+         hardcoded SVG font. -- Peter Speck speck from vitality.dk
+
+2005-05-09 13:22  oetiker
+
+       * src/rrd_afm.c, src/rrd_gfx.c: * switch to courier if the font is
+         unknown * fix font positioning
+
+2005-05-09 05:39  oetiker
+
+       * bindings/perl-shared/Makefile.PL: perls $^O is set to linux not
+         Linux
+
+2005-05-08 22:02  oetiker
+
+       * src/rrd_gfx.c: svg/pdf/eps rendering improvements. There are still
+         issues though ... -- peter speck
+
+2005-05-08 21:25  oetiker
+
+       * libraries/afm/compile_afm.pl, src/rrd_afm.c, src/rrd_afm.h,
+         src/rrd_afm_data.c, src/rrd_afm_data.h: added support for getting
+         ascent/descent size info for ps fonts -- Peter Speck
+
+2005-05-08 20:15  oetiker
+
+       * src/art_rgb_affine_private.h, src/art_rgba_rgba_affine.c,
+         src/art_rgba_rgba_affine.h: we do not actually need these files
+         ... goodbye
+
+2005-05-08 16:59  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/Makefile.am,
+         src/gdpng.c, src/gifsize.c, src/pngsize.c, src/rrd.h,
+         src/rrd_afm.c, src/rrd_afm.h, src/rrd_afm_data.c,
+         src/rrd_afm_data.h, src/rrd_cgi.c, src/rrd_create.c,
+         src/rrd_datalang.c, src/rrd_diff.c, src/rrd_dump.c,
+         src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_not_thread_safe.c, src/rrd_open.c,
+         src/rrd_resize.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_rpncalc.h, src/rrd_stat.c, src/rrd_thread_safe.c,
+         src/rrd_thread_safe_nt.c, src/rrd_tool.c, src/rrd_tool.h,
+         src/rrd_tune.c, src/rrd_update.c, src/rrd_xport.c,
+         src/rrd_xport.h: prepare for the release of rrdtool-1.2.4
+
+2005-05-08 16:22  oetiker
+
+       * src/rrd_graph.c: * adjust spacing at the left border of the graph.
+         use less white space * increasse minimal grid spacing and label
+         spacing
+
+2005-05-08 16:02  oetiker
+
+       * src/rrd_graph.c: increase minimal vertical spacing for y-axis
+         lables
+
+2005-05-08 16:01  oetiker
+
+       * src/rrd_graph.c: shorten space for y-axis labels a bit
+
+2005-05-08 15:40  oetiker
+
+       * src/rrd_tool.c: remove the premature fox for the unused parameter
+         in xport
+
+2005-05-08 15:30  oetiker
+
+       * README: sync with reality
+
+2005-05-08 15:19  oetiker
+
+       * src/rrd_tool.c: be more portable with shorter strings
+
+2005-05-08 15:18  oetiker
+
+       * src/Makefile.am: we do not use the affine functions
+
+2005-05-08 15:07  oetiker
+
+       * configure.ac, src/rrd_graph_helper.c: removed extra $ from from
+         PERLCC test
+
+2005-05-08 08:20  oetiker
+
+       * doc/rrdbuild.pod: fix rendering errors by removing single spaces
+
+2005-05-07 23:54  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/gdpng.c,
+         src/gifsize.c, src/pngsize.c, src/rrd.h, src/rrd_afm.c,
+         src/rrd_afm.h, src/rrd_afm_data.c, src/rrd_afm_data.h,
+         src/rrd_cgi.c, src/rrd_create.c, src/rrd_datalang.c,
+         src/rrd_diff.c, src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c,
+         src/rrd_first.c, src/rrd_format.c, src/rrd_format.h,
+         src/rrd_gfx.c, src/rrd_gfx.h, src/rrd_graph.c,
+         src/rrd_graph_helper.c, src/rrd_hw.c, src/rrd_hw.h,
+         src/rrd_info.c, src/rrd_is_thread_safe.h, src/rrd_last.c,
+         src/rrd_not_thread_safe.c, src/rrd_open.c, src/rrd_resize.c,
+         src/rrd_restore.c, src/rrd_rpncalc.c, src/rrd_rpncalc.h,
+         src/rrd_stat.c, src/rrd_thread_safe.c, src/rrd_thread_safe_nt.c,
+         src/rrd_tool.c, src/rrd_tool.h, src/rrd_tune.c, src/rrd_update.c,
+         src/rrd_xport.c, src/rrd_xport.h: prepare for the release of
+         rrdtool-1.2.3
+
+2005-05-07 23:26  oetiker
+
+       * src/art_rgba_rgba_affine.c, src/art_rgba_rgba_affine.h: fix some
+         more y0, y1 complaints
+
+2005-05-07 23:26  oetiker
+
+       * src/rrd_graph_helper.c: When encountering an empty legend, do NOT
+         make space for drawing the color spats in front of it.
+
+2005-05-07 15:57  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdbuild.pod, rrdtool.spec, src/gdpng.c,
+         src/gifsize.c, src/pngsize.c, src/rrd.h, src/rrd_afm.c,
+         src/rrd_afm.h, src/rrd_afm_data.c, src/rrd_afm_data.h,
+         src/rrd_cgi.c, src/rrd_create.c, src/rrd_datalang.c,
+         src/rrd_diff.c, src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c,
+         src/rrd_first.c, src/rrd_format.c, src/rrd_format.h,
+         src/rrd_gfx.c, src/rrd_gfx.h, src/rrd_graph.c,
+         src/rrd_graph_helper.c, src/rrd_hw.c, src/rrd_hw.h,
+         src/rrd_info.c, src/rrd_is_thread_safe.h, src/rrd_last.c,
+         src/rrd_not_thread_safe.c, src/rrd_open.c, src/rrd_resize.c,
+         src/rrd_restore.c, src/rrd_rpncalc.c, src/rrd_rpncalc.h,
+         src/rrd_stat.c, src/rrd_thread_safe.c, src/rrd_thread_safe_nt.c,
+         src/rrd_tool.c, src/rrd_tool.h, src/rrd_tune.c, src/rrd_update.c,
+         src/rrd_xport.c, src/rrd_xport.h: prep for 1.2.2 release
+
+2005-05-07 15:51  oetiker
+
+       * src/Makefile.am: increment library revision
+
+2005-05-07 15:45  oetiker
+
+       * src/art_rgba_svp.c, src/rrd_gfx.c, src/rrd_gfx.h: fix these
+         annoying y0 warnings.
+
+2005-05-07 15:45  oetiker
+
+       * src/rrd_graph.c: add rrdtool attribution string back using a
+         transparent version of the font color
+
+2005-05-07 15:23  oetiker
+
+       * doc/Makefile.am, doc/rrdbuild.pod, doc/rrdgraph_graph.pod: added
+         build instructions
+
+2005-05-07 10:38  oetiker
+
+       * src/rrd_gfx.c: fix for rotation code in pdf,eps,svg formats --
+         Peter Speck <speck from vitality.dk>
+
+2005-05-07 10:34  oetiker
+
+       * src/rrd_graph.c, src/rrd_rpncalc.c: fix handling of PREV(x)
+         command
+
+2005-05-06 23:00  oetiker
+
+       * src/rrd_graph.c: * added RRDTOOL/TOBI OETIKER back in * in riggid
+         mode, cut data and 'min' and 'max' not two above * gibt ytop0 a
+         default value
+
+2005-05-06 22:59  oetiker
+
+       * src/rrd_tool.c: fixed documentation strings for rrdgraph
+
+2005-05-06 22:03  oetiker
+
+       * doc/rrdgraph.pod: added doc for new slope-mode
+
+2005-05-06 21:52  oetiker
+
+       * src/rrd_gfx.c, src/rrd_graph.c, src/rrd_graph.h: since the drawing
+         code is now much simpler we do not need to perturbe the points or
+         rewind the graph anymore this saves quite some time ...
+
+2005-05-06 15:44  oetiker
+
+       * src/rrd_graph_helper.c: * allow for 3(4) letter color names *
+         better debugging code * fix tick, line, stack parsing -- Alex van
+         den Bogaerdt <alex with ergens.op.het.net>
+
+2005-05-06 15:24  oetiker
+
+       * src/rrd_graph.c: if stacking on nothing we should not try to
+         figure out WHAT we stacked on since this will result in a segfault
+         ... -- Alex van den Bogaerdt <alex at ergens.op.het.net>
+
+2005-05-05 22:15  oetiker
+
+       * doc/rrdgraph_graph.pod: clarify LINE/AREA syntax -- Alex van den
+         Bogaerdt alex with ergens.op.het.net
+
+2005-05-05 09:07  oetiker
+
+       * src/rrd_create.c: better not to write into argv elements ...
+         Henrik Stoerner <henrik from hswn.dk>
+
+2005-05-03 20:23  oetiker
+
+       * src/rrd_tool.c: do not die upon wront input when in remote mode
+
+2005-05-03 18:10  oetiker
+
+       * doc/Makefile.am: install documentation into
+         $PREFIX/shared/doc/rrdtool-$VERSION/{txt,html} but drop the
+         rrdtool-$VERSION/ bit if $PREFIX matches on rrd assuming that the
+         tool is being installed into a custom directory anyway.
+
+2005-05-03 17:24  oetiker
+
+       * doc/rrdgraph.pod, src/rrd_gfx.c, src/rrd_gfx.h, src/rrd_graph.c:
+         new options to tune how fontsmoothing works: -R/--font-render-mode
+         {normal,light,mono} and -B/--font-smoothing-threshold size -- John
+         yffffffff4271ef37 at f4n.org
+
+2005-05-03 17:22  oetiker
+
+       * NT-BUILD-TIPS.txt: note about win32comp
+
+2005-05-02 20:27  oetiker
+
+       * confignt/config.h, src/win32comp.c: files that help getting that
+         native windows port going -- Philippe.Simonet with swisscom.com
+
+2005-05-02 19:47  oetiker
+
+       * src/rrd_gfx.c: when walking the bytes use the pitch not the width
+
+2005-05-02 19:33  oetiker
+
+       * src/strftime.c: pow is alreay used as a function ... so lets call
+         it power instead
+
+2005-05-02 19:32  oetiker
+
+       * src/rrd_graph_helper.c: no infinite line width please
+
+2005-05-01 22:07  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, rrdtool.spec, src/gdpng.c, src/gifsize.c,
+         src/pngsize.c, src/rrd.h, src/rrd_afm.c, src/rrd_afm.h,
+         src/rrd_afm_data.c, src/rrd_afm_data.h, src/rrd_cgi.c,
+         src/rrd_create.c, src/rrd_datalang.c, src/rrd_diff.c,
+         src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_not_thread_safe.c, src/rrd_open.c,
+         src/rrd_resize.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_rpncalc.h, src/rrd_stat.c, src/rrd_thread_safe.c,
+         src/rrd_thread_safe_nt.c, src/rrd_tool.c, src/rrd_tool.h,
+         src/rrd_tune.c, src/rrd_update.c, src/rrd_xport.c,
+         src/rrd_xport.h: prep for 1.2.1 release
+
+2005-05-01 22:04  oetiker
+
+       * src/rrd_graph.c: add some more vertical space above the graph if
+         no title is available
+
+2005-05-01 21:24  oetiker
+
+       * src/rrd_gfx.c: use the pen to determine string length, do not look
+         at the realy length, or space will get ignored.
+
+2005-05-01 21:16  oetiker
+
+       * src/DejaVuSansMono-Roman.ttf, src/Makefile.am, src/rrd_graph.c:
+         DejaVuSansMono-Roman is a variant of VeraMono with lots of added
+         unicode glyphes ... check out http://dejavu.sourceforge.net
+
+2005-05-01 20:49  oetiker
+
+       * src/rrd_graph.c: fix spaceing ... more space for the title and
+         more space the the left of the yaxis lable
+
+2005-05-01 13:19  oetiker
+
+       * src/rrd_gfx.c: the multibyte support tried did not work ...
+         takeing it out again
+
+2005-05-01 13:18  oetiker
+
+       * configure.ac: update tested library version
+
+2005-05-01 11:02  oetiker
+
+       * src/pngsize.c: undef jmpbuf to make compile work on AIX 5.1
+
+2005-05-01 11:00  oetiker
+
+       * src/Makefile.am: increasse revision of shared library number since
+         the library source code has changed
+
+2005-05-01 11:00  oetiker
+
+       * src/rrd_gfx.c: add wide character support
+
+2005-05-01 10:42  oetiker
+
+       * src/rrd_graph.c: do not make the graph wider if the title does not
+         fit ... this is wagging the dog the graph is not ABOUT the title
+
+2005-05-01 10:37  oetiker
+
+       * doc/rrdgraph_graph.pod: fix description of VRULE
+
+2005-05-01 10:23  oetiker
+
+       * bindings/perl-shared/RRDs.xs, src/rrd_cgi.c, src/rrd_create.c,
+         src/rrd_fetch.c, src/rrd_first.c, src/rrd_graph.c,
+         src/rrd_restore.c, src/rrd_tool.c, src/rrd_tune.c,
+         src/rrd_update.c, src/rrd_xport.c: reset optind opterr inside the
+         function calls ...
+
+2005-05-01 10:22  oetiker
+
+       * doc/rrdgraph_graph.pod: fixed documentation regarding floating
+         point line width
+
+2005-05-01 10:20  oetiker
+
+       * src/rrd_graph_helper.c: relax parsing of LINE commands LINE: is
+         valid as well as LINE<double>: eg. LINE1.2323:
+
+2005-05-01 09:16  oetiker
+
+       * src/rrd_gfx.c: allow for characters over 127
+
+2005-04-30 09:56  oetiker
+
+       * doc/rrdgraph_graph.pod: added notes on escaping colons in COMMENT
+         and put deprecated forms of command to the back and not to the
+         front
+
+2005-04-30 09:51  oetiker
+
+       * src/rrd_open.c, src/rrd_update.c: always open with rb/wb when it
+         is a binary file ... unix and windows will work alike with this
+         ...
+
+2005-04-30 09:48  oetiker
+
+       * src/rrdupdate.c: this file is not required ...
+
+2005-04-30 09:41  oetiker
+
+       * src/rrd_open.c: even better lets have rb for CYGWIN too ... one
+         never knows it is windows after all.
+
+2005-04-30 09:40  oetiker
+
+       * src/rrd_open.c: oops inverted code here ... windows needs rb unix
+         not
+
+2005-04-30 09:38  oetiker
+
+       * confignt/config.h, src/rrd_graph.c: let rrd_graph honor the font
+         name (RRD_DEFAULT_FONT) defined in confignt/config.h
+
+2005-04-26 22:08  oetiker
+
+       * doc/rrdtool.pod: use pod syntax not html syntax in pod :-)
+
+2005-04-26 22:04  oetiker
+
+       * doc/cdeftutorial.pod, doc/rrd-beginners.pod, doc/rrdcreate.pod,
+         doc/rrdgraph.pod: more fixes by fritz
+
+2005-04-26 05:33  oetiker
+
+       * CONTRIBUTORS: obfuscate email addresses
+
+2005-04-26 05:30  oetiker
+
+       * doc/rrdtool.pod: * remove jakes old address * add security warning
+
+2005-04-25 22:55  oetiker
+
+       * doc/rpntutorial.pod: remove pdf link
+
+2005-04-25 22:18  oetiker
+
+       * src/parsetime.c: use time_t to improve portability to 64bit
+         systems -- John R Mocho <jmocho in royaldc.com>
+
+2005-04-25 21:01  oetiker
+
+       * NEWS: added new state
+
+2005-04-25 20:45  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, doc/rrdgraph_graph.pod, rrdtool.spec, src/gdpng.c,
+         src/gifsize.c, src/pngsize.c, src/rrd.h, src/rrd_afm.c,
+         src/rrd_afm.h, src/rrd_afm_data.c, src/rrd_afm_data.h,
+         src/rrd_cgi.c, src/rrd_create.c, src/rrd_datalang.c,
+         src/rrd_diff.c, src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c,
+         src/rrd_first.c, src/rrd_format.c, src/rrd_format.h,
+         src/rrd_gfx.c, src/rrd_gfx.h, src/rrd_graph.c,
+         src/rrd_graph_helper.c, src/rrd_hw.c, src/rrd_hw.h,
+         src/rrd_info.c, src/rrd_is_thread_safe.h, src/rrd_last.c,
+         src/rrd_not_thread_safe.c, src/rrd_open.c, src/rrd_resize.c,
+         src/rrd_restore.c, src/rrd_rpncalc.c, src/rrd_rpncalc.h,
+         src/rrd_stat.c, src/rrd_thread_safe.c, src/rrd_thread_safe_nt.c,
+         src/rrd_tool.c, src/rrd_tool.h, src/rrd_tune.c, src/rrd_update.c,
+         src/rrd_xport.c, src/rrd_xport.h, src/rrdupdate.c: prep for 1.2.0
+         release
+
+2005-04-25 19:07  oetiker
+
+       * doc/rpntutorial.pod, doc/rrdcgi.pod, doc/rrdfetch.pod,
+         doc/rrdgraph_data.pod, doc/rrdgraph_examples.pod,
+         doc/rrdgraph_graph.pod, doc/rrdgraph_rpn.pod, doc/rrdtutorial.pod:
+         resolved all XXX situations
+
+2005-04-25 17:31  oetiker
+
+       * doc/bin_dec_hex.pod, doc/rpntutorial.pod, doc/rrdcgi.pod,
+         doc/rrdfetch.pod, doc/rrdgraph_data.pod,
+         doc/rrdgraph_examples.pod, doc/rrdgraph_graph.pod,
+         doc/rrdgraph_rpn.pod, doc/rrdtool.pod, doc/rrdtune.pod,
+         doc/rrdtutorial.pod, doc/rrdupdate.pod, doc/rrdxport.pod: another
+         batch of fixes from fritz
+
+2005-04-24 22:21  oetiker
+
+       * CONTRIBUTORS: fixed contributiors listing
+
+2005-04-24 17:23  oetiker
+
+       * doc/rrddump.pod, doc/rrdfirst.pod, doc/rrdinfo.pod,
+         doc/rrdlast.pod, doc/rrdresize.pod, doc/rrdrestore.pod,
+         doc/rrdthreads.pod, doc/rrdtool-xport.dtd, doc/rrdtutorial.pod:
+         big patch-up for the 1.2. Documents Revisited by Fritz Zaucker
+
+2005-04-22 18:35  oetiker
+
+       * NEWS, bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, rrdtool.spec, src/Makefile.am, src/gdpng.c,
+         src/gifsize.c, src/pngsize.c, src/rrd.h, src/rrd_afm.c,
+         src/rrd_afm.h, src/rrd_afm_data.c, src/rrd_afm_data.h,
+         src/rrd_cgi.c, src/rrd_create.c, src/rrd_datalang.c,
+         src/rrd_diff.c, src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c,
+         src/rrd_first.c, src/rrd_format.c, src/rrd_format.h,
+         src/rrd_gfx.c, src/rrd_gfx.h, src/rrd_graph.c,
+         src/rrd_graph_helper.c, src/rrd_hw.c, src/rrd_hw.h,
+         src/rrd_info.c, src/rrd_is_thread_safe.h, src/rrd_last.c,
+         src/rrd_not_thread_safe.c, src/rrd_open.c, src/rrd_resize.c,
+         src/rrd_restore.c, src/rrd_rpncalc.c, src/rrd_rpncalc.h,
+         src/rrd_stat.c, src/rrd_thread_safe.c, src/rrd_thread_safe_nt.c,
+         src/rrd_tool.c, src/rrd_tool.h, src/rrd_tune.c, src/rrd_update.c,
+         src/rrd_xport.c, src/rrd_xport.h, src/rrdupdate.c: prep for 1.2rc9
+         release
+
+2005-04-19 21:09  oetiker
+
+       * doc/rrddump.pod, doc/rrdgraph.pod, doc/rrdgraph_data.pod,
+         doc/rrdgraph_graph.pod, doc/rrdinfo.pod, doc/rrdresize.pod: fix
+         titles
+
+2005-04-19 21:05  oetiker
+
+       * doc/bin_dec_hex.pod: fixed title
+
+2005-04-18 22:39  oetiker
+
+       * doc/Makefile.am, doc/cdeftutorial.pod, doc/rrd-beginners.pod,
+         doc/rrdgraph.pod, doc/rrdgraph.src, doc/rrdgraph_data.pod,
+         doc/rrdgraph_data.src, doc/rrdgraph_examples.pod,
+         doc/rrdgraph_examples.src, doc/rrdgraph_graph.pod,
+         doc/rrdgraph_graph.src, doc/rrdgraph_rpn.pod,
+         doc/rrdgraph_rpn.src, doc/rrdinfo.pod, doc/rrdlast.pod,
+         doc/rrdresize.pod, doc/rrdrestore.pod, doc/rrdtune.pod,
+         doc/rrdtutorial.pod, doc/rrdupdate.pod, doc/rrdxport.pod: src
+         moved back to pod. this include thing was a neat idea but it just
+         adds another twist to things which is not necessary. fixed some
+         pod errors
+
+2005-04-18 22:13  oetiker
+
+       * doc/rrdcgi.pod, doc/rrdcreate.pod, doc/rrddump.pod,
+         doc/rrdfetch.pod, doc/rrdfirst.pod, doc/rrdgraph.src,
+         doc/rrdgraph_data.src, doc/rrdgraph_examples.src,
+         doc/rrdgraph_graph.src, doc/rrdgraph_rpn.src, doc/rrdtool.pod:
+         misc fixes for better display
+
+2005-04-18 11:07  oetiker
+
+       * doc/rrdgraph_graph.src, branches/1.2/website,
+         branches/1.2/website/bin, branches/1.2/website/doc,
+         branches/1.2/website/tut: fixed format
+
+2005-04-17 22:43  oetiker
+
+       * doc/bin_dec_hex.pod, doc/rrd-beginners.pod, doc/rrdcgi.pod,
+         doc/rrdcreate.pod, doc/rrddump.pod, doc/rrdfetch.pod,
+         doc/rrdfirst.pod, doc/rrdgraph.src, doc/rrdgraph_data.src,
+         doc/rrdgraph_examples.src, doc/rrdgraph_graph.src,
+         doc/rrdgraph_rpn.src, doc/rrdinfo.pod, doc/rrdlast.pod,
+         doc/rrdresize.pod, doc/rrdrestore.pod, doc/rrdthreads.pod,
+         doc/rrdtune.pod, doc/rrdupdate.pod, doc/rrdxport.pod: fixed many
+         pod bugs while creating the new website
+
+2005-04-17 17:29  oetiker
+
+       * doc/rrdgraph.src: make sure argument descriptions comply with Bold
+         = fixed and Italics = variable
+
+2005-04-17 16:26  oetiker
+
+       * doc/rrdcreate.pod: fix use of =item commands
+
+2005-04-17 16:25  oetiker
+
+       * doc/Makefile.am: allow to build pods (for website)
+
+2005-04-13 22:00  oetiker
+
+       * src/rrd_graph.c: * draw the axis last to have them always on top *
+         use a smaller font for labeling the axis
+
+2005-04-13 19:53  oetiker
+
+       * src/rrd_gfx.c: have better default compression
+
+2005-04-13 19:53  oetiker
+
+       * src/rrd_graph.c: tune fontsizes and spacing to be more in line
+         with rrdtool 1.0
+
+2005-04-12 21:52  oetiker
+
+       * src/rrd_graph.c: prep for 1.2rc8 release
+
+2005-04-12 21:10  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, rrdtool.spec, src/gdpng.c, src/gifsize.c,
+         src/pngsize.c, src/rrd.h, src/rrd_afm.c, src/rrd_afm.h,
+         src/rrd_afm_data.c, src/rrd_afm_data.h, src/rrd_cgi.c,
+         src/rrd_create.c, src/rrd_datalang.c, src/rrd_diff.c,
+         src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_not_thread_safe.c, src/rrd_open.c,
+         src/rrd_resize.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_rpncalc.h, src/rrd_stat.c, src/rrd_thread_safe.c,
+         src/rrd_thread_safe_nt.c, src/rrd_tool.c, src/rrd_tool.h,
+         src/rrd_tune.c, src/rrd_update.c, src/rrd_xport.c,
+         src/rrd_xport.h, src/rrdupdate.c: prep for 1.2rc8 release
+
+2005-04-12 20:56  oetiker
+
+       * src/rrd_graph.c, src/rrd_graph.h: * better fix for units-exponent
+         issue ... now the whole scaling happens only at print time ...
+         this is more stable -- tobi * remove the newline from ctime (%c)
+         in VDEF -- alex
+
+2005-04-11 23:23  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, rrdtool.spec, src/gdpng.c, src/gifsize.c,
+         src/pngsize.c, src/rrd.h, src/rrd_afm.c, src/rrd_afm.h,
+         src/rrd_afm_data.c, src/rrd_afm_data.h, src/rrd_cgi.c,
+         src/rrd_create.c, src/rrd_datalang.c, src/rrd_diff.c,
+         src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_not_thread_safe.c, src/rrd_open.c,
+         src/rrd_resize.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_rpncalc.h, src/rrd_stat.c, src/rrd_thread_safe.c,
+         src/rrd_thread_safe_nt.c, src/rrd_tool.c, src/rrd_tool.h,
+         src/rrd_tune.c, src/rrd_update.c, src/rrd_xport.c,
+         src/rrd_xport.h, src/rrdupdate.c: prep for 1.2rc7 release
+
+2005-04-11 23:22  oetiker
+
+       * doc/rrdgraph.src, src/rrd_graph.c, src/rrd_graph.h,
+         src/rrd_tool.c: * adjusted element spacing within the graph *
+         re-intruduced --units-length option * stabilized --units-exponent
+         option by jumping to alt-y-grid mode once the default autogrid can
+         not cope with the data anymore.
+
+2005-04-11 23:20  oetiker
+
+       * NEWS: added note about incompatible changes
+
+2005-04-11 12:29  oetiker
+
+       * NEWS: started change log
+
+2005-04-11 12:17  oetiker
+
+       * doc/rrdgraph_rpn.src: added notes on INF
+
+2005-04-11 09:51  oetiker
+
+       * src/Makefile.am, src/art_rgb_affine_private.h,
+         src/art_rgba_rgba_affine.c, src/art_rgba_rgba_affine.h,
+         src/art_rgba_svp.c, src/art_rgba_svp.h, src/rrd_gfx.c,
+         src/rrd_gfx.h, src/rrd_graph.c: * we are now creating true RGBA
+         pngs * removed all memory leeks from rrd_gfx
+
+2005-04-10 22:02  oetiker
+
+       * NEWS: started updating for 1.2 release
+
+2005-04-10 18:11  oetiker
+
+       * doc/rrdresize.pod: clarified output -- alex
+
+2005-04-10 18:10  oetiker
+
+       * doc/name.inc, doc/rrdgraph.src, doc/rrdgraph_data.src,
+         doc/rrdgraph_examples.src, doc/rrdgraph_graph.src,
+         doc/rrdgraph_rpn.src: get the docs ready for the 1.2 release.
+         remove notes about things that never got implemented. -- alex
+
+2005-04-10 18:05  oetiker
+
+       * src/rrd_graph.c: do not draw AREAS that have no hight (done
+         right). draw an arrow on the positiv y axis.
+
+2005-04-10 15:35  oetiker
+
+       * doc/rrdtutorial.pod: updated for 1.2 release -- alex
+
+2005-04-10 14:00  oetiker
+
+       * src/rrd_gfx.c: fixed typo -- alex
+
+2005-04-10 13:57  oetiker
+
+       * doc/rrdcgi.pod: G<gt> does not exist E<gt> does
+
+2005-04-10 12:12  oetiker
+
+       * doc/rrdcreate.pod, doc/rrdxport.pod, src/rrd_graph_helper.c,
+         src/rrd_tool.c: fixed spelling and working -- Alex van den
+         Bogaerdt alex at ergens.op.het.net
+
+2005-04-10 11:53  oetiker
+
+       * NT-BUILD-TIPS.txt, confignt/config.h, src/strftime.c,
+         src/strftime.h: added extra strftime.[ch] which supports ISO 8601
+         week numbers, together with instructions in the NT-BUILD-TIPPS
+         file
+
+2005-04-10 11:33  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, rrdtool.spec, src/gdpng.c, src/gifsize.c,
+         src/pngsize.c, src/rrd.h, src/rrd_afm.c, src/rrd_afm.h,
+         src/rrd_afm_data.c, src/rrd_afm_data.h, src/rrd_cgi.c,
+         src/rrd_create.c, src/rrd_datalang.c, src/rrd_diff.c,
+         src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_not_thread_safe.c, src/rrd_open.c,
+         src/rrd_resize.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_rpncalc.h, src/rrd_stat.c, src/rrd_thread_safe.c,
+         src/rrd_thread_safe_nt.c, src/rrd_tool.c, src/rrd_tool.h,
+         src/rrd_tune.c, src/rrd_update.c, src/rrd_xport.c,
+         src/rrd_xport.h, src/rrdupdate.c: prep for 1.2rc6 release
+
+2005-04-10 11:31  oetiker
+
+       * src/rrd_graph.c: remove excess comment
+
+2005-04-10 11:30  oetiker
+
+       * configure.ac, src/Makefile.am: make --disable-perl work allow
+         configuration of the default font at configure time
+
+2005-04-10 11:29  oetiker
+
+       * src/rrd_gfx.c, src/rrd_graph.c, src/rrd_graph_helper.c: revamped
+         drawing routines to be less complex and more stable. be kind to
+         libart
+
+2005-04-10 09:38  oetiker
+
+       * src/rrd_graph.c: allow --color arguments with RRGGBB and not only
+         RRGGBBAA
+
+2005-04-10 09:16  oetiker
+
+       * bindings/perl-shared/Makefile.PL: everyone has other names for
+         their shared libraries, so lets drop the dependency
+
+2005-04-10 09:15  oetiker
+
+       * bindings/perl-shared/RRDs.pm: mention updatev in the synopsis
+
+2005-04-09 14:21  oetiker
+
+       * TODO: we do have 95%
+
+2005-04-07 21:35  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, rrdtool.spec, src/gdpng.c, src/gifsize.c,
+         src/pngsize.c, src/rrd.h, src/rrd_afm.c, src/rrd_afm.h,
+         src/rrd_afm_data.c, src/rrd_afm_data.h, src/rrd_cgi.c,
+         src/rrd_create.c, src/rrd_datalang.c, src/rrd_diff.c,
+         src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_not_thread_safe.c, src/rrd_open.c,
+         src/rrd_resize.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_rpncalc.h, src/rrd_stat.c, src/rrd_thread_safe.c,
+         src/rrd_thread_safe_nt.c, src/rrd_tool.c, src/rrd_tool.h,
+         src/rrd_tune.c, src/rrd_update.c, src/rrd_xport.c,
+         src/rrd_xport.h, src/rrdupdate.c: prep for 1.2rc5 release
+
+2005-04-07 21:31  oetiker
+
+       * src/rrd_graph.c: fix implementation of --only-graph
+
+2005-04-07 21:31  oetiker
+
+       * src/rrd_gfx.c: make libart happy by NOT adjusting coordinates and
+         by using the ART_WIND_RULE_NONZERO winding rule
+
+2005-04-07 21:30  oetiker
+
+       * src/rrd_tool.c: return propper exit codes
+
+2005-04-07 20:07  oetiker
+
+       * src/rrd_graph.h: fix bitpatterns of extraflags so that they do not
+         interfear
+
+2005-04-06 23:58  oetiker
+
+       * bindings/Makefile.am: prep for 1.2rc4 release
+
+2005-04-06 23:24  oetiker
+
+       * Makefile.am, bindings/Makefile.am, bindings/perl-piped/RRDp.pm,
+         bindings/perl-shared/Makefile.PL, bindings/perl-shared/RRDs.pm,
+         configure.ac, rrdtool.spec, src/gdpng.c, src/gifsize.c,
+         src/pngsize.c, src/rrd.h, src/rrd_afm.c, src/rrd_afm.h,
+         src/rrd_afm_data.c, src/rrd_afm_data.h, src/rrd_cgi.c,
+         src/rrd_create.c, src/rrd_datalang.c, src/rrd_diff.c,
+         src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_not_thread_safe.c, src/rrd_open.c,
+         src/rrd_resize.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_rpncalc.h, src/rrd_stat.c, src/rrd_thread_safe.c,
+         src/rrd_thread_safe_nt.c, src/rrd_tool.c, src/rrd_tool.h,
+         src/rrd_tune.c, src/rrd_update.c, src/rrd_xport.c,
+         src/rrd_xport.h, src/rrdupdate.c: prep for 1.2rc4 release
+
+2005-04-06 23:18  oetiker
+
+       * doc/rrdgraph.src: document RRD_DEFAULT_FONT environment variable
+
+2005-04-06 22:40  oetiker
+
+       * src/rrd_afm.c, src/rrd_cgi.c, src/rrd_graph.c, src/rrd_nan_inf.c,
+         src/rrd_open.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_tool.c, src/rrd_tool.h, src/rrd_update.c, src/rrd_xport.c,
+         src/rrdupdate.c: make sure WIN32 sections do NOT kick in for
+         cygwin compiles
+
+2005-04-05 22:49  oetiker
+
+       * src/rrd_gfx.c: only unwind the areas, the lines should be fine by
+         themselves!
+
+2005-04-05 20:32  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, rrdtool.spec, src/gdpng.c, src/gifsize.c,
+         src/pngsize.c, src/rrd.h, src/rrd_afm.c, src/rrd_afm.h,
+         src/rrd_afm_data.c, src/rrd_afm_data.h, src/rrd_cgi.c,
+         src/rrd_create.c, src/rrd_datalang.c, src/rrd_diff.c,
+         src/rrd_dump.c, src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_not_thread_safe.c, src/rrd_open.c,
+         src/rrd_resize.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_rpncalc.h, src/rrd_stat.c, src/rrd_thread_safe.c,
+         src/rrd_thread_safe_nt.c, src/rrd_tool.c, src/rrd_tool.h,
+         src/rrd_tune.c, src/rrd_update.c, src/rrd_xport.c,
+         src/rrd_xport.h, src/rrdupdate.c: prep for 1.2rc3 release
+
+2005-04-05 20:17  oetiker
+
+       * src/rrd_gfx.c, src/rrd_graph.c: * fix transparency rendering by
+         rewinding the paths propperly * fix x-axis label drawing by
+         considering label precision
+
+2005-04-05 19:14  oetiker
+
+       * src/VeraMono.ttf: new originaly copy
+
+2005-04-05 19:12  oetiker
+
+       * src/VeraMono.ttf: fixed propperties to have a RAW font
+
+2005-04-04 21:56  oetiker
+
+       * configure.ac: make configure work even when no prefix is specified
+
+2005-04-04 21:40  oetiker
+
+       * src/gdpng.c, src/gifsize.c, src/pngsize.c, src/rrd.h,
+         src/rrd_afm.c, src/rrd_afm.h, src/rrd_afm_data.c,
+         src/rrd_afm_data.h, src/rrd_cgi.c, src/rrd_create.c,
+         src/rrd_datalang.c, src/rrd_diff.c, src/rrd_dump.c,
+         src/rrd_error.c, src/rrd_fetch.c, src/rrd_first.c,
+         src/rrd_format.c, src/rrd_format.h, src/rrd_gfx.c, src/rrd_gfx.h,
+         src/rrd_graph.c, src/rrd_graph_helper.c, src/rrd_hw.c,
+         src/rrd_hw.h, src/rrd_info.c, src/rrd_is_thread_safe.h,
+         src/rrd_last.c, src/rrd_not_thread_safe.c, src/rrd_open.c,
+         src/rrd_resize.c, src/rrd_restore.c, src/rrd_rpncalc.c,
+         src/rrd_rpncalc.h, src/rrd_stat.c, src/rrd_thread_safe.c,
+         src/rrd_thread_safe_nt.c, src/rrd_tool.c, src/rrd_tool.h,
+         src/rrd_tune.c, src/rrd_update.c, src/rrd_xport.c,
+         src/rrd_xport.h, src/rrdupdate.c: prep for 1.2rc2 release
+
+2005-04-04 21:22  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm,
+         configure.ac, rrdtool.spec: prepared for 1.2rc2 release
+
+2005-04-04 21:21  oetiker
+
+       * configure.ac: prepared for 1.2rc1 release
+
+2005-04-04 21:12  oetiker
+
+       * acinclude.m4, configure.ac: prepared for 1.2rc1 release
+
+2005-04-04 21:07  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm:
+         prepared for 1.2rc1 release
+
+2005-04-04 21:05  oetiker
+
+       * bindings/perl-piped/RRDp.pm, bindings/perl-shared/RRDs.pm:
+         prepared for 1.2rc1 release
+
+2005-04-04 20:56  oetiker
+
+       * configure.ac: fixed prefix detection code again
+
+2005-04-04 20:53  oetiker
+
+       * configure.ac: fixed autoprefix
+
+2005-04-04 20:48  oetiker
+
+       * configure.ac: fixed config script for prefixing
+
+2005-04-04 20:37  oetiker
+
+       * 00README, COPYRIGHT, NEWS, PROJECTS, README, TODO, acinclude.m4,
+         configure.ac, rrdtool.spec: get ready for 1.2
+
+2005-04-04 19:55  oetiker
+
+       * branches/1.2: branche for 1.2
+
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
new file mode 100644 (file)
index 0000000..aaf7718
--- /dev/null
@@ -0,0 +1,74 @@
+I would like to thank to following people for helping to
+bring RRDtool into existence.
+
+Alan Lichty <alan_lichty with eli.net> 
+Alan Milligan <alan.milligan@last-bastion.net> Python bindings
+Alex van den Bogaerdt <alex with ergens.op.het.net> (rrd_resize.c and more)
+Amos Shapira <amos with gezernet.co.il>
+Andreas Kroomaa <andre with ml.ee>
+Andrew Turner <turner with mint.net> (LAST consolidator)
+Bernard Fischer <bfischer with syslog.ch> 64bit stuff and --alt-autoscale-max
+Bill Fenner <fenner with research.att.com>
+Blair Zajac <bzajac with geostaff.com>
+Bruce Campbell <bruce.campbell with apnic.net>
+Chin-A-Young <china with thewrittenword.com>
+Christophe VG <Christophe.VanGinneken with ubizen.com>
+Christophe Van Ginneken <Christophe.VanGinneken with ubizen.com> (--no-legend)
+Dan Dunn <dandunn with computer.org>
+Dave Bodenstab <dave@bodenstab.org> AT style time in update, tclfixes
+David Grimes <dgrimes with navisite.com> SQRT/SORT/REV/SHIFT/TREND
+David L. Barker <dave with ncomtech.com> xport function bug fixes
+Frank Strauss <strauss with escape.de> TCL bindings
+Henrik Storner <henrik with hswn.dk> functions for min/max values of data in graph
+Hermann Hueni <hueni with glue.ch> (SunOS porting)
+Jakob Ilves <jilves with se.oracle.com> HPUX 11
+Jeff R. Allen <jeff.allen with acm.org> (autoconfigure, portability)  
+Jeremy Fischer <jeremy with pobox.com> (Makefile changes & RPM builds)
+Jesús Couto Fandiño
+Joel Becker <jlbec with raleigh.ibm.com> AIX
+Joey Miller <joeym with inficad.com>php3 and php4 bindings
+Jost.Krieger <Jost.Krieger with ruhr-uni-bochum.de>
+Kai Siering <kai.siering with mediaways.net>
+Larry Leszczynski <larryl with furph.com>
+McCreary mccreary with xoanon.colorado.edu
+Mike Mitchell <mcm with unx.sas.com>
+Mike Slifcak <slif with bellsouth.net> many rrdtool-1.1.x fixes
+Oleg Cherevko <olwi with icyb.kiev.ua>
+Otmar Lendl <O.Lendl with Austria.EU.net> (lots of bugfixes)
+Paul Joslin <Paul.Joslin with sdrc.com>
+Peter Speck <speck with vitality.dk> eps/svg/pdf file format code in rrdtool-1.x
+Peter Stamfest <peter with stamfest.at> initial multi-thread support
+Peter Breitenlohner <peb with mppmu.mpg.de>  many patches for rrdtool 1.2.x
+Philippe.Simonet <Philippe.Simonet with swisscom.com> (NT porting)
+Poul-Henning Kamp <phk with freebsd.org> CDEF enhancements
+REIBENSCHUH Alfred <alfred.reibenschuh with it-austria.com> AIX
+Radoslaw Karas <rkaras with tyndall.ie>
+Rainer Bawidamann <Rainer.Bawidamann with informatik.uni-ulm.de>
+Roman Hoogant <rhoogant with ee.ethz.ch>
+Ronan Mullally <ronan in 4L.ie>
+Roger J. Meier <roger.meier in terreactive.ch> (arbitrary linelength in rrdtool)
+Russ Wright <rwwright with home.com>
+Sean Summers <sean with Fenstermaker.com> (RPM .spec)
+Selena M Brewington <smbrewin with ichips.intel.com> add_ds
+Shane O'Donnell <shaneo with opennms.org>
+Simon Leinen <simon with switch.ch>
+Steen Linden <Steen.Linden with ebone.net>
+Stefan Mueller <s.mueller with computer.org> HPUX 11
+Steve Harris <steveh with wesley.com.au> AIX portability
+Steve Rader <rader with teak.wiscnet.net> (rrd_cgi debugging and LAST)
+Terminator rAT <karl_schilke with eli.net>
+Tobias Weingartner <weingart with cs.ualberta.ca>
+Tom Crawley <Tom.Crawley with hi.riotinto.com.au> (GCC&HP configuration)
+Travis Brown <tebrown with csh.rit.edu> 
+Tuc <ttsg with ttsg.com>
+Ulf Lilleengen <lulf with pvv.ntnu.no> Python binding for 'rrdtool first'
+Ulrich Schilling <schilling with netz.uni-essen.de> AIX
+Wim Heirman <wim.heirman elis.ugent.be> --units=si option
+Wolfgang Schrimm <wschrimm with uni-hd.de> xport function
+Wrolf Courtney <wrolf with wrolf.net> (HP-UX)
+hendrik visage <hvisage with is.co.za>
+Philippe Simonet <philippe.simonet with swisscom.ch> (Windows Binaries)
+Alexander Lucke (lucke with dns-net.de) 
+ of DNS:NET Internet Services (www.dns-net.de) http://rrdtool.org
+Hedley Simons <heds@metahusky.net>
+Nicola Worthington <nicolaw@cpan.org>
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..37c6105
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,280 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for non-commercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
diff --git a/COPYRIGHT b/COPYRIGHT
new file mode 100644 (file)
index 0000000..ab5c695
--- /dev/null
+++ b/COPYRIGHT
@@ -0,0 +1,90 @@
+ RRDTOOL - Round Robin Database Tool
+ A tool for fast logging of numerical data graphical display
+ of this data.
+
+ Copyright (c) 1998-2006 Tobias Oetiker
+ All rights reserved.
+ GNU GPL License
+ ===============
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
+
+ FLOSS License Exception 
+ =======================
+ (Adapted from http://www.mysql.com/company/legal/licensing/foss-exception.html)
+
+ I want specified Free/Libre and Open Source Software ("FLOSS")
+ applications to be able to use specified GPL-licensed RRDtool
+ libraries (the "Program") despite the fact that not all FLOSS licenses are
+ compatible with version 2 of the GNU General Public License (the "GPL").
+ As a special exception to the terms and conditions of version 2.0 of the GPL:
+
+ You are free to distribute a Derivative Work that is formed entirely from
+ the Program and one or more works (each, a "FLOSS Work") licensed under one
+ or more of the licenses listed below, as long as:
+
+   1. You obey the GPL in all respects for the Program and the Derivative
+   Work, except for identifiable sections of the Derivative Work which are
+   not derived from the Program, and which can reasonably be considered
+   independent and separate works in themselves,
+
+   2. all identifiable sections of the Derivative Work which are not derived
+   from the Program, and which can reasonably be considered independent and
+   separate works in themselves,
+
+         1. are distributed subject to one of the FLOSS licenses listed
+         below, and
+
+         2. the object code or executable form of those sections are
+         accompanied by the complete corresponding machine-readable source
+         code for those sections on the same medium and under the same FLOSS
+         license as the corresponding object code or executable forms of
+         those sections, and
+
+   3. any works which are aggregated with the Program or with a Derivative
+   Work on a volume of a storage or distribution medium in accordance with
+   the GPL, can reasonably be considered independent and separate works in
+   themselves which are not derivatives of either the Program, a Derivative
+   Work or a FLOSS Work.
+
+ If the above conditions are not met, then the Program may only be copied,
+ modified, distributed or used under the terms and conditions of the GPL.
+
+ FLOSS License List
+ ==================
+ License name  Version(s)/Copyright Date
+ Academic Free License         2.0
+ Apache Software License       1.0/1.1/2.0
+ Apple Public Source License   2.0
+ Artistic license              From Perl 5.8.0
+ BSD license                   "July 22 1999"
+ Common Public License         1.0
+ GNU Library or "Lesser" General Public License (LGPL) 2.0/2.1
+ IBM Public License, Version    1.0
+ Jabber Open Source License    1.0
+ MIT License (As listed in file MIT-License.txt)       -
+ Mozilla Public License (MPL)  1.0/1.1
+ Open Software License         2.0
+ OpenSSL license (with original SSLeay license)        "2003" ("1998")
+ PHP License                   3.0
+ Python license (CNRI Python License)  -
+ Python Software Foundation License    2.1.1
+ Sleepycat License             "1999"
+ W3C License                   "2001"
+ X11 License                   "2001"
+ Zlib/libpng License           -
+ Zope Public License           2.0
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..4bbab3e
--- /dev/null
@@ -0,0 +1,50 @@
+## Process this file with automake to produce Makefile.in
+RSYNC = rsync --rsh=ssh
+
+# build the following subdirectories
+SUBDIRS = src doc examples bindings
+
+  # the following files are not mentioned in any other Makefile
+EXTRA_DIST = COPYRIGHT CHANGES WIN32-BUILD-TIPS.txt TODO CONTRIBUTORS THREADS \
+            rrdtool.spec favicon.ico win32/config.h win32/rrd.dsp win32/rrd.vcproj \
+            win32/rrdtool.dsp win32/rrdtool.dsw win32/rrdtool.vcproj win32/Makefile \
+            win32/rrd_config.h.msvc netware/Makefile
+
+            
+
+CLEANFILES = config.cache
+
+# use relaxed rules when building dists
+AUTOMAKE_OPTIONS= foreign 
+
+# where we keep local rules for automake
+
+ACLOCAL_M4= $(top_srcdir)/aclocal.m4
+#AUTOHEADER = @AUTOHEADER@ --localdir=$(top_srcdir)/config
+#AUTOCONF = @AUTOCONF@ --localdir=$(top_srcdir)/config
+
+to-docs: to-versync
+       (cd doc && $(MAKE) clean && $(MAKE) && $(MAKE) pdf)
+
+to-dist: to-docs dist
+       mv $(PACKAGE)-$(VERSION).tar.gz archive
+
+to-scp: to-dist
+       cp CHANGES  archive/$(PACKAGE)-$(VERSION).tar.gz /home/oetiker/public_html/webtools/rrdtool/pub/
+       (cd /home/oetiker/public_html/webtools/rrdtool/pub; rm $(PACKAGE).tar.gz; ln -s $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE).tar.gz)
+
+#      $(RSYNC) CHANGES archive/$(PACKAGE)-$(VERSION).tar.gz tobi@ipn.caida.org:/ipn/web/Tools/RRDtool/pub/
+
+site-perl-inst: site-perl-install
+
+site-perl-install: all bindings/perl-piped/Makefile bindings/perl-shared/Makefile
+       cd bindings/perl-piped && $(MAKE) install
+       cd bindings/perl-shared && $(MAKE) install
+
+site-tcl-install: all
+       cd bindings/tcl && $(MAKE) tcl-install
+
+site-python-install: all
+       cd bindings/python && $(PYTHON) setup.py install
+
+##END##
diff --git a/Makefile.in b/Makefile.in
new file mode 100644 (file)
index 0000000..0fd1890
--- /dev/null
@@ -0,0 +1,718 @@
+# Makefile.in generated by automake 1.9.6 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@
+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 = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in $(srcdir)/rrd_config.h.in \
+       $(top_srcdir)/configure COPYING NEWS TODO compile config.guess \
+       config.sub depcomp install-sh ltmain.sh missing
+subdir = .
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+       $(top_srcdir)/configure.ac
+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 = $(install_sh) -d
+CONFIG_HEADER = rrd_config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+       html-recursive info-recursive install-data-recursive \
+       install-exec-recursive install-info-recursive \
+       install-recursive installcheck-recursive installdirs-recursive \
+       pdf-recursive ps-recursive uninstall-info-recursive \
+       uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+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@
+ALL_LIBS = @ALL_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_MULTITHREAD_FALSE = @BUILD_MULTITHREAD_FALSE@
+BUILD_MULTITHREAD_TRUE = @BUILD_MULTITHREAD_TRUE@
+BUILD_RRDCGI_FALSE = @BUILD_RRDCGI_FALSE@
+BUILD_RRDCGI_TRUE = @BUILD_RRDCGI_TRUE@
+BUILD_TCL_FALSE = @BUILD_TCL_FALSE@
+BUILD_TCL_SITE_FALSE = @BUILD_TCL_SITE_FALSE@
+BUILD_TCL_SITE_TRUE = @BUILD_TCL_SITE_TRUE@
+BUILD_TCL_TRUE = @BUILD_TCL_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMP_PERL = @COMP_PERL@
+COMP_PYTHON = @COMP_PYTHON@
+COMP_RUBY = @COMP_RUBY@
+CORE_LIBS = @CORE_LIBS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MULTITHREAD_CFLAGS = @MULTITHREAD_CFLAGS@
+MULTITHREAD_LDFLAGS = @MULTITHREAD_LDFLAGS@
+NROFF = @NROFF@
+NUMVERS = @NUMVERS@
+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@
+PERL = @PERL@
+PERLCC = @PERLCC@
+PERLCCFLAGS = @PERLCCFLAGS@
+PERLFLAGS = @PERLFLAGS@
+PERLLD = @PERLLD@
+PERLLDFLAGS = @PERLLDFLAGS@
+PERL_CC = @PERL_CC@
+PERL_MAKE_OPTIONS = @PERL_MAKE_OPTIONS@
+PERL_VERSION = @PERL_VERSION@
+PKGCONFIG = @PKGCONFIG@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+RRDDOCDIR = @RRDDOCDIR@
+RRDGRAPH_YLEGEND_ANGLE = @RRDGRAPH_YLEGEND_ANGLE@
+RRD_DEFAULT_FONT = @RRD_DEFAULT_FONT@
+RUBY = @RUBY@
+RUBY_MAKE_OPTIONS = @RUBY_MAKE_OPTIONS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@
+TCL_PACKAGE_DIR = @TCL_PACKAGE_DIR@
+TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@
+TCL_PREFIX = @TCL_PREFIX@
+TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@
+TCL_SHLIB_LD = @TCL_SHLIB_LD@
+TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@
+TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
+TCL_VERSION = @TCL_VERSION@
+TROFF = @TROFF@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_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 = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+RSYNC = rsync --rsh=ssh
+
+# build the following subdirectories
+SUBDIRS = src doc examples bindings
+EXTRA_DIST = COPYRIGHT CHANGES WIN32-BUILD-TIPS.txt TODO CONTRIBUTORS THREADS \
+            rrdtool.spec favicon.ico win32/config.h win32/rrd.dsp win32/rrd.vcproj \
+            win32/rrdtool.dsp win32/rrdtool.dsw win32/rrdtool.vcproj win32/Makefile \
+            win32/rrd_config.h.msvc netware/Makefile
+
+CLEANFILES = config.cache
+
+# use relaxed rules when building dists
+AUTOMAKE_OPTIONS = foreign 
+
+# where we keep local rules for automake
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+all: rrd_config.h
+       $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+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) --foreign '; \
+             cd $(srcdir) && $(AUTOMAKE) --foreign  \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --foreign  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)
+
+rrd_config.h: stamp-h1
+       @if test ! -f $@; then \
+         rm -f stamp-h1; \
+         $(MAKE) stamp-h1; \
+       else :; fi
+
+stamp-h1: $(srcdir)/rrd_config.h.in $(top_builddir)/config.status
+       @rm -f stamp-h1
+       cd $(top_builddir) && $(SHELL) ./config.status rrd_config.h
+$(srcdir)/rrd_config.h.in:  $(am__configure_deps) 
+       cd $(top_srcdir) && $(AUTOHEADER)
+       rm -f stamp-h1
+       touch $@
+
+distclean-hdr:
+       -rm -f rrd_config.h stamp-h1
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+distclean-libtool:
+       -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+       @failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       target=`echo $@ | sed s/-recursive//`; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           dot_seen=yes; \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done; \
+       if test "$$dot_seen" = "no"; then \
+         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+       fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+       @failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       case "$@" in \
+         distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+         *) list='$(SUBDIRS)' ;; \
+       esac; \
+       rev=''; for subdir in $$list; do \
+         if test "$$subdir" = "."; then :; else \
+           rev="$$subdir $$rev"; \
+         fi; \
+       done; \
+       rev="$$rev ."; \
+       target=`echo $@ | sed s/-recursive//`; \
+       for subdir in $$rev; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done && test -z "$$fail"
+tags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+       done
+ctags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+       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: tags-recursive $(HEADERS) $(SOURCES) rrd_config.h.in $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+         include_option=--etags-include; \
+         empty_fix=.; \
+       else \
+         include_option=--include; \
+         empty_fix=; \
+       fi; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test ! -f $$subdir/TAGS || \
+             tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+         fi; \
+       done; \
+       list='$(SOURCES) $(HEADERS) rrd_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: ctags-recursive $(HEADERS) $(SOURCES) rrd_config.h.in $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS) rrd_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)/bindings/tcl $(distdir)/examples $(distdir)/netware $(distdir)/win32
+       @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
+       list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test -d "$(distdir)/$$subdir" \
+           || $(mkdir_p) "$(distdir)/$$subdir" \
+           || exit 1; \
+           distdir=`$(am__cd) $(distdir) && pwd`; \
+           top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+           (cd $$subdir && \
+             $(MAKE) $(AM_MAKEFLAGS) \
+               top_distdir="$$top_distdir" \
+               distdir="$$distdir/$$subdir" \
+               distdir) \
+             || 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-recursive
+all-am: Makefile rrd_config.h
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+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-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-hdr \
+       distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+       -rm -rf $(top_srcdir)/autom4te.cache
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
+       check-am clean clean-generic clean-libtool clean-recursive \
+       ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
+       dist-shar dist-tarZ dist-zip distcheck distclean \
+       distclean-generic distclean-hdr distclean-libtool \
+       distclean-recursive distclean-tags distcleancheck distdir \
+       distuninstallcheck dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am install-exec \
+       install-exec-am install-info install-info-am install-man \
+       install-strip installcheck installcheck-am installdirs \
+       installdirs-am maintainer-clean maintainer-clean-generic \
+       maintainer-clean-recursive mostlyclean mostlyclean-generic \
+       mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+       tags tags-recursive uninstall uninstall-am uninstall-info-am
+
+
+  # the following files are not mentioned in any other Makefile
+#AUTOHEADER = @AUTOHEADER@ --localdir=$(top_srcdir)/config
+#AUTOCONF = @AUTOCONF@ --localdir=$(top_srcdir)/config
+
+to-docs: to-versync
+       (cd doc && $(MAKE) clean && $(MAKE) && $(MAKE) pdf)
+
+to-dist: to-docs dist
+       mv $(PACKAGE)-$(VERSION).tar.gz archive
+
+to-scp: to-dist
+       cp CHANGES  archive/$(PACKAGE)-$(VERSION).tar.gz /home/oetiker/public_html/webtools/rrdtool/pub/
+       (cd /home/oetiker/public_html/webtools/rrdtool/pub; rm $(PACKAGE).tar.gz; ln -s $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE).tar.gz)
+
+#      $(RSYNC) CHANGES archive/$(PACKAGE)-$(VERSION).tar.gz tobi@ipn.caida.org:/ipn/web/Tools/RRDtool/pub/
+
+site-perl-inst: site-perl-install
+
+site-perl-install: all bindings/perl-piped/Makefile bindings/perl-shared/Makefile
+       cd bindings/perl-piped && $(MAKE) install
+       cd bindings/perl-shared && $(MAKE) install
+
+site-tcl-install: all
+       cd bindings/tcl && $(MAKE) tcl-install
+
+site-python-install: all
+       cd bindings/python && $(PYTHON) setup.py install
+# 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..156864e
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,62 @@
+RRDTOOL NEWS
+============
+Major Changes between 1.0.x and 1.2.x
+
+Graphing
+--------
+
+* rewritten graphics generation based on libart.
+  - anti-aliased output
+  - alpha transparency support
+  - truetype fonts
+* additional graphics formats: EPS, PDF, SVG
+
+* extended multi-part documentation
+
+* VDEF support; define and use variables.  Find, and use, the
+  maximum rate seen by rrdtool; compute and show the average
+
+* Sliding window (trend) analysis
+  Compute a smoother average, for instance over the last 6 CDPs
+
+* percentile (95th or other)
+  Remove peaks, 95 percent of all rates are at or below the
+  returned value
+
+Logging
+-------
+* a second logging interface: rrdtool updatev
+  Verbose updating of the database; show CPDs being created
+
+* Aberrant Behavior Detection with Holt-Winters Forecasting
+  Compare current data with expected data, detect and log when
+  the rates are outside expected levels
+
+* COMPUTE data type for artificial data-sources calculating their
+  input using RPN math and data from the other data-sources.
+Incompatibilities
+-----------------
+* Colons in COMMENT arguments to rrdtool graph must be escaped with a backslash
+
+* the --alt-y-mrtg option is gone or rather since 1.2.7 it is back but
+  without functionality.
+
+* In pipe mode, rrdtool answers with OK only if it was successful with the
+  command. Otherwhise the answer will be ERROR...
+
+
+Behind the Scenes
+-----------------
+* In order to support Holt-Winters and Calculated Datasources,
+  the rrdtool data format has changed. While the new version of rrdtool can
+  read files created with rrdtool 1.0.x. It is not possible to read files
+  created by rrdtool-1.2.x with rrdtool-1.0.x
+
+* External libraries are not included with rrdtool anymore. This is in line
+  with todays trend of using shared libraries everywhere. With the exception
+  of the cgi library most things required by rrdtool will be found on every recent
+  system.
+
+* Memory Mapped IO support for faster logging.
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..cba88fd
--- /dev/null
+++ b/README
@@ -0,0 +1,75 @@
+Round Robin Database Tools
+==========================
+
+It is pretty easy to gather status information from all sorts of things,
+ranging from the temperature in your office to the number of octets which
+have passed through the FDDI interface of your router. But it is not so
+trivial to store this data in a efficient and systematic manner. This is
+where RRDtool kicks in. It lets you log and analyze the data you gather from
+all kinds of data-sources (DS). The data analysis part of RRDtool is based
+on the ability to quickly generate graphical representations of the data
+values collected over a definable time period.
+
+
+To compile:
+-----------
+
+check out the instructions in doc/rrdbuild.txt
+
+Getting Started:
+----------------
+
+Either after compiling or after installing you can try the example
+RRDtool applications in the examples directory.
+
+To learn:
+---------
+
+Read the documentation in the doc directory. Start of with
+RRDtool. All documents are available as html and as ASCII text.  
+
+If you are looking for a more slow paced introduction, make sure to read
+Alex van den Bogaerdt's rrdtutorial which is also available from the doc
+directory. Also read his cdeftutorial and Steve Rader's rpntutorial.
+If you want to know about the format of the log files check
+src/rrd_format.h there are a lot of comments in there ...
+
+How to make Tobi happy:
+-----------------------
+
+If you want to show your appreciation for RRDtool you could make me happy
+by going to http://tobi.oetiker.ch/wish and ordering a CD from
+my CD wish list ... 
+
+
+How to keep in touch:
+---------------------
+
+There are 3 Mailing lists for RRDtool:
+
+rrd-announce   LOW volume RRDtool Announcements List (Only Stable Releases)
+rrd-users       For discussion amongst people who use RRDtool in their applications
+rrd-developers  For people who actually HACK RRDtool code
+
+To subscribe to <MAILGLIST> send a message with the subject 'subscribe'
+to <MAILGLIST>-request@lists.oetiker.ch
+
+Note, that postings to rrd-announce will always be cross-posted 
+to rrd-users and rrd-developers as well.
+
+To Contribute:
+--------------
+
+Contributed feature and bug patches are most welcome. But please
+send complete patches. A complete patch patches the CODE as well
+as the CHANGES, CONTRIBUTORS and the POD files.
+
+Use GNU   diff --unified --recursive olddir newdir   to build your patches.
+
+The latest Version:
+-------------------
+Is available from http://oss.oetiker.ch/rrdtool/
+
+
+Tobias Oetiker <tobi@oetiker.ch>
diff --git a/THREADS b/THREADS
new file mode 100644 (file)
index 0000000..b048163
--- /dev/null
+++ b/THREADS
@@ -0,0 +1,60 @@
+In order to use the librrd in multi-threaded programs you must:
+
+  * Link with librrd_th instead of with librrd
+  * Use the *_r function instead or the *-functions
+  * Never use non *_r functions unless it is explicitly documented that the 
+    function is tread-safe
+
+Every thread SHOULD call rrd_get_context() before the first call to
+any librrd function in order to set up thread specific data. This is
+not strictly required, but it is the only way to test if memory
+allocation can be done by this function. Otherwise the program may die
+with a SIGSEGV in a low-memory situation.
+
+
+IMPORTANT NOTE FOR RRD CONTRIBUTORS:
+
+Some precautions must be followed when developing rrd from now on:
+
+* Only use thread-safe functions in library code. Many often used libc
+  functions aren't thread-safe. Take care if you want to use any of
+  the following functions:
+
+    + direct strerror calls must be avoided: use rrd_strerror instead,
+      it provides a per-thread error message
+    + the getpw*, getgr*, gethost* function families (and some more get*
+      functions): use the *_r variants
+    + Time functions: asctime, ctime, gmtime, localtime: use *_r variants
+    + strtok: use strtok_r
+    + tmpnam: use tmpnam_r
+    + many other (lookup documentation)
+
+As an aide(?) a header file named "rrd_is_thread_safe.h" is provided
+that works with the GNU C-preprocessor to "poison" some of the most
+common non-thread-safe functions using the "#pragma GCC poison"
+directive. Just include this header in source files you want to keep
+thread-safe.
+    
+* Do not introduce global variables!
+
+  If you really, really have to use a global variable you may add a 
+  new field to the rrd_context structure and modify rrd_error.c,
+  rrd_thread_safe.c and rrd_non_thread_safe.c
+
+* Do not use "getopt" or "getopt_long" in *_r (directly or indirectly)
+
+  getopt uses global variables and behaves badly in a multithreaded
+  application when called concurrently. Instead provide a *_r function
+  taking all options as function parameters. You may provide argc and
+  **argv arguments for variable length argument lists. See
+  rrd_update_r as an example. 
+
+* Do not use the parsetime function!
+
+  It uses lots of global vars. You may use it in functions not
+  designed to be thread-safe like functions wrapping the _r version of some
+  operation (eg. rrd_create, but not in rrd_create_r)
+
+WIN32 Platform Note (added 04/01/03):
+
+Both rrdtool.vcproj (MSVC++ 7.0) and rrd.dsw (MSVC++ 6.0) are configured to compile with rrd_thread_safe_nt.c.
diff --git a/TODO b/TODO
new file mode 100644 (file)
index 0000000..baa64f7
--- /dev/null
+++ b/TODO
@@ -0,0 +1,68 @@
+What has to be done before the 1.2.0 Release
+--------------------------------------------
+* Sync Docs with reality (there are things described which have not been
+  implemented)
+
+* Write Changes Document with all new features
+
+* Update Tutorials for new Release.
+
+Future Ideas
+------------
+reverse order of stacked graph entries prior to plotting ... this is to make
+plotting order more naturally fit with the ordering of the legend ...
+
+make it possible to define order of legend items independant of their order
+on the commandline ...
+
+use XDR to write architecture independant date
+
+have drawing methode modifier for the LINE, AREA, STACK functions which allows
+to select wether the data points should be presented as stepes (todays state)
+or connected with lines.
+
+LINEx:ds[#color][/method]:description
+
+be more clever in the fetch function when no complete data coverage for the
+desired area is possible.
+
+Let the user define the base resolution of the graph independently of
+the pixel resolution. If it is smaller than one pixel it will simply
+be ignored
+
+allow sub second precision for the step definition
+
+modularise consolidation and acquisition functions
+
+Allow the user to define vertical scaling of graphs in a more flexible way.
+some thing like --inner-range 0-1000 and --outer-range 0-10000 which means
+that the grapher can choose its vertical scaling in the given range ... 
+this would replace upper and lower limit
+
+make the inclusion of G?PRINT like output in to the lables of other graph 
+elements possible
+
+add axis on the right and on top of the graph ... 
+
+add configurable counter wrap
+
+build derivatives while plotting
+
+show trend by building moving average and represent it as an arrow
+
+offer side by side tiny box plots for each succesive hour, or some other
+means of seeing the variation rather than just the mean level
+
+circular periodic plots ... (polar)
+
+analyse data in non time domain ... 
+
+add smothing functions to grapher, using rolling average ... 
+
+make VRULE and HRULE with 123 versions ... 
+
+have configurable role-over limits for counters
+
+align data points not to GMT but some free offset
+
+allow starting through symlinks called rrdcreate rrdtune and the like
diff --git a/WIN32-BUILD-TIPS.txt b/WIN32-BUILD-TIPS.txt
new file mode 100644 (file)
index 0000000..7d731c8
--- /dev/null
@@ -0,0 +1,335 @@
+Compiling RRDtool 1.1.x on Win32 with Microsoft Visual C++:
+---------------------------------------------------------------
+5/1/05 Tobi
+to help windows deal with the reentrant versions of many unix
+calls link with win32comp.c
+
+4/10/05 Tobi
+The windows implementation of strftime does not seem to support
+the ISO 8601 week number (%V) I have therfore included the file
+strftime.[ch] which provides strftime_ ... if you compile rrdtool
+with -Dstrftime=_strftime and link strftime.o then you will
+get propper support for %V.
+
+7/29/04 Jake Brutlag
+
+As of Jan 2004, code for libraries utilized by rrdtool 
+(png, libart, freetype, and zlib) is no longer distributed with
+rrdtool. This requires some changes to the compile process on
+Win32. The solution described here is to compile rrdtool to
+link against these libraries dynamically. There is an advantage
+to this approach: namely the rrdtool distribution doesn't have to
+worry about how to compile these libraries on Win32. In theory,
+since others already provide and maintain Win32 binaries for these
+libraries the users don't have to worry about how to compile them
+either. The disadvantage of this approach is that the DLLs for
+these libraries must be available on the hosts where rrdtool will run.
+
+Here are step by step instructions for compiling rrdtool.exe and
+the perl shared library (RRDS.dll) with Microsoft Visual C++ 6.0.
+(1) Download libraries rrdtool depends on from GnuWin32:
+http://gnuwin32.sourceforge.net/
+For freetype, libpng, and zlib download the "Complete Package"; each of
+these will be a self-extracting self-installing executable.
+For libart, download both the "Binaries" and "Developer Files" packages.
+Unfortunately at this time GnuWin32 doesn't provide the "Complete Package"
+installer for libart. Perhaps by the time you are following these
+instructions GnuWin32 will have a "Complete Package" for libart.
+(2) Install the GnuWin32 libraries by running the executables for freetype,
+libpng, and zlib. These instructions and the Visual C++ project files
+distributed with rrdtool assume that you will use the default install
+location: C:\Program Files\GnuWin32. Extract the two zip files for libart,
+libart-2.3.3-bin.zip and libart-2.3.3-1-lib.zip into the GnuWin32 directory;
+the appropriate libart files will be added to the include, lib, and bin
+subdirectories.
+(3) Add C:\Program Files\GnuWin32\bin to the PATH (Control Panel ->
+System -> Advanced -> Environment Variables).
+(4) Start Microsoft Visual C++ 6.0. Load the workspace file, rrdtool.dsw,
+from the src subdirectory of your rrdtool code directory.
+(5) Compile the Release build of the rrdtool project (since rrdtool depends
+on the rrd project, the rrd library will also be compiled). At this
+time, the compile will fail in zconf.h, a zlib header file. The problem
+is a preprocessor directive that loads unistd.h. Open zconf.h in VC++
+(this file is in C:\Program Files\GnuWin32\include) and find the following
+code block:
+
+#if 1           /* HAVE_UNISTD_H -- this line is updated by ./configure */
+#  include <sys/types.h> /* for off_t */
+#  include <unistd.h>    /* for SEEK_* and off_t */
+#  ifdef VMS
+#    include <unixio.h>   /* for off_t */
+#  endif
+#  define z_off_t  off_t
+#endif 
+
+Change it to reads as follows (this is code from zlib-1.1.4):
+
+#if HAVE_UNISTD_H
+#  include <sys/types.h> /* for off_t */
+#  include <unistd.h>    /* for SEEK_* and off_t */
+#  ifdef VMS
+#    include <unixio.h>   /* for off_t */
+#  endif
+#  define z_off_t  off_t
+#endif 
+
+Note that it is actually just a one line change. Save the file and
+recompile rrdtool. By the time you are following these instructions
+this issue with zconf.h may be resolved.
+(6) At this point, you can run the executable rrdtool.exe in the
+src\toolrelease subdirectory. Note that if you wish to run rrdtool
+on other machines, you will need the following DLLs installed (on the
+path) on those machines:
+zlib1.dll
+libpng12.dll
+libart_lgpl.dll
+freetype6.dll
+msvcrt.dll
+The names of the first four DLLs might vary from what is listed here
+depending on the versions of the packages you downloaded from GnuWin32.
+The fifth DLL, msvcrt.dll, is a system DLL for most versions of Windows.
+If you are running on old version of Windows, you can install/upgrade to
+IE4.0 to get this DLL.
+(7) To compile the perl-shared library, open a Command Prompt (DOS box)
+and cd to the bindings\perl-shared subdirectory.
+(8) Run vcvars32.bat; this batch file, in your vc98\bin directory will
+set necessary environment options for command line compiling.
+(9) In bindings\perl-shared, run
+perl ntmake.pl
+nmake
+nmake test
+If nmake test succeeds, you are good to go. RRDs.dll is in 
+blib\arch\auto\RRDs. If you plan to install via the Active State ppm
+tool, tar and gzip the blib directory. You can use the RRDs.ppd file
+in bindings\perl-shared directory. Remember that as in the case of
+rrdtool.exe you will need the DLLs listed in (6) on the machine where
+you are going to use RRDs.dll.
+
+Microsoft Visual C++ 7.1 (.NET 2003):
+
+Unfortunately, this is more difficult than with VC++ 6.0. The problem
+is that by default the C runtime dll for VC++ 7.1 is msvcr71.dll rather
+than msvcrt.dll. The GnuWin32 library binaries are all compiled
+to use msvcrt.dll and you can't mix msvcr71.dll and msvcrt.dll in the
+same process. One option is to download the source code for the libraries
+(available from http://gnuwin32.sourceforge.net) recompile them with
+VC++ 7.l. Then all the components will use msvcr71.dll. Once you are
+going to go this route, you can also use static multi-threaded libraries
+and use static linking between rrdtool (or RRDs.dll) and its dependencies.
+
+To use the GnuWin32 library binaries, you need to trick VC++ 7.1 into
+compiling rrdtool to use the older msvcrt.dll. Follow steps (1) - (3)
+as above, then:
+(4) Obtain a different version of the msvcrt.lib import library that
+is compatible with vc7 and points to msvcrt.dll:
+msvcrtlib_for_vc7.zip from http://xchat.org/win32/testing
+Backup msvcrt.lib in your vc7\lib directory 
+(\Program Files\Microsoft Visual Studio .NET 2003\vc7\lib)
+Then extract the msvcrt.lib from the zip file into the vc7\lib directory.
+WARNING: Use this msvcrt.lib at your own risk! This is not a Microsoft
+supplied file nor a file supported by anyone associated with rrdtool.
+(5) Start Microsoft Visual C++ 7.1. Load the solution file, rrdtool.sln,
+from the src subdirectory of your rrdtool code directory. Edit zconf.h,
+as needed, as described under (5) above. Compile the release build of
+the rrdtool project.
+Proceed with steps (6) - (9) as above, if you are using/picking up
+the wrong msvcrt.lib import library then nmake test for perl-shared
+will fail.
+
+Note: it is possible in the future that GnuWin32 will provide Win32
+binaries that utilize msvcr71.dll rather than msvcrt.dll.
+
+5/14/02 Jake Brutlag
+
+These notes share some insight I gained compiling 1.1.x with
+MS Visual C++ 6.0 (using project files). This information may or
+may not be accurate at the time you are reading this.
+
+(1) freetype and rrdtool cannot use precompiled headers (which are
+enabled by default for MSVC++ projects).  MSVC++ 6.0 does not
+support precompiled headers if #include directives contain MACROS.
+(2) Compile Release build with Default optimization, not the
+Maximize Speed optimization. I encountered some strange errors
+(related to argument processing for complex commands like graph--
+perhaps the getopt stuff is too blame) with Maximize Speed.
+(3) libart relies upon config.h (ostensibly generated by the
+configure script-- but of course not on Win32 platforms). ..\..\confignt
+(which contains a static Win32 version of config.h) should be on
+the include path.
+(4) Fonts are located in the %windir%\fonts, so the default font
+is c:\winnt\fonts\cour.ttf. (6/19/02) At Kerry Calvert's suggestion
+this setting was moved to confignt\config.h.
+(5) libart requires a custom build step to generate art_config.h; this
+is done manually via the commands:
+cl -I..\..\confignt gen_art_config.c
+gen_art_config.exe > art_config.h
+
+Currently, to compile rrd.lib and rrdtool.exe using
+the MSVC++ project files, first start MSVC++ 6.0. Open the rrdtool
+workspace (rrdtool.dsw in the src directory). The active project/
+configuration should be rrdtool-Win32 Release. Select Rebuild All
+from the Build menu. The static link library (rrd.lib) will
+be generated in src\release directory and executable will be generated
+in the src\toolrelease directory.
+
+Compiling RRDtool on NT ... work in progress
+---------------------------------------------------------------
+                         by Tamas Kovacshazy (khazy@mit.bme.hu)
+
+Persisting Problems with the current NT port:
+
+Unfortunately, the RRD perl modules does not work with Perl
+(ActivePerl) using the current distribution.
+
+The RRD shared perl module can be compiled after some
+modification...
+
+Follow these steps:
+
+0. Install perl if you do not have it!
+   Visit http://www.ActiveState.com/pw32/ for a complete distribution.
+
+1. Copy ..\gd1.2\release\gd.lib  to ..\gd1.2\
+2. Copy ..\src\release\rrd.lib to ..\src
+3. perl Makefile.pl
+
+In this step the system complains about something I do not
+understand. The error message is the following:
+
+Note (probably harmless): No library found for '-lm'
+
+Is a library missing? But it does not stop with an error...
+
+4. nmake test (You must have Visual C++ on the machine!)
+
+After these steps it generates the test files (svgs and rrds),
+and they seem to be good.
+
+The real problem in the shared perl modul is the following:
+
+I do not know how this installation stuff works. The problem is
+that the installation stuff looks for the gd.lib and the
+rrd.lib in the ..\gd1.2 and ..\src directory. The UNIX compile
+puts the files into these directories, but the NT compile does
+not.
+
+It is all for today,
+
+khazy
+
+Tamas Kovacshazy  E-mail: khazy@mit.bme.hu  
+WWW: http://www.mit.bme.hu/~khazy
+Technical University of Budapest 
+Department of Measurement and Information Systems
+
+
+Compiling RRDtool 1.2.x on Win32 with MingW32 gcc:
+---------------------------------------------------------------
+
+1. Obtain and install the current version of the MingW package.
+
+     http://www.mingw.org/download.shtml
+
+   In the MinGW set you will need the gcc and binutils as a minimum.
+
+2. Obtain either of the following awk versions and install in a directory
+   on your System Path:
+
+   - awk.exe
+
+     http://cm.bell-labs.com/cm/cs/awkbook/index.html
+
+     Note: This version has no dependencies to other libs.
+
+   - gawk.exe  (GnuWin32 version)
+
+     http://gnuwin32.sourceforge.net/packages/gawk.htm
+
+     Note: Also fetch the dependant libraries for it from the same page.
+
+3. If you plan to create a 'distribution' release of the RRD Tools, the
+   Makefile.Win32 will copy all the needed files to an output directory and
+   then zip the entire directory. A suitable zip utility can be obtained here:
+
+     http://www.info-zip.org/
+
+   Install in a directory on your System Path.
+
+4. Obtain the following libraries, ideally install them all under a common
+   directory:
+
+   = zlib
+
+     http://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz
+     http://www.zlib.net/
+
+   = libpng
+
+     http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.12.tar.gz
+     http://libpng.sourceforge.net/
+
+   = freetype
+
+     http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.2.1.tar.gz
+     http://freetype.sourceforge.net/index2.html
+   = libart_lgpl
+
+     http://oss.oetiker.ch/rrdtool/pub/libs/libart_lgpl-2.3.17.tar.gz
+     http://www.levien.com/libart/
+
+     Note: libart_lgpl needs a special tweak because the archive contains
+     only the base directory, but the libart headers are usually included with
+     a directory prefix; therefore create a subfolder 'libart_lgpl' and move
+     all files into this subfolder.
+
+5. Set up for DOS environment.
+
+   Add MingW\bin and MSYS\bin directories to your System path.
+
+   If the libraries share a common directory set the following environment var:
+
+     set LIBBASE=<shared director>
+     e.g set LIBBASE=C:\Libraries
+
+   If the libraries are scattered, set the following environment vers:
+
+     set ZLIBSDK=<path to zlib>
+     e.g set ZLIBSDK=C:\mytest\zlib-1.2.3
+     set LIBPNG=<path to libpng>
+     set LIBFT2=<path to freetype>
+     set LIBART=<path to libart>
+
+   If using the Gnu Awk (gawk.exe), edit the Makefile.Win32 and change the line:
+
+      AWK      = awk
+
+   to
+
+      AWK      = gawk
+
+6. Compile the project.
+
+   All dependent libs are statically linked in. This has the benefit that the
+   binaries do not depend on any other DLLs.
+   In order to build the static freetype lib enter the freetype base directory
+   and type 'make'. If everything is fine a message appears that gcc is detected,
+   and that you should again type 'make'. Follow that in order to build freetype.
+   All other libs are build from the sources with the RRDTool Makefile.Win32.
+
+   Switch to the RRDTOOL .\src directory. Then:
+
+      make -f Makefile.Win32 help
+
+   to see the build options, or
+
+      make -f Makefile.Win32 all
+
+   should build the entire package.
+
+6. Happy Graphing!
+
+
+written by normw & gk.
+
+
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644 (file)
index 0000000..b71fe8e
--- /dev/null
@@ -0,0 +1,548 @@
+dnl Helper Functions for the RRDtool configure.ac script
+dnl 
+dnl this file gets included into aclocal.m4 when runnning aclocal
+dnl
+dnl
+dnl
+dnl Check for the presence of a particular library and its header files
+dnl if this check fails set the environment variable EX_CHECK_ALL_ERR to YES
+dnl and prints out a helful message
+dnl
+dnl
+dnl EX_CHECK_ALL(library, function, header, pkgconf name, tested-version, homepage, cppflags)
+dnl              $1       $2        $3      $4            $5              $6        $7
+dnl
+dnl
+AC_DEFUN([EX_CHECK_ALL],
+[
+ AC_LANG_PUSH(C)
+ EX_CHECK_STATE=NO
+ ex_check_save_LIBS=${LIBS}
+ ex_check_save_CPPFLAGS=${CPPFLAGS}
+ ex_check_save_LDFLAGS=${LDFLAGS}
+ if test "x$7" != "x"; then
+   CPPFLAGS="$CPPFLAGS -I$7"
+ fi
+ dnl try compiling naked first
+ AC_CHECK_LIB($1,$2, [
+    AC_CHECK_HEADER($3,[LIBS="-l$1 ${LIBS}";EX_CHECK_STATE=YES],[])],[])
+ if test $EX_CHECK_STATE = NO; then
+    dnl now asking pkg-config for help
+    AC_CHECK_PROGS(PKGCONFIG,[pkg-config],no)
+    if test "$PKGCONFIG" != "no"; then
+          if $PKGCONFIG --exists $4; then
+             CPPFLAGS=${CPPFLAGS}" "`$PKGCONFIG --cflags $4`
+             LDFLAGS=${LDFLAGS}" "`$PKGCONFIG --libs-only-L $4`
+             LDFLAGS=${LDFLAGS}" "`$PKGCONFIG --libs-only-other $4`
+             LIBS=${LIBS}" "`$PKGCONFIG --libs-only-l $4`
+            dnl remove the cached value and test again
+            unset ac_cv_lib_$1_$2
+             AC_CHECK_LIB($1,$2,[
+                unset ac_cv_header_`echo $3 | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
+                AC_CHECK_HEADER($3,[EX_CHECK_STATE=YES],[])
+            ],[])
+          else
+             AC_MSG_WARN([
+----------------------------------------------------------------------------
+* I found a copy of pkgconfig, but there is no $4.pc file around.
+  You may want to set the PKG_CONFIG_PATH variable to point to its
+  location.
+----------------------------------------------------------------------------
+                       ])
+           fi
+     fi
+  fi  
+
+  if test ${EX_CHECK_STATE} = NO; then
+     AC_MSG_WARN([
+----------------------------------------------------------------------------
+* I could not find a working copy of $4. Check config.log for hints on why
+  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
+  so that compiler and the linker can find lib$1 and its header files. If
+  you have not installed $4, you can get it either from its original home on
+
+     $6
+
+  You can find also find an archive copy on
+
+     http://oss.oetiker.ch/rrdtool/pub/libs
+
+  The last tested version of $4 is $5.
+
+       LIBS=$LIBS
+   LDFLAGS=$LDFLAGS
+  CPPFLAGS=$CPPFLAGS
+
+----------------------------------------------------------------------------
+                ])
+       EX_CHECK_ALL_ERR=YES
+       LIBS="${ex_check_save_LIBS}"
+       CPPFLAGS="${ex_check_save_CPPFLAGS}"
+       LDFLAGS="${ex_check_save_LDFLAGS}"
+    fi
+    AC_LANG_POP(C)
+]
+)
+
+dnl
+dnl  Ptherad check from http://autoconf-archive.cryp.to/acx_pthread.m4
+dnl
+dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+dnl
+dnl This macro figures out how to build C programs using POSIX threads.
+dnl It sets the PTHREAD_LIBS output variable to the threads library and
+dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
+dnl C compiler flags that are needed. (The user can also force certain
+dnl compiler flags/libs to be tested by setting these environment
+dnl variables.)
+dnl
+dnl Also sets PTHREAD_CC to any special C compiler that is needed for
+dnl multi-threaded programs (defaults to the value of CC otherwise).
+dnl (This is necessary on AIX to use the special cc_r compiler alias.)
+dnl
+dnl NOTE: You are assumed to not only compile your program with these
+dnl flags, but also link it with them as well. e.g. you should link
+dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
+dnl $LIBS
+dnl
+dnl If you are only building threads programs, you may wish to use
+dnl these variables in your default LIBS, CFLAGS, and CC:
+dnl
+dnl        LIBS="$PTHREAD_LIBS $LIBS"
+dnl        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+dnl        CC="$PTHREAD_CC"
+dnl
+dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
+dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
+dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+dnl
+dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
+dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
+dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
+dnl default action will define HAVE_PTHREAD.
+dnl
+dnl Please let the authors know if this macro fails on any platform, or
+dnl if you have any other suggestions or comments. This macro was based
+dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
+dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
+dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
+dnl We are also grateful for the helpful feedback of numerous users.
+dnl
+dnl @category InstalledPackages
+dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
+dnl @version 2005-01-14
+dnl @license GPLWithACException
+
+AC_DEFUN([ACX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_PUSH(C)
+acx_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
+        AC_MSG_RESULT($acx_pthread_ok)
+        if test x"$acx_pthread_ok" = xno; then
+                PTHREAD_LIBS=""
+                PTHREAD_CFLAGS=""
+        fi
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try.  Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important.  Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+#       other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+#      doesn't hurt to check since this sometimes defines pthreads too;
+#      also defines -D_REENTRANT)
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case "${host_cpu}-${host_os}" in
+        *solaris*)
+
+        # On Solaris (at least, for some versions), libc contains stubbed
+        # (non-functional) versions of the pthreads routines, so link-based
+        # tests will erroneously succeed.  (We need to link with -pthread or
+        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
+        # a function called by this macro, so we could check for that, but
+        # who knows whether they'll stub that too in a future libc.)  So,
+        # we'll just look for -pthreads and -lpthread first:
+
+        acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
+        ;;
+esac
+
+if test x"$acx_pthread_ok" = xno; then
+for flag in $acx_pthread_flags; do
+
+        case $flag in
+                none)
+                AC_MSG_CHECKING([whether pthreads work without any flags])
+                ;;
+
+                -*)
+                AC_MSG_CHECKING([whether pthreads work with $flag])
+                PTHREAD_CFLAGS="$flag"
+                ;;
+
+               pthread-config)
+               AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
+               if test x"$acx_pthread_config" = xno; then continue; fi
+               PTHREAD_CFLAGS="`pthread-config --cflags`"
+               PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+               ;;
+
+                *)
+                AC_MSG_CHECKING([for the pthreads library -l$flag])
+                PTHREAD_LIBS="-l$flag"
+                ;;
+        esac
+
+        save_LIBS="$LIBS"
+        save_CFLAGS="$CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Check for various functions.  We must include pthread.h,
+        # since some functions may be macros.  (On the Sequent, we
+        # need a special flag -Kthread to make this header compile.)
+        # We check for pthread_join because it is in -lpthread on IRIX
+        # while pthread_create is in libc.  We check for pthread_attr_init
+        # due to DEC craziness with -lpthreads.  We check for
+        # pthread_cleanup_push because it is one of the few pthread
+        # functions on Solaris that doesn't have a non-functional libc stub.
+        # We try pthread_create on general principles.
+        AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t th; pthread_join(th, 0);
+                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
+                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ]])],[acx_pthread_ok=yes],[])
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        AC_MSG_RESULT($acx_pthread_ok)
+        if test "x$acx_pthread_ok" = xyes; then
+                break;
+        fi
+
+        PTHREAD_LIBS=""
+        PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$acx_pthread_ok" = xyes; then
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+       AC_MSG_CHECKING([for joinable pthread attribute])
+       attr_name=unknown
+       for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+           AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], [[int attr=$attr;]])],[attr_name=$attr; break],[])
+       done
+        AC_MSG_RESULT($attr_name)
+        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+            AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
+                               [Define to necessary symbol if this constant
+                                uses a non-standard name on your system.])
+        fi
+
+        AC_MSG_CHECKING([if more special flags are required for pthreads])
+        x_rflag=no
+        case "${host_cpu}-${host_os}" in
+            *-aix* | *-freebsd* | *-darwin*) x_rflag="-D_THREAD_SAFE";;
+            *solaris* | *-osf* | *-hpux*) x_rflag="-D_REENTRANT";;
+            *-linux*)
+            if test x"$PTHREAD_CFLAGS" = "x-pthread"; then
+                # For Linux/gcc "-pthread" implies "-lpthread". We need, however, to make this explicit
+                # in PTHREAD_LIBS such that a shared library to be built properly depends on libpthread.
+                PTHREAD_LIBS="-lpthread $PTHREAD_LIBS"
+            fi;;
+        esac
+        AC_MSG_RESULT(${x_rflag})
+        if test "x$x_rflag" != xno; then
+            PTHREAD_CFLAGS="$x_rflag $PTHREAD_CFLAGS"
+        fi
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        # More AIX lossage: must compile with cc_r
+        AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
+else
+        PTHREAD_CC="$CC"
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_CC)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$acx_pthread_ok" = xyes; then
+        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
+        :
+else
+        acx_pthread_ok=no
+        $2
+fi
+AC_LANG_POP(C)
+])dnl ACX_PTHREAD
+
+
+dnl
+dnl determine how to get IEEE math working
+dnl AC_IEEE(MESSAGE, set rd_cv_ieee_[var] variable, INCLUDES,
+dnl   FUNCTION-BODY, [ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]])
+dnl
+
+dnl substitute them in all the files listed in AC_OUTPUT
+AC_SUBST(PERLFLAGS)
+
+AC_DEFUN([AC_IEEE], [
+AC_MSG_CHECKING([if IEEE math works $1])
+AC_CACHE_VAL([rd_cv_ieee_$2],
+[AC_RUN_IFELSE([AC_LANG_SOURCE([[$3
+
+#if HAVE_MATH_H
+#  include <math.h>
+#endif
+
+#if HAVE_FLOAT_H
+#  include <float.h>  
+#endif
+
+#if HAVE_IEEEFP_H
+#  include <ieeefp.h>
+#endif
+
+#if HAVE_FP_CLASS_H
+#  include <fp_class.h>
+#endif
+
+/* Solaris */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
+#endif
+
+/* solaris 10 it defines isnan such that only forte can compile it ... bad bad  */
+#if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS))
+#  undef isnan
+#  define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN)
+#endif
+
+/* Digital UNIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FP_CLASS) && defined(HAVE_FP_CLASS_H))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fp_class(a) == FP_NEG_INF || fp_class(a) == FP_POS_INF)
+#endif 
+
+/* AIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_CLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (class(a) == FP_MINUS_INF || class(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_PLUS_INF) && defined(FP_MINUS_INF))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_MINUS_INF || fpclassify(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_INFINITE))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_INFINITE)
+#endif
+
+#include <stdio.h>
+int main(void){
+    double rrdnan,rrdinf,rrdc,rrdzero;
+    $4;
+    /* some math to see if we get a floating point exception */
+    rrdzero=sin(0.0); /* don't let the compiler optimize us away */
+    rrdnan=0.0/rrdzero; /* especially here */
+    rrdinf=1.0/rrdzero; /* and here. I want to know if it can do the magic */
+                 /* at run time without sig fpe */
+    rrdc = rrdinf + rrdnan;
+    rrdc = rrdinf / rrdnan;
+    if (! isnan(rrdnan)) {printf ("not isnan(NaN) ... "); return 1;}
+    if (rrdnan == rrdnan) {printf ("nan == nan ... "); return 1;}
+    if (! isinf(rrdinf)) {printf ("not isinf(oo) ... "); return 1;}
+    if (! isinf(-rrdinf)) {printf ("not isinf(-oo) ... "); return 1;}
+    if (! rrdinf > 0) {printf ("not inf > 0 ... "); return 1;}
+    if (! -rrdinf < 0) {printf ("not -inf < 0 ... "); return 1;}
+    return 0;
+ }]])],[rd_cv_ieee_$2=yes],[rd_cv_ieee_$2=no],[:])])
+dnl these we run regardles is cached or not
+if test x${rd_cv_ieee_$2} = "xyes"; then
+ AC_MSG_RESULT(yes)
+ $5
+else
+ AC_MSG_RESULT(no)
+ $6
+fi
+
+])
+
+AC_DEFUN([AC_FULL_IEEE],[
+AC_LANG_PUSH(C)
+_cflags=${CFLAGS}
+AC_IEEE([out of the box], works, , , ,
+  [CFLAGS="$_cflags -ieee"
+  AC_IEEE([with the -ieee switch], switch, , , ,
+    [CFLAGS="$_cflags -qfloat=nofold"
+    AC_IEEE([with the -qfloat=nofold switch], nofold, , , ,
+      [CFLAGS="$_cflags -w -qflttrap=enable:zerodivide"
+      AC_IEEE([with the -w -qflttrap=enable:zerodivide], flttrap, , , ,
+       [CFLAGS="$_cflags -mieee"
+       AC_IEEE([with the -mieee switch], mswitch, , , ,
+         [CFLAGS="$_cflags -q float=rndsngl"
+         AC_IEEE([with the -q float=rndsngl switch], qswitch, , , ,
+           [CFLAGS="$_cflags -OPT:IEEE_NaN_inf=ON"
+           AC_IEEE([with the -OPT:IEEE_NaN_inf=ON switch], ieeenaninfswitch, , , ,
+             [CFLAGS="$_cflags -OPT:IEEE_comparisons=ON"
+             AC_IEEE([with the -OPT:IEEE_comparisons=ON switch], ieeecmpswitch, , , ,
+               [CFLAGS=$_cflags
+               AC_IEEE([with fpsetmask(0)], mask,
+                 [#include <floatingpoint.h>], [fpsetmask(0)],
+                 [AC_DEFINE(MUST_DISABLE_FPMASK)
+                PERLFLAGS="CCFLAGS=-DMUST_DISABLE_FPMASK"],
+                 [AC_IEEE([with signal(SIGFPE,SIG_IGN)], sigfpe,
+                   [#include <signal.h>], [signal(SIGFPE,SIG_IGN)],
+                   [AC_DEFINE(MUST_DISABLE_SIGFPE)
+                   PERLFLAGS="CCFLAGS=-DMUST_DISABLE_SIGFPE"],         
+                   AC_MSG_ERROR([
+Your Compiler does not do propper IEEE math ... Please find out how to
+make IEEE math work with your compiler and let me know (tobi@oetiker.ch).
+Check config.log to see what went wrong ...
+]))])])])])])])])])])
+
+AC_LANG_POP(C)
+
+])
+
+
+dnl a macro to check for ability to create python extensions
+dnl  AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
+dnl function also defines PYTHON_INCLUDES
+AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
+[AC_REQUIRE([AM_PATH_PYTHON])
+AC_MSG_CHECKING(for headers required to compile python extensions)
+dnl deduce PYTHON_INCLUDES
+py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
+py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
+PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
+if test "$py_prefix" != "$py_exec_prefix"; then
+  PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
+fi
+AC_SUBST(PYTHON_INCLUDES)
+dnl check if the headers exist:
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
+AC_TRY_CPP([#include <Python.h>],dnl
+[AC_MSG_RESULT(found)
+$1],dnl
+[AC_MSG_RESULT(not found)
+$2])
+CPPFLAGS="$save_CPPFLAGS"
+])
+
+dnl a macro to add some color to the build process.
+dnl CONFIGURE_PART(MESSAGE)
+
+AC_DEFUN([CONFIGURE_PART],[
+case $TERM in
+       #   for the most important terminal types we directly know the sequences
+       xterm|xterm*|vt220|vt220*)
+               T_MD=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </dev/null 2>/dev/null`
+               T_ME=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/null 2>/dev/null`
+       ;;
+       vt100|vt100*|cygwin)
+               T_MD=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' </dev/null 2>/dev/null`
+               T_ME=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' </dev/null 2>/dev/null`
+       ;;
+       *)
+               T_MD=''
+               T_ME=''
+       ;;
+esac
+  AC_MSG_RESULT()
+  AC_MSG_RESULT([${T_MD}$1${T_ME}])
+])
+
+
+dnl ---------------------------------------------------------------------------
+dnl CF_DISABLE_ECHO version: 10 updated: 2003/04/17 22:27:11
+dnl ---------------
+dnl stolen from xterm aclocal.m4
+dnl
+dnl You can always use "make -n" to see the actual options, but it's hard to
+dnl pick out/analyze warning messages when the compile-line is long.
+dnl
+dnl Sets:
+dnl     ECHO_LT - symbol to control if libtool is verbose
+dnl     ECHO_LD - symbol to prefix "cc -o" lines
+dnl     RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
+dnl     SHOW_CC - symbol to put before explicit "cc -c" lines
+dnl     ECHO_CC - symbol to put before any "cc" line
+dnl
+AC_DEFUN([CF_DISABLE_ECHO],[
+AC_MSG_CHECKING(if you want to see long compiling messages)
+CF_ARG_DISABLE(echo,
+        [  --disable-echo          display "compiling" commands],
+        [
+    ECHO_LT='--silent'
+    ECHO_LD='@echo linking [$]@;'
+    RULE_CC='   @echo compiling [$]<'
+    SHOW_CC='   @echo compiling [$]@'
+    ECHO_CC='@'
+],[
+    ECHO_LT=''
+    ECHO_LD=''
+    RULE_CC='# compiling'
+    SHOW_CC='# compiling'
+    ECHO_CC=''
+])
+AC_MSG_RESULT($enableval)
+AC_SUBST(ECHO_LT)
+AC_SUBST(ECHO_LD)
+AC_SUBST(RULE_CC)
+AC_SUBST(SHOW_CC)
+AC_SUBST(ECHO_CC)
+])dnl
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644 (file)
index 0000000..8401174
--- /dev/null
@@ -0,0 +1,7401 @@
+# generated automatically by aclocal 1.9.6 -*- 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.
+
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+
+# serial 48 Debian 1.5.22-4 AC_PROG_LIBTOOL
+
+
+# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
+# -----------------------------------------------------------
+# If this macro is not defined by Autoconf, define it here.
+m4_ifdef([AC_PROVIDE_IFELSE],
+         [],
+         [m4_define([AC_PROVIDE_IFELSE],
+                [m4_ifdef([AC_PROVIDE_$1],
+                          [$2], [$3])])])
+
+
+# AC_PROG_LIBTOOL
+# ---------------
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+  AC_PROVIDE_IFELSE([AC_PROG_CXX],
+    [AC_LIBTOOL_CXX],
+    [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+  ])])
+dnl And a similar setup for Fortran 77 support
+  AC_PROVIDE_IFELSE([AC_PROG_F77],
+    [AC_LIBTOOL_F77],
+    [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+  AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+    [AC_LIBTOOL_GCJ],
+    [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+      [AC_LIBTOOL_GCJ],
+      [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+       [AC_LIBTOOL_GCJ],
+      [ifdef([AC_PROG_GCJ],
+            [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+       ifdef([A][M_PROG_GCJ],
+            [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+       ifdef([LT_AC_PROG_GCJ],
+            [define([LT_AC_PROG_GCJ],
+               defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
+])])# AC_PROG_LIBTOOL
+
+
+# _AC_PROG_LIBTOOL
+# ----------------
+AC_DEFUN([_AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Prevent multiple expansion
+define([AC_PROG_LIBTOOL], [])
+])# _AC_PROG_LIBTOOL
+
+
+# AC_LIBTOOL_SETUP
+# ----------------
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.50)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+AC_LIBTOOL_SYS_MAX_CMD_LEN
+AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+AC_LIBTOOL_OBJDIR
+
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+_LT_AC_PROG_ECHO_BACKSLASH
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
+
+# Same as above, but do not quote variable references.
+[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+AC_CHECK_TOOL(AR, ar, false)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    AC_PATH_MAGIC
+  fi
+  ;;
+esac
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+enable_win32_dll=yes, enable_win32_dll=no)
+
+AC_ARG_ENABLE([libtool-lock],
+    [AC_HELP_STRING([--disable-libtool-lock],
+       [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+AC_ARG_WITH([pic],
+    [AC_HELP_STRING([--with-pic],
+       [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [pic_mode="$withval"],
+    [pic_mode=default])
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+AC_LIBTOOL_LANG_C_CONFIG
+_LT_AC_TAGCONFIG
+])# AC_LIBTOOL_SETUP
+
+
+# _LT_AC_SYS_COMPILER
+# -------------------
+AC_DEFUN([_LT_AC_SYS_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_AC_SYS_COMPILER
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+AC_DEFUN([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+  case $cc_temp in
+    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+])
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+AC_DEFUN([_LT_COMPILER_BOILERPLATE],
+[ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+AC_DEFUN([_LT_LINKER_BOILERPLATE],
+[ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+])# _LT_LINKER_BOILERPLATE
+
+
+# _LT_AC_SYS_LIBPATH_AIX
+# ----------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
+[AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])# _LT_AC_SYS_LIBPATH_AIX
+
+
+# _LT_AC_SHELL_INIT(ARG)
+# ----------------------
+AC_DEFUN([_LT_AC_SHELL_INIT],
+[ifdef([AC_DIVERSION_NOTICE],
+            [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+        [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_AC_SHELL_INIT
+
+
+# _LT_AC_PROG_ECHO_BACKSLASH
+# --------------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
+[_LT_AC_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X[$]1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+[$]*
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+       echo_test_string=`eval $cmd` &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    IFS="$lt_save_ifs"
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+        test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+        echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+        test "X$echo_testing_string" = "X$echo_test_string"; then
+       # Cool, printf works
+       :
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+          test "X$echo_testing_string" = 'X\t' &&
+          echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+          test "X$echo_testing_string" = "X$echo_test_string"; then
+       CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+       export CONFIG_SHELL
+       SHELL="$CONFIG_SHELL"
+       export SHELL
+       echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+          test "X$echo_testing_string" = 'X\t' &&
+          echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+          test "X$echo_testing_string" = "X$echo_test_string"; then
+       echo="$CONFIG_SHELL [$]0 --fallback-echo"
+      else
+       # maybe with a smaller string...
+       prev=:
+
+       for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+         if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+         then
+           break
+         fi
+         prev="$cmd"
+       done
+
+       if test "$prev" != 'sed 50q "[$]0"'; then
+         echo_test_string=`eval $prev`
+         export echo_test_string
+         exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+       else
+         # Oops.  We lost completely, so just stick with echo.
+         echo=echo
+       fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(ECHO)
+])])# _LT_AC_PROG_ECHO_BACKSLASH
+
+
+# _LT_AC_LOCK
+# -----------
+AC_DEFUN([_LT_AC_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+    [AC_HELP_STRING([--disable-libtool-lock],
+       [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *ELF-32*)
+      HPUX_IA64_MODE="32"
+      ;;
+    *ELF-64*)
+      HPUX_IA64_MODE="64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+   if test "$lt_cv_prog_gnu_ld" = yes; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -melf32bsmip"
+      ;;
+    *N32*)
+      LD="${LD-ld} -melf32bmipn32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -melf64bmip"
+      ;;
+    esac
+   else
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+   fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *32-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_i386"
+          ;;
+        ppc64-*linux*|powerpc64-*linux*)
+          LD="${LD-ld} -m elf32ppclinux"
+          ;;
+        s390x-*linux*)
+          LD="${LD-ld} -m elf_s390"
+          ;;
+        sparc64-*linux*)
+          LD="${LD-ld} -m elf32_sparc"
+          ;;
+      esac
+      ;;
+    *64-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        ppc*-*linux*|powerpc*-*linux*)
+          LD="${LD-ld} -m elf64ppc"
+          ;;
+        s390*-*linux*)
+          LD="${LD-ld} -m elf64_s390"
+          ;;
+        sparc*-*linux*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)    LD="${LD-ld} -64" ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+  ])
+esac
+
+need_locks="$enable_libtool_lock"
+
+])# _LT_AC_LOCK
+
+
+# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#              [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
+[AC_REQUIRE([LT_AC_PROG_SED])
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+  ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       $2=yes
+     fi
+   fi
+   $rm conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    ifelse([$5], , :, [$5])
+else
+    ifelse([$6], , :, [$6])
+fi
+])# AC_LIBTOOL_COMPILER_OPTION
+
+
+# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                          [ACTION-SUCCESS], [ACTION-FAILURE])
+# ------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
+[AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         $2=yes
+       fi
+     else
+       $2=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    ifelse([$4], , :, [$4])
+else
+    ifelse([$5], , :, [$5])
+fi
+])# AC_LIBTOOL_LINKER_OPTION
+
+
+# AC_LIBTOOL_SYS_MAX_CMD_LEN
+# --------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
+[# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536      # usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[       ]]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    # If test is not a shell built-in, we'll probably end up computing a
+    # maximum length that is only half of the actual maximum length, but
+    # we can't tell.
+    SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+    while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
+              = "XX$teststring") >/dev/null 2>&1 &&
+           new_result=`expr "X$teststring" : ".*" 2>&1` &&
+           lt_cv_sys_max_cmd_len=$new_result &&
+           test $i != 17 # 1/2 MB should be enough
+    do
+      i=`expr $i + 1`
+      teststring=$teststring$teststring
+    done
+    teststring=
+    # Add a significant safety factor because C++ compilers can tack on massive
+    # amounts of additional arguments before passing them to the linker.
+    # It appears as though 1/2 is a usable value.
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    ;;
+  esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+])# AC_LIBTOOL_SYS_MAX_CMD_LEN
+
+
+# _LT_AC_CHECK_DLFCN
+# ------------------
+AC_DEFUN([_LT_AC_CHECK_DLFCN],
+[AC_CHECK_HEADERS(dlfcn.h)dnl
+])# _LT_AC_CHECK_DLFCN
+
+
+# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                           ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ---------------------------------------------------------------------
+AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+    exit (status);
+}]
+EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_dlunknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_AC_TRY_DLOPEN_SELF
+
+
+# AC_LIBTOOL_DLOPEN_SELF
+# ----------------------
+AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+   ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+   ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+         [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+           [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
+       [AC_CHECK_FUNC([dlopen],
+             [lt_cv_dlopen="dlopen"],
+         [AC_CHECK_LIB([dl], [dlopen],
+               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+           [AC_CHECK_LIB([svld], [dlopen],
+                 [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+             [AC_CHECK_LIB([dld], [dld_link],
+                   [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
+             ])
+           ])
+         ])
+       ])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+         lt_cv_dlopen_self, [dnl
+         _LT_AC_TRY_DLOPEN_SELF(
+           lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+           lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+         lt_cv_dlopen_self_static, [dnl
+         _LT_AC_TRY_DLOPEN_SELF(
+           lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+           lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+])# AC_LIBTOOL_DLOPEN_SELF
+
+
+# AC_LIBTOOL_PROG_CC_C_O([TAGNAME])
+# ---------------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler
+AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w . 2>&AS_MESSAGE_LOG_FD
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+])
+])# AC_LIBTOOL_PROG_CC_C_O
+
+
+# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME])
+# -----------------------------------------
+# Check to see if we can do hard links to lock some files if needed
+AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS],
+[AC_REQUIRE([_LT_AC_LOCK])dnl
+
+hard_links="nottested"
+if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS
+
+
+# AC_LIBTOOL_OBJDIR
+# -----------------
+AC_DEFUN([AC_LIBTOOL_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+])# AC_LIBTOOL_OBJDIR
+
+
+# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME])
+# ----------------------------------------------
+# Check hardcoding attributes.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_AC_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
+   test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \
+   test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+     test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_AC_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_AC_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_AC_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH
+
+
+# AC_LIBTOOL_SYS_LIB_STRIP
+# ------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP],
+[striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         AC_MSG_RESULT([yes])
+       else
+  AC_MSG_RESULT([no])
+fi
+       ;;
+   *)
+  AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+])# AC_LIBTOOL_SYS_LIB_STRIP
+
+
+# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
+[AC_MSG_CHECKING([dynamic linker characteristics])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[[45]]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[[123]]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  freebsd*) # from 4.6 on
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix3*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test "$lt_cv_prog_gnu_ld" = yes; then
+               version_type=linux
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,   ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[[89]] | openbsd2.[[89]].*)
+       shlibpath_overrides_runpath=no
+       ;;
+      *)
+       shlibpath_overrides_runpath=yes
+       ;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+       ;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
+
+
+# _LT_AC_TAGCONFIG
+# ----------------
+AC_DEFUN([_LT_AC_TAGCONFIG],
+[AC_ARG_WITH([tags],
+    [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
+        [include additional configurations @<:@automatic@:>@])],
+    [tagnames="$withval"])
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+  if test ! -f "${ofile}"; then
+    AC_MSG_WARN([output file `$ofile' does not exist])
+  fi
+
+  if test -z "$LTCC"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+    if test -z "$LTCC"; then
+      AC_MSG_WARN([output file `$ofile' does not look like a libtool script])
+    else
+      AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile'])
+    fi
+  fi
+  if test -z "$LTCFLAGS"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
+  fi
+
+  # Extract list of available tagged configurations in $ofile.
+  # Note that this assumes the entire list is on one line.
+  available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+  lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+  for tagname in $tagnames; do
+    IFS="$lt_save_ifs"
+    # Check whether tagname contains only valid characters
+    case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in
+    "") ;;
+    *)  AC_MSG_ERROR([invalid tag name: $tagname])
+       ;;
+    esac
+
+    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+    then
+      AC_MSG_ERROR([tag name \"$tagname\" already exists])
+    fi
+
+    # Update the list of available tags.
+    if test -n "$tagname"; then
+      echo appending configuration tag \"$tagname\" to $ofile
+
+      case $tagname in
+      CXX)
+       if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+           ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+           (test "X$CXX" != "Xg++"))) ; then
+         AC_LIBTOOL_LANG_CXX_CONFIG
+       else
+         tagname=""
+       fi
+       ;;
+
+      F77)
+       if test -n "$F77" && test "X$F77" != "Xno"; then
+         AC_LIBTOOL_LANG_F77_CONFIG
+       else
+         tagname=""
+       fi
+       ;;
+
+      GCJ)
+       if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+         AC_LIBTOOL_LANG_GCJ_CONFIG
+       else
+         tagname=""
+       fi
+       ;;
+
+      RC)
+       AC_LIBTOOL_LANG_RC_CONFIG
+       ;;
+
+      *)
+       AC_MSG_ERROR([Unsupported tag name: $tagname])
+       ;;
+      esac
+
+      # Append the new tag name to the list of available tags.
+      if test -n "$tagname" ; then
+      available_tags="$available_tags $tagname"
+    fi
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  # Now substitute the updated list of available tags.
+  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+    mv "${ofile}T" "$ofile"
+    chmod +x "$ofile"
+  else
+    rm -f "${ofile}T"
+    AC_MSG_ERROR([unable to update list of available tagged configurations.])
+  fi
+fi
+])# _LT_AC_TAGCONFIG
+
+
+# AC_LIBTOOL_DLOPEN
+# -----------------
+# enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN],
+ [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_DLOPEN
+
+
+# AC_LIBTOOL_WIN32_DLL
+# --------------------
+# declare package support for building win32 DLLs
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_WIN32_DLL
+
+
+# AC_ENABLE_SHARED([DEFAULT])
+# ---------------------------
+# implement the --enable-shared flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([shared],
+    [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+       [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_shared=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]AC_ENABLE_SHARED_DEFAULT)
+])# AC_ENABLE_SHARED
+
+
+# AC_DISABLE_SHARED
+# -----------------
+# set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)
+])# AC_DISABLE_SHARED
+
+
+# AC_ENABLE_STATIC([DEFAULT])
+# ---------------------------
+# implement the --enable-static flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([static],
+    [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+       [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_static=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]AC_ENABLE_STATIC_DEFAULT)
+])# AC_ENABLE_STATIC
+
+
+# AC_DISABLE_STATIC
+# -----------------
+# set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)
+])# AC_DISABLE_STATIC
+
+
+# AC_ENABLE_FAST_INSTALL([DEFAULT])
+# ---------------------------------
+# implement the --enable-fast-install flag
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([fast-install],
+    [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_fast_install=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT)
+])# AC_ENABLE_FAST_INSTALL
+
+
+# AC_DISABLE_FAST_INSTALL
+# -----------------------
+# set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)
+])# AC_DISABLE_FAST_INSTALL
+
+
+# AC_LIBTOOL_PICMODE([MODE])
+# --------------------------
+# implement the --with-pic flag
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)
+])# AC_LIBTOOL_PICMODE
+
+
+# AC_PROG_EGREP
+# -------------
+# This is predefined starting with Autoconf 2.54, so this conditional
+# definition can be removed once we require Autoconf 2.54 or later.
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP],
+[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
+   [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])
+ EGREP=$ac_cv_prog_egrep
+ AC_SUBST([EGREP])
+])])
+
+
+# AC_PATH_TOOL_PREFIX
+# -------------------
+# find a file program which can recognise shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="ifelse([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+       case $deplibs_check_method in
+       "file_magic "*)
+         file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+         MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+         if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+           $EGREP "$file_magic_regex" > /dev/null; then
+           :
+         else
+           cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+         fi ;;
+       esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+])# AC_PATH_TOOL_PREFIX
+
+
+# AC_PATH_MAGIC
+# -------------
+# find a file program which can recognise a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# AC_PATH_MAGIC
+
+
+# AC_PROG_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH([gnu-ld],
+    [AC_HELP_STRING([--with-gnu-ld],
+       [assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])
+AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+       test "$with_gnu_ld" != no && break
+       ;;
+      *)
+       test "$with_gnu_ld" != yes && break
+       ;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])# AC_PROG_LD
+
+
+# AC_PROG_LD_GNU
+# --------------
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# AC_PROG_LD_GNU
+
+
+# AC_PROG_LD_RELOAD_FLAG
+# ----------------------
+# find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+  lt_cv_ld_reload_flag,
+  [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+])# AC_PROG_LD_RELOAD_FLAG
+
+
+# AC_DEPLIBS_CHECK_METHOD
+# -----------------------
+# how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_CACHE_CHECK([how to recognise dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[[45]]*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump'.
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix3*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd* | netbsdelf*-gnu)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+nto-qnx*)
+  lt_cv_deplibs_check_method=unknown
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+])# AC_DEPLIBS_CHECK_METHOD
+
+
+# AC_PROG_NM
+# ----------
+# find the pathname to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then 
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+       # Check to see if the nm accepts a BSD-compat flag.
+       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+       #   nm: unknown option "B" ignored
+       # Tru64's nm complains that /dev/null is an invalid object file
+       case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+       */dev/null* | *'Invalid file or object type'*)
+         lt_cv_path_NM="$tmp_nm -B"
+         break
+         ;;
+       *)
+         case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+         */dev/null*)
+           lt_cv_path_NM="$tmp_nm -p"
+           break
+           ;;
+         *)
+           lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+           continue # so that we can try to find one that supports BSD flags
+           ;;
+         esac
+         ;;
+       esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+])# AC_PROG_NM
+
+
+# AC_CHECK_LIBM
+# -------------
+# check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  ;;
+esac
+])# AC_CHECK_LIBM
+
+
+# AC_LIBLTDL_CONVENIENCE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl convenience library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-convenience to the configure arguments.  Note that
+# AC_CONFIG_SUBDIRS is not called here.  If DIRECTORY is not provided,
+# it is assumed to be `libltdl'.  LIBLTDL will be prefixed with
+# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/'
+# (note the single quotes!).  If your package is not flat and you're not
+# using automake, define top_builddir and top_srcdir appropriately in
+# the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  case $enable_ltdl_convenience in
+  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+  "") enable_ltdl_convenience=yes
+      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+  esac
+  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+  LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_CONVENIENCE
+
+
+# AC_LIBLTDL_INSTALLABLE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl installable library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-install to the configure arguments.  Note that
+# AC_CONFIG_SUBDIRS is not called here.  If DIRECTORY is not provided,
+# and an installed libltdl is not found, it is assumed to be `libltdl'.
+# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with
+# '${top_srcdir}/' (note the single quotes!).  If your package is not
+# flat and you're not using automake, define top_builddir and top_srcdir
+# appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+  AC_CHECK_LIB(ltdl, lt_dlinit,
+  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+  [if test x"$enable_ltdl_install" = xno; then
+     AC_MSG_WARN([libltdl not installed, but installation disabled])
+   else
+     enable_ltdl_install=yes
+   fi
+  ])
+  if test x"$enable_ltdl_install" = x"yes"; then
+    ac_configure_args="$ac_configure_args --enable-ltdl-install"
+    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+    LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+  else
+    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+    LIBLTDL="-lltdl"
+    LTDLINCL=
+  fi
+  # For backwards non-gettext consistent compatibility...
+  INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_INSTALLABLE
+
+
+# AC_LIBTOOL_CXX
+# --------------
+# enable support for C++ libraries
+AC_DEFUN([AC_LIBTOOL_CXX],
+[AC_REQUIRE([_LT_AC_LANG_CXX])
+])# AC_LIBTOOL_CXX
+
+
+# _LT_AC_LANG_CXX
+# ---------------
+AC_DEFUN([_LT_AC_LANG_CXX],
+[AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
+])# _LT_AC_LANG_CXX
+
+# _LT_AC_PROG_CXXCPP
+# ------------------
+AC_DEFUN([_LT_AC_PROG_CXXCPP],
+[
+AC_REQUIRE([AC_PROG_CXX])
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+fi
+])# _LT_AC_PROG_CXXCPP
+
+# AC_LIBTOOL_F77
+# --------------
+# enable support for Fortran 77 libraries
+AC_DEFUN([AC_LIBTOOL_F77],
+[AC_REQUIRE([_LT_AC_LANG_F77])
+])# AC_LIBTOOL_F77
+
+
+# _LT_AC_LANG_F77
+# ---------------
+AC_DEFUN([_LT_AC_LANG_F77],
+[AC_REQUIRE([AC_PROG_F77])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77])
+])# _LT_AC_LANG_F77
+
+
+# AC_LIBTOOL_GCJ
+# --------------
+# enable support for GCJ libraries
+AC_DEFUN([AC_LIBTOOL_GCJ],
+[AC_REQUIRE([_LT_AC_LANG_GCJ])
+])# AC_LIBTOOL_GCJ
+
+
+# _LT_AC_LANG_GCJ
+# ---------------
+AC_DEFUN([_LT_AC_LANG_GCJ],
+[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+    [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+      [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+        [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+          [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ])
+])# _LT_AC_LANG_GCJ
+
+
+# AC_LIBTOOL_RC
+# -------------
+# enable support for Windows resource files
+AC_DEFUN([AC_LIBTOOL_RC],
+[AC_REQUIRE([LT_AC_PROG_RC])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC])
+])# AC_LIBTOOL_RC
+
+
+# AC_LIBTOOL_LANG_C_CONFIG
+# ------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG])
+AC_DEFUN([_LT_AC_LANG_C_CONFIG],
+[lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}\n'
+
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF
+
+# Report which library types will actually be built
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+    ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_C_CONFIG
+
+
+# AC_LIBTOOL_LANG_CXX_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
+AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
+[AC_LANG_PUSH(C++)
+AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Dependencies to place before and after the object being linked:
+_LT_AC_TAGVAR(predep_objects, $1)=
+_LT_AC_TAGVAR(postdep_objects, $1)=
+_LT_AC_TAGVAR(predeps, $1)=
+_LT_AC_TAGVAR(postdeps, $1)=
+_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+  lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+  $as_unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+  lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+  $as_unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+else
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+fi
+
+if test "$GXX" = yes; then
+  # Set up default GNU C++ configuration
+
+  AC_PROG_LD
+
+  # Check if GNU C++ uses GNU ld as the underlying linker, since the
+  # archiving commands below assume that GNU ld is being used.
+  if test "$with_gnu_ld" = yes; then
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+    #     investigate it a little bit more. (MM)
+    wlarc='${wl}'
+
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+       grep 'no-whole-archive' > /dev/null; then
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    with_gnu_ld=no
+    wlarc=
+
+    # A generic and very simple default shared library creation
+    # command for GNU C++ for the case where it uses the native
+    # linker, instead of GNU ld.  If possible, this setting should
+    # overridden to take advantage of the native linker features on
+    # the platform it is being used on.
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+  fi
+
+  # Commands to make compiler produce verbose output that lists
+  # what "hidden" libraries, object files and flags are used when
+  # linking a shared library.
+  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+  GXX=no
+  with_gnu_ld=no
+  wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+_LT_AC_TAGVAR(ld_shlibs, $1)=yes
+case $host_os in
+  aix3*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+       for ld_flag in $LDFLAGS; do
+         case $ld_flag in
+         *-brtl*)
+           aix_use_runtimelinking=yes
+           break
+           ;;
+         esac
+       done
+       ;;
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    _LT_AC_TAGVAR(archive_cmds, $1)=''
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+    if test "$GXX" = yes; then
+      case $host_os in aix4.[[012]]|aix4.[[012]].*)
+      # We only want to do this on AIX 4.2 and lower, the check
+      # below for broken collect2 doesn't work under 4.3+
+       collect2name=`${CC} -print-prog-name=collect2`
+       if test -f "$collect2name" && \
+          strings "$collect2name" | grep resolve_lib_name >/dev/null
+       then
+         # We have reworked collect2
+         _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+       else
+         # We have old collect2
+         _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+       fi
+       ;;
+      esac
+      shared_flag='-shared'
+      if test "$aix_use_runtimelinking" = yes; then
+       shared_flag="$shared_flag "'${wl}-G'
+      fi
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+       shared_flag='-G'
+      else
+       if test "$aix_use_runtimelinking" = yes; then
+         shared_flag='${wl}-G'
+       else
+         shared_flag='${wl}-bM:SRE'
+       fi
+      fi
+    fi
+
+    # It seems that -bexpall does not export symbols beginning with
+    # underscore (_), so it is better to generate a list of symbols to export.
+    _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+      # Determine the default libpath from the value encoded in an empty executable.
+      _LT_AC_SYS_LIBPATH_AIX
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+     else
+      if test "$host_cpu" = ia64; then
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+      else
+       # Determine the default libpath from the value encoded in an empty executable.
+       _LT_AC_SYS_LIBPATH_AIX
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+       # Warning - without using the other run time loading flags,
+       # -berok will link without error, but may produce a broken library.
+       _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+       # Exported symbols can be pulled into shared objects from archives
+       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+       _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+       # This is similar to how AIX traditionally builds its shared libraries.
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+      fi
+    fi
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+    ;;
+
+  chorus*)
+    case $cc_basename in
+      *)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+    esac
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+    # as there is no search path for DLLs.
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+    _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+    _LT_AC_TAGVAR(always_export_symbols, $1)=no
+    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+    if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      # If the export-symbols file already is a .def file (1st line
+      # is EXPORTS), use it as is; otherwise, prepend...
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+       cp $export_symbols $output_objdir/$soname.def;
+      else
+       echo EXPORTS > $output_objdir/$soname.def;
+       cat $export_symbols >> $output_objdir/$soname.def;
+      fi~
+      $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+    else
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    fi
+  ;;
+      darwin* | rhapsody*)
+        case $host_os in
+        rhapsody* | darwin1.[[012]])
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[[012]])
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+        esac
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+    if test "$GXX" = yes ; then
+      lt_int_apple_cc_single_mod=no
+      output_verbose_link_cmd='echo'
+      if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
+       lt_int_apple_cc_single_mod=yes
+      fi
+      if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      else
+          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+        fi
+        _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+        # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          else
+            _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          fi
+            _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+          _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+          ;;
+      esac
+      fi
+        ;;
+
+  dgux*)
+    case $cc_basename in
+      ec++*)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      ghcx*)
+       # Green Hills C++ Compiler
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+    esac
+    ;;
+  freebsd[[12]]*)
+    # C++ shared libraries reported to be fairly broken before switch to ELF
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  freebsd-elf*)
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    ;;
+  freebsd* | dragonfly*)
+    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+    # conventions
+    _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+    ;;
+  gnu*)
+    ;;
+  hpux9*)
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+                               # but as the default
+                               # location of the library.
+
+    case $cc_basename in
+    CC*)
+      # FIXME: insert proper C++ library support
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    aCC*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      #
+      # There doesn't appear to be a way to prevent this compiler from
+      # explicitly linking system object files so we need to strip them
+      # from the output so that they don't get included in the library
+      # dependencies.
+      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+      ;;
+    *)
+      if test "$GXX" = yes; then
+        _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+        # FIXME: insert proper C++ library support
+        _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+    ;;
+  hpux10*|hpux11*)
+    if test $with_gnu_ld = no; then
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+      case $host_cpu in
+      hppa*64*|ia64*)
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+        ;;
+      *)
+       _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        ;;
+      esac
+    fi
+    case $host_cpu in
+    hppa*64*|ia64*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+    *)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+                                             # but as the default
+                                             # location of the library.
+      ;;
+    esac
+
+    case $cc_basename in
+      CC*)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      aCC*)
+       case $host_cpu in
+       hppa*64*)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+         ;;
+       ia64*)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+         ;;
+       *)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+         ;;
+       esac
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+      *)
+       if test "$GXX" = yes; then
+         if test $with_gnu_ld = no; then
+           case $host_cpu in
+           hppa*64*)
+             _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             ;;
+           ia64*)
+             _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             ;;
+           *)
+             _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             ;;
+           esac
+         fi
+       else
+         # FIXME: insert proper C++ library support
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       fi
+       ;;
+    esac
+    ;;
+  interix3*)
+    _LT_AC_TAGVAR(hardcode_direct, $1)=no
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+    # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+    # Instead, shared libraries are loaded at an image base (0x10000000 by
+    # default) and relocated if they conflict, which is a slow very memory
+    # consuming and fragmenting process.  To avoid this, we pick a random,
+    # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+    # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    ;;
+  irix5* | irix6*)
+    case $cc_basename in
+      CC*)
+       # SGI C++
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+       # Archives containing C++ object files must be created using
+       # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+       # necessary to make sure instantiated templates are included
+       # in the archive.
+       _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+       ;;
+      *)
+       if test "$GXX" = yes; then
+         if test "$with_gnu_ld" = no; then
+           _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+         else
+           _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+         fi
+       fi
+       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+       ;;
+    esac
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+    ;;
+  linux* | k*bsd*-gnu)
+    case $cc_basename in
+      KCC*)
+       # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+       # KCC will only create a shared library if the output file
+       # ends with ".so" (or ".sl" for HP-UX), so rename the library
+       # to its proper name (with version) after linking.
+       _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir'
+       _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+       # Archives containing C++ object files must be created using
+       # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+       _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+       ;;
+      icpc*)
+       # Intel C++
+       with_gnu_ld=yes
+       # version 8.0 and above of icpc choke on multiply defined symbols
+       # if we add $predep_objects and $postdep_objects, however 7.1 and
+       # earlier do not add the objects themselves.
+       case `$CC -V 2>&1` in
+       *"Version 7."*)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+         ;;
+       *)  # Version 8.0 or newer
+         tmp_idyn=
+         case $host_cpu in
+           ia64*) tmp_idyn=' -i_dynamic';;
+         esac
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+         ;;
+       esac
+       _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+       _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+       ;;
+      pgCC*)
+        # Portland Group C++ compiler
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+       _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+        ;;
+      cxx*)
+       # Compaq C++
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+       runpath_var=LD_RUN_PATH
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+    esac
+    ;;
+  lynxos*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  m88k*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  mvs*)
+    case $cc_basename in
+      cxx*)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+    esac
+    ;;
+  netbsd* | netbsdelf*-gnu)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+      wlarc=
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    fi
+    # Workaround some broken pre-1.5 toolchains
+    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+    ;;
+  openbsd2*)
+    # C++ shared libraries are fairly broken
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  openbsd*)
+    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    fi
+    output_verbose_link_cmd='echo'
+    ;;
+  osf3*)
+    case $cc_basename in
+      KCC*)
+       # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+       # KCC will only create a shared library if the output file
+       # ends with ".so" (or ".sl" for HP-UX), so rename the library
+       # to its proper name (with version) after linking.
+       _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       # Archives containing C++ object files must be created using
+       # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+       _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+
+       ;;
+      RCC*)
+       # Rational C++ 2.4.1
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      cxx*)
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+      *)
+       if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+         # Commands to make compiler produce verbose output that lists
+         # what "hidden" libraries, object files and flags are used when
+         # linking a shared library.
+         output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+       else
+         # FIXME: insert proper C++ library support
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       fi
+       ;;
+    esac
+    ;;
+  osf4* | osf5*)
+    case $cc_basename in
+      KCC*)
+       # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+       # KCC will only create a shared library if the output file
+       # ends with ".so" (or ".sl" for HP-UX), so rename the library
+       # to its proper name (with version) after linking.
+       _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       # Archives containing C++ object files must be created using
+       # the KAI C++ compiler.
+       _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs'
+       ;;
+      RCC*)
+       # Rational C++ 2.4.1
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      cxx*)
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+         echo "-hidden">> $lib.exp~
+         $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+         $rm $lib.exp'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+      *)
+       if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+         # Commands to make compiler produce verbose output that lists
+         # what "hidden" libraries, object files and flags are used when
+         # linking a shared library.
+         output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+       else
+         # FIXME: insert proper C++ library support
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       fi
+       ;;
+    esac
+    ;;
+  psos*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  sunos4*)
+    case $cc_basename in
+      CC*)
+       # Sun C++ 4.x
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      lcc*)
+       # Lucid
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+    esac
+    ;;
+  solaris*)
+    case $cc_basename in
+      CC*)
+       # Sun C++ 4.2, 5.x and Centerline C++
+        _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes
+       _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+       $CC -G${allow_undefined_flag}  ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+       case $host_os in
+         solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+         *)
+           # The C++ compiler is used as linker so we must use $wl
+           # flag to pass the commands to the underlying system
+           # linker. We must also pass each convience library through
+           # to the system linker between allextract/defaultextract.
+           # The C++ compiler will combine linker options so we
+           # cannot just pass the convience library names through
+           # without $wl.
+           # Supported since Solaris 2.6 (maybe 2.5.1?)
+           _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract'
+           ;;
+       esac
+       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+       output_verbose_link_cmd='echo'
+
+       # Archives containing C++ object files must be created using
+       # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+       # necessary to make sure instantiated templates are included
+       # in the archive.
+       _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+       ;;
+      gcx*)
+       # Green Hills C++ Compiler
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+       # The C++ compiler must be used to create the archive.
+       _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+       ;;
+      *)
+       # GNU C++ compiler with Solaris linker
+       if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+         _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+         if $CC --version | grep -v '^2\.7' > /dev/null; then
+           _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+           _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+               $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+         else
+           # g++ 2.7 appears to require `-G' NOT `-shared' on this
+           # platform.
+           _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+           _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+               $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+         fi
+
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+       fi
+       ;;
+    esac
+    ;;
+  sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+    _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+      *)
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+    esac
+    ;;
+  sysv5* | sco3.2v5* | sco5v6*)
+    # Note: We can NOT use -z defs as we might desire, because we do not
+    # link with -lc, and that would cause any symbols used from libc to
+    # always be unresolved, which means just about no library would
+    # ever link correctly.  If we're not using GNU ld we use -z text
+    # though, which does catch some bad symbols but isn't as heavy-handed
+    # as -z defs.
+    # For security reasons, it is highly recommended that you always
+    # use absolute paths for naming shared libraries, and exclude the
+    # DT_RUNPATH tag from executables and libraries.  But doing so
+    # requires that you compile everything twice, which is a pain.
+    # So that behaviour is only enabled if SCOABSPATH is set to a
+    # non-empty value in the environment.  Most likely only useful for
+    # creating official distributions of packages.
+    # This is a hack until libtool officially supports absolute path
+    # names for shared libraries.
+    _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+    _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+      *)
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+    esac
+    ;;
+  tandem*)
+    case $cc_basename in
+      NCC*)
+       # NonStop-UX NCC 3.20
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       ;;
+    esac
+    ;;
+  vxworks*)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+  *)
+    # FIXME: insert proper C++ library support
+    _LT_AC_TAGVAR(ld_shlibs, $1)=no
+    ;;
+esac
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_AC_TAGVAR(GCC, $1)="$GXX"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_POSTDEP_PREDEP($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+])# AC_LIBTOOL_LANG_CXX_CONFIG
+
+# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
+# ------------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+ifelse([$1],[],[cat > conftest.$ac_ext <<EOF
+int a;
+void foo (void) { a = 0; }
+EOF
+],[$1],[CXX],[cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+EOF
+],[$1],[F77],[cat > conftest.$ac_ext <<EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+EOF
+],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+EOF
+])
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  # The `*' in the case matches for architectures that use `case' in
+  # $output_verbose_cmd can trigger glob expansion during the loop
+  # eval without this substitution.
+  output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+
+  for p in `eval $output_verbose_link_cmd`; do
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" \
+         || test $p = "-R"; then
+        prev=$p
+        continue
+       else
+        prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+        case $p in
+        -L* | -R*)
+          # Internal compiler library paths should come after those
+          # provided the user.  The postdeps already come after the
+          # user supplied libs so there is no need to process them.
+          if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
+            _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+          else
+            _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+          fi
+          ;;
+        # The "-l" case would never come before the object being
+        # linked, so don't bother handling this case.
+        esac
+       else
+        if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then
+          _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}"
+        else
+          _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}"
+        fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+        pre_test_object_deps_done=yes
+        continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+        if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then
+          _LT_AC_TAGVAR(predep_objects, $1)="$p"
+        else
+          _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p"
+        fi
+       else
+        if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then
+          _LT_AC_TAGVAR(postdep_objects, $1)="$p"
+        else
+          _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p"
+        fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$rm -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+ifelse([$1],[CXX],
+[case $host_os in
+interix3*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  _LT_AC_TAGVAR(predep_objects,$1)=
+  _LT_AC_TAGVAR(postdep_objects,$1)=
+  _LT_AC_TAGVAR(postdeps,$1)=
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC*)
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    _LT_AC_TAGVAR(postdeps,$1)='-lCstd -lCrun'
+    ;;
+  esac
+  ;;
+esac
+])
+
+case " $_LT_AC_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+])# AC_LIBTOOL_POSTDEP_PREDEP
+
+# AC_LIBTOOL_LANG_F77_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)])
+AC_DEFUN([_LT_AC_LANG_F77_CONFIG],
+[AC_REQUIRE([AC_PROG_F77])
+AC_LANG_PUSH(Fortran 77)
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="      subroutine t\n      return\n      end\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="      program t\n      end\n"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+_LT_AC_TAGVAR(GCC, $1)="$G77"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_F77_CONFIG
+
+
+# AC_LIBTOOL_LANG_GCJ_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)])
+AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_GCJ_CONFIG
+
+
+# AC_LIBTOOL_LANG_RC_CONFIG
+# -------------------------
+# Ensure that the configuration vars for the Windows resource compiler are
+# suitably defined.  Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)])
+AC_DEFUN([_LT_AC_LANG_RC_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_RC_CONFIG
+
+
+# AC_LIBTOOL_CONFIG([TAGNAME])
+# ----------------------------
+# If TAGNAME is not passed, then create an initial libtool script
+# with a default configuration from the untagged config vars.  Otherwise
+# add code to config.status for appending the configuration named by
+# TAGNAME from the matching tagged config vars.
+AC_DEFUN([AC_LIBTOOL_CONFIG],
+[# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    _LT_AC_TAGVAR(compiler, $1) \
+    _LT_AC_TAGVAR(CC, $1) \
+    _LT_AC_TAGVAR(LD, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \
+    _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
+    _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
+    _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
+    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \
+    _LT_AC_TAGVAR(old_archive_cmds, $1) \
+    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \
+    _LT_AC_TAGVAR(predep_objects, $1) \
+    _LT_AC_TAGVAR(postdep_objects, $1) \
+    _LT_AC_TAGVAR(predeps, $1) \
+    _LT_AC_TAGVAR(postdeps, $1) \
+    _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
+    _LT_AC_TAGVAR(archive_cmds, $1) \
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
+    _LT_AC_TAGVAR(postinstall_cmds, $1) \
+    _LT_AC_TAGVAR(postuninstall_cmds, $1) \
+    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \
+    _LT_AC_TAGVAR(allow_undefined_flag, $1) \
+    _LT_AC_TAGVAR(no_undefined_flag, $1) \
+    _LT_AC_TAGVAR(export_symbols_cmds, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \
+    _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \
+    _LT_AC_TAGVAR(hardcode_automatic, $1) \
+    _LT_AC_TAGVAR(module_cmds, $1) \
+    _LT_AC_TAGVAR(module_expsym_cmds, $1) \
+    _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
+    _LT_AC_TAGVAR(exclude_expsyms, $1) \
+    _LT_AC_TAGVAR(include_expsyms, $1); do
+
+    case $var in
+    _LT_AC_TAGVAR(old_archive_cmds, $1) | \
+    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \
+    _LT_AC_TAGVAR(archive_cmds, $1) | \
+    _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
+    _LT_AC_TAGVAR(module_cmds, $1) | \
+    _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
+    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
+    _LT_AC_TAGVAR(export_symbols_cmds, $1) | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\[$]0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'`
+    ;;
+  esac
+
+ifelse([$1], [],
+  [cfgfile="${ofile}T"
+  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+  $rm -f "$cfgfile"
+  AC_MSG_NOTICE([creating $ofile])],
+  [cfgfile="$ofile"])
+
+  cat <<__EOF__ >> "$cfgfile"
+ifelse([$1], [],
+[#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e 1s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG],
+[# ### BEGIN LIBTOOL TAG CONFIG: $tagname])
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
+
+# Is the compiler the GNU C compiler?
+with_gcc=$_LT_AC_TAGVAR(GCC, $1)
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_[]_LT_AC_TAGVAR(LD, $1)
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1)
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1)
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1)
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1)
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1)
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1)
+archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1)
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1)
+module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1)
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1)
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1)
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1)
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1)
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1)
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1)
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1)
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1)
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1)
+
+# Symbols that must always be exported.
+include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1)
+
+ifelse([$1],[],
+[# ### END LIBTOOL CONFIG],
+[# ### END LIBTOOL TAG CONFIG: $tagname])
+
+__EOF__
+
+ifelse([$1],[], [
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" || \
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+])
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+fi
+])# AC_LIBTOOL_CONFIG
+
+
+# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+
+_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+
+  AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI
+
+
+# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+# ---------------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([AC_PROG_NM])
+AC_REQUIRE([AC_OBJEXT])
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDEGRST]]'
+  fi
+  lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+linux* | k*bsd*-gnu)
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDGIRSTW]]'
+    lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+    lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris*)
+  symcode='[[BDRT]]'
+  ;;
+sco3.2v5*)
+  symcode='[[DT]]'
+  ;;
+sysv4.2uw2*)
+  symcode='[[DT]]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[[ABDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[     ]]\($symcode$symcode*\)[[       ]][[    ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+       mv -f "$nlist"T "$nlist"
+      else
+       rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if grep ' nm_test_var$' "$nlist" >/dev/null; then
+       if grep ' nm_test_func$' "$nlist" >/dev/null; then
+         cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+         # Now generate the symbol file.
+         eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+         cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr_t address;
+}
+lt_preloaded_symbols[[]] =
+{
+EOF
+         $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+         cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+         # Now try linking the two files.
+         mv conftest.$ac_objext conftstm.$ac_objext
+         lt_save_LIBS="$LIBS"
+         lt_save_CFLAGS="$CFLAGS"
+         LIBS="conftstm.$ac_objext"
+         CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+         if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+           pipe_works=yes
+         fi
+         LIBS="$lt_save_LIBS"
+         CFLAGS="$lt_save_CFLAGS"
+       else
+         echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+       fi
+      else
+       echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+
+
+# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME])
+# ---------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC],
+[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=
+
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+ ifelse([$1],[CXX],[
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | os2* | pw32*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    interix3*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       ;;
+      *)
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+       ;;
+      esac
+      ;;
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix4* | aix5*)
+       # All AIX code is PIC.
+       if test "$host_cpu" = ia64; then
+         # AIX 5 now supports IA64 processor
+         _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+       else
+         _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+       fi
+       ;;
+      chorus*)
+       case $cc_basename in
+       cxch68*)
+         # Green Hills C++ Compiler
+         # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+         ;;
+       esac
+       ;;
+       darwin*)
+         # PIC is the default on this platform
+         # Common symbols not allowed in MH_DYLIB files
+         case $cc_basename in
+           xlc*)
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           ;;
+         esac
+       ;;
+      dgux*)
+       case $cc_basename in
+         ec++*)
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           ;;
+         ghcx*)
+           # Green Hills C++ Compiler
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      freebsd* | dragonfly*)
+       # FreeBSD uses GNU C++
+       ;;
+      hpux9* | hpux10* | hpux11*)
+       case $cc_basename in
+         CC*)
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+           if test "$host_cpu" != ia64; then
+             _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+           fi
+           ;;
+         aCC*)
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+           case $host_cpu in
+           hppa*64*|ia64*)
+             # +Z the default
+             ;;
+           *)
+             _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+             ;;
+           esac
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      interix*)
+       # This is c89, which is MS Visual C++ (no shared libs)
+       # Anyone wants to do a port?
+       ;;
+      irix5* | irix6* | nonstopux*)
+       case $cc_basename in
+         CC*)
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+           # CC pic flag -KPIC is the default.
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      linux* | k*bsd*-gnu)
+       case $cc_basename in
+         KCC*)
+           # KAI C++ Compiler
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+           ;;
+         icpc* | ecpc*)
+           # Intel C++
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+           ;;
+         pgCC*)
+           # Portland Group C++ compiler.
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           ;;
+         cxx*)
+           # Compaq C++
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      lynxos*)
+       ;;
+      m88k*)
+       ;;
+      mvs*)
+       case $cc_basename in
+         cxx*)
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      netbsd* | netbsdelf*-gnu)
+       ;;
+      osf3* | osf4* | osf5*)
+       case $cc_basename in
+         KCC*)
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+           ;;
+         RCC*)
+           # Rational C++ 2.4.1
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           ;;
+         cxx*)
+           # Digital/Compaq C++
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      psos*)
+       ;;
+      solaris*)
+       case $cc_basename in
+         CC*)
+           # Sun C++ 4.2, 5.x and Centerline C++
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+           ;;
+         gcx*)
+           # Green Hills C++ Compiler
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sunos4*)
+       case $cc_basename in
+         CC*)
+           # Sun C++ 4.x
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           ;;
+         lcc*)
+           # Lucid
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      tandem*)
+       case $cc_basename in
+         NCC*)
+           # NonStop-UX NCC 3.20
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+       case $cc_basename in
+         CC*)
+           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           ;;
+       esac
+       ;;
+      vxworks*)
+       ;;
+      *)
+       _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+       ;;
+    esac
+  fi
+],
+[
+  if test "$GCC" = yes; then
+    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    interix3*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+       ;;
+      esac
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+         _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+       ;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    newsos6)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      case $cc_basename in
+      icc* | ecc*)
+       _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+       # which looks to be a dead project)
+       _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      ccc*)
+        _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    solaris*)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+       _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+      *)
+       _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+       _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    unicos*)
+      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+
+    uts4*)
+      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
+    _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
+    [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
+AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+  _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
+  $lt_tmp_static_flag,
+  [],
+  [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
+])
+
+
+# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME])
+# ------------------------------------
+# See if the linker supports building shared libraries.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
+[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+ifelse([$1],[CXX],[
+  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix4* | aix5*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+  ;;
+  cygwin* | mingw*)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  linux* | k*bsd*-gnu)
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=no
+  ;;
+  *)
+    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+],[
+  runpath_var=
+  _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+  _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_AC_TAGVAR(archive_cmds, $1)=
+  _LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)=
+  _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+  _LT_AC_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_AC_TAGVAR(hardcode_direct, $1)=no
+  _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_AC_TAGVAR(hardcode_automatic, $1)=no
+  _LT_AC_TAGVAR(module_cmds, $1)=
+  _LT_AC_TAGVAR(module_expsym_cmds, $1)=
+  _LT_AC_TAGVAR(always_export_symbols, $1)=no
+  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_AC_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  _LT_CC_BASENAME([$compiler])
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+       _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+       # support --undefined.  This deserves some investigation.  FIXME
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(always_export_symbols, $1)=no
+      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+       # If the export-symbols file already is a .def file (1st line
+       # is EXPORTS), use it as is; otherwise, prepend...
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname.def;
+       else
+         echo EXPORTS > $output_objdir/$soname.def;
+         cat $export_symbols >> $output_objdir/$soname.def;
+       fi~
+       $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    interix3*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       tmp_addflag=
+       case $cc_basename,$host_cpu in
+       pgcc*)                          # Portland Group C compiler
+         _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag'
+         ;;
+       pgf77* | pgf90* | pgf95*)       # Portland Group f77 and f90 compilers
+         _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag -Mnomain' ;;
+       ecc*,ia64* | icc*,ia64*)                # Intel C compiler on ia64
+         tmp_addflag=' -i_dynamic' ;;
+       efc*,ia64* | ifort*,ia64*)      # Intel Fortran compiler on ia64
+         tmp_addflag=' -i_dynamic -nofor_main' ;;
+       ifc* | ifort*)                  # Intel Fortran compiler
+         tmp_addflag=' -nofor_main' ;;
+       esac
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+       if test $supports_anon_versioning = yes; then
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+         $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+       fi
+       _LT_AC_TAGVAR(link_all_deplibs, $1)=no
+      else
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+       wlarc=
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) 
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+       ;;
+       *)
+         if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+           _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+           _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+           _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+         else
+           _LT_AC_TAGVAR(ld_shlibs, $1)=no
+         fi
+       ;;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then
+      runpath_var=
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+       # Neither direct hardcoding nor static linking is supported with a
+       # broken collect2.
+       _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+       # On IA64, the linker does run time linking by default, so we don't
+       # have to do anything special.
+       aix_use_runtimelinking=no
+       exp_sym_flag='-Bexport'
+       no_entry_flag=""
+      else
+       # If we're using GNU nm, then we don't want the "-C" option.
+       # -C means demangle to AIX nm, but means don't demangle with GNU nm
+       if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+         _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+       else
+         _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
+       fi
+       aix_use_runtimelinking=no
+
+       # Test if we are trying to use run time linking or normal
+       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+       # need to do runtime linking.
+       case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+         for ld_flag in $LDFLAGS; do
+         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+           aix_use_runtimelinking=yes
+           break
+         fi
+         done
+         ;;
+       esac
+
+       exp_sym_flag='-bexport'
+       no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      _LT_AC_TAGVAR(archive_cmds, $1)=''
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+      if test "$GCC" = yes; then
+       case $host_os in aix4.[[012]]|aix4.[[012]].*)
+       # We only want to do this on AIX 4.2 and lower, the check
+       # below for broken collect2 doesn't work under 4.3+
+         collect2name=`${CC} -print-prog-name=collect2`
+         if test -f "$collect2name" && \
+          strings "$collect2name" | grep resolve_lib_name >/dev/null
+         then
+         # We have reworked collect2
+         _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+         else
+         # We have old collect2
+         _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+         _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+         fi
+         ;;
+       esac
+       shared_flag='-shared'
+       if test "$aix_use_runtimelinking" = yes; then
+         shared_flag="$shared_flag "'${wl}-G'
+       fi
+      else
+       # not using gcc
+       if test "$host_cpu" = ia64; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+       else
+         if test "$aix_use_runtimelinking" = yes; then
+           shared_flag='${wl}-G'
+         else
+           shared_flag='${wl}-bM:SRE'
+         fi
+       fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+      if test "$aix_use_runtimelinking" = yes; then
+       # Warning - without using the other runtime loading flags (-brtl),
+       # -berok will link without error, but may produce a broken library.
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       _LT_AC_SYS_LIBPATH_AIX
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+       if test "$host_cpu" = ia64; then
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+       else
+        # Determine the default libpath from the value encoded in an empty executable.
+        _LT_AC_SYS_LIBPATH_AIX
+        _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+         # Warning - without using the other run time loading flags,
+         # -berok will link without error, but may produce a broken library.
+         _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+         # Exported symbols can be pulled into shared objects from archives
+         _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+         _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+         # This is similar to how AIX traditionally builds its shared libraries.
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+       fi
+      fi
+      ;;
+
+    amigaos*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      # see comment about different semantics on the GNU ld section
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    bsdi[[45]]*)
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
+      # FIXME: Should let the user specify the lib program.
+      _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[[012]])
+         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[[012]])
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_direct, $1)=no
+      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+    if test "$GCC" = yes ; then
+       output_verbose_link_cmd='echo'
+        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+         _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         _LT_AC_TAGVAR(ld_shlibs, $1)=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    freebsd1*)
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+       _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+       # hardcode_minus_L: Not really in the search PATH,
+       # but as the default location of the library.
+       _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       case $host_cpu in
+       hppa*64*)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      else
+       case $host_cpu in
+       hppa*64*)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      fi
+      if test "$with_gnu_ld" = no; then
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+       _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       case $host_cpu in
+       hppa*64*|ia64*)
+         _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+         _LT_AC_TAGVAR(hardcode_direct, $1)=no
+         _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+         ;;
+       *)
+         _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+         _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+         ;;
+       esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    openbsd*)
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+       _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      else
+       case $host_os in
+        openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+          _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+          _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+          ;;
+        *)
+          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+          _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+          ;;
+       esac
+      fi
+      ;;
+
+    os2*)
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)     # as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      else
+       _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+       $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+       # Both c and cxx compiler support -rpath directly
+       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    solaris*)
+      _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
+      if test "$GCC" = yes; then
+       wlarc='${wl}'
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+         $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+       wlarc=''
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+       $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *)
+       # The compiler driver will combine linker options so we
+       # cannot just pass the convience library names through
+       # without $wl, iff we do not link with $LD.
+       # Luckily, gcc supports the same syntax we need for Sun Studio.
+       # Supported since Solaris 2.6 (maybe 2.5.1?)
+       case $wlarc in
+       '')
+         _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;;
+       *)
+         _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+       esac ;;
+      esac
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+       # Use $CC to link under sequent, because it throws in some extra .o
+       # files that make .init and .fini sections work.
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+       sni)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+       ;;
+       siemens)
+         ## LD is ld it makes a PLAMLIB
+         ## CC just makes a GrossModule.
+         _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+         _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+         _LT_AC_TAGVAR(hardcode_direct, $1)=no
+        ;;
+       motorola)
+         _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+       ;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+       runpath_var=LD_RUN_PATH
+       hardcode_runpath_var=yes
+       _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7*)
+      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_AC_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+  fi
+])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $_LT_AC_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+       pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1)
+        _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+        if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
+        then
+         _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+        else
+         _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+        fi
+        _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)])
+      ;;
+    esac
+  fi
+  ;;
+esac
+])# AC_LIBTOOL_PROG_LD_SHLIBS
+
+
+# _LT_AC_FILE_LTDLL_C
+# -------------------
+# Be careful that the start marker always follows a newline.
+AC_DEFUN([_LT_AC_FILE_LTDLL_C], [
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# #  ifdef __CYGWIN32__
+# #    define __CYGWIN__ __CYGWIN32__
+# #  endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+#   __hDllInstance_base = hInst;
+#   return TRUE;
+# }
+# /* ltdll.c ends here */
+])# _LT_AC_FILE_LTDLL_C
+
+
+# _LT_AC_TAGVAR(VARNAME, [TAGNAME])
+# ---------------------------------
+AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])])
+
+
+# old names
+AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
+
+# This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])
+
+AC_DEFUN([LT_AC_PROG_GCJ],
+[AC_CHECK_TOOL(GCJ, gcj, no)
+  test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+  AC_SUBST(GCJFLAGS)
+])
+
+AC_DEFUN([LT_AC_PROG_RC],
+[AC_CHECK_TOOL(RC, windres, no)
+])
+
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+# LT_AC_PROG_SED
+# --------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+AC_DEFUN([LT_AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+])
+SED=$lt_cv_path_SED
+AC_MSG_RESULT([$SED])
+])
+
+# 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.6])])
+
+# 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"])
+])
+
+# 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])])
+
+# 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.
+
+# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# ---------------------------------------------------------------------------
+# Adds support for distributing Python modules and packages.  To
+# install modules, copy them to $(pythondir), using the python_PYTHON
+# automake variable.  To install a package with the same name as the
+# automake package, install to $(pkgpythondir), or use the
+# pkgpython_PYTHON automake variable.
+#
+# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
+# locations to install python extension modules (shared libraries).
+# Another macro is required to find the appropriate flags to compile
+# extension modules.
+#
+# If your package is configured with a different prefix to python,
+# users will have to add the install directory to the PYTHONPATH
+# environment variable, or create a .pth file (see the python
+# documentation for details).
+#
+# If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will
+# cause an error if the version of python installed on the system
+# doesn't meet the requirement.  MINIMUM-VERSION should consist of
+# numbers and dots only.
+AC_DEFUN([AM_PATH_PYTHON],
+ [
+  dnl Find a Python interpreter.  Python versions prior to 1.5 are not
+  dnl supported because the default installation locations changed from
+  dnl $prefix/lib/site-python in 1.4 to $prefix/lib/python1.5/site-packages
+  dnl in 1.5.
+  m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
+                    [python python2 python2.5 python2.4 python2.3 python2.2 dnl
+python2.1 python2.0 python1.6 python1.5])
+
+  m4_if([$1],[],[
+    dnl No version check is needed.
+    # Find any Python interpreter.
+    if test -z "$PYTHON"; then
+      AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :)
+    fi
+    am_display_PYTHON=python
+  ], [
+    dnl A version check is needed.
+    if test -n "$PYTHON"; then
+      # If the user set $PYTHON, use it and don't search something else.
+      AC_MSG_CHECKING([whether $PYTHON version >= $1])
+      AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
+                             [AC_MSG_RESULT(yes)],
+                             [AC_MSG_ERROR(too old)])
+      am_display_PYTHON=$PYTHON
+    else
+      # Otherwise, try each interpreter until we find one that satisfies
+      # VERSION.
+      AC_CACHE_CHECK([for a Python interpreter with version >= $1],
+       [am_cv_pathless_PYTHON],[
+       for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do
+         test "$am_cv_pathless_PYTHON" = none && break
+         AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break])
+       done])
+      # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
+      if test "$am_cv_pathless_PYTHON" = none; then
+       PYTHON=:
+      else
+        AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
+      fi
+      am_display_PYTHON=$am_cv_pathless_PYTHON
+    fi
+  ])
+
+  if test "$PYTHON" = :; then
+  dnl Run any user-specified action, or abort.
+    m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])])
+  else
+
+  dnl Query Python for its version number.  Getting [:3] seems to be
+  dnl the best way to do this; it's what "site.py" does in the standard
+  dnl library.
+
+  AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
+    [am_cv_python_version=`$PYTHON -c "import sys; print sys.version[[:3]]"`])
+  AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
+
+  dnl Use the values of $prefix and $exec_prefix for the corresponding
+  dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX.  These are made
+  dnl distinct variables so they can be overridden if need be.  However,
+  dnl general consensus is that you shouldn't need this ability.
+
+  AC_SUBST([PYTHON_PREFIX], ['${prefix}'])
+  AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}'])
+
+  dnl At times (like when building shared libraries) you may want
+  dnl to know which OS platform Python thinks this is.
+
+  AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
+    [am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"`])
+  AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
+
+
+  dnl Set up 4 directories:
+
+  dnl pythondir -- where to install python scripts.  This is the
+  dnl   site-packages directory, not the python standard library
+  dnl   directory like in previous automake betas.  This behavior
+  dnl   is more consistent with lispdir.m4 for example.
+  dnl Query distutils for this directory.  distutils does not exist in
+  dnl Python 1.5, so we fall back to the hardcoded directory if it
+  dnl doesn't work.
+  AC_CACHE_CHECK([for $am_display_PYTHON script directory],
+    [am_cv_python_pythondir],
+    [am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')" 2>/dev/null ||
+     echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`])
+  AC_SUBST([pythondir], [$am_cv_python_pythondir])
+
+  dnl pkgpythondir -- $PACKAGE directory under pythondir.  Was
+  dnl   PYTHON_SITE_PACKAGE in previous betas, but this naming is
+  dnl   more consistent with the rest of automake.
+
+  AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE])
+
+  dnl pyexecdir -- directory for installing python extension modules
+  dnl   (shared libraries)
+  dnl Query distutils for this directory.  distutils does not exist in
+  dnl Python 1.5, so we fall back to the hardcoded directory if it
+  dnl doesn't work.
+  AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
+    [am_cv_python_pyexecdir],
+    [am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')" 2>/dev/null ||
+     echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`])
+  AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
+
+  dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
+
+  AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE])
+
+  dnl Run any user-specified action.
+  $2
+  fi
+
+])
+
+
+# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+# ---------------------------------------------------------------------------
+# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION.
+# Run ACTION-IF-FALSE otherwise.
+# This test uses sys.hexversion instead of the string equivalent (first
+# word of sys.version), in order to cope with versions such as 2.2c1.
+# hexversion has been introduced in Python 1.5.2; it's probably not
+# worth to support older versions (1.5.1 was released on October 31, 1998).
+AC_DEFUN([AM_PYTHON_CHECK_VERSION],
+ [prog="import sys, string
+# split strings by '.' and convert to numeric.  Append some zeros
+# because we need at least 4 digits for the hex conversion.
+minver = map(int, string.split('$2', '.')) + [[0, 0, 0]]
+minverhex = 0
+for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]]
+sys.exit(sys.hexversion < minverhex)"
+  AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
+
+# 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_RUN_LOG(COMMAND)
+# -------------------
+# Run COMMAND, save the exit status in ac_status, and log it.
+# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
+AC_DEFUN([AM_RUN_LOG],
+[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
+   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   (exit $ac_status); }])
+
+# 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
+
+m4_include([acinclude.m4])
diff --git a/bindings/Makefile.am b/bindings/Makefile.am
new file mode 100644 (file)
index 0000000..a0e0907
--- /dev/null
@@ -0,0 +1,56 @@
+.PHONY: python ruby
+
+if BUILD_TCL
+SUB_tcl = tcl
+endif
+
+SUBDIRS = $(SUB_tcl)
+
+# the following files are not mentioned in any other Makefile
+EXTRA_DIST = perl-piped/MANIFEST perl-piped/README perl-piped/Makefile.PL perl-piped/RRDp.pm perl-piped/t/base.t \
+            perl-shared/ntmake.pl perl-shared/MANIFEST perl-shared/README perl-shared/Makefile.PL perl-shared/RRDs.pm  perl-shared/RRDs.xs perl-shared/t/base.t \
+            ruby/CHANGES     ruby/README      ruby/extconf.rb  ruby/main.c      ruby/test.rb \
+             python/ACKNOWLEDGEMENT python/AUTHORS python/COPYING python/README python/rrd_extra.h python/rrdtoolmodule.c python/setup.py
+
+
+# add the following to the all target
+all-local:  @COMP_PERL@ @COMP_RUBY@ @COMP_PYTHON@
+
+install-data-local:
+       test -f perl-piped/Makefile && cd perl-piped && $(MAKE) install || true
+       test -f perl-shared/Makefile && cd perl-shared && $(MAKE) install || true
+       test -f ruby/Makefile && cd ruby && $(MAKE) EPREFIX=$(DESTDIR)$(exec_prefix) $(RUBY_MAKE_OPTIONS) install || true
+       test -d python/build && cd python && env BUILDLIBDIR=../../src/.libs $(PYTHON) setup.py install --skip-build --prefix=$(DESTDIR)$(prefix) --exec-prefix=$(DESTDIR)$(exec_prefix) || true
+
+# rules for buildung the ruby module
+# RUBYARCHDIR= is to work around in a makefile quirk not sure 
+# it is is the right thing todo, but it makes rrdtool build on freebsd as well
+ruby: 
+       cd ruby && $(RUBY) extconf.rb && $(MAKE) EPREFIX=$(exec_prefix) $(RUBY_MAKE_OPTIONS) RUBYARCHDIR=
+
+# rules for buildung the pyton module
+python:
+       cd python && env BUILDLIBDIR=../../src/.libs $(PYTHON) setup.py build_ext --rpath=$(libdir) && env LIBDIR=../../src/.libs $(PYTHON) setup.py build
+
+# rules for building the perl module
+perl_piped: perl-piped/Makefile
+       cd perl-piped && $(MAKE)
+
+perl-piped/Makefile: perl-piped/Makefile.PL
+       cd perl-piped && $(PERL) Makefile.PL $(PERL_MAKE_OPTIONS)
+
+perl_shared: perl-shared/Makefile
+       cd perl-shared && $(MAKE)
+
+perl-shared/Makefile: perl-shared/Makefile.PL
+       cd perl-shared && $(PERL) Makefile.PL $(PERLFLAGS) $(PERL_MAKE_OPTIONS) RPATH=$(libdir)
+# LIBS="$(LDFLAGS) $(LIBS)" $(PERLFLAGS) $(PERL_MAKE_OPTIONS)
+
+clean-local:
+       test -f perl-piped/Makefile && cd perl-piped && $(MAKE) clean || true
+       test -f perl-piped/Makefile && rm perl-piped/Makefile || true
+       test -f perl-shared/Makefile && cd perl-shared && $(MAKE) clean || true
+       test -f perl-shared/Makefile && rm -f perl-shared/Makefile || true 
+       test -f ruby/Makefile && cd ruby && $(MAKE) clean && rm Makefile || true 
+       test -d python/build && cd python &&  rm -rf build || true
+##END##
diff --git a/bindings/Makefile.in b/bindings/Makefile.in
new file mode 100644 (file)
index 0000000..ce62cd1
--- /dev/null
@@ -0,0 +1,585 @@
+# Makefile.in generated by automake 1.9.6 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@
+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 = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = bindings
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+       $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/rrd_config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+       html-recursive info-recursive install-data-recursive \
+       install-exec-recursive install-info-recursive \
+       install-recursive installcheck-recursive installdirs-recursive \
+       pdf-recursive ps-recursive uninstall-info-recursive \
+       uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = tcl
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALL_LIBS = @ALL_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_MULTITHREAD_FALSE = @BUILD_MULTITHREAD_FALSE@
+BUILD_MULTITHREAD_TRUE = @BUILD_MULTITHREAD_TRUE@
+BUILD_RRDCGI_FALSE = @BUILD_RRDCGI_FALSE@
+BUILD_RRDCGI_TRUE = @BUILD_RRDCGI_TRUE@
+BUILD_TCL_FALSE = @BUILD_TCL_FALSE@
+BUILD_TCL_SITE_FALSE = @BUILD_TCL_SITE_FALSE@
+BUILD_TCL_SITE_TRUE = @BUILD_TCL_SITE_TRUE@
+BUILD_TCL_TRUE = @BUILD_TCL_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMP_PERL = @COMP_PERL@
+COMP_PYTHON = @COMP_PYTHON@
+COMP_RUBY = @COMP_RUBY@
+CORE_LIBS = @CORE_LIBS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MULTITHREAD_CFLAGS = @MULTITHREAD_CFLAGS@
+MULTITHREAD_LDFLAGS = @MULTITHREAD_LDFLAGS@
+NROFF = @NROFF@
+NUMVERS = @NUMVERS@
+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@
+PERL = @PERL@
+PERLCC = @PERLCC@
+PERLCCFLAGS = @PERLCCFLAGS@
+PERLFLAGS = @PERLFLAGS@
+PERLLD = @PERLLD@
+PERLLDFLAGS = @PERLLDFLAGS@
+PERL_CC = @PERL_CC@
+PERL_MAKE_OPTIONS = @PERL_MAKE_OPTIONS@
+PERL_VERSION = @PERL_VERSION@
+PKGCONFIG = @PKGCONFIG@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+RRDDOCDIR = @RRDDOCDIR@
+RRDGRAPH_YLEGEND_ANGLE = @RRDGRAPH_YLEGEND_ANGLE@
+RRD_DEFAULT_FONT = @RRD_DEFAULT_FONT@
+RUBY = @RUBY@
+RUBY_MAKE_OPTIONS = @RUBY_MAKE_OPTIONS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@
+TCL_PACKAGE_DIR = @TCL_PACKAGE_DIR@
+TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@
+TCL_PREFIX = @TCL_PREFIX@
+TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@
+TCL_SHLIB_LD = @TCL_SHLIB_LD@
+TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@
+TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
+TCL_VERSION = @TCL_VERSION@
+TROFF = @TROFF@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_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 = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+@BUILD_TCL_TRUE@SUB_tcl = tcl
+SUBDIRS = $(SUB_tcl)
+
+# the following files are not mentioned in any other Makefile
+EXTRA_DIST = perl-piped/MANIFEST perl-piped/README perl-piped/Makefile.PL perl-piped/RRDp.pm perl-piped/t/base.t \
+            perl-shared/ntmake.pl perl-shared/MANIFEST perl-shared/README perl-shared/Makefile.PL perl-shared/RRDs.pm  perl-shared/RRDs.xs perl-shared/t/base.t \
+            ruby/CHANGES     ruby/README      ruby/extconf.rb  ruby/main.c      ruby/test.rb \
+             python/ACKNOWLEDGEMENT python/AUTHORS python/COPYING python/README python/rrd_extra.h python/rrdtoolmodule.c python/setup.py
+
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  bindings/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --foreign  bindings/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+distclean-libtool:
+       -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+       @failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       target=`echo $@ | sed s/-recursive//`; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           dot_seen=yes; \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done; \
+       if test "$$dot_seen" = "no"; then \
+         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+       fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+       @failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       case "$@" in \
+         distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+         *) list='$(SUBDIRS)' ;; \
+       esac; \
+       rev=''; for subdir in $$list; do \
+         if test "$$subdir" = "."; then :; else \
+           rev="$$subdir $$rev"; \
+         fi; \
+       done; \
+       rev="$$rev ."; \
+       target=`echo $@ | sed s/-recursive//`; \
+       for subdir in $$rev; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done && test -z "$$fail"
+tags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+       done
+ctags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+       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: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+         include_option=--etags-include; \
+         empty_fix=.; \
+       else \
+         include_option=--include; \
+         empty_fix=; \
+       fi; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test ! -f $$subdir/TAGS || \
+             tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+         fi; \
+       done; \
+       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; }'`; \
+       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: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       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; }'`; \
+       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)
+       $(mkdir_p) $(distdir)/perl-piped $(distdir)/perl-piped/t $(distdir)/perl-shared $(distdir)/perl-shared/t $(distdir)/python $(distdir)/ruby
+       @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
+       list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test -d "$(distdir)/$$subdir" \
+           || $(mkdir_p) "$(distdir)/$$subdir" \
+           || exit 1; \
+           distdir=`$(am__cd) $(distdir) && pwd`; \
+           top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+           (cd $$subdir && \
+             $(MAKE) $(AM_MAKEFLAGS) \
+               top_distdir="$$top_distdir" \
+               distdir="$$distdir/$$subdir" \
+               distdir) \
+             || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-recursive
+all-am: Makefile all-local
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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-recursive
+
+clean-am: clean-generic clean-libtool clean-local mostlyclean-am
+
+distclean: distclean-recursive
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+       distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-data-local
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am all-local check \
+       check-am clean clean-generic clean-libtool clean-local \
+       clean-recursive ctags ctags-recursive distclean \
+       distclean-generic distclean-libtool distclean-recursive \
+       distclean-tags distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am \
+       install-data-local install-exec install-exec-am install-info \
+       install-info-am install-man install-strip installcheck \
+       installcheck-am installdirs installdirs-am maintainer-clean \
+       maintainer-clean-generic maintainer-clean-recursive \
+       mostlyclean mostlyclean-generic mostlyclean-libtool \
+       mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+       uninstall uninstall-am uninstall-info-am
+
+.PHONY: python ruby
+
+# add the following to the all target
+all-local:  @COMP_PERL@ @COMP_RUBY@ @COMP_PYTHON@
+
+install-data-local:
+       test -f perl-piped/Makefile && cd perl-piped && $(MAKE) install || true
+       test -f perl-shared/Makefile && cd perl-shared && $(MAKE) install || true
+       test -f ruby/Makefile && cd ruby && $(MAKE) EPREFIX=$(DESTDIR)$(exec_prefix) $(RUBY_MAKE_OPTIONS) install || true
+       test -d python/build && cd python && env BUILDLIBDIR=../../src/.libs $(PYTHON) setup.py install --skip-build --prefix=$(DESTDIR)$(prefix) --exec-prefix=$(DESTDIR)$(exec_prefix) || true
+
+# rules for buildung the ruby module
+# RUBYARCHDIR= is to work around in a makefile quirk not sure 
+# it is is the right thing todo, but it makes rrdtool build on freebsd as well
+ruby: 
+       cd ruby && $(RUBY) extconf.rb && $(MAKE) EPREFIX=$(exec_prefix) $(RUBY_MAKE_OPTIONS) RUBYARCHDIR=
+
+# rules for buildung the pyton module
+python:
+       cd python && env BUILDLIBDIR=../../src/.libs $(PYTHON) setup.py build_ext --rpath=$(libdir) && env LIBDIR=../../src/.libs $(PYTHON) setup.py build
+
+# rules for building the perl module
+perl_piped: perl-piped/Makefile
+       cd perl-piped && $(MAKE)
+
+perl-piped/Makefile: perl-piped/Makefile.PL
+       cd perl-piped && $(PERL) Makefile.PL $(PERL_MAKE_OPTIONS)
+
+perl_shared: perl-shared/Makefile
+       cd perl-shared && $(MAKE)
+
+perl-shared/Makefile: perl-shared/Makefile.PL
+       cd perl-shared && $(PERL) Makefile.PL $(PERLFLAGS) $(PERL_MAKE_OPTIONS) RPATH=$(libdir)
+# LIBS="$(LDFLAGS) $(LIBS)" $(PERLFLAGS) $(PERL_MAKE_OPTIONS)
+
+clean-local:
+       test -f perl-piped/Makefile && cd perl-piped && $(MAKE) clean || true
+       test -f perl-piped/Makefile && rm perl-piped/Makefile || true
+       test -f perl-shared/Makefile && cd perl-shared && $(MAKE) clean || true
+       test -f perl-shared/Makefile && rm -f perl-shared/Makefile || true 
+       test -f ruby/Makefile && cd ruby && $(MAKE) clean && rm Makefile || true 
+       test -d python/build && cd python &&  rm -rf build || true
+# 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/bindings/perl-piped/MANIFEST b/bindings/perl-piped/MANIFEST
new file mode 100644 (file)
index 0000000..a530ade
--- /dev/null
@@ -0,0 +1,5 @@
+MANIFEST
+README
+Makefile.PL
+RRDp.pm
+t/base.t
diff --git a/bindings/perl-piped/Makefile.PL b/bindings/perl-piped/Makefile.PL
new file mode 100644 (file)
index 0000000..5c1a98f
--- /dev/null
@@ -0,0 +1,10 @@
+use ExtUtils::MakeMaker;
+
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+    'NAME'         => 'RRDp',
+    'VERSION'      => '0.99.0', # finds $VERSION
+    'linkext'   => {LINKTYPE => ''},
+    'dist'    =>    {COMPRESS=>'gzip', SUFFIX=>'gz'},
+);
diff --git a/bindings/perl-piped/README b/bindings/perl-piped/README
new file mode 100644 (file)
index 0000000..672061d
--- /dev/null
@@ -0,0 +1,5 @@
+This is a Perl module for using RRDtool process via a set of pipes.
+
+perl Makefile.PL
+make test
+make install
diff --git a/bindings/perl-piped/RRDp.pm b/bindings/perl-piped/RRDp.pm
new file mode 100644 (file)
index 0000000..3dce004
--- /dev/null
@@ -0,0 +1,200 @@
+package RRDp;
+
+=head1 NAME
+
+RRDp - Attach RRDtool from within a perl script via a set of pipes;
+
+=head1 SYNOPSIS
+
+use B<RRDp>
+
+B<RRDp::start> I<path to RRDtool executable>
+
+B<RRDp::cmd>  I<rrdtool commandline>
+
+$answer = B<RRD::read>
+
+$status = B<RRD::end>
+
+B<$RRDp::user>,  B<$RRDp::sys>, B<$RRDp::real>, B<$RRDp::error_mode>, B<$RRDp::error>
+
+=head1 DESCRIPTION
+
+With this module you can safely communicate with the RRDtool. 
+
+After every B<RRDp::cmd> you have to issue an B<RRDp::read> command to get
+B<RRDtool>s answer to your command. The answer is returned as a pointer,
+in order to speed things up. If the last command did not return any
+data, B<RRDp::read> will return an undefined variable. 
+
+If you import the PERFORMANCE variables into your namespace, 
+you can access RRDtool's internal performance measurements.
+
+=over 8
+
+=item  use B<RRDp>
+
+Load the RRDp::pipe module.
+
+=item B<RRDp::start> I<path to RRDtool executable>
+
+start RRDtool. The argument must be the path to the RRDtool executable
+
+=item B<RRDp::cmd> I<rrdtool commandline>
+
+pass commands on to RRDtool. check the RRDtool documentation for
+more info on the RRDtool commands.
+
+=item $answer = B<RRDp::read>
+
+read RRDtool's response to your command. Note that the $answer variable will
+only contain a pointer to the returned data. The reason for this is, that
+RRDtool can potentially return quite excessive amounts of data
+and we don't want to copy this around in memory. So when you want to 
+access the contents of $answer you have to use $$answer which dereferences
+the variable.
+
+=item $status = B<RRDp::end>
+
+terminates RRDtool and returns RRDtool's status ... 
+
+=item B<$RRDp::user>,  B<$RRDp::sys>, B<$RRDp::real>
+
+these variables will contain totals of the user time, system time and
+real time as seen by RRDtool.  User time is the time RRDtool is
+running, System time is the time spend in system calls and real time
+is the total time RRDtool has been running.
+
+The difference between user + system and real is the time spent
+waiting for things like the hard disk and new input from the perl
+script.
+
+=item B<$RRDp::error_mode> and B<$RRDp::error>
+
+If you set the variable $RRDp::error_mode to the value 'catch' before you run RRDp::read a potential
+ERROR message will not cause the program to abort but will be returned in this variable. If no error
+occurs the variable will be empty.
+
+ $RRDp::error_mode = 'catch';
+ RRDp::cmd qw(info file.rrd);
+ print $RRDp::error if $RRDp::error;
+
+=back
+
+
+=head1 EXAMPLE
+
+ use RRDp;
+ RRDp::start "/usr/local/bin/rrdtool";
+ RRDp::cmd   qw(create demo.rrd --step 100 
+               DS:in:GAUGE:100:U:U
+              RRA:AVERAGE:0.5:1:10);
+ $answer = RRDp::read;
+ print $$answer;
+ ($usertime,$systemtime,$realtime) =  ($RRDp::user,$RRDp::sys,$RRDp::real);
+
+=head1 SEE ALSO
+
+For more information on how to use RRDtool, check the manpages.
+
+=head1 AUTHOR
+
+Tobias Oetiker <tobi@oetiker.ch>
+
+=cut
+#'  this is to make cperl.el happy
+
+use strict;
+use Fcntl;
+use Carp;
+use IO::Handle;
+use IPC::Open2;
+use vars qw($Sequence $RRDpid $VERSION);
+my $Sequence;
+my $RRDpid;
+
+# Prototypes
+
+sub start ($);
+sub cmd (@);
+sub end ();
+sub read ();
+
+$VERSION=1.2026;
+
+sub start ($){
+  croak "rrdtool is already running"
+    if defined $Sequence;
+  $Sequence = 'S';    
+  my $rrdtool = shift @_;    
+  $RRDpid = open2 \*RRDreadHand,\*RRDwriteHand, $rrdtool,"-" 
+    or croak "Can't Start rrdtool: $!";
+  RRDwriteHand->autoflush(); #flush after every write    
+  fcntl RRDreadHand, F_SETFL,O_NONBLOCK|O_NDELAY; #make readhandle NON BLOCKING
+  return $RRDpid;
+}
+
+
+sub read () {
+  croak "RRDp::read can only be called after RRDp::cmd" 
+    unless $Sequence eq 'C';
+  $RRDp::error = undef;
+  $Sequence = 'R';
+  my $inmask = 0;
+  my $srbuf;
+  my $minibuf;
+  my $buffer;
+  my $nfound;
+  my $timeleft;
+  my $ERR = 0;
+  vec($inmask,fileno(RRDreadHand),1) = 1; # setup select mask for Reader
+  while (1) {
+    my $rout;    
+    $nfound = select($rout=$inmask,undef,undef,2);
+    if ($nfound == 0 ) {
+      # here, we could do something sensible ...
+      next;
+    }
+    sysread(RRDreadHand,$srbuf,4096);
+    $minibuf .= $srbuf;
+    while ($minibuf =~ s|^(.+?)\n||s) {
+      my $line = $1;
+      # print $line,"\n";      
+      $RRDp::error = undef;
+      if ($line =~  m|^ERROR|) {       
+       $RRDp::error_mode eq 'catch' ? $RRDp::error = $line : croak $line;
+       $ERR = 1;
+      } 
+      elsif ($line =~ m|^OK u:([\d\.]+) s:([\d\.]+) r:([\d\.]+)|){
+       ($RRDp::sys,$RRDp::user,$RRDp::real)=($1,$2,$3);
+       return $ERR == 1 ? undef : \$buffer;
+      } else {
+       $buffer .= $line. "\n";
+      }
+    }
+  }
+}
+
+sub cmd (@){
+  croak "RRDp::cmd can only be called after RRDp::read or RRDp::start"
+    unless $Sequence eq 'R' or $Sequence eq 'S';
+  $Sequence = 'C';
+  my $cmd = join " ", @_;
+  if ($Sequence ne 'S') {
+  }
+  $cmd =~ s/\n/ /gs;
+  $cmd =~ s/\s/ /gs;
+  print RRDwriteHand "$cmd\n";
+}
+
+sub end (){
+  croak "RRDp::end can only be called after RRDp::start"
+    unless $Sequence;
+  close RRDwriteHand;
+  close RRDreadHand;
+  $Sequence = undef;
+  waitpid $RRDpid,0;
+  return $?
+}
+
+1;
diff --git a/bindings/perl-piped/t/base.t b/bindings/perl-piped/t/base.t
new file mode 100755 (executable)
index 0000000..5f0b2ae
--- /dev/null
@@ -0,0 +1,42 @@
+#! /usr/bin/perl 
+
+# this exercises just the perl module .. not RRDtool as such ... 
+
+BEGIN { $| = 1; print "1..5\n"; }
+END {
+  print "not ok 1\n" unless $loaded;
+  unlink "demo.rrd";
+}
+
+sub ok
+{
+    $ok_count++;
+    my($what, $result) = @_ ;
+    print "not " unless $result;
+    print "ok $ok_count $what\n";
+}
+
+use RRDp;
+
+$loaded = 1;
+$ok_count = 1;
+
+print "ok 1 module load\n";
+
+ok("RRDp::start", RRDp::start "../../src/rrdtool" > 0);
+
+$now=time();
+RRDp::cmd qw(create demo.rrd --start ), $now, qw(--step 100 ),
+  qw( DS:in:GAUGE:100:U:U RRA:AVERAGE:0.5:1:10 );
+
+$answer = RRDp::read;
+ok("RRDp::cmd",  -s "demo.rrd" );
+
+RRDp::cmd qw(last demo.rrd);
+$answer = RRDp::read;
+
+ok("RRDp::read", $$answer =~ /$now/);
+
+$status = RRDp::end;
+
+ok("RRDp::end", $status == 0);
diff --git a/bindings/perl-shared/MANIFEST b/bindings/perl-shared/MANIFEST
new file mode 100644 (file)
index 0000000..664d231
--- /dev/null
@@ -0,0 +1,7 @@
+ntmake.pl
+MANIFEST
+README
+Makefile.PL
+RRDs.pm
+RRDs.xs
+t/base.t
diff --git a/bindings/perl-shared/Makefile.PL b/bindings/perl-shared/Makefile.PL
new file mode 100644 (file)
index 0000000..863444c
--- /dev/null
@@ -0,0 +1,37 @@
+use ExtUtils::MakeMaker;
+use Config;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+
+# if the last argument when calling Makefile.PL is RPATH=/... and ... is the
+# path to librrd.so then the Makefile will be written such that RRDs.so knows
+# where to find librrd.so later on ... 
+my $R="";
+if ($ARGV[-1] =~ /RPATH=(\S+)/){
+       pop @ARGV;
+       my $rp = $1;
+       for ($^O){
+               /linux/   && do{ $R = "-Wl,--rpath -Wl,$rp"};
+               /hpux/    && do{ $R = "+b$rp"};
+               /solaris/ && do{ $R = "-R$rp"};
+                /aix/     && do{ $R = "-Wl,-blibpath:$rp"};
+       }
+}
+
+# darwin works without this because librrd contains its
+# install_name which will includes the final location of the
+# library after it is installed. This install_name gets transfered
+# to the perl shared object.
+
+my $librrd = "-L../../src/.libs/ $R -lrrd";
+
+WriteMakefile(
+    'NAME'         => 'RRDs',
+    'VERSION_FROM' => 'RRDs.pm', # finds $VERSION
+    'DEFINE'      => "-DPERLPATCHLEVEL=$Config{PATCHLEVEL}",
+    'INC'          => '-I../../src',
+    # Perl will figure out which one is valid
+    'dynamic_lib'  => {'OTHERLDFLAGS' => "$librrd -lm"},
+    'realclean'    => {FILES => 't/demo?.rrd t/demo?.png' }
+);
+
diff --git a/bindings/perl-shared/README b/bindings/perl-shared/README
new file mode 100644 (file)
index 0000000..0918ecf
--- /dev/null
@@ -0,0 +1,12 @@
+These are the Perl bindings for rrdtool as a shared library. To compile do
+the following:
+
+perl Makefile.PL
+make test
+
+(win32 users try perl ntmake.pl)
+
+* if dynamic linking does not work, try
+
+perl Makefile.PL LINKTYPE=static
+make test
diff --git a/bindings/perl-shared/RRDs.pm b/bindings/perl-shared/RRDs.pm
new file mode 100644 (file)
index 0000000..2c02dad
--- /dev/null
@@ -0,0 +1,145 @@
+package RRDs;
+
+use strict;
+use vars qw(@ISA $VERSION);
+
+@ISA = qw(DynaLoader);
+
+require DynaLoader;
+
+$VERSION=1.2026;
+
+bootstrap RRDs $VERSION;
+
+1;
+__END__
+
+=head1 NAME
+
+RRDs - Access RRDtool as a shared module
+
+=head1 SYNOPSIS
+
+  use RRDs;
+  RRDs::error
+  RRDs::last ...
+  RRDs::info ...
+  RRDs::create ...
+  RRDs::update ...
+  RRDs::updatev ...
+  RRDs::graph ...
+  RRDs::fetch ...
+  RRDs::tune ...
+  RRDs::times(start, end)
+  RRDs::dump ...
+  RRDs::restore ...
+
+=head1 DESCRIPTION
+
+=head2 Calling Sequence
+
+This module accesses RRDtool functionality directly from within perl. The
+arguments to the functions listed in the SYNOPSIS are explained in the regular
+RRDtool documentation. The commandline call
+
+ rrdtool update mydemo.rrd --template in:out N:12:13
+
+gets turned into
+
+ RRDs::update ("mydemo.rrd", "--template", "in:out", "N:12:13");
+
+Note that
+
+ --template=in:out
+
+is also valid.
+
+The RRDs::times function takes two parameters:  a "start" and "end" time.
+These should be specified in the B<AT-STYLE TIME SPECIFICATION> format
+used by RRDtool.  See the B<rrdfetch> documentation for a detailed
+explanation on how to specify time.
+
+=head2 Error Handling
+
+The RRD functions will not abort your program even when they can not make
+sense out of the arguments you fed them.
+
+The function RRDs::error should be called to get the error status
+after each function call. If RRDs::error does not return anything
+then the previous function has completed its task successfully.
+
+ use RRDs;
+ RRDs::update ("mydemo.rrd","N:12:13");
+ my $ERR=RRDs::error;
+ die "ERROR while updating mydemo.rrd: $ERR\n" if $ERR;
+
+=head2 Return Values
+
+The functions RRDs::last, RRDs::graph, RRDs::info, RRDs::fetch and RRDs::times
+return their findings.
+
+B<RRDs::last> returns a single INTEGER representing the last update time.
+
+ $lastupdate = RRDs::last ...
+
+B<RRDs::graph> returns an pointer to an ARRAY containing the x-size and y-size of the
+created image and results of the PRINT arguments.
+
+ ($averages,$xsize,$ysize) = RRDs::graph ...
+ print "Imagesize: ${xsize}x${ysize}\n";
+ print "Averages: ", (join ", ", @$averages);
+
+B<RRDs::info> returns a pointer to a hash. The keys of the hash
+represent the property names of the RRD and the values of the hash are
+the values of the properties.  
+
+ $hash = RRDs::info "example.rrd";
+ foreach my $key (keys %$hash){
+   print "$key = $$hash{$key}\n";
+ }
+
+B<RRDs::updatev> also returns a pointer to hash. The keys of the hash
+are concatenated strings of a timestamp, RRA index, and data source name for
+each consolidated data point (CDP) written to disk as a result of the
+current update call. The hash values are CDP values.
+
+B<RRDs::fetch> is the most complex of
+the pack regarding return values. There are 4 values. Two normal
+integers, a pointer to an array and a pointer to a array of pointers.
+
+  my ($start,$step,$names,$data) = RRDs::fetch ... 
+  print "Start:       ", scalar localtime($start), " ($start)\n";
+  print "Step size:   $step seconds\n";
+  print "DS names:    ", join (", ", @$names)."\n";
+  print "Data points: ", $#$data + 1, "\n";
+  print "Data:\n";
+  foreach my $line (@$data) {
+    print "  ", scalar localtime($start), " ($start) ";
+    $start += $step;
+    foreach my $val (@$line) {
+      printf "%12.1f ", $val;
+    }
+    print "\n";
+  }
+
+B<RRDs::times> returns two integers which are the number of seconds since
+epoch (1970-01-01) for the supplied "start" and "end" arguments, respectively.
+
+See the examples directory for more ways to use this extension.
+
+=head1 NOTE
+
+If you are manipulating the TZ variable you should also call the posixs
+function tzset to initialize all internal state of the library for properly
+operating in the timezone of your choice.
+
+ use POSIX qw(tzset);
+ $ENV{TZ} = 'CET';   
+ POSIX::tzset();     
+
+
+=head1 AUTHOR
+
+Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
+
+=cut
diff --git a/bindings/perl-shared/RRDs.xs b/bindings/perl-shared/RRDs.xs
new file mode 100644 (file)
index 0000000..f84efef
--- /dev/null
@@ -0,0 +1,433 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+/*
+ * rrd_tool.h includes config.h, but at least on Ubuntu Breezy Badger
+ * 5.10 with gcc 4.0.2, the C preprocessor picks up Perl's config.h
+ * which is included from the Perl includes and never reads rrdtool's
+ * config.h.  Without including rrdtool's config.h, this module does
+ * not compile, so include it here with an explicit path.
+ *
+ * Because rrdtool's config.h redefines VERSION which is originally
+ * set via Perl's Makefile.PL and passed down to the C compiler's
+ * command line, save the original value and reset it after the
+ * includes.
+ */
+#define VERSION_SAVED VERSION
+#undef VERSION
+#include "../../rrd_config.h"
+#include "../../src/rrd_tool.h"
+#undef VERSION
+#define VERSION VERSION_SAVED
+#undef VERSION_SAVED
+
+/* perl 5.004 compatibility */
+#if PERLPATCHLEVEL < 5 
+#define PL_sv_undef sv_undef
+#endif
+
+
+#define rrdcode(name) \
+               argv = (char **) malloc((items+1)*sizeof(char *));\
+               argv[0] = "dummy";\
+               for (i = 0; i < items; i++) { \
+                   STRLEN len; \
+                   char *handle= SvPV(ST(i),len);\
+                   /* actually copy the data to make sure possible modifications \
+                      on the argv data does not backfire into perl */ \
+                   argv[i+1] = (char *) malloc((strlen(handle)+1)*sizeof(char)); \
+                   strcpy(argv[i+1],handle); \
+               } \
+               rrd_clear_error();\
+               RETVAL=name(items+1,argv); \
+               for (i=0; i < items; i++) {\
+                   free(argv[i+1]);\
+               } \
+               free(argv);\
+               \
+               if (rrd_test_error()) XSRETURN_UNDEF;
+
+#define hvs(VAL) hv_store_ent(hash, sv_2mortal(newSVpv(data->key,0)),VAL,0)                
+
+#define rrdinfocode(name) \
+               /* prepare argument list */ \
+               argv = (char **) malloc((items+1)*sizeof(char *)); \
+               argv[0] = "dummy"; \
+               for (i = 0; i < items; i++) { \
+                   STRLEN len; \
+                   char *handle= SvPV(ST(i),len); \
+                   /* actually copy the data to make sure possible modifications \
+                      on the argv data does not backfire into perl */ \
+                   argv[i+1] = (char *) malloc((strlen(handle)+1)*sizeof(char)); \
+                   strcpy(argv[i+1],handle); \
+               } \
+                rrd_clear_error(); \
+                data=name(items+1, argv); \
+                for (i=0; i < items; i++) { \
+                   free(argv[i+1]); \
+               } \
+               free(argv); \
+                if (rrd_test_error()) XSRETURN_UNDEF; \
+                hash = newHV(); \
+                while (data) { \
+                   save=data; \
+               /* the newSV will get copied by hv so we create it as a mortal \
+           to make sure it does not keep hanging round after the fact */ \
+                   switch (data->type) { \
+                   case RD_I_VAL: \
+                       if (isnan(data->value.u_val)) \
+                           hvs(&PL_sv_undef); \
+                       else \
+                           hvs(newSVnv(data->value.u_val)); \
+                       break; \
+                       case RD_I_INT: \
+                       hvs(newSViv(data->value.u_int)); \
+                       break; \
+                   case RD_I_CNT: \
+                       hvs(newSViv(data->value.u_cnt)); \
+                       break; \
+                   case RD_I_STR: \
+                       hvs(newSVpv(data->value.u_str,0)); \
+                       rrd_freemem(data->value.u_str); \
+                       break; \
+                   } \
+                   rrd_freemem(data->key); \
+                   data = data->next; \
+                   rrd_freemem(save); \
+                   } \
+            rrd_freemem(data); \
+            RETVAL = newRV_noinc((SV*)hash);
+
+/*
+ * should not be needed if libc is linked (see ntmake.pl)
+#ifdef WIN32
+ #define free free
+ #define malloc malloc
+ #define realloc realloc
+#endif
+*/
+
+
+MODULE = RRDs  PACKAGE = RRDs  PREFIX = rrd_
+
+BOOT:
+#ifdef MUST_DISABLE_SIGFPE
+       signal(SIGFPE,SIG_IGN);
+#endif
+#ifdef MUST_DISABLE_FPMASK
+       fpsetmask(0);
+#endif 
+       
+
+SV*
+rrd_error()
+       CODE:
+               if (! rrd_test_error()) XSRETURN_UNDEF;
+                RETVAL = newSVpv(rrd_get_error(),0);
+       OUTPUT:
+               RETVAL
+
+       
+int
+rrd_last(...)
+      PROTOTYPE: @
+      PREINIT:
+      int i;
+      char **argv;
+      CODE:
+              rrdcode(rrd_last);
+      OUTPUT:
+            RETVAL
+
+int
+rrd_first(...)
+      PROTOTYPE: @
+      PREINIT:
+      int i;
+      char **argv;
+      CODE:
+              rrdcode(rrd_first);
+      OUTPUT:
+            RETVAL
+
+
+int
+rrd_create(...)
+       PROTOTYPE: @    
+       PREINIT:
+        int i;
+       char **argv;
+       CODE:
+               rrdcode(rrd_create);
+               RETVAL = 1;
+        OUTPUT:
+               RETVAL
+
+
+int
+rrd_update(...)
+       PROTOTYPE: @    
+       PREINIT:
+        int i;
+       char **argv;
+       CODE:
+               rrdcode(rrd_update);
+                       RETVAL = 1;
+       OUTPUT:
+               RETVAL
+
+
+int
+rrd_tune(...)
+       PROTOTYPE: @    
+       PREINIT:
+        int i;
+       char **argv;
+       CODE:
+               rrdcode(rrd_tune);
+                       RETVAL = 1;
+       OUTPUT:
+               RETVAL
+
+
+void
+rrd_graph(...)
+       PROTOTYPE: @    
+       PREINIT:
+       char **calcpr=NULL;
+       int i,xsize,ysize;
+       double ymin,ymax;
+       char **argv;
+       AV *retar;
+       PPCODE:
+               argv = (char **) malloc((items+1)*sizeof(char *));
+               argv[0] = "dummy";
+               for (i = 0; i < items; i++) { 
+                   STRLEN len;
+                   char *handle = SvPV(ST(i),len);
+                   /* actually copy the data to make sure possible modifications
+                      on the argv data does not backfire into perl */ 
+                   argv[i+1] = (char *) malloc((strlen(handle)+1)*sizeof(char));
+                   strcpy(argv[i+1],handle);
+               }
+               rrd_clear_error();
+               rrd_graph(items+1,argv,&calcpr,&xsize,&ysize,NULL,&ymin,&ymax); 
+               for (i=0; i < items; i++) {
+                   free(argv[i+1]);
+               }
+               free(argv);
+
+               if (rrd_test_error()) {
+                       if(calcpr)
+                          for(i=0;calcpr[i];i++)
+                               rrd_freemem(calcpr[i]);
+                       XSRETURN_UNDEF;
+               }
+               retar=newAV();
+               if(calcpr){
+                       for(i=0;calcpr[i];i++){
+                                av_push(retar,newSVpv(calcpr[i],0));
+                                rrd_freemem(calcpr[i]);
+                       }
+                       rrd_freemem(calcpr);
+               }
+               EXTEND(sp,4);
+               PUSHs(sv_2mortal(newRV_noinc((SV*)retar)));
+               PUSHs(sv_2mortal(newSViv(xsize)));
+               PUSHs(sv_2mortal(newSViv(ysize)));
+
+void
+rrd_fetch(...)
+       PROTOTYPE: @    
+       PREINIT:
+               time_t        start,end;                
+               unsigned long step, ds_cnt,i,ii;
+               rrd_value_t   *data,*datai;
+               char **argv;
+               char **ds_namv;
+               AV *retar,*line,*names;
+       PPCODE:
+               argv = (char **) malloc((items+1)*sizeof(char *));
+               argv[0] = "dummy";
+               for (i = 0; i < items; i++) { 
+                   STRLEN len;
+                   char *handle= SvPV(ST(i),len);
+                   /* actually copy the data to make sure possible modifications
+                      on the argv data does not backfire into perl */ 
+                   argv[i+1] = (char *) malloc((strlen(handle)+1)*sizeof(char));
+                   strcpy(argv[i+1],handle);
+               }
+               rrd_clear_error();
+               rrd_fetch(items+1,argv,&start,&end,&step,&ds_cnt,&ds_namv,&data); 
+               for (i=0; i < items; i++) {
+                   free(argv[i+1]);
+               }
+               free(argv);
+               if (rrd_test_error()) XSRETURN_UNDEF;
+                /* convert the ds_namv into perl format */
+               names=newAV();
+               for (ii = 0; ii < ds_cnt; ii++){
+                   av_push(names,newSVpv(ds_namv[ii],0));
+                   rrd_freemem(ds_namv[ii]);
+               }
+               rrd_freemem(ds_namv);                   
+               /* convert the data array into perl format */
+               datai=data;
+               retar=newAV();
+               for (i = start+step; i <= end; i += step){
+                       line = newAV();
+                       for (ii = 0; ii < ds_cnt; ii++){
+                         av_push(line,(isnan(*datai) ? &PL_sv_undef : newSVnv(*datai)));
+                         datai++;
+                       }
+                       av_push(retar,newRV_noinc((SV*)line));
+               }
+               rrd_freemem(data);
+               EXTEND(sp,5);
+               PUSHs(sv_2mortal(newSViv(start+step)));
+               PUSHs(sv_2mortal(newSViv(step)));
+               PUSHs(sv_2mortal(newRV_noinc((SV*)names)));
+               PUSHs(sv_2mortal(newRV_noinc((SV*)retar)));
+
+void
+rrd_times(start, end)
+         char *start
+         char *end
+       PREINIT:
+               struct  rrd_time_value start_tv, end_tv;
+               char    *parsetime_error = NULL;
+               time_t  start_tmp, end_tmp;
+       PPCODE:
+               rrd_clear_error();
+               if( (parsetime_error = parsetime( start, &start_tv))) {
+                       rrd_set_error( "start time: %s", parsetime_error);
+                       XSRETURN_UNDEF;
+               }
+               if( (parsetime_error = parsetime( end, &end_tv))) {
+                       rrd_set_error( "end time: %s", parsetime_error);
+                       XSRETURN_UNDEF;
+               }
+               if( proc_start_end( &start_tv, &end_tv, &start_tmp, &end_tmp) == -1) {
+                       XSRETURN_UNDEF;
+               }
+               EXTEND(sp,2);
+               PUSHs(sv_2mortal(newSVuv(start_tmp)));
+               PUSHs(sv_2mortal(newSVuv(end_tmp)));
+
+int
+rrd_xport(...)
+       PROTOTYPE: @    
+       PREINIT:
+                time_t start,end;              
+                int xsize;
+               unsigned long step, col_cnt,row_cnt,i,ii;
+               rrd_value_t *data,*ptr;
+                char **argv,**legend_v;
+               AV *retar,*line,*names;
+       PPCODE:
+               argv = (char **) malloc((items+1)*sizeof(char *));
+               argv[0] = "dummy";
+               for (i = 0; i < items; i++) { 
+                   STRLEN len;
+                   char *handle = SvPV(ST(i),len);
+                   /* actually copy the data to make sure possible modifications
+                      on the argv data does not backfire into perl */ 
+                   argv[i+1] = (char *) malloc((strlen(handle)+1)*sizeof(char));
+                   strcpy(argv[i+1],handle);
+               }
+               rrd_clear_error();
+               rrd_xport(items+1,argv,&xsize,&start,&end,&step,&col_cnt,&legend_v,&data); 
+               for (i=0; i < items; i++) {
+                   free(argv[i+1]);
+               }
+               free(argv);
+               if (rrd_test_error()) XSRETURN_UNDEF;
+
+                /* convert the legend_v into perl format */
+               names=newAV();
+               for (ii = 0; ii < col_cnt; ii++){
+                   av_push(names,newSVpv(legend_v[ii],0));
+                   rrd_freemem(legend_v[ii]);
+               }
+               rrd_freemem(legend_v);                  
+
+               /* convert the data array into perl format */
+               ptr=data;
+               retar=newAV();
+               for (i = start+step; i <= end; i += step){
+                       line = newAV();
+                       for (ii = 0; ii < col_cnt; ii++){
+                         av_push(line,(isnan(*ptr) ? &PL_sv_undef : newSVnv(*ptr)));
+                         ptr++;
+                       }
+                       av_push(retar,newRV_noinc((SV*)line));
+               }
+               rrd_freemem(data);
+
+               EXTEND(sp,7);
+               PUSHs(sv_2mortal(newSViv(start+step)));
+               PUSHs(sv_2mortal(newSViv(end)));
+               PUSHs(sv_2mortal(newSViv(step)));
+               PUSHs(sv_2mortal(newSViv(col_cnt)));
+               PUSHs(sv_2mortal(newRV_noinc((SV*)names)));
+               PUSHs(sv_2mortal(newRV_noinc((SV*)retar)));
+
+SV*
+rrd_info(...)
+       PROTOTYPE: @    
+       PREINIT:
+               info_t *data,*save;
+                int i;
+                char **argv;
+               HV *hash;
+       CODE:
+               rrdinfocode(rrd_info);  
+    OUTPUT:
+          RETVAL
+
+SV*
+rrd_updatev(...)
+       PROTOTYPE: @    
+       PREINIT:
+               info_t *data,*save;
+                int i;
+                char **argv;
+               HV *hash;
+       CODE:
+               rrdinfocode(rrd_update_v);      
+    OUTPUT:
+          RETVAL
+
+int
+rrd_dump(...)
+       PROTOTYPE: @
+       PREINIT:
+        int i;
+       char **argv;
+       CODE:
+               rrdcode(rrd_dump);
+                       RETVAL = 1;
+       OUTPUT:
+               RETVAL
+
+int
+rrd_restore(...)
+       PROTOTYPE: @
+       PREINIT:
+        int i;
+       char **argv;
+       CODE:
+               rrdcode(rrd_restore);
+                       RETVAL = 1;
+       OUTPUT:
+               RETVAL
+
diff --git a/bindings/perl-shared/ntmake.pl b/bindings/perl-shared/ntmake.pl
new file mode 100644 (file)
index 0000000..047b76f
--- /dev/null
@@ -0,0 +1,27 @@
+use ExtUtils::MakeMaker;
+use Config;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+# Run VCVARS32.BAT before generating makefile/compiling.
+WriteMakefile(
+    'NAME'     => 'RRDs',
+    'VERSION_FROM' => 'RRDs.pm',
+#    'DEFINE'     => "-DPERLPATCHLEVEL=$Config{PATCHLEVEL}",
+# keep compatible w/ ActiveState 5xx builds
+    'DEFINE'      => "-DPERLPATCHLEVEL=5",
+
+   'INC'       => '-I../../src/ "-I/Program Files/GnuWin32/include"',
+# Since we are now using GnuWin32 libraries dynamically (instead of static
+# complile with code redistributed with rrdtool), use /MD instead of /MT.
+# Yes, this means we need msvcrt.dll but GnuWin32 dlls already require it
+# and it is available on most versions of Windows.
+   'OPTIMIZE' => '-O2 -MD',
+   'LIBS'  => '../../src/release/rrd.lib "/Program Files/GnuWin32/lib/libart_lgpl.lib" "/Program Files/GnuWin32/lib/libz.lib" "/Program Files/GnuWin32/lib/libpng.lib" "/Program Files/GnuWin32/lib/libfreetype.lib"', 
+    'realclean'    => {FILES => 't/demo?.rrd t/demo?.png' },
+    ($] ge '5.005') ? (
+        'AUTHOR' => 'Tobias Oetiker (tobi@oetiker.ch)',
+        'ABSTRACT' => 'Round Robin Database Tool',
+    ) : ()
+
+
+);
diff --git a/bindings/perl-shared/t/base.t b/bindings/perl-shared/t/base.t
new file mode 100755 (executable)
index 0000000..7b6c016
--- /dev/null
@@ -0,0 +1,171 @@
+#! /usr/bin/perl 
+
+BEGIN { $| = 1; print "1..7\n"; }
+END {
+  print "not ok 1\n" unless $loaded;
+  unlink "demo.rrd";
+}
+
+sub ok
+{
+    my($what, $result) = @_ ;
+    $ok_count++;
+    print "not " unless $result;
+    print "ok $ok_count $what\n";
+}
+
+use strict;
+use vars qw(@ISA $loaded);
+
+use RRDs;
+$loaded = 1;
+my $ok_count = 1;
+
+ok("loading",1);
+
+######################### End of black magic.
+
+my $STEP  = 100;
+my $RUNS  = 500;
+my $GRUNS = 4;
+my $RRD1  = "demo1.rrd";
+my $RRD2  = "demo2.rrd";
+my $PNG1  = "demo1.png";
+my $PNG2  = "demo2.png";
+my $time  = 30*int(time/30);
+my $START = $time-$RUNS*$STEP;
+
+my @options = ("-b", $START, "-s", $STEP,
+ "DS:a:GAUGE:2000:U:U",
+ "DS:b:GAUGE:200:U:U",
+ "DS:c:GAUGE:200:U:U",
+ "DS:d:GAUGE:200:U:U",
+ "DS:e:DERIVE:200:U:U",
+ "RRA:AVERAGE:0.5:1:5000",
+ "RRA:AVERAGE:0.5:10:500");
+
+print "* Creating RRD $RRD1 starting at $time.\n\n";
+RRDs::create $RRD1, @options;
+
+my $ERROR = RRDs::error;
+ok("create 1", !$ERROR);                                                       #  2
+if ($ERROR) {
+  die "$0: unable to create `$RRD1': $ERROR\n";
+}
+
+print "* Creating RRD $RRD2 starting at $time.\n\n";
+RRDs::create $RRD2, @options;
+
+$ERROR= RRDs::error;
+ok("create 2",!$ERROR);                                                        #  3
+if ($ERROR) {
+  die "$0: unable to create `$RRD2': $ERROR\n";
+}
+
+my $last = RRDs::last $RRD1;
+if ($ERROR = RRDs::error) {
+  die "$0: unable to get last `$RRD1': $ERROR\n";
+}
+ok("last 1", $last == $START);                                         #  4
+
+$last = RRDs::last $RRD2;
+if ($ERROR = RRDs::error) {
+  die "$0: unable to get last `$RRD2': $ERROR\n";
+}
+ok("last 2", $last == $START);                                         #  5
+
+print "* Filling $RRD1 and $RRD2 with $RUNS*5 values. One moment please ...\n";
+print "* If you are running over NFS this will take *MUCH* longer\n\n";
+
+srand(int($time / 100));
+
+@options = ();
+
+my $counter = 1e7;
+for (my $t=$START+1;
+     $t<$START+$STEP*$RUNS;
+     $t+=$STEP+int((rand()-0.5)*7)){
+  $counter += int(2500*sin($t/2000)*$STEP);
+  my $data = (1000+500*sin($t/1000)).":".
+      (1000+900*sin($t/2330)).":".
+      (2000*cos($t/1550)).":".
+      (3220*sin($t/3420)).":$counter";
+  push(@options, "$t:$data");
+  RRDs::update $RRD1, "$t:$data";
+  if ($ERROR = RRDs::error) {
+    warn "$0: unable to update `$RRD1': $ERROR\n";
+  }
+}
+
+ok("update 1",!$ERROR);                                                        #  3
+
+RRDs::update $RRD2, @options;
+
+ok("update 2",!$ERROR);                                                        #  3
+
+if ($ERROR = RRDs::error) {
+  die "$0: unable to update `$RRD2': $ERROR\n";
+}
+
+print "* Creating $GRUNS graphs: $PNG1 & $PNG2\n\n";
+my $now = $time;
+for (my $i=0;$i<$GRUNS;$i++) {
+  my @rrd_pngs = ($RRD1, $PNG1, $RRD2, $PNG2);
+  while (@rrd_pngs) {
+    my $RRD = shift(@rrd_pngs);
+    my $PNG = shift(@rrd_pngs);
+    my ($graphret,$xs,$ys) = RRDs::graph $PNG, "--title", 'Test GRAPH',
+          "--vertical-label", 'Dummy Units', "--start", (-$RUNS*$STEP),
+          "DEF:alpha=$RRD:a:AVERAGE",
+          "DEF:beta=$RRD:b:AVERAGE",
+          "DEF:gamma=$RRD:c:AVERAGE",
+          "DEF:delta=$RRD:d:AVERAGE",
+          "DEF:epsilon=$RRD:e:AVERAGE",
+          "CDEF:calc=alpha,beta,+,2,/",
+          "AREA:alpha#0022e9:Short",
+          "STACK:beta#00b871:Demo Text",
+          "LINE1:gamma#ff0000:Line 1",
+          "LINE2:delta#888800:Line 2",
+          "LINE3:calc#00ff44:Line 3",
+          "LINE3:epsilon#000000:Line 4",
+          "HRULE:1500#ff8800:Horizontal Line at 1500",
+          "PRINT:alpha:AVERAGE:Average Alpha %1.2lf",
+          "PRINT:alpha:MIN:Min Alpha %1.2lf %s",
+          "PRINT:alpha:MIN:Min Alpha %1.2lf",
+          "PRINT:alpha:MAX:Max Alpha %1.2lf",
+          "GPRINT:calc:AVERAGE:Average calc %1.2lf %s",
+          "GPRINT:calc:AVERAGE:Average calc %1.2lf",
+          "GPRINT:calc:MAX:Max calc %1.2lf",
+          "GPRINT:calc:MIN:Min calc %1.2lf",
+          "VRULE:".($now-3600)."#008877:60 Minutes ago",
+          "VRULE:".($now-7200)."#008877:120 Minutes ago";
+
+    if ($ERROR = RRDs::error) {
+      print "ERROR: $ERROR\n";
+    } else {
+      print "Image Size: ${xs}x${ys}\n";
+      print "Graph Return:\n",(join "\n", @$graphret),"\n\n";
+    }
+  }
+}
+
+
+
+my ($start,$step,$names,$array) = RRDs::fetch $RRD1, "AVERAGE";
+$ERROR = RRDs::error;
+print "ERROR: $ERROR\n" if $ERROR ;
+print "start=$start, step=$step\n";
+print "             "; 
+map {printf("%12s",$_)} @$names ;
+foreach my $line (@$array){
+  print "".localtime($start),"   ";
+  $start += $step; 
+  foreach my $val (@$line) {           
+    if (not defined $val){
+        printf "%12s", "UNKNOWN";
+    } else {
+      printf "%12.1f", $val;
+    }
+  }
+  print "\n";
+}
diff --git a/bindings/python/ACKNOWLEDGEMENT b/bindings/python/ACKNOWLEDGEMENT
new file mode 100644 (file)
index 0000000..8cf3658
--- /dev/null
@@ -0,0 +1,7 @@
+ACKNOWLEDGMENT
+==============
+
+This is a list of people who have made contributions to py-rrdtool.
+
+Matthew W. Samsonoff <mws@rochester.rr.com>
+Brian E. Gallew <geek+python@cmu.edu>
diff --git a/bindings/python/AUTHORS b/bindings/python/AUTHORS
new file mode 100644 (file)
index 0000000..b3b5713
--- /dev/null
@@ -0,0 +1 @@
+Hye-Shik Chang <perky@fallin.lv>
diff --git a/bindings/python/COPYING b/bindings/python/COPYING
new file mode 100644 (file)
index 0000000..b1e3f5a
--- /dev/null
@@ -0,0 +1,504 @@
+                 GNU LESSER GENERAL PUBLIC LICENSE
+                      Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+\f
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+\f
+                 GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+\f
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+\f
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+\f
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+\f
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+\f
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+\f
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                           NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/bindings/python/README b/bindings/python/README
new file mode 100644 (file)
index 0000000..265244f
--- /dev/null
@@ -0,0 +1,28 @@
+Python-RRDtool 0.2.1
+--------------------
+
+The python-rrdtool provides a interface to rrdtool, the wonderful
+graphing and logging utility. This wrapper implementation has
+worked from the scratch (without SWIG), and it's under LGPL.
+
+This module have not documented yet. Please refer pydoc.
+
+
+Project
+-------
+
+Homepage: http://www.nongnu.org/py-rrdtool/
+
+Mailing Lists:
+
+  CVS Checkins     py-rrdtool-cvs@nongnu.org
+  Users & Hackers  py-rrdtool-users@nongnu.org
+
+
+Author
+------
+
+Hye-Shik Chang <perky@FreeBSD.org>
+
+Any comments, suggestions, and/or patches are very welcome.
+Thank you for using py-rrdtool!
diff --git a/bindings/python/rrd_extra.h b/bindings/python/rrd_extra.h
new file mode 100644 (file)
index 0000000..99b5aa0
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ *  This file is part of RRDtool.
+ *
+ *  RRDtool is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published
+ *  by the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  RRDtool 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 Foobar; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*****************************************************************************
+ * RRDtool 1.0.37  Copyright Tobias Oetiker, 1997 - 2000
+ *****************************************************************************
+ * rrd_tool.h   Common Header File
+ *****************************************************************************
+ * Id: rrd_tool.h,v 1.1.1.1 2002/02/26 10:21:37 oetiker Exp
+ * Log: rrd_tool.h,v
+ * Revision 1.1.1.1  2002/02/26 10:21:37  oetiker
+ * Intial Import
+ *
+ *****************************************************************************/
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+#ifndef _RRD_EXTRA_H
+#define _RRD_EXTRA_H
+
+#include "rrd_format.h"
+
+#ifndef WIN32
+#ifndef isnan /* POSIX */
+int isnan(double value);
+#endif
+#else /* Windows only */
+#include <float.h>
+#define isnan _isnan
+#endif
+
+void rrd_free(rrd_t *rrd);
+void rrd_init(rrd_t *rrd);
+
+int rrd_open(char *file_name, FILE **in_file, rrd_t *rrd, int rdwr);
+int readfile(char *file, char **buffer, int skipfirst);
+
+#define RRD_READONLY    0
+#define RRD_READWRITE   1
+
+#endif
+
+#ifdef  __cplusplus
+}
+#endif
diff --git a/bindings/python/rrdtoolmodule.c b/bindings/python/rrdtoolmodule.c
new file mode 100644 (file)
index 0000000..6f5b36c
--- /dev/null
@@ -0,0 +1,542 @@
+/*
+ * rrdtoolmodule.c
+ *
+ * RRDTool Python binding
+ *
+ * Author  : Hye-Shik Chang <perky@fallin.lv>
+ * Date    : $Date: 2003/02/22 07:41:19 $
+ * Created : 23 May 2002
+ *
+ * $Revision: 1.14 $
+ *
+ *  ==========================================================================
+ *  This file is part of py-rrdtool.
+ *
+ *  py-rrdtool is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser General Public License as published
+ *  by the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  py-rrdtool 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 Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with Foobar; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#ifdef UNUSED
+#elif defined(__GNUC__)
+# define UNUSED(x) x __attribute__((unused))
+#elif defined(__LCLINT__)
+# define UNUSED(x) /*@unused@*/ x
+#else
+# define UNUSED(x) x
+#endif
+
+static const char *__version__ = "$Revision: 1.14 $";
+
+#include "Python.h"
+#include "rrd.h"
+#include "rrd_extra.h"
+
+static PyObject *ErrorObject;
+extern int optind;
+extern int opterr;
+
+/* forward declaration to keep compiler happy */
+void initrrdtool(void);
+
+static int
+create_args(char *command, PyObject *args, int *argc, char ***argv)
+{
+    PyObject        *o;
+    int              size, i;
+    
+    size    = PyTuple_Size(args);
+    *argv   = PyMem_New(char *, size + 1);
+    if (*argv == NULL)
+        return -1;
+
+    for (i = 0; i < size; i++) {
+        o = PyTuple_GET_ITEM(args, i);
+        if (PyString_Check(o))
+            (*argv)[i + 1] = PyString_AS_STRING(o);
+        else {
+            PyMem_Del(*argv);
+            PyErr_Format(PyExc_TypeError, "argument %d must be string", i);
+            return -1;
+        }
+    }
+    (*argv)[0] = command;
+    *argc = size + 1;
+
+    /* reset getopt state */
+    opterr = optind = 0;
+
+    return 0;
+}
+
+static void
+destroy_args(char ***argv)
+{
+    PyMem_Del(*argv);
+    *argv = NULL;
+}
+
+static char PyRRD_create__doc__[] =
+"create(args..): Set up a new Round Robin Database\n\
+    create filename [--start|-b start time] \
+[--step|-s step] [DS:ds-name:DST:heartbeat:min:max] \
+[RRA:CF:xff:steps:rows]";
+
+static PyObject *
+PyRRD_create(PyObject UNUSED(*self), PyObject *args)
+{
+    PyObject        *r;
+    char           **argv;
+    int              argc;
+
+    if (create_args("create", args, &argc, &argv) < 0)
+        return NULL;
+
+    if (rrd_create(argc, argv) == -1) {
+        PyErr_SetString(ErrorObject, rrd_get_error());
+        rrd_clear_error();
+        r = NULL;
+    } else {
+        Py_INCREF(Py_None);
+        r = Py_None;
+    }
+
+    destroy_args(&argv);
+    return r;
+}
+
+static char PyRRD_update__doc__[] =
+"update(args..): Store a new set of values into the rrd\n"
+"    update filename [--template|-t ds-name[:ds-name]...] "
+"N|timestamp:value[:value...] [timestamp:value[:value...] ...]";
+
+static PyObject *
+PyRRD_update(PyObject UNUSED(*self), PyObject *args)
+{
+    PyObject        *r;
+    char           **argv;
+    int              argc;
+
+    if (create_args("update", args, &argc, &argv) < 0)
+        return NULL;
+
+    if (rrd_update(argc, argv) == -1) {
+        PyErr_SetString(ErrorObject, rrd_get_error());
+        rrd_clear_error();
+        r = NULL;
+    } else {
+        Py_INCREF(Py_None);
+        r = Py_None;
+    }
+
+    destroy_args(&argv);
+    return r;
+}
+
+static char PyRRD_fetch__doc__[] =
+"fetch(args..): fetch data from an rrd.\n"
+"    fetch filename CF [--resolution|-r resolution] "
+"[--start|-s start] [--end|-e end]";
+
+static PyObject *
+PyRRD_fetch(PyObject UNUSED(*self), PyObject *args)
+{
+    PyObject        *r;
+    rrd_value_t     *data, *datai;
+    unsigned long    step, ds_cnt;
+    time_t           start, end;
+    int              argc;
+    char           **argv, **ds_namv;
+
+    if (create_args("fetch", args, &argc, &argv) < 0)
+        return NULL;
+
+    if (rrd_fetch(argc, argv, &start, &end, &step,
+                  &ds_cnt, &ds_namv, &data) == -1) {
+        PyErr_SetString(ErrorObject, rrd_get_error());
+        rrd_clear_error();
+        r = NULL;
+    } else {
+        /* Return :
+          ((start, end, step), (name1, name2, ...), [(data1, data2, ..), ...]) */
+        PyObject    *range_tup, *dsnam_tup, *data_list, *t;
+        unsigned long          i, j, row;
+        rrd_value_t  dv;
+
+        row = ((end - start) / step + 1);
+
+        r = PyTuple_New(3);
+        range_tup = PyTuple_New(3);
+        dsnam_tup = PyTuple_New(ds_cnt);
+        data_list = PyList_New(row);
+        PyTuple_SET_ITEM(r, 0, range_tup);
+        PyTuple_SET_ITEM(r, 1, dsnam_tup);
+        PyTuple_SET_ITEM(r, 2, data_list);
+
+        datai = data;
+
+        PyTuple_SET_ITEM(range_tup, 0, PyInt_FromLong((long)start));
+        PyTuple_SET_ITEM(range_tup, 1, PyInt_FromLong((long)end));
+        PyTuple_SET_ITEM(range_tup, 2, PyInt_FromLong((long)step));
+
+        for (i = 0; i < ds_cnt; i++)
+            PyTuple_SET_ITEM(dsnam_tup, i, PyString_FromString(ds_namv[i]));
+
+        for (i = 0; i < row; i ++) {
+            t = PyTuple_New(ds_cnt);
+            PyList_SET_ITEM(data_list, i, t);
+
+            for (j = 0; j < ds_cnt; j++) {
+                dv = *(datai++);
+                if (isnan(dv)) {
+                    PyTuple_SET_ITEM(t, j, Py_None);
+                    Py_INCREF(Py_None);
+                } else {
+                    PyTuple_SET_ITEM(t, j, PyFloat_FromDouble((double)dv));
+                }
+            }
+        }
+
+        for (i = 0; i < ds_cnt; i++)
+            free(ds_namv[i]);
+        free(ds_namv); /* rrdtool don't use PyMem_Malloc :) */
+        free(data);
+    }
+
+    destroy_args(&argv);
+    return r;
+}
+
+static char PyRRD_graph__doc__[] =
+"graph(args..): Create a graph based on data from one or several RRD\n"
+"    graph filename [-s|--start seconds] "
+"[-e|--end seconds] [-x|--x-grid x-axis grid and label] "
+"[-y|--y-grid y-axis grid and label] [--alt-y-grid] [--alt-y-mrtg] "
+"[--alt-autoscale] [--alt-autoscale-max] [--units-exponent] value "
+"[-v|--vertical-label text] [-w|--width pixels] [-h|--height pixels] "
+"[-i|--interlaced] "
+"[-f|--imginfo formatstring] [-a|--imgformat GIF|PNG|GD] "
+"[-B|--background value] [-O|--overlay value] "
+"[-U|--unit value] [-z|--lazy] [-o|--logarithmic] "
+"[-u|--upper-limit value] [-l|--lower-limit value] "
+"[-g|--no-legend] [-r|--rigid] [--step value] "
+"[-b|--base value] [-c|--color COLORTAG#rrggbb] "
+"[-t|--title title] [DEF:vname=rrd:ds-name:CF] "
+"[CDEF:vname=rpn-expression] [PRINT:vname:CF:format] "
+"[GPRINT:vname:CF:format] [COMMENT:text] "
+"[HRULE:value#rrggbb[:legend]] [VRULE:time#rrggbb[:legend]] "
+"[LINE{1|2|3}:vname[#rrggbb[:legend]]] "
+"[AREA:vname[#rrggbb[:legend]]] "
+"[STACK:vname[#rrggbb[:legend]]]";
+
+static PyObject *
+PyRRD_graph(PyObject UNUSED(*self), PyObject *args)
+{
+    PyObject        *r;
+    char           **argv, **calcpr;
+    int              argc, xsize, ysize, i;
+    double          ymin, ymax;
+    if (create_args("graph", args, &argc, &argv) < 0)
+        return NULL;
+
+    if (rrd_graph(argc, argv, &calcpr, &xsize, &ysize, NULL, &ymin, &ymax) == -1) {
+        PyErr_SetString(ErrorObject, rrd_get_error());
+        rrd_clear_error();
+        r = NULL;
+    } else {
+        r = PyTuple_New(3);
+
+        PyTuple_SET_ITEM(r, 0, PyInt_FromLong((long)xsize));
+        PyTuple_SET_ITEM(r, 1, PyInt_FromLong((long)ysize));
+
+        if (calcpr) {
+            PyObject    *e, *t;
+            
+            e = PyList_New(0);
+            PyTuple_SET_ITEM(r, 2, e);
+
+            for(i = 0; calcpr[i]; i++) {
+                t = PyString_FromString(calcpr[i]);
+                PyList_Append(e, t);
+                Py_DECREF(t);
+                free(calcpr[i]);
+            }
+            free(calcpr);
+        } else {
+            Py_INCREF(Py_None);
+            PyTuple_SET_ITEM(r, 2, Py_None);
+        }
+    }
+
+    destroy_args(&argv);
+    return r;
+}
+
+static char PyRRD_tune__doc__[] =
+"tune(args...): Modify some basic properties of a Round Robin Database\n"
+"    tune filename [--heartbeat|-h ds-name:heartbeat] "
+"[--minimum|-i ds-name:min] [--maximum|-a ds-name:max] "
+"[--data-source-type|-d ds-name:DST] [--data-source-rename|-r old-name:new-name]";
+
+static PyObject *
+PyRRD_tune(PyObject UNUSED(*self), PyObject *args)
+{
+    PyObject        *r;
+    char           **argv;
+    int              argc;
+
+    if (create_args("tune", args, &argc, &argv) < 0)
+        return NULL;
+
+    if (rrd_tune(argc, argv) == -1) {
+        PyErr_SetString(ErrorObject, rrd_get_error());
+        rrd_clear_error();
+        r = NULL;
+    } else {
+        Py_INCREF(Py_None);
+        r = Py_None;
+    }
+
+    destroy_args(&argv);
+    return r;
+}
+
+static char PyRRD_first__doc__[] =
+"first(filename): Return the timestamp of the first data sample in an RRD";
+
+static PyObject *
+PyRRD_first(PyObject UNUSED(*self), PyObject *args)
+{
+    PyObject        *r;
+    int              argc, ts;
+    char           **argv;
+
+    if (create_args("first", args, &argc, &argv) < 0)
+        return NULL;
+
+    if ((ts = rrd_first(argc, argv)) == -1) {
+        PyErr_SetString(ErrorObject, rrd_get_error());
+        rrd_clear_error();
+        r = NULL;
+    } else
+        r = PyInt_FromLong((long)ts);
+
+    destroy_args(&argv);
+    return r;
+}
+
+static char PyRRD_last__doc__[] =
+"last(filename): Return the timestamp of the last data sample in an RRD";
+
+static PyObject *
+PyRRD_last(PyObject UNUSED(*self), PyObject *args)
+{
+    PyObject        *r;
+    int              argc, ts;
+    char           **argv;
+
+    if (create_args("last", args, &argc, &argv) < 0)
+        return NULL;
+
+    if ((ts = rrd_last(argc, argv)) == -1) {
+        PyErr_SetString(ErrorObject, rrd_get_error());
+        rrd_clear_error();
+        r = NULL;
+    } else
+        r = PyInt_FromLong((long)ts);
+
+    destroy_args(&argv);
+    return r;
+}
+
+static char PyRRD_resize__doc__[] =
+"resize(args...): alters the size of an RRA.\n"
+"    resize filename rra-num GROW|SHRINK rows";
+
+static PyObject *
+PyRRD_resize(PyObject UNUSED(*self), PyObject *args)
+{
+    PyObject        *r;
+    char           **argv;
+    int              argc, ts;
+
+    if (create_args("resize", args, &argc, &argv) < 0)
+        return NULL;
+
+    if ((ts = rrd_resize(argc, argv)) == -1) {
+        PyErr_SetString(ErrorObject, rrd_get_error());
+        rrd_clear_error();
+        r = NULL;
+    } else {
+        Py_INCREF(Py_None);
+        r = Py_None;
+    }
+
+    destroy_args(&argv);
+    return r;
+}
+
+static char PyRRD_info__doc__[] =
+"info(filename): extract header information from an rrd";
+
+static PyObject *
+PyRRD_info(PyObject UNUSED(*self), PyObject *args)
+{
+    PyObject        *r, *t, *ds;
+    rrd_t            rrd;
+    FILE            *in_file;
+    char            *filename;
+    unsigned long   i, j;
+
+    if (! PyArg_ParseTuple(args, "s:info", &filename))
+        return NULL;
+
+    if (rrd_open(filename, &in_file, &rrd, RRD_READONLY) == -1) {
+        PyErr_SetString(ErrorObject, rrd_get_error());
+        rrd_clear_error();
+        return NULL;
+    }
+    fclose(in_file);
+
+#define DICTSET_STR(dict, name, value) \
+    t = PyString_FromString(value); \
+    PyDict_SetItemString(dict, name, t); \
+    Py_DECREF(t);
+
+#define DICTSET_CNT(dict, name, value) \
+    t = PyInt_FromLong((long)value); \
+    PyDict_SetItemString(dict, name, t); \
+    Py_DECREF(t);
+
+#define DICTSET_VAL(dict, name, value) \
+    t = isnan(value) ? (Py_INCREF(Py_None), Py_None) :  \
+        PyFloat_FromDouble((double)value); \
+    PyDict_SetItemString(dict, name, t); \
+    Py_DECREF(t);
+
+    r = PyDict_New();
+
+    DICTSET_STR(r, "filename", filename);
+    DICTSET_STR(r, "rrd_version", rrd.stat_head->version);
+    DICTSET_CNT(r, "step", rrd.stat_head->pdp_step);
+    DICTSET_CNT(r, "last_update", rrd.live_head->last_up);
+
+    ds = PyDict_New();
+    PyDict_SetItemString(r, "ds", ds);
+    Py_DECREF(ds);
+
+    for (i = 0; i < rrd.stat_head->ds_cnt; i++) {
+        PyObject    *d;
+
+        d = PyDict_New();
+        PyDict_SetItemString(ds, rrd.ds_def[i].ds_nam, d);
+        Py_DECREF(d);
+
+        DICTSET_STR(d, "ds_name", rrd.ds_def[i].ds_nam);
+        DICTSET_STR(d, "type", rrd.ds_def[i].dst);
+        DICTSET_CNT(d, "minimal_heartbeat", rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt);
+        DICTSET_VAL(d, "min", rrd.ds_def[i].par[DS_min_val].u_val);
+        DICTSET_VAL(d, "max", rrd.ds_def[i].par[DS_max_val].u_val);
+        DICTSET_STR(d, "last_ds", rrd.pdp_prep[i].last_ds);
+        DICTSET_VAL(d, "value", rrd.pdp_prep[i].scratch[PDP_val].u_val);
+        DICTSET_CNT(d, "unknown_sec", rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt);
+    }
+
+    ds = PyList_New(rrd.stat_head->rra_cnt);
+    PyDict_SetItemString(r, "rra", ds);
+    Py_DECREF(ds);
+
+    for (i = 0; i < rrd.stat_head->rra_cnt; i++) {
+        PyObject    *d, *cdp;
+
+        d = PyDict_New();
+        PyList_SET_ITEM(ds, i, d);
+
+        DICTSET_STR(d, "cf", rrd.rra_def[i].cf_nam);
+        DICTSET_CNT(d, "rows", rrd.rra_def[i].row_cnt);
+        DICTSET_CNT(d, "pdp_per_row", rrd.rra_def[i].pdp_cnt);
+        DICTSET_VAL(d, "xff", rrd.rra_def[i].par[RRA_cdp_xff_val].u_val);
+
+        cdp = PyList_New(rrd.stat_head->ds_cnt);
+        PyDict_SetItemString(d, "cdp_prep", cdp);
+        Py_DECREF(cdp);
+
+        for (j = 0; j < rrd.stat_head->ds_cnt; j++) {
+            PyObject    *cdd;
+
+            cdd = PyDict_New();
+            PyList_SET_ITEM(cdp, j, cdd);
+
+            DICTSET_VAL(cdd, "value",
+                    rrd.cdp_prep[i*rrd.stat_head->ds_cnt+j].scratch[CDP_val].u_val);
+            DICTSET_CNT(cdd, "unknown_datapoints",
+                    rrd.cdp_prep[i*rrd.stat_head->ds_cnt+j].scratch[CDP_unkn_pdp_cnt].u_cnt);
+        }
+    }
+
+    rrd_free(&rrd);
+
+    return r;
+}
+
+/* List of methods defined in the module */
+#define meth(name, func, doc) {name, (PyCFunction)func, METH_VARARGS, doc}
+
+static PyMethodDef _rrdtool_methods[] = {
+    meth("create",  PyRRD_create,   PyRRD_create__doc__),
+    meth("update",  PyRRD_update,   PyRRD_update__doc__),
+    meth("fetch",   PyRRD_fetch,    PyRRD_fetch__doc__),
+    meth("graph",   PyRRD_graph,    PyRRD_graph__doc__),
+    meth("tune",    PyRRD_tune,     PyRRD_tune__doc__),
+    meth("first",   PyRRD_first,    PyRRD_first__doc__),
+    meth("last",    PyRRD_last,     PyRRD_last__doc__),
+    meth("resize",  PyRRD_resize,   PyRRD_resize__doc__),
+    meth("info",    PyRRD_info,     PyRRD_info__doc__),
+    {NULL, NULL,0,NULL}
+};
+
+#define SET_INTCONSTANT(dict, value) \
+            t = PyInt_FromLong((long)value); \
+            PyDict_SetItemString(dict, #value, t); \
+            Py_DECREF(t);
+#define SET_STRCONSTANT(dict, value) \
+            t = PyString_FromString(value); \
+            PyDict_SetItemString(dict, #value, t); \
+            Py_DECREF(t);
+
+/* Initialization function for the module */
+void
+initrrdtool(void)
+{
+    PyObject    *m, *d, *t;
+
+    /* Create the module and add the functions */
+    m = Py_InitModule("rrdtool", _rrdtool_methods);
+
+    /* Add some symbolic constants to the module */
+    d = PyModule_GetDict(m);
+
+    SET_STRCONSTANT(d, __version__);
+    ErrorObject = PyErr_NewException("rrdtool.error", NULL, NULL);
+    PyDict_SetItemString(d, "error", ErrorObject);
+
+    /* Check for errors */
+    if (PyErr_Occurred())
+        Py_FatalError("can't initialize the rrdtool module");
+}
+
+/*
+ * $Id: _rrdtoolmodule.c,v 1.14 2003/02/22 07:41:19 perky Exp $
+ * ex: ts=8 sts=4 et
+ */
diff --git a/bindings/python/setup.py b/bindings/python/setup.py
new file mode 100644 (file)
index 0000000..7a41a11
--- /dev/null
@@ -0,0 +1,55 @@
+#! /usr/bin/env python
+#
+# setup.py
+#
+# py-rrdtool distutil setup
+#
+# Author  : Hye-Shik Chang <perky@fallin.lv>
+# Date    : $Date: 2003/02/14 02:38:16 $
+# Created : 24 May 2002
+#
+# $Revision: 1.7 $
+#
+#  ==========================================================================
+#  This file is part of py-rrdtool.
+#
+#  py-rrdtool is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU Lesser General Public License as published
+#  by the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  py-rrdtool 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 Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public License
+#  along with Foobar; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+
+from distutils.core import setup, Extension
+import sys, os
+
+RRDBASE = os.environ.get('LOCALBASE', '../../src')
+library_dir = os.environ.get('BUILDLIBDIR', os.path.join(RRDBASE, 'lib'))
+include_dir = os.environ.get('INCDIR', RRDBASE)
+
+setup(name = "py-rrdtool",
+      version = "0.2.1",
+      description = "Python Interface to RRDTool",
+      author = "Hye-Shik Chang",
+      author_email = "perky@fallin.lv",
+      license = "LGPL",
+      url = "http://oss.oetiker.ch/rrdtool",
+      #packages = ['rrdtool'],
+      ext_modules = [
+          Extension(
+            "rrdtoolmodule",
+            ["rrdtoolmodule.c"],
+            libraries=['rrd'],
+            library_dirs=[library_dir],
+            include_dirs=[include_dir],
+          )
+      ]
+)
diff --git a/bindings/ruby/CHANGES b/bindings/ruby/CHANGES
new file mode 100644 (file)
index 0000000..c84ff29
--- /dev/null
@@ -0,0 +1,3 @@
+2006-07-25 Loïs Lherbier
+ add y_min and y_max parameters to rrd_graph
+ update test.rb to send only strings to RRD.fetch
diff --git a/bindings/ruby/README b/bindings/ruby/README
new file mode 100644 (file)
index 0000000..888a062
--- /dev/null
@@ -0,0 +1,22 @@
+#
+# ruby librrd bindings
+# author: Miles Egan <miles@caddr.com>
+#
+
+- Introduction 
+
+This module provides ruby bindings for librrd, with functionality
+comparable to the native perl bindings.  See test.rb for a script that
+exercises all ruby-librrd functionality.
+
+- Installation
+
+Installation is standard.  Simply run:
+
+ruby extconf.rb
+make
+make install
+
+I hope this works for you.  Please let me know if you have any
+problems or suggestions.  Someday when I'm feeling less lazy I'll
+actually document this thing.  Thanks to Tobi for rrdtool!
diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
new file mode 100644 (file)
index 0000000..2045e5a
--- /dev/null
@@ -0,0 +1,18 @@
+# $Id: extconf.rb,v 1.2 2001/11/28 18:30:16 miles Exp $
+# Lost ticket pays maximum rate.
+
+require 'mkmf'
+
+if /linux/ =~ RUBY_PLATFORM
+   $LDFLAGS += '-Wl,--rpath -Wl,$(EPREFIX)/lib'
+elsif /solaris/ =~ RUBY_PLATFORM
+   $LDFLAGS += '-R$(EPREFIX)/lib'
+elsif /hpux/ =~ RUBY_PLATFORM
+   $LDFLAGS += '+b$(EPREFIX)/lib'
+elsif /aix/ =~ RUBY_PLATFORM
+   $LDFLAGS += '-Wl,-blibpath:$(EPREFIX)/lib'
+end
+
+dir_config("rrd","../../src","../../src/.libs")
+have_library("rrd", "rrd_create")
+create_makefile("RRD")
diff --git a/bindings/ruby/main.c b/bindings/ruby/main.c
new file mode 100644 (file)
index 0000000..8a762ad
--- /dev/null
@@ -0,0 +1,258 @@
+/* $Id: main.c 1212 2007-11-08 10:13:48Z oetiker $
+ * Substantial penalty for early withdrawal.
+ */
+
+#include <unistd.h>
+#include <ruby.h>
+#include "../../src/rrd_tool.h"
+
+typedef struct string_arr_t {
+    int len;
+    char **strings;
+} string_arr;
+
+VALUE mRRD;
+VALUE rb_eRRDError;
+
+typedef int (*RRDFUNC)(int argc, char ** argv);
+#define RRD_CHECK_ERROR  \
+    if (rrd_test_error()) \
+      rb_raise(rb_eRRDError, rrd_get_error()); \
+    rrd_clear_error();
+
+string_arr string_arr_new(VALUE rb_strings)
+{
+    string_arr a;
+    char buf[64];
+    int i;
+   
+    Check_Type(rb_strings, T_ARRAY);
+    a.len = RARRAY(rb_strings)->len + 1;
+
+    a.strings = malloc(a.len * sizeof(char *));
+    a.strings[0] = "dummy";     /* first element is a dummy element */
+
+    for (i = 0; i < a.len - 1; i++) {
+        VALUE v = rb_ary_entry(rb_strings, i);
+        switch (TYPE(v)) {
+        case T_STRING:
+            a.strings[i + 1] = strdup(STR2CSTR(v));
+            break;
+        case T_FIXNUM:
+            snprintf(buf, 63, "%d", FIX2INT(v));
+            a.strings[i + 1] = strdup(buf);
+            break;
+        default:
+            rb_raise(rb_eTypeError, "invalid argument - %s, expected T_STRING or T_FIXNUM on index %d", rb_class2name(CLASS_OF(v)), i);
+            break;
+        }
+    }
+
+    return a;
+}
+
+void string_arr_delete(string_arr a)
+{
+    int i;
+
+    /* skip dummy first entry */
+    for (i = 1; i < a.len; i++) {
+        free(a.strings[i]);
+    }
+
+    free(a.strings);
+}
+
+void reset_rrd_state()
+{
+    optind = 0; 
+    opterr = 0;
+    rrd_clear_error();
+}
+
+VALUE rrd_call(RRDFUNC func, VALUE args)
+{
+    string_arr a;
+
+    a = string_arr_new(args);
+    reset_rrd_state();
+    func(a.len, a.strings);
+    string_arr_delete(a);
+
+    RRD_CHECK_ERROR
+
+    return Qnil;
+}
+
+VALUE rb_rrd_create(VALUE self, VALUE args)
+{
+    return rrd_call(rrd_create, args);
+}
+
+VALUE rb_rrd_dump(VALUE self, VALUE args)
+{
+    return rrd_call(rrd_dump, args);
+}
+
+VALUE rb_rrd_fetch(VALUE self, VALUE args)
+{
+    string_arr a;
+    unsigned long i, j, k, step, ds_cnt;
+    rrd_value_t *raw_data;
+    char **raw_names;
+    VALUE data, names, result;
+    time_t start, end;
+
+    a = string_arr_new(args);
+    reset_rrd_state();
+    rrd_fetch(a.len, a.strings, &start, &end, &step, &ds_cnt, &raw_names, &raw_data);
+    string_arr_delete(a);
+
+    RRD_CHECK_ERROR
+
+    names = rb_ary_new();
+    for (i = 0; i < ds_cnt; i++) {
+        rb_ary_push(names, rb_str_new2(raw_names[i]));
+        free(raw_names[i]);
+    }
+    free(raw_names);
+
+    k = 0;
+    data = rb_ary_new();
+    for (i = start; i <= end; i += step) {
+        VALUE line = rb_ary_new2(ds_cnt);
+        for (j = 0; j < ds_cnt; j++) {
+            rb_ary_store(line, j, rb_float_new(raw_data[k]));
+            k++;
+        }
+        rb_ary_push(data, line);
+    }
+    free(raw_data);
+   
+    result = rb_ary_new2(4);
+    rb_ary_store(result, 0, INT2NUM(start));
+    rb_ary_store(result, 1, INT2NUM(end));
+    rb_ary_store(result, 2, names);
+    rb_ary_store(result, 3, data);
+    return result;
+}
+
+VALUE rb_rrd_graph(VALUE self, VALUE args)
+{
+    string_arr a;
+    char **calcpr, **p;
+    VALUE result, print_results;
+    int xsize, ysize;
+    double ymin, ymax;
+
+    a = string_arr_new(args);
+    reset_rrd_state();
+    rrd_graph(a.len, a.strings, &calcpr, &xsize, &ysize, NULL, &ymin, &ymax);
+    string_arr_delete(a);
+
+    RRD_CHECK_ERROR
+
+    result = rb_ary_new2(3);
+    print_results = rb_ary_new();
+    p = calcpr;
+    for (p = calcpr; p && *p; p++) {
+        rb_ary_push(print_results, rb_str_new2(*p));
+        free(*p);
+    }
+    free(calcpr);
+    rb_ary_store(result, 0, print_results);
+    rb_ary_store(result, 1, INT2FIX(xsize));
+    rb_ary_store(result, 2, INT2FIX(ysize));
+    return result;
+}
+
+VALUE rb_rrd_info(VALUE self, VALUE args)
+{
+    string_arr a;
+    info_t *p, *data;
+    VALUE result;
+
+    a = string_arr_new(args);
+    data = rrd_info(a.len, a.strings);
+    string_arr_delete(a);
+
+    RRD_CHECK_ERROR
+
+    result = rb_hash_new();
+    while (data) {
+        VALUE key = rb_str_new2(data->key);
+        switch (data->type) {
+        case RD_I_VAL:
+            if (isnan(data->value.u_val)) {
+                rb_hash_aset(result, key, Qnil);
+            }
+            else {
+                rb_hash_aset(result, key, rb_float_new(data->value.u_val));
+            }
+            break;
+        case RD_I_CNT:
+            rb_hash_aset(result, key, INT2FIX(data->value.u_cnt));
+            break;
+        case RD_I_STR:
+            rb_hash_aset(result, key, rb_str_new2(data->value.u_str));
+            free(data->value.u_str);
+            break;
+        }
+        p = data;
+        data = data->next;
+        free(p);
+    }
+    return result;
+}
+
+VALUE rb_rrd_last(VALUE self, VALUE args)
+{
+    string_arr a;
+    time_t last;
+
+    a = string_arr_new(args);
+    reset_rrd_state();
+    last = rrd_last(a.len, a.strings);
+    string_arr_delete(a);
+
+    RRD_CHECK_ERROR
+
+    return rb_funcall(rb_cTime, rb_intern("at"), 1, INT2FIX(last));
+}
+
+VALUE rb_rrd_resize(VALUE self, VALUE args)
+{
+    return rrd_call(rrd_resize, args);
+}
+
+VALUE rb_rrd_restore(VALUE self, VALUE args)
+{
+    return rrd_call(rrd_restore, args);
+}
+
+VALUE rb_rrd_tune(VALUE self, VALUE args)
+{
+    return rrd_call(rrd_tune, args);
+}
+
+VALUE rb_rrd_update(VALUE self, VALUE args)
+{
+    return rrd_call(rrd_update, args);
+}
+
+void Init_RRD() 
+{
+    mRRD = rb_define_module("RRD");
+    rb_eRRDError = rb_define_class("RRDError", rb_eStandardError);
+
+    rb_define_module_function(mRRD, "create", rb_rrd_create, -2);
+    rb_define_module_function(mRRD, "dump", rb_rrd_dump, -2);
+    rb_define_module_function(mRRD, "fetch", rb_rrd_fetch, -2);
+    rb_define_module_function(mRRD, "graph", rb_rrd_graph, -2);
+    rb_define_module_function(mRRD, "last", rb_rrd_last, -2);
+    rb_define_module_function(mRRD, "resize", rb_rrd_resize, -2);
+    rb_define_module_function(mRRD, "restore", rb_rrd_restore, -2);
+    rb_define_module_function(mRRD, "tune", rb_rrd_tune, -2);
+    rb_define_module_function(mRRD, "update", rb_rrd_update, -2);
+    rb_define_module_function(mRRD, "info", rb_rrd_info, -2);
+}
diff --git a/bindings/ruby/test.rb b/bindings/ruby/test.rb
new file mode 100755 (executable)
index 0000000..4853326
--- /dev/null
@@ -0,0 +1,52 @@
+#!/usr/bin/env ruby
+# $Id: test.rb,v 1.2 2002/10/22 17:34:00 miles Exp $
+# Driver does not carry cash.
+
+$: << '/scratch/rrd12build/lib/ruby/1.8/i386-linux/'
+
+require "RRD"
+
+name = "test"
+rrd = "#{name}.rrd"
+start = Time.now.to_i
+
+puts "creating #{rrd}"
+RRD.create(
+    rrd,
+    "--start", "#{start - 1}",
+    "--step", "300",
+       "DS:a:GAUGE:600:U:U",
+    "DS:b:GAUGE:600:U:U",
+    "RRA:AVERAGE:0.5:1:300")
+puts
+
+puts "updating #{rrd}"
+start.to_i.step(start.to_i + 300 * 300, 300) { |i|
+    RRD.update(rrd, "#{i}:#{rand(100)}:#{Math.sin(i / 800) * 50 + 50}")
+}
+puts
+
+puts "fetching data from #{rrd}"
+(fstart, fend, data) = RRD.fetch(rrd, "--start", start.to_s, "--end", (start + 300 * 300).to_s, "AVERAGE")
+puts "got #{data.length} data points from #{fstart} to #{fend}"
+puts
+
+puts "generating graph #{name}.png"
+RRD.graph(
+   "#{name}.png",
+    "--title", " RubyRRD Demo", 
+    "--start", "#{start+3600}",
+    "--end", "start + 1000 min",
+    "--interlace", 
+    "--imgformat", "PNG",
+    "--width=450",
+    "DEF:a=#{rrd}:a:AVERAGE",
+    "DEF:b=#{rrd}:b:AVERAGE",
+    "CDEF:line=TIME,2400,%,300,LT,a,UNKN,IF",
+    "AREA:b#00b6e4:beta",
+    "AREA:line#0022e9:alpha",
+    "LINE3:line#ff0000")
+puts
+
+print "This script has created #{name}.png in the current directory\n";
+print "This demonstrates the use of the TIME and % RPN operators\n";
diff --git a/bindings/tcl/Makefile.am b/bindings/tcl/Makefile.am
new file mode 100644 (file)
index 0000000..3e183c6
--- /dev/null
@@ -0,0 +1,57 @@
+
+EXTRA_DIST = README tclrrd.c
+
+VERSION = @VERSION@
+
+AM_CFLAGS = @CFLAGS@
+
+TCL_PREFIX = @TCL_PREFIX@
+TCL_SHLIB_LD = @TCL_SHLIB_LD@
+TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@
+TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@
+TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@
+TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@
+TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
+TCL_INC_DIR = @TCL_INC_DIR@
+
+CLEANFILES = tclrrd.o tclrrd.so
+
+SRC_DIR            = $(top_srcdir)/src
+AM_CPPFLAGS        = -I$(TCL_INC_DIR) -I$(SRC_DIR) -DUSE_TCL_STUBS
+LIBDIRS            = -L$(top_builddir)/src/.libs -L$(top_builddir)/src -L$(libdir)
+LIB_RUNTIME_DIR    = $(libdir)
+
+if BUILD_TCL_SITE
+tclpkgdir = @TCL_PACKAGE_DIR@
+tclpkg_DATA = pkgIndex.tcl
+tclpkg_SCRIPTS = ifOctets.tcl
+else
+pkglib_DATA = pkgIndex.tcl
+pkglib_SCRIPTS = ifOctets.tcl
+endif
+
+# Automake doen't like `tclrrd$(VERSION)$(TCL_SHLIB_SUFFIX)' as
+# library name. So we build and install this library `by hand'.
+#
+# We do, however, specify a lib_LIBRARIES target such that
+# automake creates the directory (if neecessary).
+#
+TCL_RRD_LIB = tclrrd$(VERSION)$(TCL_SHLIB_SUFFIX)
+
+lib_LIBRARIES =
+
+all-local: $(TCL_RRD_LIB)
+
+$(TCL_RRD_LIB): tclrrd.o
+       $(TCL_SHLIB_LD) $(TCL_LD_SEARCH_FLAGS) $(LIBDIRS) $< -o $@ -lrrd_th -lm $(TCL_STUB_LIB_SPEC) $(LDFLAGS) $(LIBS)
+
+tclrrd.o: tclrrd.c
+       $(CC) $(AM_CFLAGS) $(CFLAGS) $(TCL_SHLIB_CFLAGS) $(AM_CPPFLAGS) -c $< -DVERSION=\"$(VERSION)\"
+
+pkgIndex.tcl:
+       echo "package ifneeded Rrd $(VERSION) \"load $(libdir)/tclrrd$(VERSION)[info sharedlibextension]\"" > $@
+
+install-exec-local: $(TCL_RRD_LIB)
+       @$(NORMAL_INSTALL)
+       $(INSTALL_PROGRAM) $(TCL_RRD_LIB) $(DESTDIR)$(libdir)/$(TCL_RRD_LIB)
+
diff --git a/bindings/tcl/Makefile.in b/bindings/tcl/Makefile.in
new file mode 100644 (file)
index 0000000..08fc714
--- /dev/null
@@ -0,0 +1,549 @@
+# Makefile.in generated by automake 1.9.6 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@
+
+
+
+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 = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = bindings/tcl
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(srcdir)/ifOctets.tcl.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+       $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/rrd_config.h
+CONFIG_CLEAN_FILES = ifOctets.tcl
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkglibdir)" \
+       "$(DESTDIR)$(tclpkgdir)" "$(DESTDIR)$(pkglibdir)" \
+       "$(DESTDIR)$(tclpkgdir)"
+libLIBRARIES_INSTALL = $(INSTALL_DATA)
+LIBRARIES = $(lib_LIBRARIES)
+pkglibSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+tclpkgSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+SCRIPTS = $(pkglib_SCRIPTS) $(tclpkg_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+pkglibDATA_INSTALL = $(INSTALL_DATA)
+tclpkgDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(pkglib_DATA) $(tclpkg_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALL_LIBS = @ALL_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_MULTITHREAD_FALSE = @BUILD_MULTITHREAD_FALSE@
+BUILD_MULTITHREAD_TRUE = @BUILD_MULTITHREAD_TRUE@
+BUILD_RRDCGI_FALSE = @BUILD_RRDCGI_FALSE@
+BUILD_RRDCGI_TRUE = @BUILD_RRDCGI_TRUE@
+BUILD_TCL_FALSE = @BUILD_TCL_FALSE@
+BUILD_TCL_SITE_FALSE = @BUILD_TCL_SITE_FALSE@
+BUILD_TCL_SITE_TRUE = @BUILD_TCL_SITE_TRUE@
+BUILD_TCL_TRUE = @BUILD_TCL_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMP_PERL = @COMP_PERL@
+COMP_PYTHON = @COMP_PYTHON@
+COMP_RUBY = @COMP_RUBY@
+CORE_LIBS = @CORE_LIBS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MULTITHREAD_CFLAGS = @MULTITHREAD_CFLAGS@
+MULTITHREAD_LDFLAGS = @MULTITHREAD_LDFLAGS@
+NROFF = @NROFF@
+NUMVERS = @NUMVERS@
+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@
+PERL = @PERL@
+PERLCC = @PERLCC@
+PERLCCFLAGS = @PERLCCFLAGS@
+PERLFLAGS = @PERLFLAGS@
+PERLLD = @PERLLD@
+PERLLDFLAGS = @PERLLDFLAGS@
+PERL_CC = @PERL_CC@
+PERL_MAKE_OPTIONS = @PERL_MAKE_OPTIONS@
+PERL_VERSION = @PERL_VERSION@
+PKGCONFIG = @PKGCONFIG@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+RRDDOCDIR = @RRDDOCDIR@
+RRDGRAPH_YLEGEND_ANGLE = @RRDGRAPH_YLEGEND_ANGLE@
+RRD_DEFAULT_FONT = @RRD_DEFAULT_FONT@
+RUBY = @RUBY@
+RUBY_MAKE_OPTIONS = @RUBY_MAKE_OPTIONS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@
+TCL_PACKAGE_DIR = @TCL_PACKAGE_DIR@
+TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@
+TCL_PREFIX = @TCL_PREFIX@
+TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@
+TCL_SHLIB_LD = @TCL_SHLIB_LD@
+TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@
+TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
+TCL_VERSION = @TCL_VERSION@
+TROFF = @TROFF@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_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 = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+EXTRA_DIST = README tclrrd.c
+AM_CFLAGS = @CFLAGS@
+TCL_INC_DIR = @TCL_INC_DIR@
+CLEANFILES = tclrrd.o tclrrd.so
+SRC_DIR = $(top_srcdir)/src
+AM_CPPFLAGS = -I$(TCL_INC_DIR) -I$(SRC_DIR) -DUSE_TCL_STUBS
+LIBDIRS = -L$(top_builddir)/src/.libs -L$(top_builddir)/src -L$(libdir)
+LIB_RUNTIME_DIR = $(libdir)
+@BUILD_TCL_SITE_TRUE@tclpkgdir = @TCL_PACKAGE_DIR@
+@BUILD_TCL_SITE_TRUE@tclpkg_DATA = pkgIndex.tcl
+@BUILD_TCL_SITE_TRUE@tclpkg_SCRIPTS = ifOctets.tcl
+@BUILD_TCL_SITE_FALSE@pkglib_DATA = pkgIndex.tcl
+@BUILD_TCL_SITE_FALSE@pkglib_SCRIPTS = ifOctets.tcl
+
+# Automake doen't like `tclrrd$(VERSION)$(TCL_SHLIB_SUFFIX)' as
+# library name. So we build and install this library `by hand'.
+#
+# We do, however, specify a lib_LIBRARIES target such that
+# automake creates the directory (if neecessary).
+#
+TCL_RRD_LIB = tclrrd$(VERSION)$(TCL_SHLIB_SUFFIX)
+lib_LIBRARIES = 
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  bindings/tcl/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --foreign  bindings/tcl/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+ifOctets.tcl: $(top_builddir)/config.status $(srcdir)/ifOctets.tcl.in
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-libLIBRARIES: $(lib_LIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+       @list='$(lib_LIBRARIES)'; for p in $$list; do \
+         if test -f $$p; then \
+           f=$(am__strip_dir) \
+           echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+           $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+         else :; fi; \
+       done
+       @$(POST_INSTALL)
+       @list='$(lib_LIBRARIES)'; for p in $$list; do \
+         if test -f $$p; then \
+           p=$(am__strip_dir) \
+           echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
+           $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
+         else :; fi; \
+       done
+
+uninstall-libLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @list='$(lib_LIBRARIES)'; for p in $$list; do \
+         p=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+         rm -f "$(DESTDIR)$(libdir)/$$p"; \
+       done
+
+clean-libLIBRARIES:
+       -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
+install-pkglibSCRIPTS: $(pkglib_SCRIPTS)
+       @$(NORMAL_INSTALL)
+       test -z "$(pkglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkglibdir)"
+       @list='$(pkglib_SCRIPTS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         if test -f $$d$$p; then \
+           f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+           echo " $(pkglibSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \
+           $(pkglibSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-pkglibSCRIPTS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(pkglib_SCRIPTS)'; for p in $$list; do \
+         f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+         echo " rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \
+       done
+install-tclpkgSCRIPTS: $(tclpkg_SCRIPTS)
+       @$(NORMAL_INSTALL)
+       test -z "$(tclpkgdir)" || $(mkdir_p) "$(DESTDIR)$(tclpkgdir)"
+       @list='$(tclpkg_SCRIPTS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         if test -f $$d$$p; then \
+           f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+           echo " $(tclpkgSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(tclpkgdir)/$$f'"; \
+           $(tclpkgSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(tclpkgdir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-tclpkgSCRIPTS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(tclpkg_SCRIPTS)'; for p in $$list; do \
+         f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+         echo " rm -f '$(DESTDIR)$(tclpkgdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(tclpkgdir)/$$f"; \
+       done
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+distclean-libtool:
+       -rm -f libtool
+uninstall-info-am:
+install-pkglibDATA: $(pkglib_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(pkglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkglibdir)"
+       @list='$(pkglib_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(pkglibDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \
+         $(pkglibDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \
+       done
+
+uninstall-pkglibDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(pkglib_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \
+       done
+install-tclpkgDATA: $(tclpkg_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(tclpkgdir)" || $(mkdir_p) "$(DESTDIR)$(tclpkgdir)"
+       @list='$(tclpkg_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(tclpkgDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(tclpkgdir)/$$f'"; \
+         $(tclpkgDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(tclpkgdir)/$$f"; \
+       done
+
+uninstall-tclpkgDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(tclpkg_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(tclpkgdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(tclpkgdir)/$$f"; \
+       done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+       @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
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(SCRIPTS) $(DATA) all-local
+installdirs:
+       for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(tclpkgdir)" "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(tclpkgdir)"; 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:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+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-generic clean-libLIBRARIES clean-libtool \
+       mostlyclean-am
+
+distclean: distclean-am
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-tclpkgDATA install-tclpkgSCRIPTS
+
+install-exec-am: install-exec-local install-libLIBRARIES \
+       install-pkglibDATA install-pkglibSCRIPTS
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLIBRARIES \
+       uninstall-pkglibDATA uninstall-pkglibSCRIPTS \
+       uninstall-tclpkgDATA uninstall-tclpkgSCRIPTS
+
+.PHONY: all all-am all-local check check-am clean clean-generic \
+       clean-libLIBRARIES clean-libtool distclean distclean-generic \
+       distclean-libtool distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am install-exec \
+       install-exec-am install-exec-local install-info \
+       install-info-am install-libLIBRARIES install-man \
+       install-pkglibDATA install-pkglibSCRIPTS install-strip \
+       install-tclpkgDATA install-tclpkgSCRIPTS installcheck \
+       installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-generic \
+       mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+       uninstall-info-am uninstall-libLIBRARIES uninstall-pkglibDATA \
+       uninstall-pkglibSCRIPTS uninstall-tclpkgDATA \
+       uninstall-tclpkgSCRIPTS
+
+
+all-local: $(TCL_RRD_LIB)
+
+$(TCL_RRD_LIB): tclrrd.o
+       $(TCL_SHLIB_LD) $(TCL_LD_SEARCH_FLAGS) $(LIBDIRS) $< -o $@ -lrrd_th -lm $(TCL_STUB_LIB_SPEC) $(LDFLAGS) $(LIBS)
+
+tclrrd.o: tclrrd.c
+       $(CC) $(AM_CFLAGS) $(CFLAGS) $(TCL_SHLIB_CFLAGS) $(AM_CPPFLAGS) -c $< -DVERSION=\"$(VERSION)\"
+
+pkgIndex.tcl:
+       echo "package ifneeded Rrd $(VERSION) \"load $(libdir)/tclrrd$(VERSION)[info sharedlibextension]\"" > $@
+
+install-exec-local: $(TCL_RRD_LIB)
+       @$(NORMAL_INSTALL)
+       $(INSTALL_PROGRAM) $(TCL_RRD_LIB) $(DESTDIR)$(libdir)/$(TCL_RRD_LIB)
+# 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/bindings/tcl/README b/bindings/tcl/README
new file mode 100644 (file)
index 0000000..065a03a
--- /dev/null
@@ -0,0 +1,31 @@
+TCLRRD -- A TCL interpreter extension to access the RRD library,
+         contributed to Tobias Oetiker's RRD tools.
+
+Copyright (c) 1999,2000 Frank Strauss, Technical University of Braunschweig.
+
+See the file "COPYING" for information on usage and redistribution
+of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+
+TCLRRD adds a dynamically loadable package to the Tcl 8.x interpreter
+to access all RRD functions as of RRDtool 1.0.13. All command names
+and arguments are equal to those of RRDtool. They are assigned to the
+namespace `Rrd', e.g.  `Rrd::create'. Return values are a bit
+different from plain RRDtool behavior to enable more native Tcl
+usage. Errors are mapped to the TCL_ERROR return code together with
+the RRD error strings.
+
+TCLRRD makes it easy to combine RRD use with advanced SNMP functionality
+of scotty (http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/). E.g., it's easy
+to use some scotty code to get the counters of some interfaces by their
+interface name and then use Rrd::update to store the values. Furthermore,
+data source types (see RRD::create documentation) and integer value ranges
+could be easily retrieved from MIB information.
+
+TCLRRD has been written on a Linux system for use with Tcl 8.x. It should
+work on many other platforms, although it has not been tested. There are
+no fool proof installation procedures. Take a look at Makefile.am and
+adapt it, if required.
+
+TCLRRD has been written for RRD 1.0.13.
+
+       Frank Strauss <strauss@ibr.cs.tu-bs.de>, 09-Mar-2000
diff --git a/bindings/tcl/ifOctets.tcl.in b/bindings/tcl/ifOctets.tcl.in
new file mode 100644 (file)
index 0000000..7a36397
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/sh
+# the next line restarts using tclsh -*- tcl -*- \
+exec tclsh@TCL_VERSION@ "$0" "$@"
+
+#package require Tnm 3.0
+package require Rrd @VERSION@
+
+set rrdfile "[lindex $argv 0]-[lindex $argv 1].rrd"
+
+# create rrdfile if not yet existent
+if {[file exists $rrdfile] == 0} {
+    Rrd::create $rrdfile --step 5 \
+           DS:inOctets:COUNTER:10:U:U DS:outOctets:COUNTER:10:U:U \
+           RRA:AVERAGE:0.5:1:12
+}
+
+# get an snmp session context
+set session [Tnm::snmp generator -address [lindex $argv 0]]
+
+# walk through the ifDescr column to find the right interface
+$session walk descr IF-MIB!ifDescr {
+
+    # is this the right interface?
+    if {"[Tnm::snmp value $descr 0]" == "[lindex $argv 1]"} {
+
+       # get the instance part of this table row
+       set inst [lindex [Tnm::mib split [Tnm::snmp oid $descr 0]] 1]
+
+       # get the two interface's octet counter values
+       set in [lindex [lindex [$session get IF-MIB!ifInOctets.$inst] 0] 2]
+       set out [lindex [lindex [$session get IF-MIB!ifOutOctets.$inst] 0] 2]
+
+       # write the values to the rrd
+       puts "$in $out"
+       Rrd::update $rrdfile --template inOctets:outOctets N:$in:$out
+
+       Rrd::graph gaga.png --title "gaga" \
+               DEF:in=$rrdfile:inOctets:AVERAGE \
+               DEF:out=$rrdfile:outOctets:AVERAGE \
+               AREA:in#0000FF:inOctets \
+               LINE2:out#00C000:outOctets
+
+       #puts [Rrd::fetch $rrdfile AVERAGE]
+    }
+}
diff --git a/bindings/tcl/tclrrd.c b/bindings/tcl/tclrrd.c
new file mode 100644 (file)
index 0000000..b1b43cc
--- /dev/null
@@ -0,0 +1,677 @@
+/*
+ * tclrrd.c -- A TCL interpreter extension to access the RRD library.
+ *
+ * Copyright (c) 1999,2000 Frank Strauss, Technical University of Braunschweig.
+ *
+ * Thread-safe code copyright (c) 2005 Oleg Derevenetz, CenterTelecom Voronezh ISP.
+ *
+ * See the file "COPYING" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * $Id: tclrrd.c 1044 2007-05-02 05:08:21Z oetiker $
+ */
+
+
+
+#include <errno.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <tcl.h>
+#include "../../src/rrd_tool.h"
+#include "../../src/rrd_format.h"
+
+/* support pre-8.4 tcl */
+
+#ifndef CONST84
+#   define CONST84
+#endif
+
+extern int Tclrrd_Init(Tcl_Interp *interp);
+extern int Tclrrd_SafeInit(Tcl_Interp *interp);
+
+
+/*
+ * some rrd_XXX() and new thread-safe versions of Rrd_XXX()
+ * functions might modify the argv strings passed to it.
+ * Hence, we need to do some preparation before
+ * calling the rrd library functions.
+ */
+static char ** getopt_init(int argc, CONST84 char *argv[])
+{
+    char **argv2;
+    int i;
+    
+    argv2 = calloc(argc, sizeof(char *));
+    for (i = 0; i < argc; i++) {
+       argv2[i] = strdup(argv[i]);
+    }
+    return argv2;
+}
+
+static void getopt_cleanup(int argc, char **argv2)
+{
+    int i;
+    
+    for (i = 0; i < argc; i++) {
+       if (argv2[i] != NULL) {
+           free(argv2[i]);
+       }
+    }
+    free(argv2);
+}
+
+static void getopt_free_element(argv2, argn)
+    char *argv2[];
+    int  argn;
+{
+    if (argv2[argn] != NULL) {
+       free(argv2[argn]);
+       argv2[argn] = NULL;
+    }
+}
+
+static void getopt_squieeze(argc, argv2)
+    int  *argc;
+    char *argv2[];
+{
+    int i, null_i = 0, argc_tmp = *argc;
+
+    for (i = 0; i < argc_tmp; i++) {
+       if (argv2[i] == NULL) {
+           (*argc)--;
+       } else {
+           argv2[null_i++] = argv2[i];
+       }
+    }
+}
+
+
+
+/* Thread-safe version */
+static int
+Rrd_Create(ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
+{
+    int                                argv_i;
+    char                       **argv2;
+    char                       *parsetime_error = NULL;
+    time_t                     last_up = time(NULL) - 10;
+    long int                   long_tmp;
+    unsigned long int          pdp_step = 300;
+    struct rrd_time_value      last_up_tv;
+
+    argv2 = getopt_init(argc, argv);
+
+    for (argv_i = 1; argv_i < argc; argv_i++) {
+       if (!strcmp(argv2[argv_i], "--start") || !strcmp(argv2[argv_i], "-b")) {
+           if (argv_i++>=argc) {
+               Tcl_AppendResult(interp, "RRD Error: option '",
+                                argv2[argv_i - 1], "' needs an argument", (char *) NULL);
+               getopt_cleanup(argc, argv2);
+               return TCL_ERROR;
+           }
+           if ((parsetime_error = parsetime(argv2[argv_i], &last_up_tv))) {
+               Tcl_AppendResult(interp, "RRD Error: invalid time format: '",
+                                argv2[argv_i], "'", (char *) NULL);
+               getopt_cleanup(argc, argv2);
+               return TCL_ERROR;
+           }
+           if (last_up_tv.type == RELATIVE_TO_END_TIME ||
+               last_up_tv.type == RELATIVE_TO_START_TIME) {
+               Tcl_AppendResult(interp, "RRD Error: specifying time relative to the 'start' ",
+                                "or 'end' makes no sense here", (char *) NULL);
+               getopt_cleanup(argc, argv2);
+               return TCL_ERROR;
+           }
+           last_up = mktime(&last_up_tv.tm) + last_up_tv.offset;
+           if (last_up < 3600*24*365*10) {
+               Tcl_AppendResult(interp, "RRD Error: the first entry to the RRD should be after 1980",
+                                (char *) NULL);
+               getopt_cleanup(argc, argv2);
+               return TCL_ERROR;
+           }
+           getopt_free_element(argv2, argv_i - 1);
+           getopt_free_element(argv2, argv_i);
+       } else if (!strcmp(argv2[argv_i], "--step") || !strcmp(argv2[argv_i], "-s")) {
+           if (argv_i++>=argc) {
+               Tcl_AppendResult(interp, "RRD Error: option '",
+                                argv2[argv_i - 1], "' needs an argument", (char *) NULL);
+               getopt_cleanup(argc, argv2);
+               return TCL_ERROR;
+           }
+           long_tmp = atol(argv2[argv_i]);
+           if (long_tmp < 1) {
+               Tcl_AppendResult(interp, "RRD Error: step size should be no less than one second",
+                                (char *) NULL);
+               getopt_cleanup(argc, argv2);
+               return TCL_ERROR;
+           }
+           pdp_step = long_tmp;
+           getopt_free_element(argv2, argv_i - 1);
+           getopt_free_element(argv2, argv_i);
+       } else if (!strcmp(argv2[argv_i], "--")) {
+           getopt_free_element(argv2, argv_i);
+           break;
+       } else if (argv2[argv_i][0]=='-') {
+           Tcl_AppendResult(interp, "RRD Error: unknown option '",
+                            argv2[argv_i], "'", (char *) NULL);
+           getopt_cleanup(argc, argv2);
+           return TCL_ERROR;
+       }
+    }
+
+    getopt_squieeze(&argc, argv2);
+
+    if (argc < 2) {
+       Tcl_AppendResult(interp, "RRD Error: needs rrd filename",
+                        (char *) NULL);
+       getopt_cleanup(argc, argv2);
+       return TCL_ERROR;
+    }
+
+    rrd_create_r(argv2[1], pdp_step, last_up, argc - 2, argv2 + 2);
+
+    getopt_cleanup(argc, argv2);
+    
+    if (rrd_test_error()) {
+       Tcl_AppendResult(interp, "RRD Error: ",
+                        rrd_get_error(), (char *) NULL);
+        rrd_clear_error();
+       return TCL_ERROR;
+    }
+
+    return TCL_OK;
+}
+
+
+
+/* Thread-safe version */
+static int
+Rrd_Dump(ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
+{
+    if (argc < 2) {
+       Tcl_AppendResult(interp, "RRD Error: needs rrd filename",
+                        (char *) NULL);
+       return TCL_ERROR;
+    }
+
+    rrd_dump_r(argv[1], NULL);
+
+    /* NOTE: rrd_dump() writes to stdout. No interaction with TCL. */
+
+    if (rrd_test_error()) {
+       Tcl_AppendResult(interp, "RRD Error: ",
+                        rrd_get_error(), (char *) NULL);
+        rrd_clear_error();
+       return TCL_ERROR;
+    }
+
+    return TCL_OK;
+}
+
+
+
+/* Thread-safe version */
+static int
+Rrd_Last(ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
+{
+    time_t t;
+    
+    if (argc < 2) {
+       Tcl_AppendResult(interp, "RRD Error: needs rrd filename",
+                        (char *) NULL);
+       return TCL_ERROR;
+    }
+
+    t = rrd_last_r(argv[1]);
+
+    if (rrd_test_error()) {
+       Tcl_AppendResult(interp, "RRD Error: ",
+                        rrd_get_error(), (char *) NULL);
+        rrd_clear_error();
+       return TCL_ERROR;
+    }
+
+    Tcl_SetIntObj(Tcl_GetObjResult(interp), t);
+
+    return TCL_OK;
+}
+
+
+
+/* Thread-safe version */
+static int
+Rrd_Update(ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
+{
+    int                argv_i;
+    char       **argv2, *template = NULL;
+    
+    argv2 = getopt_init(argc, argv);
+
+    for (argv_i = 1; argv_i < argc; argv_i++) {
+       if (!strcmp(argv2[argv_i], "--template") || !strcmp(argv2[argv_i], "-t")) {
+           if (argv_i++>=argc) {
+               Tcl_AppendResult(interp, "RRD Error: option '",
+                                argv2[argv_i - 1], "' needs an argument", (char *) NULL);
+               if (template != NULL) {
+                   free(template);
+               }
+               getopt_cleanup(argc, argv2);
+               return TCL_ERROR;
+           }
+           if (template != NULL) {
+               free(template);
+           }
+           template = strdup(argv2[argv_i]);
+           getopt_free_element(argv2, argv_i - 1);
+           getopt_free_element(argv2, argv_i);
+       } else if (!strcmp(argv2[argv_i], "--")) {
+           getopt_free_element(argv2, argv_i);
+           break;
+       } else if (argv2[argv_i][0]=='-') {
+           Tcl_AppendResult(interp, "RRD Error: unknown option '",
+                            argv2[argv_i], "'", (char *) NULL);
+           if (template != NULL) {
+               free(template);
+           }
+           getopt_cleanup(argc, argv2);
+           return TCL_ERROR;
+       }
+    }
+
+    getopt_squieeze(&argc, argv2);
+
+    if (argc < 2) {
+       Tcl_AppendResult(interp, "RRD Error: needs rrd filename",
+                        (char *) NULL);
+       if (template != NULL) {
+           free(template);
+       }
+       getopt_cleanup(argc, argv2);
+       return TCL_ERROR;
+    }
+
+    rrd_update_r(argv2[1], template, argc - 2, argv2 + 2);
+
+    if (template != NULL) {
+       free(template);
+    }
+    getopt_cleanup(argc, argv2);
+
+    if (rrd_test_error()) {
+       Tcl_AppendResult(interp, "RRD Error: ",
+                        rrd_get_error(), (char *) NULL);
+        rrd_clear_error();
+       return TCL_ERROR;
+    }
+
+    return TCL_OK;
+}
+
+static int
+Rrd_Lastupdate(ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
+{
+   time_t last_update;
+   char **argv2;
+   char **ds_namv;
+   char **last_ds;
+   char s[30];
+   Tcl_Obj *listPtr;
+   unsigned long ds_cnt, i;
+
+   argv2 = getopt_init(argc, argv);
+   if (rrd_lastupdate(argc-1, argv2, &last_update,
+       &ds_cnt, &ds_namv, &last_ds) == 0) {
+          listPtr = Tcl_GetObjResult(interp);
+           for (i=0; i<ds_cnt; i++) {
+              sprintf(s, " %28s", ds_namv[i]);
+              Tcl_ListObjAppendElement(interp, listPtr,
+                      Tcl_NewStringObj(s, -1));
+           sprintf(s, "\n\n%10lu:", last_update);
+              Tcl_ListObjAppendElement(interp, listPtr,
+                      Tcl_NewStringObj(s, -1));
+           for (i=0; i<ds_cnt; i++) {
+               sprintf(s, " %s", last_ds[i]);
+              Tcl_ListObjAppendElement(interp, listPtr,
+                      Tcl_NewStringObj(s, -1));
+               free(last_ds[i]);
+               free(ds_namv[i]);
+           }
+           sprintf(s, "\n");
+          Tcl_ListObjAppendElement(interp, listPtr,
+                   Tcl_NewStringObj(s, -1));
+           free(last_ds);
+           free(ds_namv);
+          }
+    }
+    return TCL_OK;
+}
+
+static int
+Rrd_Fetch(ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
+{
+    time_t start, end, j;
+    unsigned long step, ds_cnt, i, ii;
+    rrd_value_t *data, *datai;
+    char **ds_namv;
+    Tcl_Obj *listPtr;
+    char s[30];
+    char **argv2;
+    
+    argv2 = getopt_init(argc, argv);
+    if (rrd_fetch(argc, argv2, &start, &end, &step,
+                 &ds_cnt, &ds_namv, &data) != -1) {
+        datai = data;
+        listPtr = Tcl_GetObjResult(interp);
+        for (j = start; j <= end; j += step) {
+            for (ii = 0; ii < ds_cnt; ii++) {
+               sprintf(s, "%.2f", *(datai++));
+                Tcl_ListObjAppendElement(interp, listPtr,
+                                        Tcl_NewStringObj(s, -1));
+            }
+        }
+        for (i=0; i<ds_cnt; i++) free(ds_namv[i]);
+        free(ds_namv);
+        free(data);
+    }
+    getopt_cleanup(argc, argv2);
+
+    if (rrd_test_error()) {
+       Tcl_AppendResult(interp, "RRD Error: ",
+                        rrd_get_error(), (char *) NULL);
+        rrd_clear_error();
+       return TCL_ERROR;
+    }
+
+    return TCL_OK;
+}
+
+
+
+static int
+Rrd_Graph(ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
+{
+    Tcl_Channel channel;
+    int mode, fd2;
+    ClientData fd1;
+    FILE *stream = NULL;
+    char **calcpr = NULL;
+    int rc, xsize, ysize;
+    double ymin, ymax;
+    char dimensions[50];
+    char **argv2;
+    CONST84 char *save;
+    
+    /*
+     * If the "filename" is a Tcl fileID, then arrange for rrd_graph() to write to
+     * that file descriptor.  Will this work with windoze?  I have no idea.
+     */
+    if ((channel = Tcl_GetChannel(interp, argv[1], &mode)) != NULL) {
+       /*
+        * It >is< a Tcl fileID
+        */
+       if (!(mode & TCL_WRITABLE)) {
+           Tcl_AppendResult(interp, "channel \"", argv[1],
+               "\" wasn't opened for writing", (char *) NULL);
+           return TCL_ERROR;
+       }
+       /*
+        * Must flush channel to make sure any buffered data is written before
+        * rrd_graph() writes to the stream
+        */
+       if (Tcl_Flush(channel) != TCL_OK) {
+           Tcl_AppendResult(interp, "flush failed for \"", argv[1], "\": ",
+               strerror(Tcl_GetErrno()), (char *) NULL);
+           return TCL_ERROR;
+       }
+       if (Tcl_GetChannelHandle(channel, TCL_WRITABLE, &fd1) != TCL_OK) {
+           Tcl_AppendResult(interp, "cannot get file descriptor associated with \"",
+               argv[1], "\"", (char *) NULL);
+           return TCL_ERROR;
+       }
+       /*
+        * Must dup() file descriptor so we can fclose(stream), otherwise the fclose()
+        * would close Tcl's file descriptor
+        */
+       if ((fd2 = dup((int)fd1)) == -1) {
+           Tcl_AppendResult(interp, "dup() failed for file descriptor associated with \"",
+               argv[1], "\": ", strerror(errno), (char *) NULL);
+           return TCL_ERROR;
+       }
+       /*
+        * rrd_graph() wants a FILE*
+        */
+       if ((stream = fdopen(fd2, "wb")) == NULL) {
+           Tcl_AppendResult(interp, "fdopen() failed for file descriptor associated with \"",
+               argv[1], "\": ", strerror(errno), (char *) NULL);
+           close(fd2);         /* plug potential file descriptor leak */
+           return TCL_ERROR;
+       }
+
+       save = argv[1];
+       argv[1] = "-";
+       argv2 = getopt_init(argc, argv);
+       argv[1] = save;
+    } else {
+       Tcl_ResetResult(interp);        /* clear error from Tcl_GetChannel() */
+       argv2 = getopt_init(argc, argv);
+    }
+
+    rc = rrd_graph(argc, argv2, &calcpr, &xsize, &ysize, stream, &ymin, &ymax);
+    getopt_cleanup(argc, argv2);
+
+    if (stream != NULL)
+       fclose(stream);         /* plug potential malloc & file descriptor leak */
+
+    if (rc != -1) {
+        sprintf(dimensions, "%d %d", xsize, ysize);
+        Tcl_AppendResult(interp, dimensions, (char *) NULL);
+        if (calcpr) {
+#if 0
+           int i;
+           
+            for(i = 0; calcpr[i]; i++){
+                printf("%s\n", calcpr[i]);
+                free(calcpr[i]);
+            } 
+#endif
+            free(calcpr);
+        }
+    }
+
+    if (rrd_test_error()) {
+       Tcl_AppendResult(interp, "RRD Error: ",
+                        rrd_get_error(), (char *) NULL);
+        rrd_clear_error();
+       return TCL_ERROR;
+    }
+
+    return TCL_OK;
+}
+
+
+
+static int
+Rrd_Tune(ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
+{
+    char **argv2;
+    
+    argv2 = getopt_init(argc, argv);
+    rrd_tune(argc, argv2);
+    getopt_cleanup(argc, argv2);
+
+    if (rrd_test_error()) {
+       Tcl_AppendResult(interp, "RRD Error: ",
+                        rrd_get_error(), (char *) NULL);
+        rrd_clear_error();
+       return TCL_ERROR;
+    }
+
+    return TCL_OK;
+}
+
+
+
+static int
+Rrd_Resize(ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
+{
+    char **argv2;
+    
+    argv2 = getopt_init(argc, argv);
+    rrd_resize(argc, argv2);
+    getopt_cleanup(argc, argv2);
+
+    if (rrd_test_error()) {
+       Tcl_AppendResult(interp, "RRD Error: ",
+                        rrd_get_error(), (char *) NULL);
+        rrd_clear_error();
+       return TCL_ERROR;
+    }
+
+    return TCL_OK;
+}
+
+
+
+static int
+Rrd_Restore(ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
+{
+    char **argv2;
+    
+    argv2 = getopt_init(argc, argv);
+    rrd_restore(argc, argv2);
+    getopt_cleanup(argc, argv2);
+
+    if (rrd_test_error()) {
+       Tcl_AppendResult(interp, "RRD Error: ",
+                        rrd_get_error(), (char *) NULL);
+        rrd_clear_error();
+       return TCL_ERROR;
+    }
+
+    return TCL_OK;
+}
+
+
+
+/*
+ * The following structure defines the commands in the Rrd extension.
+ */
+
+typedef struct {
+    char *name;                        /* Name of the command. */
+    Tcl_CmdProc *proc;         /* Procedure for command. */
+    int hide;                  /* Hide if safe interpreter */
+} CmdInfo;
+
+static CmdInfo rrdCmds[] = {
+    { "Rrd::create",    Rrd_Create,     1 }, /* Thread-safe version */
+    { "Rrd::dump",      Rrd_Dump,       0 }, /* Thread-safe version */
+    { "Rrd::last",      Rrd_Last,       0 }, /* Thread-safe version */
+    { "Rrd::lastupdate", Rrd_Lastupdate, 0 }, /* Thread-safe version */
+    { "Rrd::update",    Rrd_Update,     1 }, /* Thread-safe version */
+    { "Rrd::fetch",     Rrd_Fetch,      0 },
+    { "Rrd::graph",     Rrd_Graph,      1 }, /* Due to RRD's API, a safe
+                                               interpreter cannot create
+                                               a graph since it writes to
+                                               a filename supplied by the
+                                               caller */
+    { "Rrd::tune",      Rrd_Tune,       1 },
+    { "Rrd::resize",    Rrd_Resize,     1 },
+    { "Rrd::restore",   Rrd_Restore,    1 },
+    { (char *) NULL,   (Tcl_CmdProc *)  NULL, 0        }
+};
+
+
+
+static int
+init(Tcl_Interp *interp, int safe)
+{ 
+    CmdInfo *cmdInfoPtr;
+    Tcl_CmdInfo info;
+
+    if ( Tcl_InitStubs(interp,TCL_VERSION,0) == NULL )
+       return TCL_ERROR;
+
+    if (Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, 1) == NULL) {
+        return TCL_ERROR;
+    }
+
+    /*
+     * Why a global array?  In keeping with the Rrd:: namespace, why
+     * not simply create a normal variable Rrd::version and set it?
+     */
+    Tcl_SetVar2(interp, "rrd", "version", VERSION, TCL_GLOBAL_ONLY);
+
+    for (cmdInfoPtr = rrdCmds; cmdInfoPtr->name != NULL; cmdInfoPtr++) {
+       /*
+        * Check if the command already exists and return an error
+        * to ensure we detect name clashes while loading the Rrd
+        * extension.
+        */
+       if (Tcl_GetCommandInfo(interp, cmdInfoPtr->name, &info)) {
+           Tcl_AppendResult(interp, "command \"", cmdInfoPtr->name,
+                            "\" already exists", (char *) NULL);
+           return TCL_ERROR;
+       }
+       if (safe && cmdInfoPtr->hide) {
+#if 0
+           /*
+            * Turns out the one cannot hide a command in a namespace
+            * due to a limitation of Tcl, one can only hide global
+            * commands.  Thus, if we created the commands without
+            * the Rrd:: namespace in a safe interpreter, then the
+            * "unsafe" commands could be hidden -- which would allow
+            * an owning interpreter either un-hiding them or doing
+            * an "interp invokehidden".  If the Rrd:: namespace is
+            * used, then it's still possible for the owning interpreter
+            * to fake out the missing commands:
+            *
+            *   # Make all Rrd::* commands available in master interperter
+            *   package require Rrd
+            *   set safe [interp create -safe]
+            *   # Make safe Rrd::* commands available in safe interperter
+            *   interp invokehidden $safe -global load ./tclrrd1.2.11.so
+            *   # Provide the safe interpreter with the missing commands
+            *   $safe alias Rrd::update do_update $safe
+            *   proc do_update {which_interp $args} {
+            *     # Do some checking maybe...
+            *       :
+            *     return [eval Rrd::update $args]
+            *   }
+            *
+            * Our solution for now is to just not create the "unsafe"
+            * commands in a safe interpreter.
+            */
+           if (Tcl_HideCommand(interp, cmdInfoPtr->name, cmdInfoPtr->name) != TCL_OK)
+               return TCL_ERROR;
+#endif
+       }
+       else
+           Tcl_CreateCommand(interp, cmdInfoPtr->name, cmdInfoPtr->proc,
+                         (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+    }
+
+    if (Tcl_PkgProvide(interp, "Rrd", VERSION) != TCL_OK) {
+       return TCL_ERROR;
+    }
+
+    return TCL_OK;
+}
+
+int
+Tclrrd_Init(Tcl_Interp *interp)
+{ 
+  return init(interp, 0);
+}
+
+/*
+ * See the comments above and note how few commands are considered "safe"...
+ * Using rrdtool in a safe interpreter has very limited functionality.  It's
+ * tempting to just return TCL_ERROR and forget about it.
+ */
+int
+Tclrrd_SafeInit(Tcl_Interp *interp)
+{ 
+  return init(interp, 1);
+}
diff --git a/compile b/compile
new file mode 100755 (executable)
index 0000000..1b1d232
--- /dev/null
+++ b/compile
@@ -0,0 +1,142 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand `-c -o'.
+
+scriptversion=2005-05-14.22
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand `-c -o'.
+Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file `INSTALL'.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "compile $scriptversion"
+    exit $?
+    ;;
+esac
+
+ofile=
+cfile=
+eat=
+
+for arg
+do
+  if test -n "$eat"; then
+    eat=
+  else
+    case $1 in
+      -o)
+       # configure might choose to run compile as `compile cc -o foo foo.c'.
+       # So we strip `-o arg' only if arg is an object.
+       eat=1
+       case $2 in
+         *.o | *.obj)
+           ofile=$2
+           ;;
+         *)
+           set x "$@" -o "$2"
+           shift
+           ;;
+       esac
+       ;;
+      *.c)
+       cfile=$1
+       set x "$@" "$1"
+       shift
+       ;;
+      *)
+       set x "$@" "$1"
+       shift
+       ;;
+    esac
+  fi
+  shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+  # If no `-o' option was seen then we might have been invoked from a
+  # pattern rule where we don't need one.  That is ok -- this is a
+  # normal compilation that the losing compiler can handle.  If no
+  # `.c' file was seen then we are probably linking.  That is also
+  # ok.
+  exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use `[/.-]' here to ensure that we don't use the same name
+# that we are using for the .o file.  Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
+while true; do
+  if mkdir "$lockdir" >/dev/null 2>&1; then
+    break
+  fi
+  sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+  mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+  mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# 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/config.guess b/config.guess
new file mode 100755 (executable)
index 0000000..396482d
--- /dev/null
@@ -0,0 +1,1500 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
+
+timestamp='2006-07-02'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, 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 Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+       for c in cc gcc c89 c99 ; do
+         if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+            CC_FOR_BUILD="$c"; break ;
+         fi ;
+       done ;
+       if test x"$CC_FOR_BUILD" = x ; then
+         CC_FOR_BUILD=no_compiler_found ;
+       fi
+       ;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+       PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+       # NetBSD (nbsd) targets should (where applicable) match one or
+       # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+       # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+       # switched to ELF, *-*-netbsd* would select the old
+       # object file format.  This provides both forward
+       # compatibility and a consistent mechanism for selecting the
+       # object file format.
+       #
+       # Note: NetBSD doesn't particularly care about the vendor
+       # portion of the name.  We always set it to "unknown".
+       sysctl="sysctl -n hw.machine_arch"
+       UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+           /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+       case "${UNAME_MACHINE_ARCH}" in
+           armeb) machine=armeb-unknown ;;
+           arm*) machine=arm-unknown ;;
+           sh3el) machine=shl-unknown ;;
+           sh3eb) machine=sh-unknown ;;
+           *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+       esac
+       # The Operating System including object format, if it has switched
+       # to ELF recently, or will in the future.
+       case "${UNAME_MACHINE_ARCH}" in
+           arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+               eval $set_cc_for_build
+               if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+                       | grep __ELF__ >/dev/null
+               then
+                   # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+                   # Return netbsd for either.  FIX?
+                   os=netbsd
+               else
+                   os=netbsdelf
+               fi
+               ;;
+           *)
+               os=netbsd
+               ;;
+       esac
+       # The OS release
+       # Debian GNU/NetBSD machines have a different userland, and
+       # thus, need a distinct triplet. However, they do not need
+       # kernel version information, so it can be replaced with a
+       # suitable tag, in the style of linux-gnu.
+       case "${UNAME_VERSION}" in
+           Debian*)
+               release='-gnu'
+               ;;
+           *)
+               release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+               ;;
+       esac
+       # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+       # contains redundant information, the shorter form:
+       # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+       echo "${machine}-${os}${release}"
+       exit ;;
+    *:OpenBSD:*:*)
+       UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+       echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+       exit ;;
+    *:ekkoBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+       exit ;;
+    *:SolidBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+       exit ;;
+    macppc:MirBSD:*:*)
+       echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
+    *:MirBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
+    alpha:OSF1:*:*)
+       case $UNAME_RELEASE in
+       *4.0)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+               ;;
+       *5.*)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+               ;;
+       esac
+       # According to Compaq, /usr/sbin/psrinfo has been available on
+       # OSF/1 and Tru64 systems produced since 1995.  I hope that
+       # covers most systems running today.  This code pipes the CPU
+       # types through head -n 1, so we only detect the type of CPU 0.
+       ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+       case "$ALPHA_CPU_TYPE" in
+           "EV4 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "EV4.5 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "LCA4 (21066/21068)")
+               UNAME_MACHINE="alpha" ;;
+           "EV5 (21164)")
+               UNAME_MACHINE="alphaev5" ;;
+           "EV5.6 (21164A)")
+               UNAME_MACHINE="alphaev56" ;;
+           "EV5.6 (21164PC)")
+               UNAME_MACHINE="alphapca56" ;;
+           "EV5.7 (21164PC)")
+               UNAME_MACHINE="alphapca57" ;;
+           "EV6 (21264)")
+               UNAME_MACHINE="alphaev6" ;;
+           "EV6.7 (21264A)")
+               UNAME_MACHINE="alphaev67" ;;
+           "EV6.8CB (21264C)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8AL (21264B)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8CX (21264D)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.9A (21264/EV69A)")
+               UNAME_MACHINE="alphaev69" ;;
+           "EV7 (21364)")
+               UNAME_MACHINE="alphaev7" ;;
+           "EV7.9 (21364A)")
+               UNAME_MACHINE="alphaev79" ;;
+       esac
+       # A Pn.n version is a patched version.
+       # A Vn.n version is a released version.
+       # A Tn.n version is a released field test version.
+       # A Xn.n version is an unreleased experimental baselevel.
+       # 1.2 uses "1.2" for uname -r.
+       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+       exit ;;
+    Alpha\ *:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # Should we change UNAME_MACHINE based on the output of uname instead
+       # of the specific Alpha model?
+       echo alpha-pc-interix
+       exit ;;
+    21064:Windows_NT:50:3)
+       echo alpha-dec-winnt3.5
+       exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+       echo m68k-unknown-sysv4
+       exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-amigaos
+       exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-morphos
+       exit ;;
+    *:OS/390:*:*)
+       echo i370-ibm-openedition
+       exit ;;
+    *:z/VM:*:*)
+       echo s390-ibm-zvmoe
+       exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+       exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+       echo arm-acorn-riscix${UNAME_RELEASE}
+       exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+       echo arm-unknown-riscos
+       exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+       echo hppa1.1-hitachi-hiuxmpp
+       exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+       # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+       if test "`(/bin/universe) 2>/dev/null`" = att ; then
+               echo pyramid-pyramid-sysv3
+       else
+               echo pyramid-pyramid-bsd
+       fi
+       exit ;;
+    NILE*:*:*:dcosx)
+       echo pyramid-pyramid-svr4
+       exit ;;
+    DRS?6000:unix:4.0:6*)
+       echo sparc-icl-nx6
+       exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+       case `/usr/bin/uname -p` in
+           sparc) echo sparc-icl-nx7; exit ;;
+       esac ;;
+    sun4H:SunOS:5.*:*)
+       echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+       echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    i86pc:SunOS:5.*:*)
+       echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:6*:*)
+       # According to config.sub, this is the proper way to canonicalize
+       # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+       # it's likely to be more like Solaris than SunOS4.
+       echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:*:*)
+       case "`/usr/bin/arch -k`" in
+           Series*|S4*)
+               UNAME_RELEASE=`uname -v`
+               ;;
+       esac
+       # Japanese Language versions have a version number like `4.1.3-JL'.
+       echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+       exit ;;
+    sun3*:SunOS:*:*)
+       echo m68k-sun-sunos${UNAME_RELEASE}
+       exit ;;
+    sun*:*:4.2BSD:*)
+       UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+       test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+       case "`/bin/arch`" in
+           sun3)
+               echo m68k-sun-sunos${UNAME_RELEASE}
+               ;;
+           sun4)
+               echo sparc-sun-sunos${UNAME_RELEASE}
+               ;;
+       esac
+       exit ;;
+    aushp:SunOS:*:*)
+       echo sparc-auspex-sunos${UNAME_RELEASE}
+       exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+        exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
+    m68k:machten:*:*)
+       echo m68k-apple-machten${UNAME_RELEASE}
+       exit ;;
+    powerpc:machten:*:*)
+       echo powerpc-apple-machten${UNAME_RELEASE}
+       exit ;;
+    RISC*:Mach:*:*)
+       echo mips-dec-mach_bsd4.3
+       exit ;;
+    RISC*:ULTRIX:*:*)
+       echo mips-dec-ultrix${UNAME_RELEASE}
+       exit ;;
+    VAX*:ULTRIX*:*:*)
+       echo vax-dec-ultrix${UNAME_RELEASE}
+       exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+       echo clipper-intergraph-clix${UNAME_RELEASE}
+       exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+       int main (int argc, char *argv[]) {
+#else
+       int main (argc, argv) int argc; char *argv[]; {
+#endif
+       #if defined (host_mips) && defined (MIPSEB)
+       #if defined (SYSTYPE_SYSV)
+         printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_SVR4)
+         printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+         printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+       #endif
+       #endif
+         exit (-1);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c &&
+         dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+         SYSTEM_NAME=`$dummy $dummyarg` &&
+           { echo "$SYSTEM_NAME"; exit; }
+       echo mips-mips-riscos${UNAME_RELEASE}
+       exit ;;
+    Motorola:PowerMAX_OS:*:*)
+       echo powerpc-motorola-powermax
+       exit ;;
+    Motorola:*:4.3:PL8-*)
+       echo powerpc-harris-powermax
+       exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+       echo powerpc-harris-powermax
+       exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+       echo powerpc-harris-powerunix
+       exit ;;
+    m88k:CX/UX:7*:*)
+       echo m88k-harris-cxux7
+       exit ;;
+    m88k:*:4*:R4*)
+       echo m88k-motorola-sysv4
+       exit ;;
+    m88k:*:3*:R3*)
+       echo m88k-motorola-sysv3
+       exit ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+       if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+       then
+           if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+              [ ${TARGET_BINARY_INTERFACE}x = x ]
+           then
+               echo m88k-dg-dgux${UNAME_RELEASE}
+           else
+               echo m88k-dg-dguxbcs${UNAME_RELEASE}
+           fi
+       else
+           echo i586-dg-dgux${UNAME_RELEASE}
+       fi
+       exit ;;
+    M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
+       echo m88k-dolphin-sysv3
+       exit ;;
+    M88*:*:R3*:*)
+       # Delta 88k system running SVR3
+       echo m88k-motorola-sysv3
+       exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+       echo m88k-tektronix-sysv3
+       exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+       echo m68k-tektronix-bsd
+       exit ;;
+    *:IRIX*:*:*)
+       echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+       exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+       echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+       exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+       echo i386-ibm-aix
+       exit ;;
+    ia64:AIX:*:*)
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+       exit ;;
+    *:AIX:2:3)
+       if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+               eval $set_cc_for_build
+               sed 's/^                //' << EOF >$dummy.c
+               #include <sys/systemcfg.h>
+
+               main()
+                       {
+                       if (!__power_pc())
+                               exit(1);
+                       puts("powerpc-ibm-aix3.2.5");
+                       exit(0);
+                       }
+EOF
+               if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+               then
+                       echo "$SYSTEM_NAME"
+               else
+                       echo rs6000-ibm-aix3.2.5
+               fi
+       elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+               echo rs6000-ibm-aix3.2.4
+       else
+               echo rs6000-ibm-aix3.2
+       fi
+       exit ;;
+    *:AIX:*:[45])
+       IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+       if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+               IBM_ARCH=rs6000
+       else
+               IBM_ARCH=powerpc
+       fi
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+       exit ;;
+    *:AIX:*:*)
+       echo rs6000-ibm-aix
+       exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+       echo romp-ibm-bsd4.4
+       exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+       echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+       exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+       echo rs6000-bull-bosx
+       exit ;;
+    DPX/2?00:B.O.S.:*:*)
+       echo m68k-bull-sysv3
+       exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+       echo m68k-hp-bsd
+       exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+       echo m68k-hp-bsd4.4
+       exit ;;
+    9000/[34678]??:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       case "${UNAME_MACHINE}" in
+           9000/31? )            HP_ARCH=m68000 ;;
+           9000/[34]?? )         HP_ARCH=m68k ;;
+           9000/[678][0-9][0-9])
+               if [ -x /usr/bin/getconf ]; then
+                   sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+                         '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+               fi
+               if [ "${HP_ARCH}" = "" ]; then
+                   eval $set_cc_for_build
+                   sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+               {
+               case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+               case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+               case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+                   switch (bits)
+                       {
+                       case 64: puts ("hppa2.0w"); break;
+                       case 32: puts ("hppa2.0n"); break;
+                       default: puts ("hppa2.0"); break;
+                       } break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+                   puts ("hppa2.0"); break;
+              #endif
+               default: puts ("hppa1.0"); break;
+               }
+                  exit (0);
+              }
+EOF
+                   (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+                   test -z "$HP_ARCH" && HP_ARCH=hppa
+               fi ;;
+       esac
+       if [ ${HP_ARCH} = "hppa2.0w" ]
+       then
+           eval $set_cc_for_build
+
+           # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+           # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+           # generating 64-bit code.  GNU and HP use different nomenclature:
+           #
+           # $ CC_FOR_BUILD=cc ./config.guess
+           # => hppa2.0w-hp-hpux11.23
+           # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+           # => hppa64-hp-hpux11.23
+
+           if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+               grep __LP64__ >/dev/null
+           then
+               HP_ARCH="hppa2.0w"
+           else
+               HP_ARCH="hppa64"
+           fi
+       fi
+       echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+       exit ;;
+    ia64:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       echo ia64-hp-hpux${HPUX_REV}
+       exit ;;
+    3050*:HI-UX:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <unistd.h>
+       int
+       main ()
+       {
+         long cpu = sysconf (_SC_CPU_VERSION);
+         /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+            true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+            results, however.  */
+         if (CPU_IS_PA_RISC (cpu))
+           {
+             switch (cpu)
+               {
+                 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+                 default: puts ("hppa-hitachi-hiuxwe2"); break;
+               }
+           }
+         else if (CPU_IS_HP_MC68K (cpu))
+           puts ("m68k-hitachi-hiuxwe2");
+         else puts ("unknown-hitachi-hiuxwe2");
+         exit (0);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+               { echo "$SYSTEM_NAME"; exit; }
+       echo unknown-hitachi-hiuxwe2
+       exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+       echo hppa1.1-hp-bsd
+       exit ;;
+    9000/8??:4.3bsd:*:*)
+       echo hppa1.0-hp-bsd
+       exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+       echo hppa1.0-hp-mpeix
+       exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+       echo hppa1.1-hp-osf
+       exit ;;
+    hp8??:OSF1:*:*)
+       echo hppa1.0-hp-osf
+       exit ;;
+    i*86:OSF1:*:*)
+       if [ -x /usr/sbin/sysversion ] ; then
+           echo ${UNAME_MACHINE}-unknown-osf1mk
+       else
+           echo ${UNAME_MACHINE}-unknown-osf1
+       fi
+       exit ;;
+    parisc*:Lites*:*:*)
+       echo hppa1.1-hp-lites
+       exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+       echo c1-convex-bsd
+        exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+        exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+       echo c34-convex-bsd
+        exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+       echo c38-convex-bsd
+        exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+       echo c4-convex-bsd
+        exit ;;
+    CRAY*Y-MP:*:*:*)
+       echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*[A-Z]90:*:*:*)
+       echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+       | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+             -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+             -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*TS:*:*:*)
+       echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*T3E:*:*:*)
+       echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*SV1:*:*:*)
+       echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    *:UNICOS/mp:*:*)
+       echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+       FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+       exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+       echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+       exit ;;
+    sparc*:BSD/OS:*:*)
+       echo sparc-unknown-bsdi${UNAME_RELEASE}
+       exit ;;
+    *:BSD/OS:*:*)
+       echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+       exit ;;
+    *:FreeBSD:*:*)
+       case ${UNAME_MACHINE} in
+           pc98)
+               echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+           amd64)
+               echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+           *)
+               echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+       esac
+       exit ;;
+    i*:CYGWIN*:*)
+       echo ${UNAME_MACHINE}-pc-cygwin
+       exit ;;
+    i*:MINGW*:*)
+       echo ${UNAME_MACHINE}-pc-mingw32
+       exit ;;
+    i*:windows32*:*)
+       # uname -m includes "-pc" on this system.
+       echo ${UNAME_MACHINE}-mingw32
+       exit ;;
+    i*:PW*:*)
+       echo ${UNAME_MACHINE}-pc-pw32
+       exit ;;
+    x86:Interix*:[3456]*)
+       echo i586-pc-interix${UNAME_RELEASE}
+       exit ;;
+    EM64T:Interix*:[3456]*)
+       echo x86_64-unknown-interix${UNAME_RELEASE}
+       exit ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+       echo i${UNAME_MACHINE}-pc-mks
+       exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+       # UNAME_MACHINE based on the output of uname instead of i386?
+       echo i586-pc-interix
+       exit ;;
+    i*:UWIN*:*)
+       echo ${UNAME_MACHINE}-pc-uwin
+       exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+       echo x86_64-unknown-cygwin
+       exit ;;
+    p*:CYGWIN*:*)
+       echo powerpcle-unknown-cygwin
+       exit ;;
+    prep*:SunOS:5.*:*)
+       echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    *:GNU:*:*)
+       # the GNU system
+       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+       exit ;;
+    *:GNU/*:*:*)
+       # other systems with GNU libc and userland
+       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+       exit ;;
+    i*86:Minix:*:*)
+       echo ${UNAME_MACHINE}-pc-minix
+       exit ;;
+    arm*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    avr32*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    cris:Linux:*:*)
+       echo cris-axis-linux-gnu
+       exit ;;
+    crisv32:Linux:*:*)
+       echo crisv32-axis-linux-gnu
+       exit ;;
+    frv:Linux:*:*)
+       echo frv-unknown-linux-gnu
+       exit ;;
+    ia64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    m32r*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    m68*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    mips:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef mips
+       #undef mipsel
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=mipsel
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=mips
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+           /^CPU/{
+               s: ::g
+               p
+           }'`"
+       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+       ;;
+    mips64:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef mips64
+       #undef mips64el
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=mips64el
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=mips64
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+           /^CPU/{
+               s: ::g
+               p
+           }'`"
+       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+       ;;
+    or32:Linux:*:*)
+       echo or32-unknown-linux-gnu
+       exit ;;
+    ppc:Linux:*:*)
+       echo powerpc-unknown-linux-gnu
+       exit ;;
+    ppc64:Linux:*:*)
+       echo powerpc64-unknown-linux-gnu
+       exit ;;
+    alpha:Linux:*:*)
+       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+         EV5)   UNAME_MACHINE=alphaev5 ;;
+         EV56)  UNAME_MACHINE=alphaev56 ;;
+         PCA56) UNAME_MACHINE=alphapca56 ;;
+         PCA57) UNAME_MACHINE=alphapca56 ;;
+         EV6)   UNAME_MACHINE=alphaev6 ;;
+         EV67)  UNAME_MACHINE=alphaev67 ;;
+         EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+       objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+       if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+       echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+       exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+       # Look for CPU level
+       case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+         PA7*) echo hppa1.1-unknown-linux-gnu ;;
+         PA8*) echo hppa2.0-unknown-linux-gnu ;;
+         *)    echo hppa-unknown-linux-gnu ;;
+       esac
+       exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+       echo hppa64-unknown-linux-gnu
+       exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+       echo ${UNAME_MACHINE}-ibm-linux
+       exit ;;
+    sh64*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    sh*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    vax:Linux:*:*)
+       echo ${UNAME_MACHINE}-dec-linux-gnu
+       exit ;;
+    x86_64:Linux:*:*)
+       echo x86_64-unknown-linux-gnu
+       exit ;;
+    i*86:Linux:*:*)
+       # The BFD linker knows what the default object file format is, so
+       # first see if it will tell us. cd to the root directory to prevent
+       # problems with other programs or directories called `ld' in the path.
+       # Set LC_ALL=C to ensure ld outputs messages in English.
+       ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+                        | sed -ne '/supported targets:/!d
+                                   s/[         ][      ]*/ /g
+                                   s/.*supported targets: *//
+                                   s/ .*//
+                                   p'`
+        case "$ld_supported_targets" in
+         elf32-i386)
+               TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+               ;;
+         a.out-i386-linux)
+               echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+               exit ;;
+         coff-i386)
+               echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+               exit ;;
+         "")
+               # Either a pre-BFD a.out linker (linux-gnuoldld) or
+               # one that does not give us useful --help.
+               echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+               exit ;;
+       esac
+       # Determine whether the default compiler is a.out or elf
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <features.h>
+       #ifdef __ELF__
+       # ifdef __GLIBC__
+       #  if __GLIBC__ >= 2
+       LIBC=gnu
+       #  else
+       LIBC=gnulibc1
+       #  endif
+       # else
+       LIBC=gnulibc1
+       # endif
+       #else
+       #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+       LIBC=gnu
+       #else
+       LIBC=gnuaout
+       #endif
+       #endif
+       #ifdef __dietlibc__
+       LIBC=dietlibc
+       #endif
+EOF
+       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+           /^LIBC/{
+               s: ::g
+               p
+           }'`"
+       test x"${LIBC}" != x && {
+               echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+               exit
+       }
+       test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+       ;;
+    i*86:DYNIX/ptx:4*:*)
+       # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+       # earlier versions are messed up and put the nodename in both
+       # sysname and nodename.
+       echo i386-sequent-sysv4
+       exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+       # I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+       echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+       exit ;;
+    i*86:OS/2:*:*)
+       # If we were able to find `uname', then EMX Unix compatibility
+       # is probably installed.
+       echo ${UNAME_MACHINE}-pc-os2-emx
+       exit ;;
+    i*86:XTS-300:*:STOP)
+       echo ${UNAME_MACHINE}-unknown-stop
+       exit ;;
+    i*86:atheos:*:*)
+       echo ${UNAME_MACHINE}-unknown-atheos
+       exit ;;
+    i*86:syllable:*:*)
+       echo ${UNAME_MACHINE}-pc-syllable
+       exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+       echo i386-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    i*86:*DOS:*:*)
+       echo ${UNAME_MACHINE}-pc-msdosdjgpp
+       exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+       UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+       if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+               echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+       else
+               echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+       fi
+       exit ;;
+    i*86:*:5:[678]*)
+       # UnixWare 7.x, OpenUNIX and OpenServer 6.
+       case `/bin/uname -X | grep "^Machine"` in
+           *486*)           UNAME_MACHINE=i486 ;;
+           *Pentium)        UNAME_MACHINE=i586 ;;
+           *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+       esac
+       echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+       exit ;;
+    i*86:*:3.2:*)
+       if test -f /usr/options/cb.name; then
+               UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+               echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+       elif /bin/uname -X 2>/dev/null >/dev/null ; then
+               UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+               (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+               (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+                       && UNAME_MACHINE=i586
+               (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+       else
+               echo ${UNAME_MACHINE}-pc-sysv32
+       fi
+       exit ;;
+    pc:*:*:*)
+       # Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+       echo i386-pc-msdosdjgpp
+        exit ;;
+    Intel:Mach:3*:*)
+       echo i386-pc-mach3
+       exit ;;
+    paragon:*:*:*)
+       echo i860-intel-osf1
+       exit ;;
+    i860:*:4.*:*) # i860-SVR4
+       if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+         echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+       else # Add other i860-SVR4 vendors below as they are discovered.
+         echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+       fi
+       exit ;;
+    mini*:CTIX:SYS*5:*)
+       # "miniframe"
+       echo m68010-convergent-sysv
+       exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+       echo m68k-convergent-sysv
+       exit ;;
+    M680?0:D-NIX:5.3:*)
+       echo m68k-diab-dnix
+       exit ;;
+    M68*:*:R3V[5678]*:*)
+       test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+       OS_REL=''
+       test -r /etc/.relid \
+       && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+         && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+         && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && { echo i486-ncr-sysv4; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+       echo m68k-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+       echo m68k-atari-sysv4
+       exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+       echo sparc-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    rs6000:LynxOS:2.*:*)
+       echo rs6000-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+       echo powerpc-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+       echo mips-dde-sysv${UNAME_RELEASE}
+       exit ;;
+    RM*:ReliantUNIX-*:*:*)
+       echo mips-sni-sysv4
+       exit ;;
+    RM*:SINIX-*:*:*)
+       echo mips-sni-sysv4
+       exit ;;
+    *:SINIX-*:*:*)
+       if uname -p 2>/dev/null >/dev/null ; then
+               UNAME_MACHINE=`(uname -p) 2>/dev/null`
+               echo ${UNAME_MACHINE}-sni-sysv4
+       else
+               echo ns32k-sni-sysv
+       fi
+       exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit ;;
+    *:UNIX_System_V:4*:FTX*)
+       # From Gerald Hewes <hewes@openmarket.com>.
+       # How about differentiating between stratus architectures? -djm
+       echo hppa1.1-stratus-sysv4
+       exit ;;
+    *:*:*:FTX*)
+       # From seanf@swdc.stratus.com.
+       echo i860-stratus-sysv4
+       exit ;;
+    i*86:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo ${UNAME_MACHINE}-stratus-vos
+       exit ;;
+    *:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo hppa1.1-stratus-vos
+       exit ;;
+    mc68*:A/UX:*:*)
+       echo m68k-apple-aux${UNAME_RELEASE}
+       exit ;;
+    news*:NEWS-OS:6*:*)
+       echo mips-sony-newsos6
+       exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+       if [ -d /usr/nec ]; then
+               echo mips-nec-sysv${UNAME_RELEASE}
+       else
+               echo mips-unknown-sysv${UNAME_RELEASE}
+       fi
+        exit ;;
+    BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
+       echo powerpc-be-beos
+       exit ;;
+    BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
+       echo powerpc-apple-beos
+       exit ;;
+    BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
+       echo i586-pc-beos
+       exit ;;
+    SX-4:SUPER-UX:*:*)
+       echo sx4-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-5:SUPER-UX:*:*)
+       echo sx5-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-6:SUPER-UX:*:*)
+       echo sx6-nec-superux${UNAME_RELEASE}
+       exit ;;
+    Power*:Rhapsody:*:*)
+       echo powerpc-apple-rhapsody${UNAME_RELEASE}
+       exit ;;
+    *:Rhapsody:*:*)
+       echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+       exit ;;
+    *:Darwin:*:*)
+       UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+       case $UNAME_PROCESSOR in
+           unknown) UNAME_PROCESSOR=powerpc ;;
+       esac
+       echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+       exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+       UNAME_PROCESSOR=`uname -p`
+       if test "$UNAME_PROCESSOR" = "x86"; then
+               UNAME_PROCESSOR=i386
+               UNAME_MACHINE=pc
+       fi
+       echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+       exit ;;
+    *:QNX:*:4*)
+       echo i386-pc-qnx
+       exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+       echo nse-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+       echo nsr-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    *:NonStop-UX:*:*)
+       echo mips-compaq-nonstopux
+       exit ;;
+    BS2000:POSIX*:*:*)
+       echo bs2000-siemens-sysv
+       exit ;;
+    DS/*:UNIX_System_V:*:*)
+       echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+       exit ;;
+    *:Plan9:*:*)
+       # "uname -m" is not consistent, so use $cputype instead. 386
+       # is converted to i386 for consistency with other x86
+       # operating systems.
+       if test "$cputype" = "386"; then
+           UNAME_MACHINE=i386
+       else
+           UNAME_MACHINE="$cputype"
+       fi
+       echo ${UNAME_MACHINE}-unknown-plan9
+       exit ;;
+    *:TOPS-10:*:*)
+       echo pdp10-unknown-tops10
+       exit ;;
+    *:TENEX:*:*)
+       echo pdp10-unknown-tenex
+       exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+       echo pdp10-dec-tops20
+       exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+       echo pdp10-xkl-tops20
+       exit ;;
+    *:TOPS-20:*:*)
+       echo pdp10-unknown-tops20
+       exit ;;
+    *:ITS:*:*)
+       echo pdp10-unknown-its
+       exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+       exit ;;
+    *:DragonFly:*:*)
+       echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+       exit ;;
+    *:*VMS:*:*)
+       UNAME_MACHINE=`(uname -p) 2>/dev/null`
+       case "${UNAME_MACHINE}" in
+           A*) echo alpha-dec-vms ; exit ;;
+           I*) echo ia64-dec-vms ; exit ;;
+           V*) echo vax-dec-vms ; exit ;;
+       esac ;;
+    *:XENIX:*:SysV)
+       echo i386-pc-xenix
+       exit ;;
+    i*86:skyos:*:*)
+       echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+       exit ;;
+    i*86:rdos:*:*)
+       echo ${UNAME_MACHINE}-pc-rdos
+       exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+         ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+       printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+       printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+       { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+       echo c1-convex-bsd
+       exit ;;
+    c2*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+       exit ;;
+    c34*)
+       echo c34-convex-bsd
+       exit ;;
+    c38*)
+       echo c38-convex-bsd
+       exit ;;
+    c4*)
+       echo c4-convex-bsd
+       exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+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`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config.sub b/config.sub
new file mode 100755 (executable)
index 0000000..fab0aa3
--- /dev/null
@@ -0,0 +1,1616 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
+
+timestamp='2006-09-20'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, 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.
+
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#      CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#      CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+       -sun*os*)
+               # Prevent following clause from handling this invalid input.
+               ;;
+       -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+       -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+       -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+       -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+       -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+       -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+       -apple | -axis | -knuth | -cray)
+               os=
+               basic_machine=$1
+               ;;
+       -sim | -cisco | -oki | -wec | -winbond)
+               os=
+               basic_machine=$1
+               ;;
+       -scout)
+               ;;
+       -wrs)
+               os=-vxworks
+               basic_machine=$1
+               ;;
+       -chorusos*)
+               os=-chorusos
+               basic_machine=$1
+               ;;
+       -chorusrdb)
+               os=-chorusrdb
+               basic_machine=$1
+               ;;
+       -hiux*)
+               os=-hiuxwe2
+               ;;
+       -sco6)
+               os=-sco5v6
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco5)
+               os=-sco3.2v5
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco4)
+               os=-sco3.2v4
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2.[4-9]*)
+               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2v[4-9]*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco5v6*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco*)
+               os=-sco3.2v2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -udk*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -isc)
+               os=-isc2.2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -clix*)
+               basic_machine=clipper-intergraph
+               ;;
+       -isc*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -lynx*)
+               os=-lynxos
+               ;;
+       -ptx*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+               ;;
+       -windowsnt*)
+               os=`echo $os | sed -e 's/windowsnt/winnt/'`
+               ;;
+       -psos*)
+               os=-psos
+               ;;
+       -mint | -mint[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+       # Recognize the basic CPU types without company name.
+       # Some are omitted here because they have special meanings below.
+       1750a | 580 \
+       | a29k \
+       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+       | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+       | am33_2.0 \
+       | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+       | bfin \
+       | c4x | clipper \
+       | d10v | d30v | dlx | dsp16xx \
+       | fr30 | frv \
+       | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+       | i370 | i860 | i960 | ia64 \
+       | ip2k | iq2000 \
+       | m32c | m32r | m32rle | m68000 | m68k | m88k \
+       | maxq | mb | microblaze | mcore \
+       | mips | mipsbe | mipseb | mipsel | mipsle \
+       | mips16 \
+       | mips64 | mips64el \
+       | mips64vr | mips64vrel \
+       | mips64orion | mips64orionel \
+       | mips64vr4100 | mips64vr4100el \
+       | mips64vr4300 | mips64vr4300el \
+       | mips64vr5000 | mips64vr5000el \
+       | mips64vr5900 | mips64vr5900el \
+       | mipsisa32 | mipsisa32el \
+       | mipsisa32r2 | mipsisa32r2el \
+       | mipsisa64 | mipsisa64el \
+       | mipsisa64r2 | mipsisa64r2el \
+       | mipsisa64sb1 | mipsisa64sb1el \
+       | mipsisa64sr71k | mipsisa64sr71kel \
+       | mipstx39 | mipstx39el \
+       | mn10200 | mn10300 \
+       | mt \
+       | msp430 \
+       | nios | nios2 \
+       | ns16k | ns32k \
+       | or32 \
+       | pdp10 | pdp11 | pj | pjl \
+       | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+       | pyramid \
+       | score \
+       | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+       | sh64 | sh64le \
+       | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+       | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+       | spu | strongarm \
+       | tahoe | thumb | tic4x | tic80 | tron \
+       | v850 | v850e \
+       | we32k \
+       | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+       | z8k)
+               basic_machine=$basic_machine-unknown
+               ;;
+       m6811 | m68hc11 | m6812 | m68hc12)
+               # Motorola 68HC11/12.
+               basic_machine=$basic_machine-unknown
+               os=-none
+               ;;
+       m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+               ;;
+       ms1)
+               basic_machine=mt-unknown
+               ;;
+
+       # We use `pc' rather than `unknown'
+       # because (1) that's what they normally are, and
+       # (2) the word "unknown" tends to confuse beginning users.
+       i*86 | x86_64)
+         basic_machine=$basic_machine-pc
+         ;;
+       # Object if more than one company name word.
+       *-*-*)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+       # Recognize the basic CPU types with company name.
+       580-* \
+       | a29k-* \
+       | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+       | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+       | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+       | avr-* | avr32-* \
+       | bfin-* | bs2000-* \
+       | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+       | clipper-* | craynv-* | cydra-* \
+       | d10v-* | d30v-* | dlx-* \
+       | elxsi-* \
+       | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+       | h8300-* | h8500-* \
+       | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+       | i*86-* | i860-* | i960-* | ia64-* \
+       | ip2k-* | iq2000-* \
+       | m32c-* | m32r-* | m32rle-* \
+       | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+       | m88110-* | m88k-* | maxq-* | mcore-* \
+       | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+       | mips16-* \
+       | mips64-* | mips64el-* \
+       | mips64vr-* | mips64vrel-* \
+       | mips64orion-* | mips64orionel-* \
+       | mips64vr4100-* | mips64vr4100el-* \
+       | mips64vr4300-* | mips64vr4300el-* \
+       | mips64vr5000-* | mips64vr5000el-* \
+       | mips64vr5900-* | mips64vr5900el-* \
+       | mipsisa32-* | mipsisa32el-* \
+       | mipsisa32r2-* | mipsisa32r2el-* \
+       | mipsisa64-* | mipsisa64el-* \
+       | mipsisa64r2-* | mipsisa64r2el-* \
+       | mipsisa64sb1-* | mipsisa64sb1el-* \
+       | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+       | mipstx39-* | mipstx39el-* \
+       | mmix-* \
+       | mt-* \
+       | msp430-* \
+       | nios-* | nios2-* \
+       | none-* | np1-* | ns16k-* | ns32k-* \
+       | orion-* \
+       | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+       | pyramid-* \
+       | romp-* | rs6000-* \
+       | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+       | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+       | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+       | sparclite-* \
+       | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+       | tahoe-* | thumb-* \
+       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+       | tron-* \
+       | v850-* | v850e-* | vax-* \
+       | we32k-* \
+       | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+       | xstormy16-* | xtensa-* \
+       | ymp-* \
+       | z8k-*)
+               ;;
+       # Recognize the various machine names and aliases which stand
+       # for a CPU type and a company and sometimes even an OS.
+       386bsd)
+               basic_machine=i386-unknown
+               os=-bsd
+               ;;
+       3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+               basic_machine=m68000-att
+               ;;
+       3b*)
+               basic_machine=we32k-att
+               ;;
+       a29khif)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       abacus)
+               basic_machine=abacus-unknown
+               ;;
+       adobe68k)
+               basic_machine=m68010-adobe
+               os=-scout
+               ;;
+       alliant | fx80)
+               basic_machine=fx80-alliant
+               ;;
+       altos | altos3068)
+               basic_machine=m68k-altos
+               ;;
+       am29k)
+               basic_machine=a29k-none
+               os=-bsd
+               ;;
+       amd64)
+               basic_machine=x86_64-pc
+               ;;
+       amd64-*)
+               basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       amdahl)
+               basic_machine=580-amdahl
+               os=-sysv
+               ;;
+       amiga | amiga-*)
+               basic_machine=m68k-unknown
+               ;;
+       amigaos | amigados)
+               basic_machine=m68k-unknown
+               os=-amigaos
+               ;;
+       amigaunix | amix)
+               basic_machine=m68k-unknown
+               os=-sysv4
+               ;;
+       apollo68)
+               basic_machine=m68k-apollo
+               os=-sysv
+               ;;
+       apollo68bsd)
+               basic_machine=m68k-apollo
+               os=-bsd
+               ;;
+       aux)
+               basic_machine=m68k-apple
+               os=-aux
+               ;;
+       balance)
+               basic_machine=ns32k-sequent
+               os=-dynix
+               ;;
+       c90)
+               basic_machine=c90-cray
+               os=-unicos
+               ;;
+       convex-c1)
+               basic_machine=c1-convex
+               os=-bsd
+               ;;
+       convex-c2)
+               basic_machine=c2-convex
+               os=-bsd
+               ;;
+       convex-c32)
+               basic_machine=c32-convex
+               os=-bsd
+               ;;
+       convex-c34)
+               basic_machine=c34-convex
+               os=-bsd
+               ;;
+       convex-c38)
+               basic_machine=c38-convex
+               os=-bsd
+               ;;
+       cray | j90)
+               basic_machine=j90-cray
+               os=-unicos
+               ;;
+       craynv)
+               basic_machine=craynv-cray
+               os=-unicosmp
+               ;;
+       cr16c)
+               basic_machine=cr16c-unknown
+               os=-elf
+               ;;
+       crds | unos)
+               basic_machine=m68k-crds
+               ;;
+       crisv32 | crisv32-* | etraxfs*)
+               basic_machine=crisv32-axis
+               ;;
+       cris | cris-* | etrax*)
+               basic_machine=cris-axis
+               ;;
+       crx)
+               basic_machine=crx-unknown
+               os=-elf
+               ;;
+       da30 | da30-*)
+               basic_machine=m68k-da30
+               ;;
+       decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+               basic_machine=mips-dec
+               ;;
+       decsystem10* | dec10*)
+               basic_machine=pdp10-dec
+               os=-tops10
+               ;;
+       decsystem20* | dec20*)
+               basic_machine=pdp10-dec
+               os=-tops20
+               ;;
+       delta | 3300 | motorola-3300 | motorola-delta \
+             | 3300-motorola | delta-motorola)
+               basic_machine=m68k-motorola
+               ;;
+       delta88)
+               basic_machine=m88k-motorola
+               os=-sysv3
+               ;;
+       djgpp)
+               basic_machine=i586-pc
+               os=-msdosdjgpp
+               ;;
+       dpx20 | dpx20-*)
+               basic_machine=rs6000-bull
+               os=-bosx
+               ;;
+       dpx2* | dpx2*-bull)
+               basic_machine=m68k-bull
+               os=-sysv3
+               ;;
+       ebmon29k)
+               basic_machine=a29k-amd
+               os=-ebmon
+               ;;
+       elxsi)
+               basic_machine=elxsi-elxsi
+               os=-bsd
+               ;;
+       encore | umax | mmax)
+               basic_machine=ns32k-encore
+               ;;
+       es1800 | OSE68k | ose68k | ose | OSE)
+               basic_machine=m68k-ericsson
+               os=-ose
+               ;;
+       fx2800)
+               basic_machine=i860-alliant
+               ;;
+       genix)
+               basic_machine=ns32k-ns
+               ;;
+       gmicro)
+               basic_machine=tron-gmicro
+               os=-sysv
+               ;;
+       go32)
+               basic_machine=i386-pc
+               os=-go32
+               ;;
+       h3050r* | hiux*)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       h8300hms)
+               basic_machine=h8300-hitachi
+               os=-hms
+               ;;
+       h8300xray)
+               basic_machine=h8300-hitachi
+               os=-xray
+               ;;
+       h8500hms)
+               basic_machine=h8500-hitachi
+               os=-hms
+               ;;
+       harris)
+               basic_machine=m88k-harris
+               os=-sysv3
+               ;;
+       hp300-*)
+               basic_machine=m68k-hp
+               ;;
+       hp300bsd)
+               basic_machine=m68k-hp
+               os=-bsd
+               ;;
+       hp300hpux)
+               basic_machine=m68k-hp
+               os=-hpux
+               ;;
+       hp3k9[0-9][0-9] | hp9[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k2[0-9][0-9] | hp9k31[0-9])
+               basic_machine=m68000-hp
+               ;;
+       hp9k3[2-9][0-9])
+               basic_machine=m68k-hp
+               ;;
+       hp9k6[0-9][0-9] | hp6[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k7[0-79][0-9] | hp7[0-79][0-9])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k78[0-9] | hp78[0-9])
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][13679] | hp8[0-9][13679])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][0-9] | hp8[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hppa-next)
+               os=-nextstep3
+               ;;
+       hppaosf)
+               basic_machine=hppa1.1-hp
+               os=-osf
+               ;;
+       hppro)
+               basic_machine=hppa1.1-hp
+               os=-proelf
+               ;;
+       i370-ibm* | ibm*)
+               basic_machine=i370-ibm
+               ;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+       i*86v32)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv32
+               ;;
+       i*86v4*)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv4
+               ;;
+       i*86v)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv
+               ;;
+       i*86sol2)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-solaris2
+               ;;
+       i386mach)
+               basic_machine=i386-mach
+               os=-mach
+               ;;
+       i386-vsta | vsta)
+               basic_machine=i386-unknown
+               os=-vsta
+               ;;
+       iris | iris4d)
+               basic_machine=mips-sgi
+               case $os in
+                   -irix*)
+                       ;;
+                   *)
+                       os=-irix4
+                       ;;
+               esac
+               ;;
+       isi68 | isi)
+               basic_machine=m68k-isi
+               os=-sysv
+               ;;
+       m88k-omron*)
+               basic_machine=m88k-omron
+               ;;
+       magnum | m3230)
+               basic_machine=mips-mips
+               os=-sysv
+               ;;
+       merlin)
+               basic_machine=ns32k-utek
+               os=-sysv
+               ;;
+       mingw32)
+               basic_machine=i386-pc
+               os=-mingw32
+               ;;
+       miniframe)
+               basic_machine=m68000-convergent
+               ;;
+       *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+       mips3*-*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+               ;;
+       mips3*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+               ;;
+       monitor)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       morphos)
+               basic_machine=powerpc-unknown
+               os=-morphos
+               ;;
+       msdos)
+               basic_machine=i386-pc
+               os=-msdos
+               ;;
+       ms1-*)
+               basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+               ;;
+       mvs)
+               basic_machine=i370-ibm
+               os=-mvs
+               ;;
+       ncr3000)
+               basic_machine=i486-ncr
+               os=-sysv4
+               ;;
+       netbsd386)
+               basic_machine=i386-unknown
+               os=-netbsd
+               ;;
+       netwinder)
+               basic_machine=armv4l-rebel
+               os=-linux
+               ;;
+       news | news700 | news800 | news900)
+               basic_machine=m68k-sony
+               os=-newsos
+               ;;
+       news1000)
+               basic_machine=m68030-sony
+               os=-newsos
+               ;;
+       news-3600 | risc-news)
+               basic_machine=mips-sony
+               os=-newsos
+               ;;
+       necv70)
+               basic_machine=v70-nec
+               os=-sysv
+               ;;
+       next | m*-next )
+               basic_machine=m68k-next
+               case $os in
+                   -nextstep* )
+                       ;;
+                   -ns2*)
+                     os=-nextstep2
+                       ;;
+                   *)
+                     os=-nextstep3
+                       ;;
+               esac
+               ;;
+       nh3000)
+               basic_machine=m68k-harris
+               os=-cxux
+               ;;
+       nh[45]000)
+               basic_machine=m88k-harris
+               os=-cxux
+               ;;
+       nindy960)
+               basic_machine=i960-intel
+               os=-nindy
+               ;;
+       mon960)
+               basic_machine=i960-intel
+               os=-mon960
+               ;;
+       nonstopux)
+               basic_machine=mips-compaq
+               os=-nonstopux
+               ;;
+       np1)
+               basic_machine=np1-gould
+               ;;
+       nsr-tandem)
+               basic_machine=nsr-tandem
+               ;;
+       op50n-* | op60c-*)
+               basic_machine=hppa1.1-oki
+               os=-proelf
+               ;;
+       openrisc | openrisc-*)
+               basic_machine=or32-unknown
+               ;;
+       os400)
+               basic_machine=powerpc-ibm
+               os=-os400
+               ;;
+       OSE68000 | ose68000)
+               basic_machine=m68000-ericsson
+               os=-ose
+               ;;
+       os68k)
+               basic_machine=m68k-none
+               os=-os68k
+               ;;
+       pa-hitachi)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       paragon)
+               basic_machine=i860-intel
+               os=-osf
+               ;;
+       pbd)
+               basic_machine=sparc-tti
+               ;;
+       pbb)
+               basic_machine=m68k-tti
+               ;;
+       pc532 | pc532-*)
+               basic_machine=ns32k-pc532
+               ;;
+       pc98)
+               basic_machine=i386-pc
+               ;;
+       pc98-*)
+               basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentium | p5 | k5 | k6 | nexgen | viac3)
+               basic_machine=i586-pc
+               ;;
+       pentiumpro | p6 | 6x86 | athlon | athlon_*)
+               basic_machine=i686-pc
+               ;;
+       pentiumii | pentium2 | pentiumiii | pentium3)
+               basic_machine=i686-pc
+               ;;
+       pentium4)
+               basic_machine=i786-pc
+               ;;
+       pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+               basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumpro-* | p6-* | 6x86-* | athlon-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentium4-*)
+               basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pn)
+               basic_machine=pn-gould
+               ;;
+       power)  basic_machine=power-ibm
+               ;;
+       ppc)    basic_machine=powerpc-unknown
+               ;;
+       ppc-*)  basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppcle | powerpclittle | ppc-le | powerpc-little)
+               basic_machine=powerpcle-unknown
+               ;;
+       ppcle-* | powerpclittle-*)
+               basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64)  basic_machine=powerpc64-unknown
+               ;;
+       ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+               basic_machine=powerpc64le-unknown
+               ;;
+       ppc64le-* | powerpc64little-*)
+               basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ps2)
+               basic_machine=i386-ibm
+               ;;
+       pw32)
+               basic_machine=i586-unknown
+               os=-pw32
+               ;;
+       rdos)
+               basic_machine=i386-pc
+               os=-rdos
+               ;;
+       rom68k)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       rm[46]00)
+               basic_machine=mips-siemens
+               ;;
+       rtpc | rtpc-*)
+               basic_machine=romp-ibm
+               ;;
+       s390 | s390-*)
+               basic_machine=s390-ibm
+               ;;
+       s390x | s390x-*)
+               basic_machine=s390x-ibm
+               ;;
+       sa29200)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       sb1)
+               basic_machine=mipsisa64sb1-unknown
+               ;;
+       sb1el)
+               basic_machine=mipsisa64sb1el-unknown
+               ;;
+       sde)
+               basic_machine=mipsisa32-sde
+               os=-elf
+               ;;
+       sei)
+               basic_machine=mips-sei
+               os=-seiux
+               ;;
+       sequent)
+               basic_machine=i386-sequent
+               ;;
+       sh)
+               basic_machine=sh-hitachi
+               os=-hms
+               ;;
+       sh64)
+               basic_machine=sh64-unknown
+               ;;
+       sparclite-wrs | simso-wrs)
+               basic_machine=sparclite-wrs
+               os=-vxworks
+               ;;
+       sps7)
+               basic_machine=m68k-bull
+               os=-sysv2
+               ;;
+       spur)
+               basic_machine=spur-unknown
+               ;;
+       st2000)
+               basic_machine=m68k-tandem
+               ;;
+       stratus)
+               basic_machine=i860-stratus
+               os=-sysv4
+               ;;
+       sun2)
+               basic_machine=m68000-sun
+               ;;
+       sun2os3)
+               basic_machine=m68000-sun
+               os=-sunos3
+               ;;
+       sun2os4)
+               basic_machine=m68000-sun
+               os=-sunos4
+               ;;
+       sun3os3)
+               basic_machine=m68k-sun
+               os=-sunos3
+               ;;
+       sun3os4)
+               basic_machine=m68k-sun
+               os=-sunos4
+               ;;
+       sun4os3)
+               basic_machine=sparc-sun
+               os=-sunos3
+               ;;
+       sun4os4)
+               basic_machine=sparc-sun
+               os=-sunos4
+               ;;
+       sun4sol2)
+               basic_machine=sparc-sun
+               os=-solaris2
+               ;;
+       sun3 | sun3-*)
+               basic_machine=m68k-sun
+               ;;
+       sun4)
+               basic_machine=sparc-sun
+               ;;
+       sun386 | sun386i | roadrunner)
+               basic_machine=i386-sun
+               ;;
+       sv1)
+               basic_machine=sv1-cray
+               os=-unicos
+               ;;
+       symmetry)
+               basic_machine=i386-sequent
+               os=-dynix
+               ;;
+       t3e)
+               basic_machine=alphaev5-cray
+               os=-unicos
+               ;;
+       t90)
+               basic_machine=t90-cray
+               os=-unicos
+               ;;
+       tic54x | c54x*)
+               basic_machine=tic54x-unknown
+               os=-coff
+               ;;
+       tic55x | c55x*)
+               basic_machine=tic55x-unknown
+               os=-coff
+               ;;
+       tic6x | c6x*)
+               basic_machine=tic6x-unknown
+               os=-coff
+               ;;
+       tx39)
+               basic_machine=mipstx39-unknown
+               ;;
+       tx39el)
+               basic_machine=mipstx39el-unknown
+               ;;
+       toad1)
+               basic_machine=pdp10-xkl
+               os=-tops20
+               ;;
+       tower | tower-32)
+               basic_machine=m68k-ncr
+               ;;
+       tpf)
+               basic_machine=s390x-ibm
+               os=-tpf
+               ;;
+       udi29k)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       ultra3)
+               basic_machine=a29k-nyu
+               os=-sym1
+               ;;
+       v810 | necv810)
+               basic_machine=v810-nec
+               os=-none
+               ;;
+       vaxv)
+               basic_machine=vax-dec
+               os=-sysv
+               ;;
+       vms)
+               basic_machine=vax-dec
+               os=-vms
+               ;;
+       vpp*|vx|vx-*)
+               basic_machine=f301-fujitsu
+               ;;
+       vxworks960)
+               basic_machine=i960-wrs
+               os=-vxworks
+               ;;
+       vxworks68)
+               basic_machine=m68k-wrs
+               os=-vxworks
+               ;;
+       vxworks29k)
+               basic_machine=a29k-wrs
+               os=-vxworks
+               ;;
+       w65*)
+               basic_machine=w65-wdc
+               os=-none
+               ;;
+       w89k-*)
+               basic_machine=hppa1.1-winbond
+               os=-proelf
+               ;;
+       xbox)
+               basic_machine=i686-pc
+               os=-mingw32
+               ;;
+       xps | xps100)
+               basic_machine=xps100-honeywell
+               ;;
+       ymp)
+               basic_machine=ymp-cray
+               os=-unicos
+               ;;
+       z8k-*-coff)
+               basic_machine=z8k-unknown
+               os=-sim
+               ;;
+       none)
+               basic_machine=none-none
+               os=-none
+               ;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+       w89k)
+               basic_machine=hppa1.1-winbond
+               ;;
+       op50n)
+               basic_machine=hppa1.1-oki
+               ;;
+       op60c)
+               basic_machine=hppa1.1-oki
+               ;;
+       romp)
+               basic_machine=romp-ibm
+               ;;
+       mmix)
+               basic_machine=mmix-knuth
+               ;;
+       rs6000)
+               basic_machine=rs6000-ibm
+               ;;
+       vax)
+               basic_machine=vax-dec
+               ;;
+       pdp10)
+               # there are many clones, so DEC is not a safe bet
+               basic_machine=pdp10-unknown
+               ;;
+       pdp11)
+               basic_machine=pdp11-dec
+               ;;
+       we32k)
+               basic_machine=we32k-att
+               ;;
+       sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+               basic_machine=sh-unknown
+               ;;
+       sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+               basic_machine=sparc-sun
+               ;;
+       cydra)
+               basic_machine=cydra-cydrome
+               ;;
+       orion)
+               basic_machine=orion-highlevel
+               ;;
+       orion105)
+               basic_machine=clipper-highlevel
+               ;;
+       mac | mpw | mac-mpw)
+               basic_machine=m68k-apple
+               ;;
+       pmac | pmac-mpw)
+               basic_machine=powerpc-apple
+               ;;
+       *-unknown)
+               # Make sure to match an already-canonicalized machine name.
+               ;;
+       *)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+       *-digital*)
+               basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+               ;;
+       *-commodore*)
+               basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+               ;;
+       *)
+               ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+       # -solaris* is a basic system type, with this one exception.
+       -solaris1 | -solaris1.*)
+               os=`echo $os | sed -e 's|solaris1|sunos4|'`
+               ;;
+       -solaris)
+               os=-solaris2
+               ;;
+       -svr4*)
+               os=-sysv4
+               ;;
+       -unixware*)
+               os=-sysv4.2uw
+               ;;
+       -gnu/linux*)
+               os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+               ;;
+       # First accept the basic system types.
+       # The portable systems comes first.
+       # Each alternative MUST END IN A *, to match a version number.
+       # -sysv* is not here because it comes later, after sysvr4.
+       -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+             | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+             | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+             | -aos* \
+             | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+             | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+             | -openbsd* | -solidbsd* \
+             | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+             | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+             | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+             | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+             | -chorusos* | -chorusrdb* \
+             | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+             | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+             | -uxpv* | -beos* | -mpeix* | -udk* \
+             | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+             | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+             | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+             | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+             | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+             | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+             | -skyos* | -haiku* | -rdos* | -toppers*)
+       # Remember, each alternative MUST END IN *, to match a version number.
+               ;;
+       -qnx*)
+               case $basic_machine in
+                   x86-* | i*86-*)
+                       ;;
+                   *)
+                       os=-nto$os
+                       ;;
+               esac
+               ;;
+       -nto-qnx*)
+               ;;
+       -nto*)
+               os=`echo $os | sed -e 's|nto|nto-qnx|'`
+               ;;
+       -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+             | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+             | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+               ;;
+       -mac*)
+               os=`echo $os | sed -e 's|mac|macos|'`
+               ;;
+       -linux-dietlibc)
+               os=-linux-dietlibc
+               ;;
+       -linux*)
+               os=`echo $os | sed -e 's|linux|linux-gnu|'`
+               ;;
+       -sunos5*)
+               os=`echo $os | sed -e 's|sunos5|solaris2|'`
+               ;;
+       -sunos6*)
+               os=`echo $os | sed -e 's|sunos6|solaris3|'`
+               ;;
+       -opened*)
+               os=-openedition
+               ;;
+        -os400*)
+               os=-os400
+               ;;
+       -wince*)
+               os=-wince
+               ;;
+       -osfrose*)
+               os=-osfrose
+               ;;
+       -osf*)
+               os=-osf
+               ;;
+       -utek*)
+               os=-bsd
+               ;;
+       -dynix*)
+               os=-bsd
+               ;;
+       -acis*)
+               os=-aos
+               ;;
+       -atheos*)
+               os=-atheos
+               ;;
+       -syllable*)
+               os=-syllable
+               ;;
+       -386bsd)
+               os=-bsd
+               ;;
+       -ctix* | -uts*)
+               os=-sysv
+               ;;
+       -nova*)
+               os=-rtmk-nova
+               ;;
+       -ns2 )
+               os=-nextstep2
+               ;;
+       -nsk*)
+               os=-nsk
+               ;;
+       # Preserve the version number of sinix5.
+       -sinix5.*)
+               os=`echo $os | sed -e 's|sinix|sysv|'`
+               ;;
+       -sinix*)
+               os=-sysv4
+               ;;
+        -tpf*)
+               os=-tpf
+               ;;
+       -triton*)
+               os=-sysv3
+               ;;
+       -oss*)
+               os=-sysv3
+               ;;
+       -svr4)
+               os=-sysv4
+               ;;
+       -svr3)
+               os=-sysv3
+               ;;
+       -sysvr4)
+               os=-sysv4
+               ;;
+       # This must come after -sysvr4.
+       -sysv*)
+               ;;
+       -ose*)
+               os=-ose
+               ;;
+       -es1800*)
+               os=-ose
+               ;;
+       -xenix)
+               os=-xenix
+               ;;
+       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+               os=-mint
+               ;;
+       -aros*)
+               os=-aros
+               ;;
+       -kaos*)
+               os=-kaos
+               ;;
+       -zvmoe)
+               os=-zvmoe
+               ;;
+       -none)
+               ;;
+       *)
+               # Get rid of the `-' at the beginning of $os.
+               os=`echo $os | sed 's/[^-]*-//'`
+               echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+        score-*)
+               os=-elf
+               ;;
+        spu-*)
+               os=-elf
+               ;;
+       *-acorn)
+               os=-riscix1.2
+               ;;
+       arm*-rebel)
+               os=-linux
+               ;;
+       arm*-semi)
+               os=-aout
+               ;;
+        c4x-* | tic4x-*)
+               os=-coff
+               ;;
+       # This must come before the *-dec entry.
+       pdp10-*)
+               os=-tops20
+               ;;
+       pdp11-*)
+               os=-none
+               ;;
+       *-dec | vax-*)
+               os=-ultrix4.2
+               ;;
+       m68*-apollo)
+               os=-domain
+               ;;
+       i386-sun)
+               os=-sunos4.0.2
+               ;;
+       m68000-sun)
+               os=-sunos3
+               # This also exists in the configure program, but was not the
+               # default.
+               # os=-sunos4
+               ;;
+       m68*-cisco)
+               os=-aout
+               ;;
+       mips*-cisco)
+               os=-elf
+               ;;
+       mips*-*)
+               os=-elf
+               ;;
+       or32-*)
+               os=-coff
+               ;;
+       *-tti)  # must be before sparc entry or we get the wrong os.
+               os=-sysv3
+               ;;
+       sparc-* | *-sun)
+               os=-sunos4.1.1
+               ;;
+       *-be)
+               os=-beos
+               ;;
+       *-haiku)
+               os=-haiku
+               ;;
+       *-ibm)
+               os=-aix
+               ;;
+       *-knuth)
+               os=-mmixware
+               ;;
+       *-wec)
+               os=-proelf
+               ;;
+       *-winbond)
+               os=-proelf
+               ;;
+       *-oki)
+               os=-proelf
+               ;;
+       *-hp)
+               os=-hpux
+               ;;
+       *-hitachi)
+               os=-hiux
+               ;;
+       i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+               os=-sysv
+               ;;
+       *-cbm)
+               os=-amigaos
+               ;;
+       *-dg)
+               os=-dgux
+               ;;
+       *-dolphin)
+               os=-sysv3
+               ;;
+       m68k-ccur)
+               os=-rtu
+               ;;
+       m88k-omron*)
+               os=-luna
+               ;;
+       *-next )
+               os=-nextstep
+               ;;
+       *-sequent)
+               os=-ptx
+               ;;
+       *-crds)
+               os=-unos
+               ;;
+       *-ns)
+               os=-genix
+               ;;
+       i370-*)
+               os=-mvs
+               ;;
+       *-next)
+               os=-nextstep3
+               ;;
+       *-gould)
+               os=-sysv
+               ;;
+       *-highlevel)
+               os=-bsd
+               ;;
+       *-encore)
+               os=-bsd
+               ;;
+       *-sgi)
+               os=-irix
+               ;;
+       *-siemens)
+               os=-sysv4
+               ;;
+       *-masscomp)
+               os=-rtu
+               ;;
+       f30[01]-fujitsu | f700-fujitsu)
+               os=-uxpv
+               ;;
+       *-rom68k)
+               os=-coff
+               ;;
+       *-*bug)
+               os=-coff
+               ;;
+       *-apple)
+               os=-macos
+               ;;
+       *-atari*)
+               os=-mint
+               ;;
+       *)
+               os=-none
+               ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+       *-unknown)
+               case $os in
+                       -riscix*)
+                               vendor=acorn
+                               ;;
+                       -sunos*)
+                               vendor=sun
+                               ;;
+                       -aix*)
+                               vendor=ibm
+                               ;;
+                       -beos*)
+                               vendor=be
+                               ;;
+                       -hpux*)
+                               vendor=hp
+                               ;;
+                       -mpeix*)
+                               vendor=hp
+                               ;;
+                       -hiux*)
+                               vendor=hitachi
+                               ;;
+                       -unos*)
+                               vendor=crds
+                               ;;
+                       -dgux*)
+                               vendor=dg
+                               ;;
+                       -luna*)
+                               vendor=omron
+                               ;;
+                       -genix*)
+                               vendor=ns
+                               ;;
+                       -mvs* | -opened*)
+                               vendor=ibm
+                               ;;
+                       -os400*)
+                               vendor=ibm
+                               ;;
+                       -ptx*)
+                               vendor=sequent
+                               ;;
+                       -tpf*)
+                               vendor=ibm
+                               ;;
+                       -vxsim* | -vxworks* | -windiss*)
+                               vendor=wrs
+                               ;;
+                       -aux*)
+                               vendor=apple
+                               ;;
+                       -hms*)
+                               vendor=hitachi
+                               ;;
+                       -mpw* | -macos*)
+                               vendor=apple
+                               ;;
+                       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+                               vendor=atari
+                               ;;
+                       -vos*)
+                               vendor=stratus
+                               ;;
+               esac
+               basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+               ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/configure b/configure
new file mode 100755 (executable)
index 0000000..715e1f9
--- /dev/null
+++ b/configure
@@ -0,0 +1,29062 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.61 for rrdtool 1.2.26.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006 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 more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+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+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# 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
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" ""       $as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+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
+IFS=$as_save_IFS
+
+     ;;
+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_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+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) >/dev/null 2>&1 && $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; 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'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+if test "x$CONFIG_SHELL" = x; then
+  if (eval ":") 2>/dev/null; then
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+
+  if test $as_have_required = yes &&    (eval ":
+(as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=\$LINENO
+  as_lineno_2=\$LINENO
+  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+  :
+else
+  as_candidate_shells=
+    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=.
+  case $as_dir in
+        /*)
+          for as_base in sh bash ksh sh5; do
+            as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+          done;;
+       esac
+done
+IFS=$as_save_IFS
+
+
+      for as_shell in $as_candidate_shells $SHELL; do
+        # Try only shells that exist, to save several forks.
+        if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+               { ("$as_shell") 2> /dev/null <<\_ASEOF
+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+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+_ASEOF
+}; then
+  CONFIG_SHELL=$as_shell
+              as_have_required=yes
+              if { "$as_shell" 2> /dev/null <<\_ASEOF
+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+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+(as_func_return () {
+  (exit $1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+  break
+fi
+
+fi
+
+      done
+
+      if test "x$CONFIG_SHELL" != x; then
+  for as_var in BASH_ENV ENV
+        do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+        done
+        export CONFIG_SHELL
+        exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+    if test $as_have_required = no; then
+  echo This script requires a shell more modern than all the
+      echo shells that I found on your system.  Please install a
+      echo modern shell, or manually run the script under such a
+      echo shell if you do have one.
+      { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+  echo No shell found that supports shell functions.
+  echo Please tell autoconf@gnu.org about your system,
+  echo including any error possibly output before this
+  echo message
+}
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+  # 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 after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, 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
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\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 sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s='ln -s'
+  # ... but there are two gotchas:
+  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+  # In both cases, we have to default to `cp -p'.
+  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+    as_ln_s='cp -p'
+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$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+        test -d "$1/.";
+      else
+       case $1 in
+        -*)set "./$1";;
+       esac;
+       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+       ???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# 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'"
+
+
+
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','`
+  ;;
+esac
+
+echo=${ECHO-echo}
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+  for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+    if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+       echo_test_string=`eval $cmd` &&
+       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+    then
+      break
+    fi
+  done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+   test "X$echo_testing_string" = "X$echo_test_string"; then
+  :
+else
+  # The Solaris, AIX, and Digital Unix default echo programs unquote
+  # backslashes.  This makes it impossible to quote backslashes using
+  #   echo "$something" | sed 's/\\/\\\\/g'
+  #
+  # So, first we look for a working echo in the user's PATH.
+
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for dir in $PATH /usr/ucb; do
+    IFS="$lt_save_ifs"
+    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      echo="$dir/echo"
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  if test "X$echo" = Xecho; then
+    # We didn't find a better echo, so look for alternatives.
+    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+       test "X$echo_testing_string" = "X$echo_test_string"; then
+      # This shell has a builtin print -r that does the trick.
+      echo='print -r'
+    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+        test "X$CONFIG_SHELL" != X/bin/ksh; then
+      # If we have ksh, try running configure again with it.
+      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+      export ORIGINAL_CONFIG_SHELL
+      CONFIG_SHELL=/bin/ksh
+      export CONFIG_SHELL
+      exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+    else
+      # Try using printf.
+      echo='printf %s\n'
+      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+        echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+        test "X$echo_testing_string" = "X$echo_test_string"; then
+       # Cool, printf works
+       :
+      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+          test "X$echo_testing_string" = 'X\t' &&
+          echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+          test "X$echo_testing_string" = "X$echo_test_string"; then
+       CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+       export CONFIG_SHELL
+       SHELL="$CONFIG_SHELL"
+       export SHELL
+       echo="$CONFIG_SHELL $0 --fallback-echo"
+      elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+          test "X$echo_testing_string" = 'X\t' &&
+          echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+          test "X$echo_testing_string" = "X$echo_test_string"; then
+       echo="$CONFIG_SHELL $0 --fallback-echo"
+      else
+       # maybe with a smaller string...
+       prev=:
+
+       for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+         if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+         then
+           break
+         fi
+         prev="$cmd"
+       done
+
+       if test "$prev" != 'sed 50q "$0"'; then
+         echo_test_string=`eval $prev`
+         export echo_test_string
+         exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+       else
+         # Oops.  We lost completely, so just stick with echo.
+         echo=echo
+       fi
+      fi
+    fi
+  fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+   ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+
+
+tagnames=${tagnames+${tagnames},}CXX
+
+tagnames=${tagnames+${tagnames},}F77
+
+exec 7<&0 </dev/null 6>&1
+
+# 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`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Identity of this package.
+PACKAGE_NAME='rrdtool'
+PACKAGE_TARNAME='rrdtool'
+PACKAGE_VERSION='1.2.26'
+PACKAGE_STRING='rrdtool 1.2.26'
+PACKAGE_BUGREPORT=''
+
+ac_default_prefix=/usr/local/rrdtool-$PACKAGE_VERSION
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='PERLFLAGS
+SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+NUMVERS
+build
+build_cpu
+build_vendor
+build_os
+host
+host_cpu
+host_vendor
+host_os
+target
+target_cpu
+target_vendor
+target_os
+INSTALL_PROGRAM
+INSTALL_SCRIPT
+INSTALL_DATA
+CYGPATH_W
+PACKAGE
+VERSION
+ACLOCAL
+AUTOCONF
+AUTOMAKE
+AUTOHEADER
+MAKEINFO
+install_sh
+STRIP
+INSTALL_STRIP_PROGRAM
+mkdir_p
+AWK
+SET_MAKE
+am__leading_dot
+AMTAR
+am__tar
+am__untar
+RRDGRAPH_YLEGEND_ANGLE
+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
+GREP
+EGREP
+LN_S
+ECHO
+AR
+RANLIB
+CXX
+CXXFLAGS
+ac_ct_CXX
+CXXDEPMODE
+am__fastdepCXX_TRUE
+am__fastdepCXX_FALSE
+CXXCPP
+F77
+FFLAGS
+ac_ct_F77
+LIBTOOL
+RRD_DEFAULT_FONT
+MULTITHREAD_CFLAGS
+MULTITHREAD_LDFLAGS
+acx_pthread_config
+PTHREAD_CC
+PTHREAD_LIBS
+PTHREAD_CFLAGS
+BUILD_MULTITHREAD_TRUE
+BUILD_MULTITHREAD_FALSE
+BUILD_RRDCGI_TRUE
+BUILD_RRDCGI_FALSE
+PKGCONFIG
+CORE_LIBS
+ALL_LIBS
+PERL
+PERLCC
+PERLCCFLAGS
+PERLLD
+PERLLDFLAGS
+PERL_CC
+PERL_MAKE_OPTIONS
+COMP_PERL
+PERL_VERSION
+RUBY
+RUBY_MAKE_OPTIONS
+COMP_RUBY
+BUILD_TCL_TRUE
+BUILD_TCL_FALSE
+BUILD_TCL_SITE_TRUE
+BUILD_TCL_SITE_FALSE
+TCL_PREFIX
+TCL_SHLIB_CFLAGS
+TCL_SHLIB_LD
+TCL_SHLIB_SUFFIX
+TCL_PACKAGE_PATH
+TCL_LD_SEARCH_FLAGS
+TCL_STUB_LIB_SPEC
+TCL_VERSION
+TCL_PACKAGE_DIR
+PYTHON
+PYTHON_VERSION
+PYTHON_PREFIX
+PYTHON_EXEC_PREFIX
+PYTHON_PLATFORM
+pythondir
+pkgpythondir
+pyexecdir
+pkgpyexecdir
+PYTHON_INCLUDES
+COMP_PYTHON
+NROFF
+TROFF
+RRDDOCDIR
+LIBOBJS
+LTLIBOBJS'
+ac_subst_files=''
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+RRDGRAPH_YLEGEND_ANGLE
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
+CXX
+CXXFLAGS
+CCC
+CXXCPP
+F77
+FFLAGS
+PERLCC
+PERLCCFLAGS
+PERLLD
+PERLLDFLAGS
+RRDDOCDIR'
+
+
+# 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.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+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
+
+  case $ac_option in
+  *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *)   ac_optarg=yes ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
+
+  -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)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=*)
+    datadir=$ac_optarg ;;
+
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$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 ;;
+
+  -docdir | --docdir | --docdi | --doc | --do)
+    ac_prev=docdir ;;
+  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+    docdir=$ac_optarg ;;
+
+  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+    ac_prev=dvidir ;;
+  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+    dvidir=$ac_optarg ;;
+
+  -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'`
+    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 ;;
+
+  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+    ac_prev=htmldir ;;
+  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+  | --ht=*)
+    htmldir=$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 ;;
+
+  -localedir | --localedir | --localedi | --localed | --locale)
+    ac_prev=localedir ;;
+  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+    localedir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst | --locals)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+    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 ;;
+
+  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+    ac_prev=pdfdir ;;
+  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+    pdfdir=$ac_optarg ;;
+
+  -psdir | --psdir | --psdi | --psd | --ps)
+    ac_prev=psdir ;;
+  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+    psdir=$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'`
+    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; }; }
+    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 directory names.
+for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
+               datadir sysconfdir sharedstatedir localstatedir includedir \
+               oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+               libdir localedir mandir
+do
+  eval ac_val=\$$ac_var
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+  esac
+  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; }
+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
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+  { echo "$as_me: error: Working directory cannot be determined" >&2
+   { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  { echo "$as_me: error: pwd does not report name of working directory" >&2
+   { (exit 1); exit 1; }; }
+
+
+# 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 the parent directory.
+  ac_confdir=`$as_dirname -- "$0" ||
+$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
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+       cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
+   { (exit 1); exit 1; }; }
+       pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+  srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+  eval ac_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_env_${ac_var}_value=\$${ac_var}
+  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# 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 rrdtool 1.2.26 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 \`..']
+
+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]
+  --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]
+  --datarootdir=DIR      read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR          read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR          info documentation [DATAROOTDIR/info]
+  --localedir=DIR        locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR           man documentation [DATAROOTDIR/man]
+  --docdir=DIR           documentation root [DATAROOTDIR/doc/rrdtool]
+  --htmldir=DIR          html documentation [DOCDIR]
+  --dvidir=DIR           dvi documentation [DOCDIR]
+  --pdfdir=DIR           pdf documentation [DOCDIR]
+  --psdir=DIR            ps documentation [DOCDIR]
+_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
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+  --target=TARGET   configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of rrdtool 1.2.26:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --disable-rrdcgi        disable building of rrdcgi
+  --disable-mmap          disable mmap in rrd_update, use seek+write instead
+  --disable-pthread       disable multithread support
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
+  --enable-shared[=PKGS]  build shared libraries [default=yes]
+  --enable-static[=PKGS]  build static libraries [default=yes]
+  --enable-fast-install[=PKGS]
+                          optimize for fast installation [default=yes]
+  --disable-libtool-lock  avoid locking (might break parallel builds)
+  --disable-perl          do not build the perl modules
+  --enable-perl-site-install   by default the rrdtool perl modules are installed
+                         together with rrdtool in $prefix/lib/perl. You have to
+                          put a 'use lib qw($prefix/lib/perl)' into your scripts
+                          when you want to use them. When you set this option
+                          the perl modules will get installed wherever
+                          your perl setup thinks it is best.
+  --disable-ruby          do not build the ruby modules
+  --enable-ruby-site-install   by default the rrdtool ruby modules are installed
+                         together with rrdtool in $prefix/lib/ruby. You have to
+                          add $prefix/lib/ruby/$ruby_version/$sitearch to you $: variable
+                          for ruby to find the RRD.so file.
+  --disable-tcl           do not build the tcl modules
+  --enable-tcl-site        install the tcl extension in the tcl tree
+  --disable-python        do not build the python modules
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-rrd-default-font=OPTIONS  set the full path to your default font.
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-pic              try to use only PIC/non-PIC objects [default=use
+                          both]
+  --with-tags[=TAGS]      include additional configurations [automatic]
+  --with-perl-options=OPTIONS  options to pass on command-line when
+                          generating Makefile from Makefile.PL. If you set this
+                          option, interesting things may happen unless you know
+                          what you are doing!
+  --with-ruby-options=OPTIONS  options to pass on command-line when
+                          generating Makefile from extconf.rb. If you set this
+                          option, interesting things may happen unless you know
+                          what you are doing!
+  --with-tcllib=DIR       location of the tclConfig.sh
+
+Some influential environment variables:
+  RRDGRAPH_YLEGEND_ANGLE
+              Vertical label angle: 90.0 (default) or 270.0
+  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>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
+  CXXCPP      C++ preprocessor
+  F77         Fortran 77 compiler command
+  FFLAGS      Fortran 77 compiler flags
+  PERLCC      [] C compiler for Perl modules
+  PERLCCFLAGS [] CC flags for Perl modules
+  PERLLD      [same], [as], [PERLCC] Linker for Perl modules
+  PERLLDFLAGS [] LD flags for Perl modules
+  RRDDOCDIR   [DATADIR/doc/PACKAGE-VERSION] Documentation directory
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d "$ac_dir" || continue
+    ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+    cd "$ac_dir" || { ac_status=$?; continue; }
+    # Check for guested 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
+    else
+      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi || ac_status=$?
+    cd "$ac_pwd" || { ac_status=$?; break; }
+  done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+  cat <<\_ACEOF
+rrdtool configure 1.2.26
+generated by GNU Autoconf 2.61
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 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
+fi
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by rrdtool $as_me 1.2.26, which was
+generated by GNU Autoconf 2.61.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+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`
+/usr/bin/hostinfo      = `(/usr/bin/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
+IFS=$as_save_IFS
+
+} >&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_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_arg'"
+      ;;
+    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: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+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,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+       "s/'\''/'\''\\\\'\'''\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+       eval ac_val=\$$ac_var
+       case $ac_val in
+       *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+       esac
+       echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r 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 -f -r conftest* 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 -n "$CONFIG_SITE"; then
+  set x "$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+  set x "$prefix/share/config.site" "$prefix/etc/config.site"
+else
+  set x "$ac_default_prefix/share/config.site" \
+       "$ac_default_prefix/etc/config.site"
+fi
+shift
+for ac_site_file
+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 $ac_precious_vars; 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
+
+
+NUMVERS=1.2026
+
+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
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+{ echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
+if test "${ac_cv_build+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+echo "$as_me: error: invalid value of canonical build" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
+if test "${ac_cv_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+echo "$as_me: error: invalid value of canonical host" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ echo "$as_me:$LINENO: checking target system type" >&5
+echo $ECHO_N "checking target system type... $ECHO_C" >&6; }
+if test "${ac_cv_target+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "x$target_alias" = x; then
+  ac_cv_target=$ac_cv_host
+else
+  ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+    { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_target" >&5
+echo "${ECHO_T}$ac_cv_target" >&6; }
+case $ac_cv_target in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5
+echo "$as_me: error: invalid value of canonical target" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+target=$ac_cv_target
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_target
+shift
+target_cpu=$1
+target_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+target_os=$*
+IFS=$ac_save_IFS
+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+am__api_version="1.9"
+# 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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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
+IFS=$as_save_IFS
+
+
+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.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    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 -f 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+IFS=$as_save_IFS
+
+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 x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+       @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$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='rrdtool'
+ VERSION='1.2.26'
+
+
+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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+IFS=$as_save_IFS
+
+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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+IFS=$as_save_IFS
+
+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
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+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 rrd_config.h"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define RRDGRAPH_YLEGEND_ANGLE ${RRDGRAPH_YLEGEND_ANGLE:-90.0}
+_ACEOF
+
+
+# Check whether --enable-rrdcgi was given.
+if test "${enable_rrdcgi+set}" = set; then
+  enableval=$enable_rrdcgi;
+else
+  enable_rrdcgi=yes
+fi
+
+
+
+# Check whether --with-rrd-default-font was given.
+if test "${with_rrd_default_font+set}" = set; then
+  withval=$with_rrd_default_font; RRD_DEFAULT_FONT=$withval
+else
+
+  if test -d ${WINDIR:-nodir}/cour.ttf ; then
+       RRD_DEFAULT_FONT=`cd $WINDIR;pwd`/cour.ttf
+  else
+       RRD_DEFAULT_FONT='$(fontsdir)/$(fonts_DATA)'
+  fi
+
+fi
+
+
+# Check whether --enable-mmap was given.
+if test "${enable_mmap+set}" = set; then
+  enableval=$enable_mmap;
+else
+  enable_mmap=yes
+fi
+
+
+
+ # Check whether --enable-pthread was given.
+if test "${enable_pthread+set}" = set; then
+  enableval=$enable_pthread;
+else
+  enable_pthread=yes
+fi
+
+
+
+
+
+case $TERM in
+       #   for the most important terminal types we directly know the sequences
+       xterm|xterm*|vt220|vt220*)
+               T_MD=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </dev/null 2>/dev/null`
+               T_ME=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/null 2>/dev/null`
+       ;;
+       vt100|vt100*|cygwin)
+               T_MD=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' </dev/null 2>/dev/null`
+               T_ME=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' </dev/null 2>/dev/null`
+       ;;
+       *)
+               T_MD=''
+               T_ME=''
+       ;;
+esac
+  { echo "$as_me:$LINENO: result: " >&5
+echo "${ECHO_T}" >&6; }
+  { echo "$as_me:$LINENO: result: ${T_MD}Audit Compilation Environment${T_ME}" >&5
+echo "${ECHO_T}${T_MD}Audit Compilation Environment${T_ME}" >&6; }
+
+
+
+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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+IFS=$as_save_IFS
+
+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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+IFS=$as_save_IFS
+
+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
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+IFS=$as_save_IFS
+
+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
+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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+IFS=$as_save_IFS
+
+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.exe
+  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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+IFS=$as_save_IFS
+
+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.exe
+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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+IFS=$as_save_IFS
+
+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
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+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`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&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[^ ]*//'`
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort.  b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions.  Remove them first so a
+# subsequent execution test works.
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+       ;;
+    [ab].out )
+       # We found the default executable, but exeext='' is most
+       # certainly right.
+       break;;
+    *.* )
+        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+       then :; else
+          ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+       fi
+       # We set ac_cv_exeext here because the later test for it is not
+       # safe: cross compilers may not add the suffix if given an `-o'
+       # argument, so we may need to know it at that point already.
+       # Even if this section looks crufty: it has the advantage of
+       # actually working.
+       break;;
+    * )
+       break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+  ac_file=''
+fi
+
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
+if test -z "$ac_file"; then
+  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
+
+# Check that 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'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 that 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 { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 | *.map | *.inf | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+         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 { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
+    *) 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 { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; 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 core 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
+{ 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
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   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 { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       CFLAGS=""
+      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 { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_c_werror_flag=$ac_save_c_werror_flag
+        CFLAGS="-g"
+        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 { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+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 ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_c89=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 -std 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 -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 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
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+       -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_c89=$ac_arg
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+  xno)
+    { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+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
+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 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
+
+
+
+
+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 { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.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 nonexistent 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 { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.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 { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.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 nonexistent 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 { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.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
+
+# Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then
+  enableval=$enable_shared; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_shared=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_shared=yes
+fi
+
+
+# Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then
+  enableval=$enable_static; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_static=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_static=yes
+fi
+
+
+# Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+  enableval=$enable_fast_install; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_fast_install=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_fast_install=yes
+fi
+
+
+{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; }
+if test "${lt_cv_path_SED+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+
+fi
+
+SED=$lt_cv_path_SED
+{ echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6; }
+
+{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # Extract the first word of "grep ggrep" to use in msg output
+if test -z "$GREP"; then
+set dummy grep ggrep; ac_prog_name=$2
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_path_GREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in grep ggrep; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+    { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+    # Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+    $ac_path_GREP_found && break 3
+  done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+GREP="$ac_cv_path_GREP"
+if test -z "$GREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
+if test "${ac_cv_path_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_path_EGREP="$GREP -E"
+   else
+     # Extract the first word of "egrep" to use in msg output
+if test -z "$EGREP"; then
+set dummy egrep; ac_prog_name=$2
+if test "${ac_cv_path_EGREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_path_EGREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in egrep; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+    { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+    # Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+    $ac_path_EGREP_found && break 3
+  done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+EGREP="$ac_cv_path_EGREP"
+if test -z "$EGREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+
+   fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+else
+  { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+       test "$with_gnu_ld" != no && break
+       ;;
+      *)
+       test "$with_gnu_ld" != yes && break
+       ;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; }
+if test "${lt_cv_ld_reload_flag+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+
+{ echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
+echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; }
+if test "${lt_cv_path_NM+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+       # Check to see if the nm accepts a BSD-compat flag.
+       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+       #   nm: unknown option "B" ignored
+       # Tru64's nm complains that /dev/null is an invalid object file
+       case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+       */dev/null* | *'Invalid file or object type'*)
+         lt_cv_path_NM="$tmp_nm -B"
+         break
+         ;;
+       *)
+         case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+         */dev/null*)
+           lt_cv_path_NM="$tmp_nm -p"
+           break
+           ;;
+         *)
+           lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+           continue # so that we can try to find one that supports BSD flags
+           ;;
+         esac
+         ;;
+       esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+echo "${ECHO_T}$lt_cv_path_NM" >&6; }
+NM="$lt_cv_path_NM"
+
+{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5
+echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6; }
+if test "${lt_cv_deplibs_check_method+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[45]*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump'.
+  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix3*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd* | netbsdelf*-gnu)
+  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+nto-qnx*)
+  lt_cv_deplibs_check_method=unknown
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; }
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  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
+    case `/usr/bin/file conftest.$ac_objext` in
+    *ELF-32*)
+      HPUX_IA64_MODE="32"
+      ;;
+    *ELF-64*)
+      HPUX_IA64_MODE="64"
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line 4749 "configure"' > conftest.$ac_ext
+  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
+   if test "$lt_cv_prog_gnu_ld" = yes; then
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -melf32bsmip"
+      ;;
+    *N32*)
+      LD="${LD-ld} -melf32bmipn32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -melf64bmip"
+      ;;
+    esac
+   else
+    case `/usr/bin/file conftest.$ac_objext` in
+    *32-bit*)
+      LD="${LD-ld} -32"
+      ;;
+    *N32*)
+      LD="${LD-ld} -n32"
+      ;;
+    *64-bit*)
+      LD="${LD-ld} -64"
+      ;;
+    esac
+   fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  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
+    case `/usr/bin/file conftest.o` in
+    *32-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_i386"
+          ;;
+        ppc64-*linux*|powerpc64-*linux*)
+          LD="${LD-ld} -m elf32ppclinux"
+          ;;
+        s390x-*linux*)
+          LD="${LD-ld} -m elf_s390"
+          ;;
+        sparc64-*linux*)
+          LD="${LD-ld} -m elf32_sparc"
+          ;;
+      esac
+      ;;
+    *64-bit*)
+      case $host in
+        x86_64-*linux*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        ppc*-*linux*|powerpc*-*linux*)
+          LD="${LD-ld} -m elf64ppc"
+          ;;
+        s390*-*linux*)
+          LD="${LD-ld} -m elf64_s390"
+          ;;
+        sparc*-*linux*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; }
+if test "${lt_cv_cc_needs_belf+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  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
+
+     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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  lt_cv_cc_needs_belf=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       lt_cv_cc_needs_belf=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext 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
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; }
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  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
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)    LD="${LD-ld} -64" ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+
+esac
+
+need_locks="$enable_libtool_lock"
+
+
+
+{ 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 { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; 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 core 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>
+#include <stdlib.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))
+      return 2;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 core.conftest.* 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 { as_var=$as_ac_Header; eval "test \"\${$as_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.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; 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 core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&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 dlfcn.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&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 { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; 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 core 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 { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.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;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&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
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  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_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+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_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CXX" && break
+done
+
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
+fi
+
+  fi
+fi
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C++ compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&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_cxx_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 { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_cxx_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; 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 core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; }
+GXX=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   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 { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_cxx_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cxx_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       CXXFLAGS=""
+      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 { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_cxx_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+        CXXFLAGS="-g"
+        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 { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_cxx_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cxx_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+depcc="$CXX"  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_CXX_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_CXX_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_CXX_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+  am__fastdepCXX_TRUE=
+  am__fastdepCXX_FALSE='#'
+else
+  am__fastdepCXX_TRUE='#'
+  am__fastdepCXX_FALSE=
+fi
+
+
+
+
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_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; }
+if test -z "$CXXCPP"; then
+  if test "${ac_cv_prog_CXXCPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CXXCPP needs to be expanded
+    for CXXCPP in "$CXX -E" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_cxx_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 { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+        test ! -s conftest.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 nonexistent 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 { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+        test ! -s conftest.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_CXXCPP=$CXXCPP
+
+fi
+  CXXCPP=$ac_cv_prog_CXXCPP
+else
+  ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ echo "$as_me:$LINENO: result: $CXXCPP" >&5
+echo "${ECHO_T}$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_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 { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+        test ! -s conftest.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 nonexistent 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 { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+        test ! -s conftest.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 \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+fi
+
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+  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_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$F77"; then
+  ac_cv_prog_F77="$F77" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_F77="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+F77=$ac_cv_prog_F77
+if test -n "$F77"; then
+  { echo "$as_me:$LINENO: result: $F77" >&5
+echo "${ECHO_T}$F77" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$F77" && break
+  done
+fi
+if test -z "$F77"; then
+  ac_ct_F77=$F77
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+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_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_F77"; then
+  ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_F77="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_F77=$ac_cv_prog_ac_ct_F77
+if test -n "$ac_ct_F77"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
+echo "${ECHO_T}$ac_ct_F77" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_F77" && break
+done
+
+  if test "x$ac_ct_F77" = x; then
+    F77=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    F77=$ac_ct_F77
+  fi
+fi
+
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+rm -f a.out
+
+# If we don't use `.F' as extension, the preprocessor is not run on the
+# input file.  (Note that this only needs to work for GNU compilers.)
+ac_save_ext=$ac_ext
+ac_ext=F
+{ echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6; }
+if test "${ac_cv_f77_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+      program main
+#ifndef __GNUC__
+       choke me
+#endif
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_f77_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; 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 core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_f77_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6; }
+ac_ext=$ac_save_ext
+ac_test_FFLAGS=${FFLAGS+set}
+ac_save_FFLAGS=$FFLAGS
+FFLAGS=
+{ echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
+echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_f77_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  FFLAGS=-g
+cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_f77_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_f77_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_prog_f77_g=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
+echo "${ECHO_T}$ac_cv_prog_f77_g" >&6; }
+if test "$ac_test_FFLAGS" = set; then
+  FFLAGS=$ac_save_FFLAGS
+elif test $ac_cv_prog_f77_g = yes; then
+  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+    FFLAGS="-g -O2"
+  else
+    FFLAGS="-g"
+  fi
+else
+  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
+    FFLAGS="-O2"
+  else
+    FFLAGS=
+  fi
+fi
+
+G77=`test $ac_compiler_gnu = yes && echo yes`
+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
+
+
+
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+
+# find the maximum length of command line arguments
+{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; }
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+    i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536      # usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[        ]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    # If test is not a shell built-in, we'll probably end up computing a
+    # maximum length that is only half of the actual maximum length, but
+    # we can't tell.
+    SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+    while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \
+              = "XX$teststring") >/dev/null 2>&1 &&
+           new_result=`expr "X$teststring" : ".*" 2>&1` &&
+           lt_cv_sys_max_cmd_len=$new_result &&
+           test $i != 17 # 1/2 MB should be enough
+    do
+      i=`expr $i + 1`
+      teststring=$teststring$teststring
+    done
+    teststring=
+    # Add a significant safety factor because C++ compilers can tack on massive
+    # amounts of additional arguments before passing them to the linker.
+    # It appears as though 1/2 is a usable value.
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    ;;
+  esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+  { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; }
+else
+  { echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6; }
+fi
+
+
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; }
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*) # Its linker distinguishes data from code symbols
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDEGRST]'
+  fi
+  lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+  lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  ;;
+linux* | k*bsd*-gnu)
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDGIRSTW]'
+    lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+    lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
+  ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
+solaris*)
+  symcode='[BDRT]'
+  ;;
+sco3.2v5*)
+  symcode='[DT]'
+  ;;
+sysv4.2uw2*)
+  symcode='[DT]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[ABDT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[      ]\($symcode$symcode*\)[         ][      ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+  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
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
+  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+       mv -f "$nlist"T "$nlist"
+      else
+       rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if grep ' nm_test_var$' "$nlist" >/dev/null; then
+       if grep ' nm_test_func$' "$nlist" >/dev/null; then
+         cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+         # Now generate the symbol file.
+         eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+
+         cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+  const char *name;
+  lt_ptr_t address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+         $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+         cat <<\EOF >> conftest.$ac_ext
+  {0, (lt_ptr_t) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+         # Now try linking the two files.
+         mv conftest.$ac_objext conftstm.$ac_objext
+         lt_save_LIBS="$LIBS"
+         lt_save_CFLAGS="$CFLAGS"
+         LIBS="conftstm.$ac_objext"
+         CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+         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); } && test -s conftest${ac_exeext}; then
+           pipe_works=yes
+         fi
+         LIBS="$lt_save_LIBS"
+         CFLAGS="$lt_save_CFLAGS"
+       else
+         echo "cannot find nm_test_func in $nlist" >&5
+       fi
+      else
+       echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -f conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  { echo "$as_me:$LINENO: result: failed" >&5
+echo "${ECHO_T}failed" >&6; }
+else
+  { echo "$as_me:$LINENO: result: ok" >&5
+echo "${ECHO_T}ok" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking for objdir" >&5
+echo $ECHO_N "checking for objdir... $ECHO_C" >&6; }
+if test "${lt_cv_objdir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+echo "${ECHO_T}$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; 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_AR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AR="${ac_tool_prefix}ar"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  { echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+  ac_ct_AR=$AR
+  # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; 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_AR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_AR"; then
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_AR="ar"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_AR" = x; then
+    AR="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    AR=$ac_ct_AR
+  fi
+else
+  AR="$ac_cv_prog_AR"
+fi
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; 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_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  { echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; 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_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    RANLIB=$ac_ct_RANLIB
+  fi
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+IFS=$as_save_IFS
+
+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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+IFS=$as_save_IFS
+
+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
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+       case $deplibs_check_method in
+       "file_magic "*)
+         file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+         MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+         if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+           $EGREP "$file_magic_regex" > /dev/null; then
+           :
+         else
+           cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+         fi ;;
+       esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    { echo "$as_me:$LINENO: checking for file" >&5
+echo $ECHO_N "checking for file... $ECHO_C" >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+       case $deplibs_check_method in
+       "file_magic "*)
+         file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+         MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+         if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+           $EGREP "$file_magic_regex" > /dev/null; then
+           :
+         else
+           cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+         fi ;;
+       esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+enable_dlopen=no
+enable_win32_dll=no
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+  enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then
+  withval=$with_pic; pic_mode="$withval"
+else
+  pic_mode=default
+fi
+
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
+lt_save_CC="$CC"
+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
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}\n'
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:7246: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:7250: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl='-Wl,'
+    lt_prog_compiler_static='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic='-fno-common'
+      ;;
+
+    interix3*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       lt_prog_compiler_pic=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic='-fPIC'
+       ;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl='-Wl,'
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static='-Bstatic'
+      else
+       lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         lt_prog_compiler_pic='-qnocommon'
+         lt_prog_compiler_wl='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic='+Z'
+       ;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      case $cc_basename in
+      icc* | ecc*)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-KPIC'
+       lt_prog_compiler_static='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+       # which looks to be a dead project)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-fpic'
+       lt_prog_compiler_static='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static='-non_shared'
+        ;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+       lt_prog_compiler_wl='-Qoption ld ';;
+      *)
+       lt_prog_compiler_wl='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl='-Qoption ld '
+      lt_prog_compiler_pic='-PIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+       lt_prog_compiler_pic='-Kconform_pic'
+       lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_can_build_shared=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic='-pic'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:7514: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:7518: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_prog_compiler_pic_works=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_prog_compiler_pic_works" = xyes; then
+    case $lt_prog_compiler_pic in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+     esac
+else
+    lt_prog_compiler_pic=
+     lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic=
+    ;;
+  *)
+    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_static_works=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_prog_compiler_static_works=yes
+       fi
+     else
+       lt_prog_compiler_static_works=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works" >&6; }
+
+if test x"$lt_prog_compiler_static_works" = xyes; then
+    :
+else
+    lt_prog_compiler_static=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:7618: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:7622: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  runpath_var=
+  allow_undefined_flag=
+  enable_shared_with_static_runtimes=no
+  archive_cmds=
+  archive_expsym_cmds=
+  old_archive_From_new_cmds=
+  old_archive_from_expsyms_cmds=
+  export_dynamic_flag_spec=
+  whole_archive_flag_spec=
+  thread_safe_flag_spec=
+  hardcode_libdir_flag_spec=
+  hardcode_libdir_flag_spec_ld=
+  hardcode_libdir_separator=
+  hardcode_direct=no
+  hardcode_minus_L=no
+  hardcode_shlibpath_var=unsupported
+  link_all_deplibs=unknown
+  hardcode_automatic=no
+  module_cmds=
+  module_expsym_cmds=
+  always_export_symbols=no
+  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+       whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+       whole_archive_flag_spec=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+       ld_shlibs=no
+       cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       allow_undefined_flag=unsupported
+       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+       # support --undefined.  This deserves some investigation.  FIXME
+       archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      allow_undefined_flag=unsupported
+      always_export_symbols=no
+      enable_shared_with_static_runtimes=yes
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+       # If the export-symbols file already is a .def file (1st line
+       # is EXPORTS), use it as is; otherwise, prepend...
+       archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname.def;
+       else
+         echo EXPORTS > $output_objdir/$soname.def;
+         cat $export_symbols >> $output_objdir/$soname.def;
+       fi~
+       $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    interix3*)
+      hardcode_direct=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       tmp_addflag=
+       case $cc_basename,$host_cpu in
+       pgcc*)                          # Portland Group C compiler
+         whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag'
+         ;;
+       pgf77* | pgf90* | pgf95*)       # Portland Group f77 and f90 compilers
+         whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag -Mnomain' ;;
+       ecc*,ia64* | icc*,ia64*)                # Intel C compiler on ia64
+         tmp_addflag=' -i_dynamic' ;;
+       efc*,ia64* | ifort*,ia64*)      # Intel Fortran compiler on ia64
+         tmp_addflag=' -i_dynamic -nofor_main' ;;
+       ifc* | ifort*)                  # Intel Fortran compiler
+         tmp_addflag=' -nofor_main' ;;
+       esac
+       archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+       if test $supports_anon_versioning = yes; then
+         archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+         $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+       fi
+       link_all_deplibs=no
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+       wlarc=
+      else
+       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+       ld_shlibs=no
+       cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+       ld_shlibs=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+       ;;
+       *)
+         if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+           hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+           archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+           archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+         else
+           ld_shlibs=no
+         fi
+       ;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec=
+      export_dynamic_flag_spec=
+      whole_archive_flag_spec=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag=unsupported
+      always_export_symbols=yes
+      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+       # Neither direct hardcoding nor static linking is supported with a
+       # broken collect2.
+       hardcode_direct=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+       # On IA64, the linker does run time linking by default, so we don't
+       # have to do anything special.
+       aix_use_runtimelinking=no
+       exp_sym_flag='-Bexport'
+       no_entry_flag=""
+      else
+       # If we're using GNU nm, then we don't want the "-C" option.
+       # -C means demangle to AIX nm, but means don't demangle with GNU nm
+       if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+         export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+       else
+         export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+       fi
+       aix_use_runtimelinking=no
+
+       # Test if we are trying to use run time linking or normal
+       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+       # need to do runtime linking.
+       case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+         for ld_flag in $LDFLAGS; do
+         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+           aix_use_runtimelinking=yes
+           break
+         fi
+         done
+         ;;
+       esac
+
+       exp_sym_flag='-bexport'
+       no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds=''
+      hardcode_direct=yes
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+
+      if test "$GCC" = yes; then
+       case $host_os in aix4.[012]|aix4.[012].*)
+       # We only want to do this on AIX 4.2 and lower, the check
+       # below for broken collect2 doesn't work under 4.3+
+         collect2name=`${CC} -print-prog-name=collect2`
+         if test -f "$collect2name" && \
+          strings "$collect2name" | grep resolve_lib_name >/dev/null
+         then
+         # We have reworked collect2
+         hardcode_direct=yes
+         else
+         # We have old collect2
+         hardcode_direct=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         hardcode_minus_L=yes
+         hardcode_libdir_flag_spec='-L$libdir'
+         hardcode_libdir_separator=
+         fi
+         ;;
+       esac
+       shared_flag='-shared'
+       if test "$aix_use_runtimelinking" = yes; then
+         shared_flag="$shared_flag "'${wl}-G'
+       fi
+      else
+       # not using gcc
+       if test "$host_cpu" = ia64; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+       else
+         if test "$aix_use_runtimelinking" = yes; then
+           shared_flag='${wl}-G'
+         else
+           shared_flag='${wl}-bM:SRE'
+         fi
+       fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols=yes
+      if test "$aix_use_runtimelinking" = yes; then
+       # Warning - without using the other runtime loading flags (-brtl),
+       # -berok will link without error, but may produce a broken library.
+       allow_undefined_flag='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+       archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+       if test "$host_cpu" = ia64; then
+         hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+         allow_undefined_flag="-z nodefs"
+         archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+       else
+        # Determine the default libpath from the value encoded in an empty executable.
+        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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+         # Warning - without using the other run time loading flags,
+         # -berok will link without error, but may produce a broken library.
+         no_undefined_flag=' ${wl}-bernotok'
+         allow_undefined_flag=' ${wl}-berok'
+         # Exported symbols can be pulled into shared objects from archives
+         whole_archive_flag_spec='$convenience'
+         archive_cmds_need_lc=yes
+         # This is similar to how AIX traditionally builds its shared libraries.
+         archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+       fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs=no
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec=' '
+      allow_undefined_flag=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      archive_cmds_need_lc=no
+      hardcode_direct=no
+      hardcode_automatic=yes
+      hardcode_shlibpath_var=unsupported
+      whole_archive_flag_spec=''
+      link_all_deplibs=yes
+    if test "$GCC" = yes ; then
+       output_verbose_link_cmd='echo'
+        archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+         module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+       archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+       archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      export_dynamic_flag_spec='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+       hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+       hardcode_libdir_separator=:
+
+       hardcode_direct=yes
+       export_dynamic_flag_spec='${wl}-E'
+
+       # hardcode_minus_L: Not really in the search PATH,
+       # but as the default location of the library.
+       hardcode_minus_L=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       case $host_cpu in
+       hppa*64*)
+         archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      else
+       case $host_cpu in
+       hppa*64*)
+         archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      fi
+      if test "$with_gnu_ld" = no; then
+       hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+       hardcode_libdir_separator=:
+
+       case $host_cpu in
+       hppa*64*|ia64*)
+         hardcode_libdir_flag_spec_ld='+b $libdir'
+         hardcode_direct=no
+         hardcode_shlibpath_var=no
+         ;;
+       *)
+         hardcode_direct=yes
+         export_dynamic_flag_spec='${wl}-E'
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         hardcode_minus_L=yes
+         ;;
+       esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       hardcode_libdir_flag_spec_ld='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      link_all_deplibs=yes
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+       archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    newsos6)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_shlibpath_var=no
+      ;;
+
+    openbsd*)
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+       archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+       hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+       export_dynamic_flag_spec='${wl}-E'
+      else
+       case $host_os in
+        openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+          archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+          hardcode_libdir_flag_spec='-R$libdir'
+          ;;
+        *)
+          archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+          hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+          ;;
+       esac
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       allow_undefined_flag=' -expect_unresolved \*'
+       archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+
+    osf4* | osf5*)     # as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+       allow_undefined_flag=' -expect_unresolved \*'
+       archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+       $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+       # Both c and cxx compiler support -rpath directly
+       hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      hardcode_libdir_separator=:
+      ;;
+
+    solaris*)
+      no_undefined_flag=' -z text'
+      if test "$GCC" = yes; then
+       wlarc='${wl}'
+       archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+         $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+       wlarc=''
+       archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+       $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_shlibpath_var=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+       # The compiler driver will combine linker options so we
+       # cannot just pass the convience library names through
+       # without $wl, iff we do not link with $LD.
+       # Luckily, gcc supports the same syntax we need for Sun Studio.
+       # Supported since Solaris 2.6 (maybe 2.5.1?)
+       case $wlarc in
+       '')
+         whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+       *)
+         whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+       esac ;;
+      esac
+      link_all_deplibs=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+       # Use $CC to link under sequent, because it throws in some extra .o
+       # files that make .init and .fini sections work.
+       archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+       sni)
+         archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct=yes # is this really true???
+       ;;
+       siemens)
+         ## LD is ld it makes a PLAMLIB
+         ## CC just makes a GrossModule.
+         archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+         reload_cmds='$CC -r -o $output$reload_objs'
+         hardcode_direct=no
+        ;;
+       motorola)
+         archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+       ;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      export_dynamic_flag_spec='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       hardcode_shlibpath_var=no
+       runpath_var=LD_RUN_PATH
+       hardcode_runpath_var=yes
+       ld_shlibs=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
+      no_undefined_flag='${wl}-z,text'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag='${wl}-z,text'
+      allow_undefined_flag='${wl}-z,nodefs'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      export_dynamic_flag_spec='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      ld_shlibs=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+echo "${ECHO_T}$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      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); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl
+       pic_flag=$lt_prog_compiler_pic
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag
+        allow_undefined_flag=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+         archive_cmds_need_lc=no
+        else
+         archive_cmds_need_lc=yes
+        fi
+        allow_undefined_flag=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+echo "${ECHO_T}$archive_cmds_need_lc" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  freebsd*) # from 4.6 on
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix3*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test "$lt_cv_prog_gnu_ld" = yes; then
+               version_type=linux
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,       ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+       shlibpath_overrides_runpath=no
+       ;;
+      *)
+       shlibpath_overrides_runpath=yes
+       ;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+       ;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+   test -n "$runpath_var" || \
+   test "X$hardcode_automatic" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action" >&5
+echo "${ECHO_T}$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+striplib=
+old_striplib=
+{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+   darwin*)
+       if test -n "$STRIP" ; then
+         striplib="$STRIP -x"
+         { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+       else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+       ;;
+   *)
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+    ;;
+  esac
+fi
+
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+   ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+   ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_lib_dl_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+
+fi
+
+   ;;
+
+  *)
+    { echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; }
+if test "${ac_cv_func_shl_load+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 shl_load to an innocuous variant, in case <limits.h> declares shl_load.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define shl_load innocuous_shl_load
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char shl_load (); 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 shl_load
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+/* 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_shl_load || defined __stub___shl_load
+choke me
+#endif
+
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_func_shl_load=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6; }
+if test $ac_cv_func_shl_load = yes; then
+  lt_cv_dlopen="shl_load"
+else
+  { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dld_shl_load=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_lib_dld_shl_load=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
+if test $ac_cv_lib_dld_shl_load = yes; then
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+else
+  { echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
+if test "${ac_cv_func_dlopen+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 dlopen to an innocuous variant, in case <limits.h> declares dlopen.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define dlopen innocuous_dlopen
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char dlopen (); 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 dlopen
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+/* 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_dlopen || defined __stub___dlopen
+choke me
+#endif
+
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_func_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6; }
+if test $ac_cv_func_dlopen = yes; then
+  lt_cv_dlopen="dlopen"
+else
+  { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_lib_dl_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_svld_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_lib_svld_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; }
+if test $ac_cv_lib_svld_dlopen = yes; then
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_dld_dld_link=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_lib_dld_dld_link=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
+if test $ac_cv_lib_dld_dld_link = yes; then
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; }
+if test "${lt_cv_dlopen_self+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+         if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 9915 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+    exit (status);
+}
+EOF
+  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); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; }
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+         if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<EOF
+#line 10015 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+    exit (status);
+}
+EOF
+  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); } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+# Report which library types will actually be built
+{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+    ;;
+esac
+{ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+{ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6; }
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler \
+    CC \
+    LD \
+    lt_prog_compiler_wl \
+    lt_prog_compiler_pic \
+    lt_prog_compiler_static \
+    lt_prog_compiler_no_builtin_flag \
+    export_dynamic_flag_spec \
+    thread_safe_flag_spec \
+    whole_archive_flag_spec \
+    enable_shared_with_static_runtimes \
+    old_archive_cmds \
+    old_archive_from_new_cmds \
+    predep_objects \
+    postdep_objects \
+    predeps \
+    postdeps \
+    compiler_lib_search_path \
+    archive_cmds \
+    archive_expsym_cmds \
+    postinstall_cmds \
+    postuninstall_cmds \
+    old_archive_from_expsyms_cmds \
+    allow_undefined_flag \
+    no_undefined_flag \
+    export_symbols_cmds \
+    hardcode_libdir_flag_spec \
+    hardcode_libdir_flag_spec_ld \
+    hardcode_libdir_separator \
+    hardcode_automatic \
+    module_cmds \
+    module_expsym_cmds \
+    lt_cv_prog_compiler_c_o \
+    exclude_expsyms \
+    include_expsyms; do
+
+    case $var in
+    old_archive_cmds | \
+    old_archive_from_new_cmds | \
+    archive_cmds | \
+    archive_expsym_cmds | \
+    module_cmds | \
+    module_expsym_cmds | \
+    old_archive_from_expsyms_cmds | \
+    export_symbols_cmds | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="${ofile}T"
+  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+  $rm -f "$cfgfile"
+  { echo "$as_me:$LINENO: creating $ofile" >&5
+echo "$as_me: creating $ofile" >&6;}
+
+  cat <<__EOF__ >> "$cfgfile"
+#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e 1s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# ### END LIBTOOL CONFIG
+
+__EOF__
+
+
+  case $host_os in
+  aix3*)
+    cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+EOF
+    ;;
+  esac
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" || \
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+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
+
+CC="$lt_save_CC"
+
+
+# Check whether --with-tags was given.
+if test "${with_tags+set}" = set; then
+  withval=$with_tags; tagnames="$withval"
+fi
+
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+  if test ! -f "${ofile}"; then
+    { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5
+echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;}
+  fi
+
+  if test -z "$LTCC"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+    if test -z "$LTCC"; then
+      { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5
+echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;}
+    else
+      { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5
+echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;}
+    fi
+  fi
+  if test -z "$LTCFLAGS"; then
+    eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
+  fi
+
+  # Extract list of available tagged configurations in $ofile.
+  # Note that this assumes the entire list is on one line.
+  available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+  lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+  for tagname in $tagnames; do
+    IFS="$lt_save_ifs"
+    # Check whether tagname contains only valid characters
+    case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in
+    "") ;;
+    *)  { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5
+echo "$as_me: error: invalid tag name: $tagname" >&2;}
+   { (exit 1); exit 1; }; }
+       ;;
+    esac
+
+    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+    then
+      { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5
+echo "$as_me: error: tag name \"$tagname\" already exists" >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+
+    # Update the list of available tags.
+    if test -n "$tagname"; then
+      echo appending configuration tag \"$tagname\" to $ofile
+
+      case $tagname in
+      CXX)
+       if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+           ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+           (test "X$CXX" != "Xg++"))) ; then
+         ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+
+
+archive_cmds_need_lc_CXX=no
+allow_undefined_flag_CXX=
+always_export_symbols_CXX=no
+archive_expsym_cmds_CXX=
+export_dynamic_flag_spec_CXX=
+hardcode_direct_CXX=no
+hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_flag_spec_ld_CXX=
+hardcode_libdir_separator_CXX=
+hardcode_minus_L_CXX=no
+hardcode_shlibpath_var_CXX=unsupported
+hardcode_automatic_CXX=no
+module_cmds_CXX=
+module_expsym_cmds_CXX=
+link_all_deplibs_CXX=unknown
+old_archive_cmds_CXX=$old_archive_cmds
+no_undefined_flag_CXX=
+whole_archive_flag_spec_CXX=
+enable_shared_with_static_runtimes_CXX=no
+
+# Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+objext_CXX=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+  lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+  $as_unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+  lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+  $as_unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+compiler_CXX=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+  lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+else
+  lt_prog_compiler_no_builtin_flag_CXX=
+fi
+
+if test "$GXX" = yes; then
+  # Set up default GNU C++ configuration
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+else
+  { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+       test "$with_gnu_ld" != no && break
+       ;;
+      *)
+       test "$with_gnu_ld" != yes && break
+       ;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+  # Check if GNU C++ uses GNU ld as the underlying linker, since the
+  # archiving commands below assume that GNU ld is being used.
+  if test "$with_gnu_ld" = yes; then
+    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+    hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+    #     investigate it a little bit more. (MM)
+    wlarc='${wl}'
+
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+       grep 'no-whole-archive' > /dev/null; then
+      whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      whole_archive_flag_spec_CXX=
+    fi
+  else
+    with_gnu_ld=no
+    wlarc=
+
+    # A generic and very simple default shared library creation
+    # command for GNU C++ for the case where it uses the native
+    # linker, instead of GNU ld.  If possible, this setting should
+    # overridden to take advantage of the native linker features on
+    # the platform it is being used on.
+    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+  fi
+
+  # Commands to make compiler produce verbose output that lists
+  # what "hidden" libraries, object files and flags are used when
+  # linking a shared library.
+  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+  GXX=no
+  with_gnu_ld=no
+  wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+ld_shlibs_CXX=yes
+case $host_os in
+  aix3*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  aix4* | aix5*)
+    if test "$host_cpu" = ia64; then
+      # On IA64, the linker does run time linking by default, so we don't
+      # have to do anything special.
+      aix_use_runtimelinking=no
+      exp_sym_flag='-Bexport'
+      no_entry_flag=""
+    else
+      aix_use_runtimelinking=no
+
+      # Test if we are trying to use run time linking or normal
+      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+      # need to do runtime linking.
+      case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+       for ld_flag in $LDFLAGS; do
+         case $ld_flag in
+         *-brtl*)
+           aix_use_runtimelinking=yes
+           break
+           ;;
+         esac
+       done
+       ;;
+      esac
+
+      exp_sym_flag='-bexport'
+      no_entry_flag='-bnoentry'
+    fi
+
+    # When large executables or shared objects are built, AIX ld can
+    # have problems creating the table of contents.  If linking a library
+    # or program results in "error TOC overflow" add -mminimal-toc to
+    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+    archive_cmds_CXX=''
+    hardcode_direct_CXX=yes
+    hardcode_libdir_separator_CXX=':'
+    link_all_deplibs_CXX=yes
+
+    if test "$GXX" = yes; then
+      case $host_os in aix4.[012]|aix4.[012].*)
+      # We only want to do this on AIX 4.2 and lower, the check
+      # below for broken collect2 doesn't work under 4.3+
+       collect2name=`${CC} -print-prog-name=collect2`
+       if test -f "$collect2name" && \
+          strings "$collect2name" | grep resolve_lib_name >/dev/null
+       then
+         # We have reworked collect2
+         hardcode_direct_CXX=yes
+       else
+         # We have old collect2
+         hardcode_direct_CXX=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         hardcode_minus_L_CXX=yes
+         hardcode_libdir_flag_spec_CXX='-L$libdir'
+         hardcode_libdir_separator_CXX=
+       fi
+       ;;
+      esac
+      shared_flag='-shared'
+      if test "$aix_use_runtimelinking" = yes; then
+       shared_flag="$shared_flag "'${wl}-G'
+      fi
+    else
+      # not using gcc
+      if test "$host_cpu" = ia64; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+       shared_flag='-G'
+      else
+       if test "$aix_use_runtimelinking" = yes; then
+         shared_flag='${wl}-G'
+       else
+         shared_flag='${wl}-bM:SRE'
+       fi
+      fi
+    fi
+
+    # It seems that -bexpall does not export symbols beginning with
+    # underscore (_), so it is better to generate a list of symbols to export.
+    always_export_symbols_CXX=yes
+    if test "$aix_use_runtimelinking" = yes; then
+      # Warning - without using the other runtime loading flags (-brtl),
+      # -berok will link without error, but may produce a broken library.
+      allow_undefined_flag_CXX='-berok'
+      # Determine the default libpath from the value encoded in an empty executable.
+      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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_cxx_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+      hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+      archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+     else
+      if test "$host_cpu" = ia64; then
+       hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
+       allow_undefined_flag_CXX="-z nodefs"
+       archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+      else
+       # Determine the default libpath from the value encoded in an empty executable.
+       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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_cxx_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+       # Warning - without using the other run time loading flags,
+       # -berok will link without error, but may produce a broken library.
+       no_undefined_flag_CXX=' ${wl}-bernotok'
+       allow_undefined_flag_CXX=' ${wl}-berok'
+       # Exported symbols can be pulled into shared objects from archives
+       whole_archive_flag_spec_CXX='$convenience'
+       archive_cmds_need_lc_CXX=yes
+       # This is similar to how AIX traditionally builds its shared libraries.
+       archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+      fi
+    fi
+    ;;
+
+  beos*)
+    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+      allow_undefined_flag_CXX=unsupported
+      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+      # support --undefined.  This deserves some investigation.  FIXME
+      archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+    else
+      ld_shlibs_CXX=no
+    fi
+    ;;
+
+  chorus*)
+    case $cc_basename in
+      *)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+    esac
+    ;;
+
+  cygwin* | mingw* | pw32*)
+    # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+    # as there is no search path for DLLs.
+    hardcode_libdir_flag_spec_CXX='-L$libdir'
+    allow_undefined_flag_CXX=unsupported
+    always_export_symbols_CXX=no
+    enable_shared_with_static_runtimes_CXX=yes
+
+    if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+      archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      # If the export-symbols file already is a .def file (1st line
+      # is EXPORTS), use it as is; otherwise, prepend...
+      archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+       cp $export_symbols $output_objdir/$soname.def;
+      else
+       echo EXPORTS > $output_objdir/$soname.def;
+       cat $export_symbols >> $output_objdir/$soname.def;
+      fi~
+      $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+    else
+      ld_shlibs_CXX=no
+    fi
+  ;;
+      darwin* | rhapsody*)
+        case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+        esac
+      archive_cmds_need_lc_CXX=no
+      hardcode_direct_CXX=no
+      hardcode_automatic_CXX=yes
+      hardcode_shlibpath_var_CXX=unsupported
+      whole_archive_flag_spec_CXX=''
+      link_all_deplibs_CXX=yes
+
+    if test "$GXX" = yes ; then
+      lt_int_apple_cc_single_mod=no
+      output_verbose_link_cmd='echo'
+      if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
+       lt_int_apple_cc_single_mod=yes
+      fi
+      if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+       archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      else
+          archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+        fi
+        module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+        # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+            archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          else
+            archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          fi
+            module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+          archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+          module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs_CXX=no
+          ;;
+      esac
+      fi
+        ;;
+
+  dgux*)
+    case $cc_basename in
+      ec++*)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      ghcx*)
+       # Green Hills C++ Compiler
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+    esac
+    ;;
+  freebsd[12]*)
+    # C++ shared libraries reported to be fairly broken before switch to ELF
+    ld_shlibs_CXX=no
+    ;;
+  freebsd-elf*)
+    archive_cmds_need_lc_CXX=no
+    ;;
+  freebsd* | dragonfly*)
+    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+    # conventions
+    ld_shlibs_CXX=yes
+    ;;
+  gnu*)
+    ;;
+  hpux9*)
+    hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+    hardcode_libdir_separator_CXX=:
+    export_dynamic_flag_spec_CXX='${wl}-E'
+    hardcode_direct_CXX=yes
+    hardcode_minus_L_CXX=yes # Not in the search PATH,
+                               # but as the default
+                               # location of the library.
+
+    case $cc_basename in
+    CC*)
+      # FIXME: insert proper C++ library support
+      ld_shlibs_CXX=no
+      ;;
+    aCC*)
+      archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      #
+      # There doesn't appear to be a way to prevent this compiler from
+      # explicitly linking system object files so we need to strip them
+      # from the output so that they don't get included in the library
+      # dependencies.
+      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+      ;;
+    *)
+      if test "$GXX" = yes; then
+        archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+      fi
+      ;;
+    esac
+    ;;
+  hpux10*|hpux11*)
+    if test $with_gnu_ld = no; then
+      hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_CXX=:
+
+      case $host_cpu in
+      hppa*64*|ia64*)
+       hardcode_libdir_flag_spec_ld_CXX='+b $libdir'
+        ;;
+      *)
+       export_dynamic_flag_spec_CXX='${wl}-E'
+        ;;
+      esac
+    fi
+    case $host_cpu in
+    hppa*64*|ia64*)
+      hardcode_direct_CXX=no
+      hardcode_shlibpath_var_CXX=no
+      ;;
+    *)
+      hardcode_direct_CXX=yes
+      hardcode_minus_L_CXX=yes # Not in the search PATH,
+                                             # but as the default
+                                             # location of the library.
+      ;;
+    esac
+
+    case $cc_basename in
+      CC*)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      aCC*)
+       case $host_cpu in
+       hppa*64*)
+         archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+         ;;
+       ia64*)
+         archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+         ;;
+       *)
+         archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+         ;;
+       esac
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+      *)
+       if test "$GXX" = yes; then
+         if test $with_gnu_ld = no; then
+           case $host_cpu in
+           hppa*64*)
+             archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             ;;
+           ia64*)
+             archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             ;;
+           *)
+             archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             ;;
+           esac
+         fi
+       else
+         # FIXME: insert proper C++ library support
+         ld_shlibs_CXX=no
+       fi
+       ;;
+    esac
+    ;;
+  interix3*)
+    hardcode_direct_CXX=no
+    hardcode_shlibpath_var_CXX=no
+    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+    export_dynamic_flag_spec_CXX='${wl}-E'
+    # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+    # Instead, shared libraries are loaded at an image base (0x10000000 by
+    # default) and relocated if they conflict, which is a slow very memory
+    # consuming and fragmenting process.  To avoid this, we pick a random,
+    # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+    # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+    archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+    ;;
+  irix5* | irix6*)
+    case $cc_basename in
+      CC*)
+       # SGI C++
+       archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+       # Archives containing C++ object files must be created using
+       # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+       # necessary to make sure instantiated templates are included
+       # in the archive.
+       old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+       ;;
+      *)
+       if test "$GXX" = yes; then
+         if test "$with_gnu_ld" = no; then
+           archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+         else
+           archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+         fi
+       fi
+       link_all_deplibs_CXX=yes
+       ;;
+    esac
+    hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+    hardcode_libdir_separator_CXX=:
+    ;;
+  linux* | k*bsd*-gnu)
+    case $cc_basename in
+      KCC*)
+       # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+       # KCC will only create a shared library if the output file
+       # ends with ".so" (or ".sl" for HP-UX), so rename the library
+       # to its proper name (with version) after linking.
+       archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+       archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+       hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir'
+       export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+       # Archives containing C++ object files must be created using
+       # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+       old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+       ;;
+      icpc*)
+       # Intel C++
+       with_gnu_ld=yes
+       # version 8.0 and above of icpc choke on multiply defined symbols
+       # if we add $predep_objects and $postdep_objects, however 7.1 and
+       # earlier do not add the objects themselves.
+       case `$CC -V 2>&1` in
+       *"Version 7."*)
+         archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+         archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+         ;;
+       *)  # Version 8.0 or newer
+         tmp_idyn=
+         case $host_cpu in
+           ia64*) tmp_idyn=' -i_dynamic';;
+         esac
+         archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+         archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+         ;;
+       esac
+       archive_cmds_need_lc_CXX=no
+       hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+       export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+       whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+       ;;
+      pgCC*)
+        # Portland Group C++ compiler
+       archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+       archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+       hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+       export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+       whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+        ;;
+      cxx*)
+       # Compaq C++
+       archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+       runpath_var=LD_RUN_PATH
+       hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+       hardcode_libdir_separator_CXX=:
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+    esac
+    ;;
+  lynxos*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  m88k*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  mvs*)
+    case $cc_basename in
+      cxx*)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+    esac
+    ;;
+  netbsd* | netbsdelf*-gnu)
+    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+      archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+      wlarc=
+      hardcode_libdir_flag_spec_CXX='-R$libdir'
+      hardcode_direct_CXX=yes
+      hardcode_shlibpath_var_CXX=no
+    fi
+    # Workaround some broken pre-1.5 toolchains
+    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+    ;;
+  openbsd2*)
+    # C++ shared libraries are fairly broken
+    ld_shlibs_CXX=no
+    ;;
+  openbsd*)
+    hardcode_direct_CXX=yes
+    hardcode_shlibpath_var_CXX=no
+    archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+      archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+      export_dynamic_flag_spec_CXX='${wl}-E'
+      whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    fi
+    output_verbose_link_cmd='echo'
+    ;;
+  osf3*)
+    case $cc_basename in
+      KCC*)
+       # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+       # KCC will only create a shared library if the output file
+       # ends with ".so" (or ".sl" for HP-UX), so rename the library
+       # to its proper name (with version) after linking.
+       archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+       hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+       hardcode_libdir_separator_CXX=:
+
+       # Archives containing C++ object files must be created using
+       # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+       old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+
+       ;;
+      RCC*)
+       # Rational C++ 2.4.1
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      cxx*)
+       allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+       hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+       hardcode_libdir_separator_CXX=:
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+      *)
+       if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+         allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+         archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+         hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+         hardcode_libdir_separator_CXX=:
+
+         # Commands to make compiler produce verbose output that lists
+         # what "hidden" libraries, object files and flags are used when
+         # linking a shared library.
+         output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+       else
+         # FIXME: insert proper C++ library support
+         ld_shlibs_CXX=no
+       fi
+       ;;
+    esac
+    ;;
+  osf4* | osf5*)
+    case $cc_basename in
+      KCC*)
+       # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+       # KCC will only create a shared library if the output file
+       # ends with ".so" (or ".sl" for HP-UX), so rename the library
+       # to its proper name (with version) after linking.
+       archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+       hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+       hardcode_libdir_separator_CXX=:
+
+       # Archives containing C++ object files must be created using
+       # the KAI C++ compiler.
+       old_archive_cmds_CXX='$CC -o $oldlib $oldobjs'
+       ;;
+      RCC*)
+       # Rational C++ 2.4.1
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      cxx*)
+       allow_undefined_flag_CXX=' -expect_unresolved \*'
+       archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+         echo "-hidden">> $lib.exp~
+         $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+         $rm $lib.exp'
+
+       hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+       hardcode_libdir_separator_CXX=:
+
+       # Commands to make compiler produce verbose output that lists
+       # what "hidden" libraries, object files and flags are used when
+       # linking a shared library.
+       #
+       # There doesn't appear to be a way to prevent this compiler from
+       # explicitly linking system object files so we need to strip them
+       # from the output so that they don't get included in the library
+       # dependencies.
+       output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+       ;;
+      *)
+       if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+         allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+        archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+         hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+         hardcode_libdir_separator_CXX=:
+
+         # Commands to make compiler produce verbose output that lists
+         # what "hidden" libraries, object files and flags are used when
+         # linking a shared library.
+         output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+       else
+         # FIXME: insert proper C++ library support
+         ld_shlibs_CXX=no
+       fi
+       ;;
+    esac
+    ;;
+  psos*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  sunos4*)
+    case $cc_basename in
+      CC*)
+       # Sun C++ 4.x
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      lcc*)
+       # Lucid
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+    esac
+    ;;
+  solaris*)
+    case $cc_basename in
+      CC*)
+       # Sun C++ 4.2, 5.x and Centerline C++
+        archive_cmds_need_lc_CXX=yes
+       no_undefined_flag_CXX=' -zdefs'
+       archive_cmds_CXX='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+       archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+       $CC -G${allow_undefined_flag}  ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+       hardcode_libdir_flag_spec_CXX='-R$libdir'
+       hardcode_shlibpath_var_CXX=no
+       case $host_os in
+         solaris2.[0-5] | solaris2.[0-5].*) ;;
+         *)
+           # The C++ compiler is used as linker so we must use $wl
+           # flag to pass the commands to the underlying system
+           # linker. We must also pass each convience library through
+           # to the system linker between allextract/defaultextract.
+           # The C++ compiler will combine linker options so we
+           # cannot just pass the convience library names through
+           # without $wl.
+           # Supported since Solaris 2.6 (maybe 2.5.1?)
+           whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract'
+           ;;
+       esac
+       link_all_deplibs_CXX=yes
+
+       output_verbose_link_cmd='echo'
+
+       # Archives containing C++ object files must be created using
+       # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+       # necessary to make sure instantiated templates are included
+       # in the archive.
+       old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+       ;;
+      gcx*)
+       # Green Hills C++ Compiler
+       archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+       # The C++ compiler must be used to create the archive.
+       old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+       ;;
+      *)
+       # GNU C++ compiler with Solaris linker
+       if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+         no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
+         if $CC --version | grep -v '^2\.7' > /dev/null; then
+           archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+           archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+               $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+         else
+           # g++ 2.7 appears to require `-G' NOT `-shared' on this
+           # platform.
+           archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+           archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+               $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+         fi
+
+         hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+       fi
+       ;;
+    esac
+    ;;
+  sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+    no_undefined_flag_CXX='${wl}-z,text'
+    archive_cmds_need_lc_CXX=no
+    hardcode_shlibpath_var_CXX=no
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+       archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+      *)
+       archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+    esac
+    ;;
+  sysv5* | sco3.2v5* | sco5v6*)
+    # Note: We can NOT use -z defs as we might desire, because we do not
+    # link with -lc, and that would cause any symbols used from libc to
+    # always be unresolved, which means just about no library would
+    # ever link correctly.  If we're not using GNU ld we use -z text
+    # though, which does catch some bad symbols but isn't as heavy-handed
+    # as -z defs.
+    # For security reasons, it is highly recommended that you always
+    # use absolute paths for naming shared libraries, and exclude the
+    # DT_RUNPATH tag from executables and libraries.  But doing so
+    # requires that you compile everything twice, which is a pain.
+    # So that behaviour is only enabled if SCOABSPATH is set to a
+    # non-empty value in the environment.  Most likely only useful for
+    # creating official distributions of packages.
+    # This is a hack until libtool officially supports absolute path
+    # names for shared libraries.
+    no_undefined_flag_CXX='${wl}-z,text'
+    allow_undefined_flag_CXX='${wl}-z,nodefs'
+    archive_cmds_need_lc_CXX=no
+    hardcode_shlibpath_var_CXX=no
+    hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+    hardcode_libdir_separator_CXX=':'
+    link_all_deplibs_CXX=yes
+    export_dynamic_flag_spec_CXX='${wl}-Bexport'
+    runpath_var='LD_RUN_PATH'
+
+    case $cc_basename in
+      CC*)
+       archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+      *)
+       archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       ;;
+    esac
+    ;;
+  tandem*)
+    case $cc_basename in
+      NCC*)
+       # NonStop-UX NCC 3.20
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+      *)
+       # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+    esac
+    ;;
+  vxworks*)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+  *)
+    # FIXME: insert proper C++ library support
+    ld_shlibs_CXX=no
+    ;;
+esac
+{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+GCC_CXX="$GXX"
+LD_CXX="$LD"
+
+
+cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+EOF
+
+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
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  # The `*' in the case matches for architectures that use `case' in
+  # $output_verbose_cmd can trigger glob expansion during the loop
+  # eval without this substitution.
+  output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+
+  for p in `eval $output_verbose_link_cmd`; do
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" \
+         || test $p = "-R"; then
+        prev=$p
+        continue
+       else
+        prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+        case $p in
+        -L* | -R*)
+          # Internal compiler library paths should come after those
+          # provided the user.  The postdeps already come after the
+          # user supplied libs so there is no need to process them.
+          if test -z "$compiler_lib_search_path_CXX"; then
+            compiler_lib_search_path_CXX="${prev}${p}"
+          else
+            compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
+          fi
+          ;;
+        # The "-l" case would never come before the object being
+        # linked, so don't bother handling this case.
+        esac
+       else
+        if test -z "$postdeps_CXX"; then
+          postdeps_CXX="${prev}${p}"
+        else
+          postdeps_CXX="${postdeps_CXX} ${prev}${p}"
+        fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+        pre_test_object_deps_done=yes
+        continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+        if test -z "$predep_objects_CXX"; then
+          predep_objects_CXX="$p"
+        else
+          predep_objects_CXX="$predep_objects_CXX $p"
+        fi
+       else
+        if test -z "$postdep_objects_CXX"; then
+          postdep_objects_CXX="$p"
+        else
+          postdep_objects_CXX="$postdep_objects_CXX $p"
+        fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling CXX test program"
+fi
+
+$rm -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+case $host_os in
+interix3*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  predep_objects_CXX=
+  postdep_objects_CXX=
+  postdeps_CXX=
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC*)
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    postdeps_CXX='-lCstd -lCrun'
+    ;;
+  esac
+  ;;
+esac
+
+
+case " $postdeps_CXX " in
+*" -lc "*) archive_cmds_need_lc_CXX=no ;;
+esac
+
+lt_prog_compiler_wl_CXX=
+lt_prog_compiler_pic_CXX=
+lt_prog_compiler_static_CXX=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    lt_prog_compiler_wl_CXX='-Wl,'
+    lt_prog_compiler_static_CXX='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static_CXX='-Bstatic'
+      fi
+      ;;
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
+      ;;
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | os2* | pw32*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_CXX='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      lt_prog_compiler_pic_CXX=
+      ;;
+    interix3*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       lt_prog_compiler_pic_CXX=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       ;;
+      *)
+       lt_prog_compiler_pic_CXX='-fPIC'
+       ;;
+      esac
+      ;;
+    *)
+      lt_prog_compiler_pic_CXX='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix4* | aix5*)
+       # All AIX code is PIC.
+       if test "$host_cpu" = ia64; then
+         # AIX 5 now supports IA64 processor
+         lt_prog_compiler_static_CXX='-Bstatic'
+       else
+         lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
+       fi
+       ;;
+      chorus*)
+       case $cc_basename in
+       cxch68*)
+         # Green Hills C++ Compiler
+         # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+         ;;
+       esac
+       ;;
+       darwin*)
+         # PIC is the default on this platform
+         # Common symbols not allowed in MH_DYLIB files
+         case $cc_basename in
+           xlc*)
+           lt_prog_compiler_pic_CXX='-qnocommon'
+           lt_prog_compiler_wl_CXX='-Wl,'
+           ;;
+         esac
+       ;;
+      dgux*)
+       case $cc_basename in
+         ec++*)
+           lt_prog_compiler_pic_CXX='-KPIC'
+           ;;
+         ghcx*)
+           # Green Hills C++ Compiler
+           lt_prog_compiler_pic_CXX='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      freebsd* | dragonfly*)
+       # FreeBSD uses GNU C++
+       ;;
+      hpux9* | hpux10* | hpux11*)
+       case $cc_basename in
+         CC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+           if test "$host_cpu" != ia64; then
+             lt_prog_compiler_pic_CXX='+Z'
+           fi
+           ;;
+         aCC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+           case $host_cpu in
+           hppa*64*|ia64*)
+             # +Z the default
+             ;;
+           *)
+             lt_prog_compiler_pic_CXX='+Z'
+             ;;
+           esac
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      interix*)
+       # This is c89, which is MS Visual C++ (no shared libs)
+       # Anyone wants to do a port?
+       ;;
+      irix5* | irix6* | nonstopux*)
+       case $cc_basename in
+         CC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_static_CXX='-non_shared'
+           # CC pic flag -KPIC is the default.
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      linux* | k*bsd*-gnu)
+       case $cc_basename in
+         KCC*)
+           # KAI C++ Compiler
+           lt_prog_compiler_wl_CXX='--backend -Wl,'
+           lt_prog_compiler_pic_CXX='-fPIC'
+           ;;
+         icpc* | ecpc*)
+           # Intel C++
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-KPIC'
+           lt_prog_compiler_static_CXX='-static'
+           ;;
+         pgCC*)
+           # Portland Group C++ compiler.
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-fpic'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           ;;
+         cxx*)
+           # Compaq C++
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           lt_prog_compiler_pic_CXX=
+           lt_prog_compiler_static_CXX='-non_shared'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      lynxos*)
+       ;;
+      m88k*)
+       ;;
+      mvs*)
+       case $cc_basename in
+         cxx*)
+           lt_prog_compiler_pic_CXX='-W c,exportall'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      netbsd* | netbsdelf*-gnu)
+       ;;
+      osf3* | osf4* | osf5*)
+       case $cc_basename in
+         KCC*)
+           lt_prog_compiler_wl_CXX='--backend -Wl,'
+           ;;
+         RCC*)
+           # Rational C++ 2.4.1
+           lt_prog_compiler_pic_CXX='-pic'
+           ;;
+         cxx*)
+           # Digital/Compaq C++
+           lt_prog_compiler_wl_CXX='-Wl,'
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           lt_prog_compiler_pic_CXX=
+           lt_prog_compiler_static_CXX='-non_shared'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      psos*)
+       ;;
+      solaris*)
+       case $cc_basename in
+         CC*)
+           # Sun C++ 4.2, 5.x and Centerline C++
+           lt_prog_compiler_pic_CXX='-KPIC'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           lt_prog_compiler_wl_CXX='-Qoption ld '
+           ;;
+         gcx*)
+           # Green Hills C++ Compiler
+           lt_prog_compiler_pic_CXX='-PIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sunos4*)
+       case $cc_basename in
+         CC*)
+           # Sun C++ 4.x
+           lt_prog_compiler_pic_CXX='-pic'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           ;;
+         lcc*)
+           # Lucid
+           lt_prog_compiler_pic_CXX='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      tandem*)
+       case $cc_basename in
+         NCC*)
+           # NonStop-UX NCC 3.20
+           lt_prog_compiler_pic_CXX='-KPIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+       case $cc_basename in
+         CC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-KPIC'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           ;;
+       esac
+       ;;
+      vxworks*)
+       ;;
+      *)
+       lt_prog_compiler_can_build_shared_CXX=no
+       ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_CXX"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works_CXX=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:12351: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:12355: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_prog_compiler_pic_works_CXX=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6; }
+
+if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then
+    case $lt_prog_compiler_pic_CXX in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
+     esac
+else
+    lt_prog_compiler_pic_CXX=
+     lt_prog_compiler_can_build_shared_CXX=no
+fi
+
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_CXX=
+    ;;
+  *)
+    lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_static_works_CXX=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_prog_compiler_static_works_CXX=yes
+       fi
+     else
+       lt_prog_compiler_static_works_CXX=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6; }
+
+if test x"$lt_prog_compiler_static_works_CXX" = xyes; then
+    :
+else
+    lt_prog_compiler_static_CXX=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:12455: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:12459: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix4* | aix5*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+    else
+      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    export_symbols_cmds_CXX="$ltdll_cmds"
+  ;;
+  cygwin* | mingw*)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  linux* | k*bsd*-gnu)
+    link_all_deplibs_CXX=no
+  ;;
+  *)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_CXX=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_CXX in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      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); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_CXX
+       pic_flag=$lt_prog_compiler_pic_CXX
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+        allow_undefined_flag_CXX=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+         archive_cmds_need_lc_CXX=no
+        else
+         archive_cmds_need_lc_CXX=yes
+        fi
+        allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  freebsd*) # from 4.6 on
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix3*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test "$lt_cv_prog_gnu_ld" = yes; then
+               version_type=linux
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,       ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+       shlibpath_overrides_runpath=no
+       ;;
+      *)
+       shlibpath_overrides_runpath=yes
+       ;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+       ;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" || \
+   test -n "$runpath_var_CXX" || \
+   test "X$hardcode_automatic_CXX" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_CXX" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
+     test "$hardcode_minus_L_CXX" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_CXX=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_CXX=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_CXX=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5
+echo "${ECHO_T}$hardcode_action_CXX" >&6; }
+
+if test "$hardcode_action_CXX" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_CXX \
+    CC_CXX \
+    LD_CXX \
+    lt_prog_compiler_wl_CXX \
+    lt_prog_compiler_pic_CXX \
+    lt_prog_compiler_static_CXX \
+    lt_prog_compiler_no_builtin_flag_CXX \
+    export_dynamic_flag_spec_CXX \
+    thread_safe_flag_spec_CXX \
+    whole_archive_flag_spec_CXX \
+    enable_shared_with_static_runtimes_CXX \
+    old_archive_cmds_CXX \
+    old_archive_from_new_cmds_CXX \
+    predep_objects_CXX \
+    postdep_objects_CXX \
+    predeps_CXX \
+    postdeps_CXX \
+    compiler_lib_search_path_CXX \
+    archive_cmds_CXX \
+    archive_expsym_cmds_CXX \
+    postinstall_cmds_CXX \
+    postuninstall_cmds_CXX \
+    old_archive_from_expsyms_cmds_CXX \
+    allow_undefined_flag_CXX \
+    no_undefined_flag_CXX \
+    export_symbols_cmds_CXX \
+    hardcode_libdir_flag_spec_CXX \
+    hardcode_libdir_flag_spec_ld_CXX \
+    hardcode_libdir_separator_CXX \
+    hardcode_automatic_CXX \
+    module_cmds_CXX \
+    module_expsym_cmds_CXX \
+    lt_cv_prog_compiler_c_o_CXX \
+    exclude_expsyms_CXX \
+    include_expsyms_CXX; do
+
+    case $var in
+    old_archive_cmds_CXX | \
+    old_archive_from_new_cmds_CXX | \
+    archive_cmds_CXX | \
+    archive_expsym_cmds_CXX | \
+    module_cmds_CXX | \
+    module_expsym_cmds_CXX | \
+    old_archive_from_expsyms_cmds_CXX | \
+    export_symbols_cmds_CXX | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_CXX
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_CXX
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_CXX
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_CXX
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path_CXX"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+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
+
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+
+       else
+         tagname=""
+       fi
+       ;;
+
+      F77)
+       if test -n "$F77" && test "X$F77" != "Xno"; then
+
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+
+
+archive_cmds_need_lc_F77=no
+allow_undefined_flag_F77=
+always_export_symbols_F77=no
+archive_expsym_cmds_F77=
+export_dynamic_flag_spec_F77=
+hardcode_direct_F77=no
+hardcode_libdir_flag_spec_F77=
+hardcode_libdir_flag_spec_ld_F77=
+hardcode_libdir_separator_F77=
+hardcode_minus_L_F77=no
+hardcode_automatic_F77=no
+module_cmds_F77=
+module_expsym_cmds_F77=
+link_all_deplibs_F77=unknown
+old_archive_cmds_F77=$old_archive_cmds
+no_undefined_flag_F77=
+whole_archive_flag_spec_F77=
+enable_shared_with_static_runtimes_F77=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+objext_F77=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="      subroutine t\n      return\n      end\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="      program t\n      end\n"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+compiler_F77=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+  test "$enable_shared" = yes && enable_static=no
+  if test -n "$RANLIB"; then
+    archive_cmds="$archive_cmds~\$RANLIB \$lib"
+    postinstall_cmds='$RANLIB $lib'
+  fi
+  ;;
+aix4* | aix5*)
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+{ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6; }
+
+GCC_F77="$G77"
+LD_F77="$LD"
+
+lt_prog_compiler_wl_F77=
+lt_prog_compiler_pic_F77=
+lt_prog_compiler_static_F77=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl_F77='-Wl,'
+    lt_prog_compiler_static_F77='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static_F77='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_F77='-fno-common'
+      ;;
+
+    interix3*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared_F77=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       lt_prog_compiler_pic_F77=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic_F77='-fPIC'
+       ;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic_F77='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static_F77='-Bstatic'
+      else
+       lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         lt_prog_compiler_pic_F77='-qnocommon'
+         lt_prog_compiler_wl_F77='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic_F77='+Z'
+       ;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static_F77='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static_F77='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      case $cc_basename in
+      icc* | ecc*)
+       lt_prog_compiler_wl_F77='-Wl,'
+       lt_prog_compiler_pic_F77='-KPIC'
+       lt_prog_compiler_static_F77='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+       # which looks to be a dead project)
+       lt_prog_compiler_wl_F77='-Wl,'
+       lt_prog_compiler_pic_F77='-fpic'
+       lt_prog_compiler_static_F77='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl_F77='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static_F77='-non_shared'
+        ;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static_F77='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+       lt_prog_compiler_wl_F77='-Qoption ld ';;
+      *)
+       lt_prog_compiler_wl_F77='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl_F77='-Qoption ld '
+      lt_prog_compiler_pic_F77='-PIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+       lt_prog_compiler_pic_F77='-Kconform_pic'
+       lt_prog_compiler_static_F77='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_pic_F77='-KPIC'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_can_build_shared_F77=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic_F77='-pic'
+      lt_prog_compiler_static_F77='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared_F77=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_F77"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works_F77=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_F77"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:14016: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:14020: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_prog_compiler_pic_works_F77=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6; }
+
+if test x"$lt_prog_compiler_pic_works_F77" = xyes; then
+    case $lt_prog_compiler_pic_F77 in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;;
+     esac
+else
+    lt_prog_compiler_pic_F77=
+     lt_prog_compiler_can_build_shared_F77=no
+fi
+
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_F77=
+    ;;
+  *)
+    lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_static_works_F77=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_prog_compiler_static_works_F77=yes
+       fi
+     else
+       lt_prog_compiler_static_works_F77=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6; }
+
+if test x"$lt_prog_compiler_static_works_F77" = xyes; then
+    :
+else
+    lt_prog_compiler_static_F77=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_F77=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:14120: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:14124: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_F77=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  runpath_var=
+  allow_undefined_flag_F77=
+  enable_shared_with_static_runtimes_F77=no
+  archive_cmds_F77=
+  archive_expsym_cmds_F77=
+  old_archive_From_new_cmds_F77=
+  old_archive_from_expsyms_cmds_F77=
+  export_dynamic_flag_spec_F77=
+  whole_archive_flag_spec_F77=
+  thread_safe_flag_spec_F77=
+  hardcode_libdir_flag_spec_F77=
+  hardcode_libdir_flag_spec_ld_F77=
+  hardcode_libdir_separator_F77=
+  hardcode_direct_F77=no
+  hardcode_minus_L_F77=no
+  hardcode_shlibpath_var_F77=unsupported
+  link_all_deplibs_F77=unknown
+  hardcode_automatic_F77=no
+  module_cmds_F77=
+  module_expsym_cmds_F77=
+  always_export_symbols_F77=no
+  export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms_F77=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs_F77=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec_F77='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+       whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+       whole_archive_flag_spec_F77=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+       ld_shlibs_F77=no
+       cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_minus_L_F77=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs_F77=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       allow_undefined_flag_F77=unsupported
+       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+       # support --undefined.  This deserves some investigation.  FIXME
+       archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+       ld_shlibs_F77=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      allow_undefined_flag_F77=unsupported
+      always_export_symbols_F77=no
+      enable_shared_with_static_runtimes_F77=yes
+      export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+       # If the export-symbols file already is a .def file (1st line
+       # is EXPORTS), use it as is; otherwise, prepend...
+       archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname.def;
+       else
+         echo EXPORTS > $output_objdir/$soname.def;
+         cat $export_symbols >> $output_objdir/$soname.def;
+       fi~
+       $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+       ld_shlibs_F77=no
+      fi
+      ;;
+
+    interix3*)
+      hardcode_direct_F77=no
+      hardcode_shlibpath_var_F77=no
+      hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec_F77='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       tmp_addflag=
+       case $cc_basename,$host_cpu in
+       pgcc*)                          # Portland Group C compiler
+         whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag'
+         ;;
+       pgf77* | pgf90* | pgf95*)       # Portland Group f77 and f90 compilers
+         whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag -Mnomain' ;;
+       ecc*,ia64* | icc*,ia64*)                # Intel C compiler on ia64
+         tmp_addflag=' -i_dynamic' ;;
+       efc*,ia64* | ifort*,ia64*)      # Intel Fortran compiler on ia64
+         tmp_addflag=' -i_dynamic -nofor_main' ;;
+       ifc* | ifort*)                  # Intel Fortran compiler
+         tmp_addflag=' -nofor_main' ;;
+       esac
+       archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+       if test $supports_anon_versioning = yes; then
+         archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+         $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+       fi
+       link_all_deplibs_F77=no
+      else
+       ld_shlibs_F77=no
+      fi
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+       wlarc=
+      else
+       archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+       ld_shlibs_F77=no
+       cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs_F77=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+       ld_shlibs_F77=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+       ;;
+       *)
+         if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+           hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+           archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+           archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+         else
+           ld_shlibs_F77=no
+         fi
+       ;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs_F77=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs_F77" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec_F77=
+      export_dynamic_flag_spec_F77=
+      whole_archive_flag_spec_F77=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag_F77=unsupported
+      always_export_symbols_F77=yes
+      archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L_F77=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+       # Neither direct hardcoding nor static linking is supported with a
+       # broken collect2.
+       hardcode_direct_F77=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+       # On IA64, the linker does run time linking by default, so we don't
+       # have to do anything special.
+       aix_use_runtimelinking=no
+       exp_sym_flag='-Bexport'
+       no_entry_flag=""
+      else
+       # If we're using GNU nm, then we don't want the "-C" option.
+       # -C means demangle to AIX nm, but means don't demangle with GNU nm
+       if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+         export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+       else
+         export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+       fi
+       aix_use_runtimelinking=no
+
+       # Test if we are trying to use run time linking or normal
+       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+       # need to do runtime linking.
+       case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+         for ld_flag in $LDFLAGS; do
+         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+           aix_use_runtimelinking=yes
+           break
+         fi
+         done
+         ;;
+       esac
+
+       exp_sym_flag='-bexport'
+       no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds_F77=''
+      hardcode_direct_F77=yes
+      hardcode_libdir_separator_F77=':'
+      link_all_deplibs_F77=yes
+
+      if test "$GCC" = yes; then
+       case $host_os in aix4.[012]|aix4.[012].*)
+       # We only want to do this on AIX 4.2 and lower, the check
+       # below for broken collect2 doesn't work under 4.3+
+         collect2name=`${CC} -print-prog-name=collect2`
+         if test -f "$collect2name" && \
+          strings "$collect2name" | grep resolve_lib_name >/dev/null
+         then
+         # We have reworked collect2
+         hardcode_direct_F77=yes
+         else
+         # We have old collect2
+         hardcode_direct_F77=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         hardcode_minus_L_F77=yes
+         hardcode_libdir_flag_spec_F77='-L$libdir'
+         hardcode_libdir_separator_F77=
+         fi
+         ;;
+       esac
+       shared_flag='-shared'
+       if test "$aix_use_runtimelinking" = yes; then
+         shared_flag="$shared_flag "'${wl}-G'
+       fi
+      else
+       # not using gcc
+       if test "$host_cpu" = ia64; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+       else
+         if test "$aix_use_runtimelinking" = yes; then
+           shared_flag='${wl}-G'
+         else
+           shared_flag='${wl}-bM:SRE'
+         fi
+       fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols_F77=yes
+      if test "$aix_use_runtimelinking" = yes; then
+       # Warning - without using the other runtime loading flags (-brtl),
+       # -berok will link without error, but may produce a broken library.
+       allow_undefined_flag_F77='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_f77_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
+       archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+       if test "$host_cpu" = ia64; then
+         hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib'
+         allow_undefined_flag_F77="-z nodefs"
+         archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+       else
+        # Determine the default libpath from the value encoded in an empty executable.
+        cat >conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_f77_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+        hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
+         # Warning - without using the other run time loading flags,
+         # -berok will link without error, but may produce a broken library.
+         no_undefined_flag_F77=' ${wl}-bernotok'
+         allow_undefined_flag_F77=' ${wl}-berok'
+         # Exported symbols can be pulled into shared objects from archives
+         whole_archive_flag_spec_F77='$convenience'
+         archive_cmds_need_lc_F77=yes
+         # This is similar to how AIX traditionally builds its shared libraries.
+         archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+       fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_minus_L_F77=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs_F77=no
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec_F77=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec_F77=' '
+      allow_undefined_flag_F77=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds_F77='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path_F77='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes_F77=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag_F77='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      archive_cmds_need_lc_F77=no
+      hardcode_direct_F77=no
+      hardcode_automatic_F77=yes
+      hardcode_shlibpath_var_F77=unsupported
+      whole_archive_flag_spec_F77=''
+      link_all_deplibs_F77=yes
+    if test "$GCC" = yes ; then
+       output_verbose_link_cmd='echo'
+        archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+         module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs_F77=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs_F77=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_F77=yes
+      hardcode_minus_L_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+       archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+       archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      hardcode_direct_F77=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L_F77=yes
+      export_dynamic_flag_spec_F77='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+       hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+       hardcode_libdir_separator_F77=:
+
+       hardcode_direct_F77=yes
+       export_dynamic_flag_spec_F77='${wl}-E'
+
+       # hardcode_minus_L: Not really in the search PATH,
+       # but as the default location of the library.
+       hardcode_minus_L_F77=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       case $host_cpu in
+       hppa*64*)
+         archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      else
+       case $host_cpu in
+       hppa*64*)
+         archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      fi
+      if test "$with_gnu_ld" = no; then
+       hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
+       hardcode_libdir_separator_F77=:
+
+       case $host_cpu in
+       hppa*64*|ia64*)
+         hardcode_libdir_flag_spec_ld_F77='+b $libdir'
+         hardcode_direct_F77=no
+         hardcode_shlibpath_var_F77=no
+         ;;
+       *)
+         hardcode_direct_F77=yes
+         export_dynamic_flag_spec_F77='${wl}-E'
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         hardcode_minus_L_F77=yes
+         ;;
+       esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+       archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       hardcode_libdir_flag_spec_ld_F77='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      link_all_deplibs_F77=yes
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+       archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    newsos6)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_F77=yes
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    openbsd*)
+      hardcode_direct_F77=yes
+      hardcode_shlibpath_var_F77=no
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+       archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+       hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+       export_dynamic_flag_spec_F77='${wl}-E'
+      else
+       case $host_os in
+        openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+          archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+          hardcode_libdir_flag_spec_F77='-R$libdir'
+          ;;
+        *)
+          archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+          hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
+          ;;
+       esac
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_minus_L_F77=yes
+      allow_undefined_flag_F77=unsupported
+      archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+       allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       allow_undefined_flag_F77=' -expect_unresolved \*'
+       archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_F77=:
+      ;;
+
+    osf4* | osf5*)     # as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+       allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+       hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+      else
+       allow_undefined_flag_F77=' -expect_unresolved \*'
+       archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+       $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+       # Both c and cxx compiler support -rpath directly
+       hardcode_libdir_flag_spec_F77='-rpath $libdir'
+      fi
+      hardcode_libdir_separator_F77=:
+      ;;
+
+    solaris*)
+      no_undefined_flag_F77=' -z text'
+      if test "$GCC" = yes; then
+       wlarc='${wl}'
+       archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+         $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+       wlarc=''
+       archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+       $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec_F77='-R$libdir'
+      hardcode_shlibpath_var_F77=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+       # The compiler driver will combine linker options so we
+       # cannot just pass the convience library names through
+       # without $wl, iff we do not link with $LD.
+       # Luckily, gcc supports the same syntax we need for Sun Studio.
+       # Supported since Solaris 2.6 (maybe 2.5.1?)
+       case $wlarc in
+       '')
+         whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;;
+       *)
+         whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+       esac ;;
+      esac
+      link_all_deplibs_F77=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+       # Use $CC to link under sequent, because it throws in some extra .o
+       # files that make .init and .fini sections work.
+       archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_direct_F77=yes
+      hardcode_minus_L_F77=yes
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+       sni)
+         archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct_F77=yes # is this really true???
+       ;;
+       siemens)
+         ## LD is ld it makes a PLAMLIB
+         ## CC just makes a GrossModule.
+         archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+         reload_cmds_F77='$CC -r -o $output$reload_objs'
+         hardcode_direct_F77=no
+        ;;
+       motorola)
+         archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie
+       ;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var_F77=no
+      export_dynamic_flag_spec_F77='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       hardcode_shlibpath_var_F77=no
+       runpath_var=LD_RUN_PATH
+       hardcode_runpath_var=yes
+       ld_shlibs_F77=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
+      no_undefined_flag_F77='${wl}-z,text'
+      archive_cmds_need_lc_F77=no
+      hardcode_shlibpath_var_F77=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag_F77='${wl}-z,text'
+      allow_undefined_flag_F77='${wl}-z,nodefs'
+      archive_cmds_need_lc_F77=no
+      hardcode_shlibpath_var_F77=no
+      hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      hardcode_libdir_separator_F77=':'
+      link_all_deplibs_F77=yes
+      export_dynamic_flag_spec_F77='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_F77='-L$libdir'
+      hardcode_shlibpath_var_F77=no
+      ;;
+
+    *)
+      ld_shlibs_F77=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5
+echo "${ECHO_T}$ld_shlibs_F77" >&6; }
+test "$ld_shlibs_F77" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_F77" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_F77=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_F77 in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      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); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_F77
+       pic_flag=$lt_prog_compiler_pic_F77
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_F77
+        allow_undefined_flag_F77=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+         archive_cmds_need_lc_F77=no
+        else
+         archive_cmds_need_lc_F77=yes
+        fi
+        allow_undefined_flag_F77=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  freebsd*) # from 4.6 on
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix3*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test "$lt_cv_prog_gnu_ld" = yes; then
+               version_type=linux
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,       ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+       shlibpath_overrides_runpath=no
+       ;;
+      *)
+       shlibpath_overrides_runpath=yes
+       ;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+       ;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_F77=
+if test -n "$hardcode_libdir_flag_spec_F77" || \
+   test -n "$runpath_var_F77" || \
+   test "X$hardcode_automatic_F77" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_F77" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no &&
+     test "$hardcode_minus_L_F77" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_F77=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_F77=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_F77=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5
+echo "${ECHO_T}$hardcode_action_F77" >&6; }
+
+if test "$hardcode_action_F77" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_F77 \
+    CC_F77 \
+    LD_F77 \
+    lt_prog_compiler_wl_F77 \
+    lt_prog_compiler_pic_F77 \
+    lt_prog_compiler_static_F77 \
+    lt_prog_compiler_no_builtin_flag_F77 \
+    export_dynamic_flag_spec_F77 \
+    thread_safe_flag_spec_F77 \
+    whole_archive_flag_spec_F77 \
+    enable_shared_with_static_runtimes_F77 \
+    old_archive_cmds_F77 \
+    old_archive_from_new_cmds_F77 \
+    predep_objects_F77 \
+    postdep_objects_F77 \
+    predeps_F77 \
+    postdeps_F77 \
+    compiler_lib_search_path_F77 \
+    archive_cmds_F77 \
+    archive_expsym_cmds_F77 \
+    postinstall_cmds_F77 \
+    postuninstall_cmds_F77 \
+    old_archive_from_expsyms_cmds_F77 \
+    allow_undefined_flag_F77 \
+    no_undefined_flag_F77 \
+    export_symbols_cmds_F77 \
+    hardcode_libdir_flag_spec_F77 \
+    hardcode_libdir_flag_spec_ld_F77 \
+    hardcode_libdir_separator_F77 \
+    hardcode_automatic_F77 \
+    module_cmds_F77 \
+    module_expsym_cmds_F77 \
+    lt_cv_prog_compiler_c_o_F77 \
+    exclude_expsyms_F77 \
+    include_expsyms_F77; do
+
+    case $var in
+    old_archive_cmds_F77 | \
+    old_archive_from_new_cmds_F77 | \
+    archive_cmds_F77 | \
+    archive_expsym_cmds_F77 | \
+    module_cmds_F77 | \
+    module_expsym_cmds_F77 | \
+    old_archive_from_expsyms_cmds_F77 | \
+    export_symbols_cmds_F77 | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_F77
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_F77
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_F77
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_F77
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_F77
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_F77
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_F77
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_F77
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_F77
+archive_expsym_cmds=$lt_archive_expsym_cmds_F77
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_F77
+module_expsym_cmds=$lt_module_expsym_cmds_F77
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_F77
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_F77
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_F77
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_F77
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_F77
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_F77
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_F77
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_F77
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_F77
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_F77
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_F77
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_F77
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_F77
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path_F77"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_F77
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_F77
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_F77
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_F77
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+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
+
+CC="$lt_save_CC"
+
+       else
+         tagname=""
+       fi
+       ;;
+
+      GCJ)
+       if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+objext_GCJ=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}\n"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+compiler_GCJ=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+archive_cmds_need_lc_GCJ=no
+
+old_archive_cmds_GCJ=$old_archive_cmds
+
+
+lt_prog_compiler_no_builtin_flag_GCJ=
+
+if test "$GCC" = yes; then
+  lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin'
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:16307: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:16311: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+lt_prog_compiler_wl_GCJ=
+lt_prog_compiler_pic_GCJ=
+lt_prog_compiler_static_GCJ=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl_GCJ='-Wl,'
+    lt_prog_compiler_static_GCJ='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static_GCJ='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      # FIXME: we need at least 68020 code to build shared libraries, but
+      # adding the `-m68020' flag to GCC prevents building anything better,
+      # like `-m68040'.
+      lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4'
+      ;;
+
+    beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_GCJ='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_GCJ='-fno-common'
+      ;;
+
+    interix3*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared_GCJ=no
+      enable_shared=no
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       lt_prog_compiler_pic_GCJ=-Kconform_pic
+      fi
+      ;;
+
+    hpux*)
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic_GCJ='-fPIC'
+       ;;
+      esac
+      ;;
+
+    *)
+      lt_prog_compiler_pic_GCJ='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static_GCJ='-Bstatic'
+      else
+       lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         lt_prog_compiler_pic_GCJ='-qnocommon'
+         lt_prog_compiler_wl_GCJ='-Wl,'
+         ;;
+       esac
+       ;;
+
+    mingw* | pw32* | os2*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic_GCJ='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic_GCJ='+Z'
+       ;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static_GCJ='-non_shared'
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      case $cc_basename in
+      icc* | ecc*)
+       lt_prog_compiler_wl_GCJ='-Wl,'
+       lt_prog_compiler_pic_GCJ='-KPIC'
+       lt_prog_compiler_static_GCJ='-static'
+        ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+       # which looks to be a dead project)
+       lt_prog_compiler_wl_GCJ='-Wl,'
+       lt_prog_compiler_pic_GCJ='-fpic'
+       lt_prog_compiler_static_GCJ='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl_GCJ='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static_GCJ='-non_shared'
+        ;;
+      esac
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static_GCJ='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+       lt_prog_compiler_wl_GCJ='-Qoption ld ';;
+      *)
+       lt_prog_compiler_wl_GCJ='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl_GCJ='-Qoption ld '
+      lt_prog_compiler_pic_GCJ='-PIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+       lt_prog_compiler_pic_GCJ='-Kconform_pic'
+       lt_prog_compiler_static_GCJ='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_pic_GCJ='-KPIC'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_can_build_shared_GCJ=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic_GCJ='-pic'
+      lt_prog_compiler_static_GCJ='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared_GCJ=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_GCJ"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_pic_works_GCJ=no
+  ac_outfile=conftest.$ac_objext
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_GCJ"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:16575: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:16579: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_prog_compiler_pic_works_GCJ=yes
+     fi
+   fi
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6; }
+
+if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then
+    case $lt_prog_compiler_pic_GCJ in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;;
+     esac
+else
+    lt_prog_compiler_pic_GCJ=
+     lt_prog_compiler_can_build_shared_GCJ=no
+fi
+
+fi
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_GCJ=
+    ;;
+  *)
+    lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ"
+    ;;
+esac
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works_GCJ+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_prog_compiler_static_works_GCJ=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   printf "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_prog_compiler_static_works_GCJ=yes
+       fi
+     else
+       lt_prog_compiler_static_works_GCJ=yes
+     fi
+   fi
+   $rm conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6; }
+
+if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then
+    :
+else
+    lt_prog_compiler_static_GCJ=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  lt_cv_prog_compiler_c_o_GCJ=no
+   $rm -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:16679: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:16683: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_GCJ=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $rm conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+   $rm out/* && rmdir out
+   cd ..
+   rmdir conftest
+   $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  hard_links=yes
+  $rm conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+  runpath_var=
+  allow_undefined_flag_GCJ=
+  enable_shared_with_static_runtimes_GCJ=no
+  archive_cmds_GCJ=
+  archive_expsym_cmds_GCJ=
+  old_archive_From_new_cmds_GCJ=
+  old_archive_from_expsyms_cmds_GCJ=
+  export_dynamic_flag_spec_GCJ=
+  whole_archive_flag_spec_GCJ=
+  thread_safe_flag_spec_GCJ=
+  hardcode_libdir_flag_spec_GCJ=
+  hardcode_libdir_flag_spec_ld_GCJ=
+  hardcode_libdir_separator_GCJ=
+  hardcode_direct_GCJ=no
+  hardcode_minus_L_GCJ=no
+  hardcode_shlibpath_var_GCJ=unsupported
+  link_all_deplibs_GCJ=unknown
+  hardcode_automatic_GCJ=no
+  module_cmds_GCJ=
+  module_expsym_cmds_GCJ=
+  always_export_symbols_GCJ=no
+  export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms_GCJ=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_"
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+  case $host_os in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
+
+  ld_shlibs_GCJ=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec_GCJ='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+       whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+       whole_archive_flag_spec_GCJ=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+       ld_shlibs_GCJ=no
+       cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we can't use
+      # them.
+      ld_shlibs_GCJ=no
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       allow_undefined_flag_GCJ=unsupported
+       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+       # support --undefined.  This deserves some investigation.  FIXME
+       archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+       ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      allow_undefined_flag_GCJ=unsupported
+      always_export_symbols_GCJ=no
+      enable_shared_with_static_runtimes_GCJ=yes
+      export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+       # If the export-symbols file already is a .def file (1st line
+       # is EXPORTS), use it as is; otherwise, prepend...
+       archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname.def;
+       else
+         echo EXPORTS > $output_objdir/$soname.def;
+         cat $export_symbols >> $output_objdir/$soname.def;
+       fi~
+       $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+       ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    interix3*)
+      hardcode_direct_GCJ=no
+      hardcode_shlibpath_var_GCJ=no
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec_GCJ='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    linux* | k*bsd*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       tmp_addflag=
+       case $cc_basename,$host_cpu in
+       pgcc*)                          # Portland Group C compiler
+         whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag'
+         ;;
+       pgf77* | pgf90* | pgf95*)       # Portland Group f77 and f90 compilers
+         whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag -Mnomain' ;;
+       ecc*,ia64* | icc*,ia64*)                # Intel C compiler on ia64
+         tmp_addflag=' -i_dynamic' ;;
+       efc*,ia64* | ifort*,ia64*)      # Intel Fortran compiler on ia64
+         tmp_addflag=' -i_dynamic -nofor_main' ;;
+       ifc* | ifort*)                  # Intel Fortran compiler
+         tmp_addflag=' -nofor_main' ;;
+       esac
+       archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+       if test $supports_anon_versioning = yes; then
+         archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+         $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+       fi
+       link_all_deplibs_GCJ=no
+      else
+       ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+       wlarc=
+      else
+       archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+       ld_shlibs_GCJ=no
+       cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs_GCJ=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+       ld_shlibs_GCJ=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+       ;;
+       *)
+         if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+           hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+           archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+           archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+         else
+           ld_shlibs_GCJ=no
+         fi
+       ;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+       archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs_GCJ=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs_GCJ" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec_GCJ=
+      export_dynamic_flag_spec_GCJ=
+      whole_archive_flag_spec_GCJ=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag_GCJ=unsupported
+      always_export_symbols_GCJ=yes
+      archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L_GCJ=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+       # Neither direct hardcoding nor static linking is supported with a
+       # broken collect2.
+       hardcode_direct_GCJ=unsupported
+      fi
+      ;;
+
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+       # On IA64, the linker does run time linking by default, so we don't
+       # have to do anything special.
+       aix_use_runtimelinking=no
+       exp_sym_flag='-Bexport'
+       no_entry_flag=""
+      else
+       # If we're using GNU nm, then we don't want the "-C" option.
+       # -C means demangle to AIX nm, but means don't demangle with GNU nm
+       if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+         export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+       else
+         export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+       fi
+       aix_use_runtimelinking=no
+
+       # Test if we are trying to use run time linking or normal
+       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+       # need to do runtime linking.
+       case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+         for ld_flag in $LDFLAGS; do
+         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+           aix_use_runtimelinking=yes
+           break
+         fi
+         done
+         ;;
+       esac
+
+       exp_sym_flag='-bexport'
+       no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds_GCJ=''
+      hardcode_direct_GCJ=yes
+      hardcode_libdir_separator_GCJ=':'
+      link_all_deplibs_GCJ=yes
+
+      if test "$GCC" = yes; then
+       case $host_os in aix4.[012]|aix4.[012].*)
+       # We only want to do this on AIX 4.2 and lower, the check
+       # below for broken collect2 doesn't work under 4.3+
+         collect2name=`${CC} -print-prog-name=collect2`
+         if test -f "$collect2name" && \
+          strings "$collect2name" | grep resolve_lib_name >/dev/null
+         then
+         # We have reworked collect2
+         hardcode_direct_GCJ=yes
+         else
+         # We have old collect2
+         hardcode_direct_GCJ=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         hardcode_minus_L_GCJ=yes
+         hardcode_libdir_flag_spec_GCJ='-L$libdir'
+         hardcode_libdir_separator_GCJ=
+         fi
+         ;;
+       esac
+       shared_flag='-shared'
+       if test "$aix_use_runtimelinking" = yes; then
+         shared_flag="$shared_flag "'${wl}-G'
+       fi
+      else
+       # not using gcc
+       if test "$host_cpu" = ia64; then
+       # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+       # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+       else
+         if test "$aix_use_runtimelinking" = yes; then
+           shared_flag='${wl}-G'
+         else
+           shared_flag='${wl}-bM:SRE'
+         fi
+       fi
+      fi
+
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols_GCJ=yes
+      if test "$aix_use_runtimelinking" = yes; then
+       # Warning - without using the other runtime loading flags (-brtl),
+       # -berok will link without error, but may produce a broken library.
+       allow_undefined_flag_GCJ='-berok'
+       # Determine the default libpath from the value encoded in an empty executable.
+       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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+       hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
+       archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+       else
+       if test "$host_cpu" = ia64; then
+         hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib'
+         allow_undefined_flag_GCJ="-z nodefs"
+         archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+       else
+        # Determine the default libpath from the value encoded in an empty executable.
+        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 conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`; fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+        hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
+         # Warning - without using the other run time loading flags,
+         # -berok will link without error, but may produce a broken library.
+         no_undefined_flag_GCJ=' ${wl}-bernotok'
+         allow_undefined_flag_GCJ=' ${wl}-berok'
+         # Exported symbols can be pulled into shared objects from archives
+         whole_archive_flag_spec_GCJ='$convenience'
+         archive_cmds_need_lc_GCJ=yes
+         # This is similar to how AIX traditionally builds its shared libraries.
+         archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+       fi
+      fi
+      ;;
+
+    amigaos*)
+      archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs_GCJ=no
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec_GCJ=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec_GCJ=' '
+      allow_undefined_flag_GCJ=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_From_new_cmds_GCJ='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes_GCJ=yes
+      ;;
+
+    darwin* | rhapsody*)
+      case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+      esac
+      archive_cmds_need_lc_GCJ=no
+      hardcode_direct_GCJ=no
+      hardcode_automatic_GCJ=yes
+      hardcode_shlibpath_var_GCJ=unsupported
+      whole_archive_flag_spec_GCJ=''
+      link_all_deplibs_GCJ=yes
+    if test "$GCC" = yes ; then
+       output_verbose_link_cmd='echo'
+        archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+         module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs_GCJ=no
+          ;;
+      esac
+    fi
+      ;;
+
+    dgux*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs_GCJ=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_GCJ=yes
+      hardcode_minus_L_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+       archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+       archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      hardcode_direct_GCJ=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L_GCJ=yes
+      export_dynamic_flag_spec_GCJ='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+       hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+       hardcode_libdir_separator_GCJ=:
+
+       hardcode_direct_GCJ=yes
+       export_dynamic_flag_spec_GCJ='${wl}-E'
+
+       # hardcode_minus_L: Not really in the search PATH,
+       # but as the default location of the library.
+       hardcode_minus_L_GCJ=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       case $host_cpu in
+       hppa*64*)
+         archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      else
+       case $host_cpu in
+       hppa*64*)
+         archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      fi
+      if test "$with_gnu_ld" = no; then
+       hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
+       hardcode_libdir_separator_GCJ=:
+
+       case $host_cpu in
+       hppa*64*|ia64*)
+         hardcode_libdir_flag_spec_ld_GCJ='+b $libdir'
+         hardcode_direct_GCJ=no
+         hardcode_shlibpath_var_GCJ=no
+         ;;
+       *)
+         hardcode_direct_GCJ=yes
+         export_dynamic_flag_spec_GCJ='${wl}-E'
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         hardcode_minus_L_GCJ=yes
+         ;;
+       esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+       archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      link_all_deplibs_GCJ=yes
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+       archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+       archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    newsos6)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct_GCJ=yes
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    openbsd*)
+      hardcode_direct_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+       archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+       hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+       export_dynamic_flag_spec_GCJ='${wl}-E'
+      else
+       case $host_os in
+        openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+          archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+          hardcode_libdir_flag_spec_GCJ='-R$libdir'
+          ;;
+        *)
+          archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+          hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+          ;;
+       esac
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_minus_L_GCJ=yes
+      allow_undefined_flag_GCJ=unsupported
+      archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+       allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       allow_undefined_flag_GCJ=' -expect_unresolved \*'
+       archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator_GCJ=:
+      ;;
+
+    osf4* | osf5*)     # as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+       allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+       hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+      else
+       allow_undefined_flag_GCJ=' -expect_unresolved \*'
+       archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+       archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+       $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+
+       # Both c and cxx compiler support -rpath directly
+       hardcode_libdir_flag_spec_GCJ='-rpath $libdir'
+      fi
+      hardcode_libdir_separator_GCJ=:
+      ;;
+
+    solaris*)
+      no_undefined_flag_GCJ=' -z text'
+      if test "$GCC" = yes; then
+       wlarc='${wl}'
+       archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+         $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+      else
+       wlarc=''
+       archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+       $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+      fi
+      hardcode_libdir_flag_spec_GCJ='-R$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+       # The compiler driver will combine linker options so we
+       # cannot just pass the convience library names through
+       # without $wl, iff we do not link with $LD.
+       # Luckily, gcc supports the same syntax we need for Sun Studio.
+       # Supported since Solaris 2.6 (maybe 2.5.1?)
+       case $wlarc in
+       '')
+         whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;;
+       *)
+         whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+       esac ;;
+      esac
+      link_all_deplibs_GCJ=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+       # Use $CC to link under sequent, because it throws in some extra .o
+       # files that make .init and .fini sections work.
+       archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_direct_GCJ=yes
+      hardcode_minus_L_GCJ=yes
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+       sni)
+         archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct_GCJ=yes # is this really true???
+       ;;
+       siemens)
+         ## LD is ld it makes a PLAMLIB
+         ## CC just makes a GrossModule.
+         archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+         reload_cmds_GCJ='$CC -r -o $output$reload_objs'
+         hardcode_direct_GCJ=no
+        ;;
+       motorola)
+         archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie
+       ;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var_GCJ=no
+      export_dynamic_flag_spec_GCJ='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       hardcode_shlibpath_var_GCJ=no
+       runpath_var=LD_RUN_PATH
+       hardcode_runpath_var=yes
+       ld_shlibs_GCJ=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
+      no_undefined_flag_GCJ='${wl}-z,text'
+      archive_cmds_need_lc_GCJ=no
+      hardcode_shlibpath_var_GCJ=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag_GCJ='${wl}-z,text'
+      allow_undefined_flag_GCJ='${wl}-z,nodefs'
+      archive_cmds_need_lc_GCJ=no
+      hardcode_shlibpath_var_GCJ=no
+      hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      hardcode_libdir_separator_GCJ=':'
+      link_all_deplibs_GCJ=yes
+      export_dynamic_flag_spec_GCJ='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec_GCJ='-L$libdir'
+      hardcode_shlibpath_var_GCJ=no
+      ;;
+
+    *)
+      ld_shlibs_GCJ=no
+      ;;
+    esac
+  fi
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5
+echo "${ECHO_T}$ld_shlibs_GCJ" >&6; }
+test "$ld_shlibs_GCJ" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_GCJ" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_GCJ=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_GCJ in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      $rm conftest*
+      printf "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      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); } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_GCJ
+       pic_flag=$lt_prog_compiler_pic_GCJ
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ
+        allow_undefined_flag_GCJ=
+        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+  (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+        then
+         archive_cmds_need_lc_GCJ=no
+        else
+         archive_cmds_need_lc_GCJ=yes
+        fi
+        allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $rm conftest*
+      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+if test "$GCC" = yes; then
+  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix4* | aix5*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  library_names_spec='$libname.ixlibrary $libname.a'
+  # Create ${libname}_ixlibrary.a entries in /sys/libs.
+  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $rm \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+  # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
+  if test "$GCC" = yes; then
+    sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
+  else
+    sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
+  fi
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  freebsd*) # from 4.6 on
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+   hppa*64*)
+     shrext_cmds='.sl'
+     hardcode_into_libs=yes
+     dynamic_linker="$host_os dld.sl"
+     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+     soname_spec='${libname}${release}${shared_ext}$major'
+     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+     ;;
+   *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix3*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test "$lt_cv_prog_gnu_ld" = yes; then
+               version_type=linux
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,       ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+nto-qnx*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+       shlibpath_overrides_runpath=no
+       ;;
+      *)
+       shlibpath_overrides_runpath=yes
+       ;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      export_dynamic_flag_spec='${wl}-Blargedynsym'
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+    shlibpath_overrides_runpath=no
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    shlibpath_overrides_runpath=yes
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+       ;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_GCJ=
+if test -n "$hardcode_libdir_flag_spec_GCJ" || \
+   test -n "$runpath_var_GCJ" || \
+   test "X$hardcode_automatic_GCJ" = "Xyes" ; then
+
+  # We can hardcode non-existant directories.
+  if test "$hardcode_direct_GCJ" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no &&
+     test "$hardcode_minus_L_GCJ" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_GCJ=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_GCJ=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_GCJ=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5
+echo "${ECHO_T}$hardcode_action_GCJ" >&6; }
+
+if test "$hardcode_action_GCJ" = relink; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_GCJ \
+    CC_GCJ \
+    LD_GCJ \
+    lt_prog_compiler_wl_GCJ \
+    lt_prog_compiler_pic_GCJ \
+    lt_prog_compiler_static_GCJ \
+    lt_prog_compiler_no_builtin_flag_GCJ \
+    export_dynamic_flag_spec_GCJ \
+    thread_safe_flag_spec_GCJ \
+    whole_archive_flag_spec_GCJ \
+    enable_shared_with_static_runtimes_GCJ \
+    old_archive_cmds_GCJ \
+    old_archive_from_new_cmds_GCJ \
+    predep_objects_GCJ \
+    postdep_objects_GCJ \
+    predeps_GCJ \
+    postdeps_GCJ \
+    compiler_lib_search_path_GCJ \
+    archive_cmds_GCJ \
+    archive_expsym_cmds_GCJ \
+    postinstall_cmds_GCJ \
+    postuninstall_cmds_GCJ \
+    old_archive_from_expsyms_cmds_GCJ \
+    allow_undefined_flag_GCJ \
+    no_undefined_flag_GCJ \
+    export_symbols_cmds_GCJ \
+    hardcode_libdir_flag_spec_GCJ \
+    hardcode_libdir_flag_spec_ld_GCJ \
+    hardcode_libdir_separator_GCJ \
+    hardcode_automatic_GCJ \
+    module_cmds_GCJ \
+    module_expsym_cmds_GCJ \
+    lt_cv_prog_compiler_c_o_GCJ \
+    exclude_expsyms_GCJ \
+    include_expsyms_GCJ; do
+
+    case $var in
+    old_archive_cmds_GCJ | \
+    old_archive_from_new_cmds_GCJ | \
+    archive_cmds_GCJ | \
+    archive_expsym_cmds_GCJ | \
+    module_cmds_GCJ | \
+    module_expsym_cmds_GCJ | \
+    old_archive_from_expsyms_cmds_GCJ | \
+    export_symbols_cmds_GCJ | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_GCJ
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_GCJ
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_GCJ
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_GCJ
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_GCJ
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_GCJ
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_GCJ
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_GCJ
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_GCJ
+archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_GCJ
+module_expsym_cmds=$lt_module_expsym_cmds_GCJ
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_GCJ
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_GCJ
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_GCJ
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_GCJ
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_GCJ
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_GCJ
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_GCJ
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_GCJ
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_GCJ
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path_GCJ"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_GCJ
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_GCJ
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_GCJ
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_GCJ
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+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
+
+CC="$lt_save_CC"
+
+       else
+         tagname=""
+       fi
+       ;;
+
+      RC)
+
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+objext_RC=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+compiler_RC=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+lt_cv_prog_compiler_c_o_RC=yes
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+  # See if we are running on zsh, and set the options which allow our commands through
+  # without removal of \ escapes.
+  if test -n "${ZSH_VERSION+set}" ; then
+    setopt NO_GLOB_SUBST
+  fi
+  # Now quote all the things that may contain metacharacters while being
+  # careful not to overquote the AC_SUBSTed values.  We take copies of the
+  # variables and quote the copies for generation of the libtool script.
+  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+    SED SHELL STRIP \
+    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+    deplibs_check_method reload_flag reload_cmds need_locks \
+    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+    lt_cv_sys_global_symbol_to_c_name_address \
+    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+    old_postinstall_cmds old_postuninstall_cmds \
+    compiler_RC \
+    CC_RC \
+    LD_RC \
+    lt_prog_compiler_wl_RC \
+    lt_prog_compiler_pic_RC \
+    lt_prog_compiler_static_RC \
+    lt_prog_compiler_no_builtin_flag_RC \
+    export_dynamic_flag_spec_RC \
+    thread_safe_flag_spec_RC \
+    whole_archive_flag_spec_RC \
+    enable_shared_with_static_runtimes_RC \
+    old_archive_cmds_RC \
+    old_archive_from_new_cmds_RC \
+    predep_objects_RC \
+    postdep_objects_RC \
+    predeps_RC \
+    postdeps_RC \
+    compiler_lib_search_path_RC \
+    archive_cmds_RC \
+    archive_expsym_cmds_RC \
+    postinstall_cmds_RC \
+    postuninstall_cmds_RC \
+    old_archive_from_expsyms_cmds_RC \
+    allow_undefined_flag_RC \
+    no_undefined_flag_RC \
+    export_symbols_cmds_RC \
+    hardcode_libdir_flag_spec_RC \
+    hardcode_libdir_flag_spec_ld_RC \
+    hardcode_libdir_separator_RC \
+    hardcode_automatic_RC \
+    module_cmds_RC \
+    module_expsym_cmds_RC \
+    lt_cv_prog_compiler_c_o_RC \
+    exclude_expsyms_RC \
+    include_expsyms_RC; do
+
+    case $var in
+    old_archive_cmds_RC | \
+    old_archive_from_new_cmds_RC | \
+    archive_cmds_RC | \
+    archive_expsym_cmds_RC | \
+    module_cmds_RC | \
+    module_expsym_cmds_RC | \
+    old_archive_from_expsyms_cmds_RC | \
+    export_symbols_cmds_RC | \
+    extract_expsyms_cmds | reload_cmds | finish_cmds | \
+    postinstall_cmds | postuninstall_cmds | \
+    old_postinstall_cmds | old_postuninstall_cmds | \
+    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+      # Double-quote double-evaled strings.
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+      ;;
+    *)
+      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      ;;
+    esac
+  done
+
+  case $lt_echo in
+  *'\$0 --fallback-echo"')
+    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  esac
+
+cfgfile="$ofile"
+
+  cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_RC
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_RC
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_RC
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_RC
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_RC
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_RC
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_RC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_RC
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_RC
+archive_expsym_cmds=$lt_archive_expsym_cmds_RC
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_RC
+module_expsym_cmds=$lt_module_expsym_cmds_RC
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_RC
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_RC
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_RC
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_RC
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_RC
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_RC
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_RC
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_RC
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_RC
+
+# Set to yes if building a shared library automatically hardcodes DIR into the library
+# and all subsequent libraries and executables linked against it.
+hardcode_automatic=$hardcode_automatic_RC
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_RC
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path_RC"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_RC
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_RC
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_RC
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_RC
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+  # If there is no Makefile yet, we rely on a make rule to execute
+  # `config.status --recheck' to rerun these tests and create the
+  # libtool script then.
+  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+  if test -f "$ltmain_in"; then
+    test -f Makefile && make "$ltmain"
+  fi
+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
+
+CC="$lt_save_CC"
+
+       ;;
+
+      *)
+       { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5
+echo "$as_me: error: Unsupported tag name: $tagname" >&2;}
+   { (exit 1); exit 1; }; }
+       ;;
+      esac
+
+      # Append the new tag name to the list of available tags.
+      if test -n "$tagname" ; then
+      available_tags="$available_tags $tagname"
+    fi
+    fi
+  done
+  IFS="$lt_save_ifs"
+
+  # Now substitute the updated list of available tags.
+  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+    mv "${ofile}T" "$ofile"
+    chmod +x "$ofile"
+  else
+    rm -f "${ofile}T"
+    { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5
+echo "$as_me: error: unable to update list of available tagged configurations." >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+fi
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Prevent multiple expansion
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test "$GCC" = "yes"; then
+  for flag in -fno-strict-aliasing -Wall -std=gnu99 -pedantic -Wshadow -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -W; do
+    oCFLAGS=$CFLAGS
+    CFLAGS="$CFLAGS $flag"
+    cachename=rd_cv_gcc_flag_`echo $flag|sed 's/[^A-Za-z]/_/g'`
+    { echo "$as_me:$LINENO: checking if gcc likes the $flag flag" >&5
+echo $ECHO_N "checking if gcc likes the $flag flag... $ECHO_C" >&6; }
+if { as_var=$cachename; eval "test \"\${$as_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.  */
+
+int
+main ()
+{
+return 0
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  eval $cachename=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       eval $cachename=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$cachename'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+    if eval test \$$cachename = no; then
+         CFLAGS=$oCFLAGS
+    fi
+  done
+fi
+
+
+
+
+
+
+case $TERM in
+       #   for the most important terminal types we directly know the sequences
+       xterm|xterm*|vt220|vt220*)
+               T_MD=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </dev/null 2>/dev/null`
+               T_ME=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/null 2>/dev/null`
+       ;;
+       vt100|vt100*|cygwin)
+               T_MD=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' </dev/null 2>/dev/null`
+               T_ME=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' </dev/null 2>/dev/null`
+       ;;
+       *)
+               T_MD=''
+               T_ME=''
+       ;;
+esac
+  { echo "$as_me:$LINENO: result: " >&5
+echo "${ECHO_T}" >&6; }
+  { echo "$as_me:$LINENO: result: ${T_MD}Checking for Header Files${T_ME}" >&5
+echo "${ECHO_T}${T_MD}Checking for Header Files${T_ME}" >&6; }
+
+
+{ 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 { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; 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 core 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>
+#include <stdlib.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))
+      return 2;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 core.conftest.* 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
+
+
+
+
+
+
+ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
+  as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
+echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_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.  */
+#include <sys/types.h>
+#include <$ac_hdr>
+
+int
+main ()
+{
+if ((DIR *) 0)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; 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 core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
+_ACEOF
+
+ac_header_dirent=$ac_hdr; break
+fi
+
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+  { echo "$as_me:$LINENO: checking for library containing opendir" >&5
+echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; }
+if test "${ac_cv_search_opendir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
+int
+main ()
+{
+return opendir ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' dir; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_search_opendir=$ac_res
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext
+  if test "${ac_cv_search_opendir+set}" = set; then
+  break
+fi
+done
+if test "${ac_cv_search_opendir+set}" = set; then
+  :
+else
+  ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+echo "${ECHO_T}$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+else
+  { echo "$as_me:$LINENO: checking for library containing opendir" >&5
+echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; }
+if test "${ac_cv_search_opendir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
+int
+main ()
+{
+return opendir ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' x; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_search_opendir=$ac_res
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext
+  if test "${ac_cv_search_opendir+set}" = set; then
+  break
+fi
+done
+if test "${ac_cv_search_opendir+set}" = set; then
+  :
+else
+  ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+echo "${ECHO_T}$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+for ac_header in sys/stat.h sys/types.h fcntl.h locale.h fp_class.h malloc.h unistd.h ieeefp.h math.h sys/times.h sys/param.h sys/resource.h float.h strings.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&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 { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; 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 core 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 { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.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;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&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
+
+
+{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; }
+if test "${ac_cv_c_const+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 ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+  /* Ultrix mips cc rejects this.  */
+  typedef int charset[2];
+  const charset cs;
+  /* SunOS 4.1.1 cc rejects this.  */
+  char const *const *pcpcc;
+  char **ppc;
+  /* NEC SVR4.0.2 mips cc rejects this.  */
+  struct point {int x, y;};
+  static struct point const zero = {0,0};
+  /* AIX XL C 1.02.0.0 rejects this.
+     It does not let you subtract one const X* pointer from another in
+     an arm of an if-expression whose if-part is not a constant
+     expression */
+  const char *g = "string";
+  pcpcc = &g + (g ? g-g : 0);
+  /* HPUX 7.0 cc rejects these. */
+  ++pcpcc;
+  ppc = (char**) pcpcc;
+  pcpcc = (char const *const *) ppc;
+  { /* SCO 3.2v4 cc rejects this.  */
+    char *t;
+    char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+    *t++ = 0;
+    if (s) return 0;
+  }
+  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+    int x[] = {25, 17};
+    const int *foo = &x[0];
+    ++foo;
+  }
+  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+    typedef const int *iptr;
+    iptr p = 0;
+    ++p;
+  }
+  { /* AIX XL C 1.02.0.0 rejects this saying
+       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+    struct s { int j; const int *ap[3]; };
+    struct s *b; b->j = 5;
+  }
+  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+    const int foo = 10;
+    if (!foo) return 0;
+  }
+  return !cs[0] && !zero.x;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_c_const=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_c_const=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; }
+if test "${ac_cv_header_time+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 <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_header_time=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_header_time=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6; }
+if test $ac_cv_header_time = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TIME_WITH_SYS_TIME 1
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5
+echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6; }
+if test "${ac_cv_struct_tm+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 <sys/types.h>
+#include <time.h>
+
+int
+main ()
+{
+struct tm tm;
+                                    int *p = &tm.tm_sec;
+                                    return !p;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_struct_tm=time.h
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_struct_tm=sys/time.h
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5
+echo "${ECHO_T}$ac_cv_struct_tm" >&6; }
+if test $ac_cv_struct_tm = sys/time.h; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TM_IN_SYS_TIME 1
+_ACEOF
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking for acos" >&5
+echo $ECHO_N "checking for acos... $ECHO_C" >&6; }
+if test "${ac_cv_func_acos+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 acos to an innocuous variant, in case <limits.h> declares acos.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define acos innocuous_acos
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char acos (); 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 acos
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char acos ();
+/* 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_acos || defined __stub___acos
+choke me
+#endif
+
+int
+main ()
+{
+return acos ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func_acos=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_func_acos=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_acos" >&5
+echo "${ECHO_T}$ac_cv_func_acos" >&6; }
+if test $ac_cv_func_acos = yes; then
+  :
+else
+
+{ echo "$as_me:$LINENO: checking for acos in -lm" >&5
+echo $ECHO_N "checking for acos in -lm... $ECHO_C" >&6; }
+if test "${ac_cv_lib_m_acos+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char acos ();
+int
+main ()
+{
+return acos ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_m_acos=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_lib_m_acos=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_acos" >&5
+echo "${ECHO_T}$ac_cv_lib_m_acos" >&6; }
+if test $ac_cv_lib_m_acos = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+
+fi
+
+
+eval `./libtool --config | grep pic_flag`
+CFLAGS="$CFLAGS $pic_flag"
+
+
+case $TERM in
+       #   for the most important terminal types we directly know the sequences
+       xterm|xterm*|vt220|vt220*)
+               T_MD=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </dev/null 2>/dev/null`
+               T_ME=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/null 2>/dev/null`
+       ;;
+       vt100|vt100*|cygwin)
+               T_MD=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' </dev/null 2>/dev/null`
+               T_ME=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' </dev/null 2>/dev/null`
+       ;;
+       *)
+               T_MD=''
+               T_ME=''
+       ;;
+esac
+  { echo "$as_me:$LINENO: result: " >&5
+echo "${ECHO_T}" >&6; }
+  { echo "$as_me:$LINENO: result: ${T_MD}Test Library Functions${T_ME}" >&5
+echo "${ECHO_T}${T_MD}Test Library Functions${T_ME}" >&6; }
+
+
+
+for ac_func in strftime
+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 { as_var=$as_ac_var; eval "test \"\${$as_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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+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
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  # strftime is in -lintl on SCO UNIX.
+{ echo "$as_me:$LINENO: checking for strftime in -lintl" >&5
+echo $ECHO_N "checking for strftime in -lintl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_intl_strftime+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lintl  $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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char strftime ();
+int
+main ()
+{
+return strftime ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_intl_strftime=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_lib_intl_strftime=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5
+echo "${ECHO_T}$ac_cv_lib_intl_strftime" >&6; }
+if test $ac_cv_lib_intl_strftime = yes; then
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRFTIME 1
+_ACEOF
+
+LIBS="-lintl $LIBS"
+fi
+
+fi
+done
+
+
+for ac_func in vprintf
+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 { as_var=$as_ac_var; eval "test \"\${$as_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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+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
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+{ echo "$as_me:$LINENO: checking for _doprnt" >&5
+echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6; }
+if test "${ac_cv_func__doprnt+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 _doprnt to an innocuous variant, in case <limits.h> declares _doprnt.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define _doprnt innocuous__doprnt
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char _doprnt (); 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 _doprnt
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char _doprnt ();
+/* 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__doprnt || defined __stub____doprnt
+choke me
+#endif
+
+int
+main ()
+{
+return _doprnt ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_func__doprnt=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_func__doprnt=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5
+echo "${ECHO_T}$ac_cv_func__doprnt" >&6; }
+if test $ac_cv_func__doprnt = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DOPRNT 1
+_ACEOF
+
+fi
+
+fi
+done
+
+
+
+{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
+echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; }
+if test "${ac_cv_c_bigendian+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # See if sys/param.h defines the BYTE_ORDER macro.
+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/param.h>
+
+int
+main ()
+{
+#if  ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \
+       && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
+ bogus endian macros
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  # It does; now see whether it defined to BIG_ENDIAN or not.
+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/param.h>
+
+int
+main ()
+{
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_c_bigendian=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_c_bigendian=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       # It does not; compile a test program.
+if test "$cross_compiling" = yes; then
+  # try to guess the endianness by grepping values into an object file
+  ac_cv_c_bigendian=unknown
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
+short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
+int
+main ()
+{
+ _ascii (); _ebcdic ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
+  ac_cv_c_bigendian=yes
+fi
+if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+  if test "$ac_cv_c_bigendian" = unknown; then
+    ac_cv_c_bigendian=no
+  else
+    # finding both strings is unlikely to happen, but who knows?
+    ac_cv_c_bigendian=unknown
+  fi
+fi
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+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
+int
+main ()
+{
+
+  /* Are we little or big endian?  From Harbison&Steele.  */
+  union
+  {
+    long int l;
+    char c[sizeof (long int)];
+  } u;
+  u.l = 1;
+  return u.c[sizeof (long int) - 1] == 1;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_c_bigendian=no
+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_c_bigendian=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
+echo "${ECHO_T}$ac_cv_c_bigendian" >&6; }
+case $ac_cv_c_bigendian in
+  yes)
+
+cat >>confdefs.h <<\_ACEOF
+#define WORDS_BIGENDIAN 1
+_ACEOF
+ ;;
+  no)
+     ;;
+  *)
+    { { echo "$as_me:$LINENO: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&5
+echo "$as_me: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
+   { (exit 1); exit 1; }; } ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+for ac_func in tzset mbstowcs opendir readdir chdir chroot getuid setlocale strerror strerror_r snprintf vsnprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday posix_fadvise madvise
+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 { as_var=$as_ac_var; eval "test \"\${$as_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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+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
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&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
+
+
+{ echo "$as_me:$LINENO: checking whether fdatasync is declared" >&5
+echo $ECHO_N "checking whether fdatasync is declared... $ECHO_C" >&6; }
+if test "${ac_cv_have_decl_fdatasync+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 <unistd.h>
+
+int
+main ()
+{
+#ifndef fdatasync
+  (void) fdatasync;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_have_decl_fdatasync=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_have_decl_fdatasync=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_fdatasync" >&5
+echo "${ECHO_T}$ac_cv_have_decl_fdatasync" >&6; }
+if test $ac_cv_have_decl_fdatasync = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FDATASYNC 1
+_ACEOF
+
+
+else
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FDATASYNC 0
+_ACEOF
+
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking whether posix_fadvise is declared" >&5
+echo $ECHO_N "checking whether posix_fadvise is declared... $ECHO_C" >&6; }
+if test "${ac_cv_have_decl_posix_fadvise+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 _XOPEN_SOURCE 600
+#include <fcntl.h>
+
+int
+main ()
+{
+#ifndef posix_fadvise
+  (void) posix_fadvise;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_have_decl_posix_fadvise=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_have_decl_posix_fadvise=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_posix_fadvise" >&5
+echo "${ECHO_T}$ac_cv_have_decl_posix_fadvise" >&6; }
+if test $ac_cv_have_decl_posix_fadvise = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_POSIX_FADVISE 1
+_ACEOF
+
+
+else
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_POSIX_FADVISE 0
+_ACEOF
+
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking whether madvise is declared" >&5
+echo $ECHO_N "checking whether madvise is declared... $ECHO_C" >&6; }
+if test "${ac_cv_have_decl_madvise+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 <sys/mman.h>
+
+int
+main ()
+{
+#ifndef madvise
+  (void) madvise;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_have_decl_madvise=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_have_decl_madvise=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_madvise" >&5
+echo "${ECHO_T}$ac_cv_have_decl_madvise" >&6; }
+if test $ac_cv_have_decl_madvise = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_MADVISE 1
+_ACEOF
+
+
+else
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_MADVISE 0
+_ACEOF
+
+
+fi
+
+
+
+if test "x$enable_mmap" = xyes; then
+  case "$host" in
+    *cygwin*)
+       # the normal mmap test does not work in cygwin
+
+for ac_func in mmap
+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 { as_var=$as_ac_var; eval "test \"\${$as_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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+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
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&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
+
+       if  "x${ac_cv_func_mmap}" = xyes ; then
+         ac_cv_func_mmap_fixed_mapped=yes
+       fi
+    ;;
+    *)
+
+
+for ac_header in stdlib.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&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 { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; 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 core 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 { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.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;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&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_func in getpagesize
+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 { as_var=$as_ac_var; eval "test \"\${$as_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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+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
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&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
+
+{ echo "$as_me:$LINENO: checking for working mmap" >&5
+echo $ECHO_N "checking for working mmap... $ECHO_C" >&6; }
+if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_mmap_fixed_mapped=no
+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
+/* malloc might have been renamed as rpl_malloc. */
+#undef malloc
+
+/* Thanks to Mike Haertel and Jim Avera for this test.
+   Here is a matrix of mmap possibilities:
+       mmap private not fixed
+       mmap private fixed at somewhere currently unmapped
+       mmap private fixed at somewhere already mapped
+       mmap shared not fixed
+       mmap shared fixed at somewhere currently unmapped
+       mmap shared fixed at somewhere already mapped
+   For private mappings, we should verify that changes cannot be read()
+   back from the file, nor mmap's back from the file at a different
+   address.  (There have been systems where private was not correctly
+   implemented like the infamous i386 svr4.0, and systems where the
+   VM page cache was not coherent with the file system buffer cache
+   like early versions of FreeBSD and possibly contemporary NetBSD.)
+   For shared mappings, we should conversely verify that changes get
+   propagated back to all the places they're supposed to be.
+
+   Grep wants private fixed already mapped.
+   The main things grep needs to know about mmap are:
+   * does it exist and is it safe to write into the mmap'd area
+   * how to use it (BSD variants)  */
+
+#include <fcntl.h>
+#include <sys/mman.h>
+
+#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H
+char *malloc ();
+#endif
+
+/* This mess was copied from the GNU getpagesize.h.  */
+#ifndef HAVE_GETPAGESIZE
+/* Assume that all systems that can run configure have sys/param.h.  */
+# ifndef HAVE_SYS_PARAM_H
+#  define HAVE_SYS_PARAM_H 1
+# endif
+
+# ifdef _SC_PAGESIZE
+#  define getpagesize() sysconf(_SC_PAGESIZE)
+# else /* no _SC_PAGESIZE */
+#  ifdef HAVE_SYS_PARAM_H
+#   include <sys/param.h>
+#   ifdef EXEC_PAGESIZE
+#    define getpagesize() EXEC_PAGESIZE
+#   else /* no EXEC_PAGESIZE */
+#    ifdef NBPG
+#     define getpagesize() NBPG * CLSIZE
+#     ifndef CLSIZE
+#      define CLSIZE 1
+#     endif /* no CLSIZE */
+#    else /* no NBPG */
+#     ifdef NBPC
+#      define getpagesize() NBPC
+#     else /* no NBPC */
+#      ifdef PAGESIZE
+#       define getpagesize() PAGESIZE
+#      endif /* PAGESIZE */
+#     endif /* no NBPC */
+#    endif /* no NBPG */
+#   endif /* no EXEC_PAGESIZE */
+#  else /* no HAVE_SYS_PARAM_H */
+#   define getpagesize() 8192  /* punt totally */
+#  endif /* no HAVE_SYS_PARAM_H */
+# endif /* no _SC_PAGESIZE */
+
+#endif /* no HAVE_GETPAGESIZE */
+
+int
+main ()
+{
+  char *data, *data2, *data3;
+  int i, pagesize;
+  int fd;
+
+  pagesize = getpagesize ();
+
+  /* First, make a file with some known garbage in it. */
+  data = (char *) malloc (pagesize);
+  if (!data)
+    return 1;
+  for (i = 0; i < pagesize; ++i)
+    *(data + i) = rand ();
+  umask (0);
+  fd = creat ("conftest.mmap", 0600);
+  if (fd < 0)
+    return 1;
+  if (write (fd, data, pagesize) != pagesize)
+    return 1;
+  close (fd);
+
+  /* Next, try to mmap the file at a fixed address which already has
+     something else allocated at it.  If we can, also make sure that
+     we see the same garbage.  */
+  fd = open ("conftest.mmap", O_RDWR);
+  if (fd < 0)
+    return 1;
+  data2 = (char *) malloc (2 * pagesize);
+  if (!data2)
+    return 1;
+  data2 += (pagesize - ((long int) data2 & (pagesize - 1))) & (pagesize - 1);
+  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
+                    MAP_PRIVATE | MAP_FIXED, fd, 0L))
+    return 1;
+  for (i = 0; i < pagesize; ++i)
+    if (*(data + i) != *(data2 + i))
+      return 1;
+
+  /* Finally, make sure that changes to the mapped area do not
+     percolate back to the file as seen by read().  (This is a bug on
+     some variants of i386 svr4.0.)  */
+  for (i = 0; i < pagesize; ++i)
+    *(data2 + i) = *(data2 + i) + 1;
+  data3 = (char *) malloc (pagesize);
+  if (!data3)
+    return 1;
+  if (read (fd, data3, pagesize) != pagesize)
+    return 1;
+  for (i = 0; i < pagesize; ++i)
+    if (*(data + i) != *(data3 + i))
+      return 1;
+  close (fd);
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_mmap_fixed_mapped=yes
+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_func_mmap_fixed_mapped=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
+echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6; }
+if test $ac_cv_func_mmap_fixed_mapped = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MMAP 1
+_ACEOF
+
+fi
+rm -f conftest.mmap
+
+    ;;
+  esac
+fi
+
+
+
+case $TERM in
+       #   for the most important terminal types we directly know the sequences
+       xterm|xterm*|vt220|vt220*)
+               T_MD=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </dev/null 2>/dev/null`
+               T_ME=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/null 2>/dev/null`
+       ;;
+       vt100|vt100*|cygwin)
+               T_MD=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' </dev/null 2>/dev/null`
+               T_ME=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' </dev/null 2>/dev/null`
+       ;;
+       *)
+               T_MD=''
+               T_ME=''
+       ;;
+esac
+  { echo "$as_me:$LINENO: result: " >&5
+echo "${ECHO_T}" >&6; }
+  { echo "$as_me:$LINENO: result: ${T_MD}IEEE Math Checks${T_ME}" >&5
+echo "${ECHO_T}${T_MD}IEEE Math Checks${T_ME}" >&6; }
+
+
+
+for ac_func in fpclassify
+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 { as_var=$as_ac_var; eval "test \"\${$as_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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+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
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  { echo "$as_me:$LINENO: checking for fpclassify with <math.h>" >&5
+echo $ECHO_N "checking for fpclassify with <math.h>... $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 <math.h>
+volatile int x;volatile float f;
+int
+main ()
+{
+x = fpclassify(f)
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+      cat >>confdefs.h <<\_ACEOF
+#define HAVE_FPCLASSIFY 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+done
+
+
+for ac_func in finite
+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 { as_var=$as_ac_var; eval "test \"\${$as_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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+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
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+
+for ac_func in isfinite
+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 { as_var=$as_ac_var; eval "test \"\${$as_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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+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
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  { echo "$as_me:$LINENO: checking for isfinite with <math.h>" >&5
+echo $ECHO_N "checking for isfinite with <math.h>... $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 <math.h>
+volatile int x;volatile float f;
+int
+main ()
+{
+x = isfinite(f)
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+      cat >>confdefs.h <<\_ACEOF
+#define HAVE_ISFINITE 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+done
+
+fi
+done
+
+
+for ac_func in isinf
+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 { as_var=$as_ac_var; eval "test \"\${$as_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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+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
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  { echo "$as_me:$LINENO: checking for isinf with <math.h>" >&5
+echo $ECHO_N "checking for isinf with <math.h>... $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 <math.h>
+volatile int x;volatile float f;
+int
+main ()
+{
+x = isinf(f)
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+      cat >>confdefs.h <<\_ACEOF
+#define HAVE_ISINF 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+done
+
+
+
+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
+
+_cflags=${CFLAGS}
+
+{ echo "$as_me:$LINENO: checking if IEEE math works out of the box" >&5
+echo $ECHO_N "checking if IEEE math works out of the box... $ECHO_C" >&6; }
+if test "${rd_cv_ieee_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  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.  */
+
+
+#if HAVE_MATH_H
+#  include <math.h>
+#endif
+
+#if HAVE_FLOAT_H
+#  include <float.h>
+#endif
+
+#if HAVE_IEEEFP_H
+#  include <ieeefp.h>
+#endif
+
+#if HAVE_FP_CLASS_H
+#  include <fp_class.h>
+#endif
+
+/* Solaris */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
+#endif
+
+/* solaris 10 it defines isnan such that only forte can compile it ... bad bad  */
+#if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS))
+#  undef isnan
+#  define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN)
+#endif
+
+/* Digital UNIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FP_CLASS) && defined(HAVE_FP_CLASS_H))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fp_class(a) == FP_NEG_INF || fp_class(a) == FP_POS_INF)
+#endif
+
+/* AIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_CLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (class(a) == FP_MINUS_INF || class(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_PLUS_INF) && defined(FP_MINUS_INF))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_MINUS_INF || fpclassify(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_INFINITE))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_INFINITE)
+#endif
+
+#include <stdio.h>
+int main(void){
+    double rrdnan,rrdinf,rrdc,rrdzero;
+    ;
+    /* some math to see if we get a floating point exception */
+    rrdzero=sin(0.0); /* don't let the compiler optimize us away */
+    rrdnan=0.0/rrdzero; /* especially here */
+    rrdinf=1.0/rrdzero; /* and here. I want to know if it can do the magic */
+                 /* at run time without sig fpe */
+    rrdc = rrdinf + rrdnan;
+    rrdc = rrdinf / rrdnan;
+    if (! isnan(rrdnan)) {printf ("not isnan(NaN) ... "); return 1;}
+    if (rrdnan == rrdnan) {printf ("nan == nan ... "); return 1;}
+    if (! isinf(rrdinf)) {printf ("not isinf(oo) ... "); return 1;}
+    if (! isinf(-rrdinf)) {printf ("not isinf(-oo) ... "); return 1;}
+    if (! rrdinf > 0) {printf ("not inf > 0 ... "); return 1;}
+    if (! -rrdinf < 0) {printf ("not -inf < 0 ... "); return 1;}
+    return 0;
+ }
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  rd_cv_ieee_works=yes
+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 )
+rd_cv_ieee_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+if test x${rd_cv_ieee_works} = "xyes"; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ CFLAGS="$_cflags -ieee"
+
+{ echo "$as_me:$LINENO: checking if IEEE math works with the -ieee switch" >&5
+echo $ECHO_N "checking if IEEE math works with the -ieee switch... $ECHO_C" >&6; }
+if test "${rd_cv_ieee_switch+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  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.  */
+
+
+#if HAVE_MATH_H
+#  include <math.h>
+#endif
+
+#if HAVE_FLOAT_H
+#  include <float.h>
+#endif
+
+#if HAVE_IEEEFP_H
+#  include <ieeefp.h>
+#endif
+
+#if HAVE_FP_CLASS_H
+#  include <fp_class.h>
+#endif
+
+/* Solaris */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
+#endif
+
+/* solaris 10 it defines isnan such that only forte can compile it ... bad bad  */
+#if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS))
+#  undef isnan
+#  define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN)
+#endif
+
+/* Digital UNIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FP_CLASS) && defined(HAVE_FP_CLASS_H))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fp_class(a) == FP_NEG_INF || fp_class(a) == FP_POS_INF)
+#endif
+
+/* AIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_CLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (class(a) == FP_MINUS_INF || class(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_PLUS_INF) && defined(FP_MINUS_INF))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_MINUS_INF || fpclassify(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_INFINITE))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_INFINITE)
+#endif
+
+#include <stdio.h>
+int main(void){
+    double rrdnan,rrdinf,rrdc,rrdzero;
+    ;
+    /* some math to see if we get a floating point exception */
+    rrdzero=sin(0.0); /* don't let the compiler optimize us away */
+    rrdnan=0.0/rrdzero; /* especially here */
+    rrdinf=1.0/rrdzero; /* and here. I want to know if it can do the magic */
+                 /* at run time without sig fpe */
+    rrdc = rrdinf + rrdnan;
+    rrdc = rrdinf / rrdnan;
+    if (! isnan(rrdnan)) {printf ("not isnan(NaN) ... "); return 1;}
+    if (rrdnan == rrdnan) {printf ("nan == nan ... "); return 1;}
+    if (! isinf(rrdinf)) {printf ("not isinf(oo) ... "); return 1;}
+    if (! isinf(-rrdinf)) {printf ("not isinf(-oo) ... "); return 1;}
+    if (! rrdinf > 0) {printf ("not inf > 0 ... "); return 1;}
+    if (! -rrdinf < 0) {printf ("not -inf < 0 ... "); return 1;}
+    return 0;
+ }
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  rd_cv_ieee_switch=yes
+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 )
+rd_cv_ieee_switch=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+if test x${rd_cv_ieee_switch} = "xyes"; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ CFLAGS="$_cflags -qfloat=nofold"
+
+{ echo "$as_me:$LINENO: checking if IEEE math works with the -qfloat=nofold switch" >&5
+echo $ECHO_N "checking if IEEE math works with the -qfloat=nofold switch... $ECHO_C" >&6; }
+if test "${rd_cv_ieee_nofold+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  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.  */
+
+
+#if HAVE_MATH_H
+#  include <math.h>
+#endif
+
+#if HAVE_FLOAT_H
+#  include <float.h>
+#endif
+
+#if HAVE_IEEEFP_H
+#  include <ieeefp.h>
+#endif
+
+#if HAVE_FP_CLASS_H
+#  include <fp_class.h>
+#endif
+
+/* Solaris */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
+#endif
+
+/* solaris 10 it defines isnan such that only forte can compile it ... bad bad  */
+#if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS))
+#  undef isnan
+#  define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN)
+#endif
+
+/* Digital UNIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FP_CLASS) && defined(HAVE_FP_CLASS_H))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fp_class(a) == FP_NEG_INF || fp_class(a) == FP_POS_INF)
+#endif
+
+/* AIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_CLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (class(a) == FP_MINUS_INF || class(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_PLUS_INF) && defined(FP_MINUS_INF))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_MINUS_INF || fpclassify(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_INFINITE))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_INFINITE)
+#endif
+
+#include <stdio.h>
+int main(void){
+    double rrdnan,rrdinf,rrdc,rrdzero;
+    ;
+    /* some math to see if we get a floating point exception */
+    rrdzero=sin(0.0); /* don't let the compiler optimize us away */
+    rrdnan=0.0/rrdzero; /* especially here */
+    rrdinf=1.0/rrdzero; /* and here. I want to know if it can do the magic */
+                 /* at run time without sig fpe */
+    rrdc = rrdinf + rrdnan;
+    rrdc = rrdinf / rrdnan;
+    if (! isnan(rrdnan)) {printf ("not isnan(NaN) ... "); return 1;}
+    if (rrdnan == rrdnan) {printf ("nan == nan ... "); return 1;}
+    if (! isinf(rrdinf)) {printf ("not isinf(oo) ... "); return 1;}
+    if (! isinf(-rrdinf)) {printf ("not isinf(-oo) ... "); return 1;}
+    if (! rrdinf > 0) {printf ("not inf > 0 ... "); return 1;}
+    if (! -rrdinf < 0) {printf ("not -inf < 0 ... "); return 1;}
+    return 0;
+ }
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  rd_cv_ieee_nofold=yes
+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 )
+rd_cv_ieee_nofold=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+if test x${rd_cv_ieee_nofold} = "xyes"; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ CFLAGS="$_cflags -w -qflttrap=enable:zerodivide"
+
+{ echo "$as_me:$LINENO: checking if IEEE math works with the -w -qflttrap=enable:zerodivide" >&5
+echo $ECHO_N "checking if IEEE math works with the -w -qflttrap=enable:zerodivide... $ECHO_C" >&6; }
+if test "${rd_cv_ieee_flttrap+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  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.  */
+
+
+#if HAVE_MATH_H
+#  include <math.h>
+#endif
+
+#if HAVE_FLOAT_H
+#  include <float.h>
+#endif
+
+#if HAVE_IEEEFP_H
+#  include <ieeefp.h>
+#endif
+
+#if HAVE_FP_CLASS_H
+#  include <fp_class.h>
+#endif
+
+/* Solaris */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
+#endif
+
+/* solaris 10 it defines isnan such that only forte can compile it ... bad bad  */
+#if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS))
+#  undef isnan
+#  define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN)
+#endif
+
+/* Digital UNIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FP_CLASS) && defined(HAVE_FP_CLASS_H))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fp_class(a) == FP_NEG_INF || fp_class(a) == FP_POS_INF)
+#endif
+
+/* AIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_CLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (class(a) == FP_MINUS_INF || class(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_PLUS_INF) && defined(FP_MINUS_INF))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_MINUS_INF || fpclassify(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_INFINITE))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_INFINITE)
+#endif
+
+#include <stdio.h>
+int main(void){
+    double rrdnan,rrdinf,rrdc,rrdzero;
+    ;
+    /* some math to see if we get a floating point exception */
+    rrdzero=sin(0.0); /* don't let the compiler optimize us away */
+    rrdnan=0.0/rrdzero; /* especially here */
+    rrdinf=1.0/rrdzero; /* and here. I want to know if it can do the magic */
+                 /* at run time without sig fpe */
+    rrdc = rrdinf + rrdnan;
+    rrdc = rrdinf / rrdnan;
+    if (! isnan(rrdnan)) {printf ("not isnan(NaN) ... "); return 1;}
+    if (rrdnan == rrdnan) {printf ("nan == nan ... "); return 1;}
+    if (! isinf(rrdinf)) {printf ("not isinf(oo) ... "); return 1;}
+    if (! isinf(-rrdinf)) {printf ("not isinf(-oo) ... "); return 1;}
+    if (! rrdinf > 0) {printf ("not inf > 0 ... "); return 1;}
+    if (! -rrdinf < 0) {printf ("not -inf < 0 ... "); return 1;}
+    return 0;
+ }
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  rd_cv_ieee_flttrap=yes
+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 )
+rd_cv_ieee_flttrap=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+if test x${rd_cv_ieee_flttrap} = "xyes"; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ CFLAGS="$_cflags -mieee"
+
+{ echo "$as_me:$LINENO: checking if IEEE math works with the -mieee switch" >&5
+echo $ECHO_N "checking if IEEE math works with the -mieee switch... $ECHO_C" >&6; }
+if test "${rd_cv_ieee_mswitch+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  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.  */
+
+
+#if HAVE_MATH_H
+#  include <math.h>
+#endif
+
+#if HAVE_FLOAT_H
+#  include <float.h>
+#endif
+
+#if HAVE_IEEEFP_H
+#  include <ieeefp.h>
+#endif
+
+#if HAVE_FP_CLASS_H
+#  include <fp_class.h>
+#endif
+
+/* Solaris */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
+#endif
+
+/* solaris 10 it defines isnan such that only forte can compile it ... bad bad  */
+#if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS))
+#  undef isnan
+#  define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN)
+#endif
+
+/* Digital UNIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FP_CLASS) && defined(HAVE_FP_CLASS_H))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fp_class(a) == FP_NEG_INF || fp_class(a) == FP_POS_INF)
+#endif
+
+/* AIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_CLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (class(a) == FP_MINUS_INF || class(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_PLUS_INF) && defined(FP_MINUS_INF))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_MINUS_INF || fpclassify(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_INFINITE))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_INFINITE)
+#endif
+
+#include <stdio.h>
+int main(void){
+    double rrdnan,rrdinf,rrdc,rrdzero;
+    ;
+    /* some math to see if we get a floating point exception */
+    rrdzero=sin(0.0); /* don't let the compiler optimize us away */
+    rrdnan=0.0/rrdzero; /* especially here */
+    rrdinf=1.0/rrdzero; /* and here. I want to know if it can do the magic */
+                 /* at run time without sig fpe */
+    rrdc = rrdinf + rrdnan;
+    rrdc = rrdinf / rrdnan;
+    if (! isnan(rrdnan)) {printf ("not isnan(NaN) ... "); return 1;}
+    if (rrdnan == rrdnan) {printf ("nan == nan ... "); return 1;}
+    if (! isinf(rrdinf)) {printf ("not isinf(oo) ... "); return 1;}
+    if (! isinf(-rrdinf)) {printf ("not isinf(-oo) ... "); return 1;}
+    if (! rrdinf > 0) {printf ("not inf > 0 ... "); return 1;}
+    if (! -rrdinf < 0) {printf ("not -inf < 0 ... "); return 1;}
+    return 0;
+ }
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  rd_cv_ieee_mswitch=yes
+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 )
+rd_cv_ieee_mswitch=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+if test x${rd_cv_ieee_mswitch} = "xyes"; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ CFLAGS="$_cflags -q float=rndsngl"
+
+{ echo "$as_me:$LINENO: checking if IEEE math works with the -q float=rndsngl switch" >&5
+echo $ECHO_N "checking if IEEE math works with the -q float=rndsngl switch... $ECHO_C" >&6; }
+if test "${rd_cv_ieee_qswitch+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  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.  */
+
+
+#if HAVE_MATH_H
+#  include <math.h>
+#endif
+
+#if HAVE_FLOAT_H
+#  include <float.h>
+#endif
+
+#if HAVE_IEEEFP_H
+#  include <ieeefp.h>
+#endif
+
+#if HAVE_FP_CLASS_H
+#  include <fp_class.h>
+#endif
+
+/* Solaris */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
+#endif
+
+/* solaris 10 it defines isnan such that only forte can compile it ... bad bad  */
+#if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS))
+#  undef isnan
+#  define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN)
+#endif
+
+/* Digital UNIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FP_CLASS) && defined(HAVE_FP_CLASS_H))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fp_class(a) == FP_NEG_INF || fp_class(a) == FP_POS_INF)
+#endif
+
+/* AIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_CLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (class(a) == FP_MINUS_INF || class(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_PLUS_INF) && defined(FP_MINUS_INF))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_MINUS_INF || fpclassify(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_INFINITE))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_INFINITE)
+#endif
+
+#include <stdio.h>
+int main(void){
+    double rrdnan,rrdinf,rrdc,rrdzero;
+    ;
+    /* some math to see if we get a floating point exception */
+    rrdzero=sin(0.0); /* don't let the compiler optimize us away */
+    rrdnan=0.0/rrdzero; /* especially here */
+    rrdinf=1.0/rrdzero; /* and here. I want to know if it can do the magic */
+                 /* at run time without sig fpe */
+    rrdc = rrdinf + rrdnan;
+    rrdc = rrdinf / rrdnan;
+    if (! isnan(rrdnan)) {printf ("not isnan(NaN) ... "); return 1;}
+    if (rrdnan == rrdnan) {printf ("nan == nan ... "); return 1;}
+    if (! isinf(rrdinf)) {printf ("not isinf(oo) ... "); return 1;}
+    if (! isinf(-rrdinf)) {printf ("not isinf(-oo) ... "); return 1;}
+    if (! rrdinf > 0) {printf ("not inf > 0 ... "); return 1;}
+    if (! -rrdinf < 0) {printf ("not -inf < 0 ... "); return 1;}
+    return 0;
+ }
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  rd_cv_ieee_qswitch=yes
+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 )
+rd_cv_ieee_qswitch=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+if test x${rd_cv_ieee_qswitch} = "xyes"; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ CFLAGS="$_cflags -OPT:IEEE_NaN_inf=ON"
+
+{ echo "$as_me:$LINENO: checking if IEEE math works with the -OPT:IEEE_NaN_inf=ON switch" >&5
+echo $ECHO_N "checking if IEEE math works with the -OPT:IEEE_NaN_inf=ON switch... $ECHO_C" >&6; }
+if test "${rd_cv_ieee_ieeenaninfswitch+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  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.  */
+
+
+#if HAVE_MATH_H
+#  include <math.h>
+#endif
+
+#if HAVE_FLOAT_H
+#  include <float.h>
+#endif
+
+#if HAVE_IEEEFP_H
+#  include <ieeefp.h>
+#endif
+
+#if HAVE_FP_CLASS_H
+#  include <fp_class.h>
+#endif
+
+/* Solaris */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
+#endif
+
+/* solaris 10 it defines isnan such that only forte can compile it ... bad bad  */
+#if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS))
+#  undef isnan
+#  define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN)
+#endif
+
+/* Digital UNIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FP_CLASS) && defined(HAVE_FP_CLASS_H))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fp_class(a) == FP_NEG_INF || fp_class(a) == FP_POS_INF)
+#endif
+
+/* AIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_CLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (class(a) == FP_MINUS_INF || class(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_PLUS_INF) && defined(FP_MINUS_INF))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_MINUS_INF || fpclassify(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_INFINITE))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_INFINITE)
+#endif
+
+#include <stdio.h>
+int main(void){
+    double rrdnan,rrdinf,rrdc,rrdzero;
+    ;
+    /* some math to see if we get a floating point exception */
+    rrdzero=sin(0.0); /* don't let the compiler optimize us away */
+    rrdnan=0.0/rrdzero; /* especially here */
+    rrdinf=1.0/rrdzero; /* and here. I want to know if it can do the magic */
+                 /* at run time without sig fpe */
+    rrdc = rrdinf + rrdnan;
+    rrdc = rrdinf / rrdnan;
+    if (! isnan(rrdnan)) {printf ("not isnan(NaN) ... "); return 1;}
+    if (rrdnan == rrdnan) {printf ("nan == nan ... "); return 1;}
+    if (! isinf(rrdinf)) {printf ("not isinf(oo) ... "); return 1;}
+    if (! isinf(-rrdinf)) {printf ("not isinf(-oo) ... "); return 1;}
+    if (! rrdinf > 0) {printf ("not inf > 0 ... "); return 1;}
+    if (! -rrdinf < 0) {printf ("not -inf < 0 ... "); return 1;}
+    return 0;
+ }
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  rd_cv_ieee_ieeenaninfswitch=yes
+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 )
+rd_cv_ieee_ieeenaninfswitch=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+if test x${rd_cv_ieee_ieeenaninfswitch} = "xyes"; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ CFLAGS="$_cflags -OPT:IEEE_comparisons=ON"
+
+{ echo "$as_me:$LINENO: checking if IEEE math works with the -OPT:IEEE_comparisons=ON switch" >&5
+echo $ECHO_N "checking if IEEE math works with the -OPT:IEEE_comparisons=ON switch... $ECHO_C" >&6; }
+if test "${rd_cv_ieee_ieeecmpswitch+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  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.  */
+
+
+#if HAVE_MATH_H
+#  include <math.h>
+#endif
+
+#if HAVE_FLOAT_H
+#  include <float.h>
+#endif
+
+#if HAVE_IEEEFP_H
+#  include <ieeefp.h>
+#endif
+
+#if HAVE_FP_CLASS_H
+#  include <fp_class.h>
+#endif
+
+/* Solaris */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
+#endif
+
+/* solaris 10 it defines isnan such that only forte can compile it ... bad bad  */
+#if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS))
+#  undef isnan
+#  define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN)
+#endif
+
+/* Digital UNIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FP_CLASS) && defined(HAVE_FP_CLASS_H))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fp_class(a) == FP_NEG_INF || fp_class(a) == FP_POS_INF)
+#endif
+
+/* AIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_CLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (class(a) == FP_MINUS_INF || class(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_PLUS_INF) && defined(FP_MINUS_INF))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_MINUS_INF || fpclassify(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_INFINITE))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_INFINITE)
+#endif
+
+#include <stdio.h>
+int main(void){
+    double rrdnan,rrdinf,rrdc,rrdzero;
+    ;
+    /* some math to see if we get a floating point exception */
+    rrdzero=sin(0.0); /* don't let the compiler optimize us away */
+    rrdnan=0.0/rrdzero; /* especially here */
+    rrdinf=1.0/rrdzero; /* and here. I want to know if it can do the magic */
+                 /* at run time without sig fpe */
+    rrdc = rrdinf + rrdnan;
+    rrdc = rrdinf / rrdnan;
+    if (! isnan(rrdnan)) {printf ("not isnan(NaN) ... "); return 1;}
+    if (rrdnan == rrdnan) {printf ("nan == nan ... "); return 1;}
+    if (! isinf(rrdinf)) {printf ("not isinf(oo) ... "); return 1;}
+    if (! isinf(-rrdinf)) {printf ("not isinf(-oo) ... "); return 1;}
+    if (! rrdinf > 0) {printf ("not inf > 0 ... "); return 1;}
+    if (! -rrdinf < 0) {printf ("not -inf < 0 ... "); return 1;}
+    return 0;
+ }
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  rd_cv_ieee_ieeecmpswitch=yes
+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 )
+rd_cv_ieee_ieeecmpswitch=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+if test x${rd_cv_ieee_ieeecmpswitch} = "xyes"; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ CFLAGS=$_cflags
+
+{ echo "$as_me:$LINENO: checking if IEEE math works with fpsetmask(0)" >&5
+echo $ECHO_N "checking if IEEE math works with fpsetmask(0)... $ECHO_C" >&6; }
+if test "${rd_cv_ieee_mask+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  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 <floatingpoint.h>
+
+#if HAVE_MATH_H
+#  include <math.h>
+#endif
+
+#if HAVE_FLOAT_H
+#  include <float.h>
+#endif
+
+#if HAVE_IEEEFP_H
+#  include <ieeefp.h>
+#endif
+
+#if HAVE_FP_CLASS_H
+#  include <fp_class.h>
+#endif
+
+/* Solaris */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
+#endif
+
+/* solaris 10 it defines isnan such that only forte can compile it ... bad bad  */
+#if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS))
+#  undef isnan
+#  define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN)
+#endif
+
+/* Digital UNIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FP_CLASS) && defined(HAVE_FP_CLASS_H))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fp_class(a) == FP_NEG_INF || fp_class(a) == FP_POS_INF)
+#endif
+
+/* AIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_CLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (class(a) == FP_MINUS_INF || class(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_PLUS_INF) && defined(FP_MINUS_INF))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_MINUS_INF || fpclassify(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_INFINITE))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_INFINITE)
+#endif
+
+#include <stdio.h>
+int main(void){
+    double rrdnan,rrdinf,rrdc,rrdzero;
+    fpsetmask(0);
+    /* some math to see if we get a floating point exception */
+    rrdzero=sin(0.0); /* don't let the compiler optimize us away */
+    rrdnan=0.0/rrdzero; /* especially here */
+    rrdinf=1.0/rrdzero; /* and here. I want to know if it can do the magic */
+                 /* at run time without sig fpe */
+    rrdc = rrdinf + rrdnan;
+    rrdc = rrdinf / rrdnan;
+    if (! isnan(rrdnan)) {printf ("not isnan(NaN) ... "); return 1;}
+    if (rrdnan == rrdnan) {printf ("nan == nan ... "); return 1;}
+    if (! isinf(rrdinf)) {printf ("not isinf(oo) ... "); return 1;}
+    if (! isinf(-rrdinf)) {printf ("not isinf(-oo) ... "); return 1;}
+    if (! rrdinf > 0) {printf ("not inf > 0 ... "); return 1;}
+    if (! -rrdinf < 0) {printf ("not -inf < 0 ... "); return 1;}
+    return 0;
+ }
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  rd_cv_ieee_mask=yes
+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 )
+rd_cv_ieee_mask=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+if test x${rd_cv_ieee_mask} = "xyes"; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+ cat >>confdefs.h <<\_ACEOF
+#define MUST_DISABLE_FPMASK 1
+_ACEOF
+
+                PERLFLAGS="CCFLAGS=-DMUST_DISABLE_FPMASK"
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+
+{ echo "$as_me:$LINENO: checking if IEEE math works with signal(SIGFPE,SIG_IGN)" >&5
+echo $ECHO_N "checking if IEEE math works with signal(SIGFPE,SIG_IGN)... $ECHO_C" >&6; }
+if test "${rd_cv_ieee_sigfpe+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  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 <signal.h>
+
+#if HAVE_MATH_H
+#  include <math.h>
+#endif
+
+#if HAVE_FLOAT_H
+#  include <float.h>
+#endif
+
+#if HAVE_IEEEFP_H
+#  include <ieeefp.h>
+#endif
+
+#if HAVE_FP_CLASS_H
+#  include <fp_class.h>
+#endif
+
+/* Solaris */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
+#endif
+
+/* solaris 10 it defines isnan such that only forte can compile it ... bad bad  */
+#if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS))
+#  undef isnan
+#  define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN)
+#endif
+
+/* Digital UNIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FP_CLASS) && defined(HAVE_FP_CLASS_H))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fp_class(a) == FP_NEG_INF || fp_class(a) == FP_POS_INF)
+#endif
+
+/* AIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_CLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (class(a) == FP_MINUS_INF || class(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_PLUS_INF) && defined(FP_MINUS_INF))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_MINUS_INF || fpclassify(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_INFINITE))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_INFINITE)
+#endif
+
+#include <stdio.h>
+int main(void){
+    double rrdnan,rrdinf,rrdc,rrdzero;
+    signal(SIGFPE,SIG_IGN);
+    /* some math to see if we get a floating point exception */
+    rrdzero=sin(0.0); /* don't let the compiler optimize us away */
+    rrdnan=0.0/rrdzero; /* especially here */
+    rrdinf=1.0/rrdzero; /* and here. I want to know if it can do the magic */
+                 /* at run time without sig fpe */
+    rrdc = rrdinf + rrdnan;
+    rrdc = rrdinf / rrdnan;
+    if (! isnan(rrdnan)) {printf ("not isnan(NaN) ... "); return 1;}
+    if (rrdnan == rrdnan) {printf ("nan == nan ... "); return 1;}
+    if (! isinf(rrdinf)) {printf ("not isinf(oo) ... "); return 1;}
+    if (! isinf(-rrdinf)) {printf ("not isinf(-oo) ... "); return 1;}
+    if (! rrdinf > 0) {printf ("not inf > 0 ... "); return 1;}
+    if (! -rrdinf < 0) {printf ("not -inf < 0 ... "); return 1;}
+    return 0;
+ }
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  rd_cv_ieee_sigfpe=yes
+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 )
+rd_cv_ieee_sigfpe=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+if test x${rd_cv_ieee_sigfpe} = "xyes"; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+ cat >>confdefs.h <<\_ACEOF
+#define MUST_DISABLE_SIGFPE 1
+_ACEOF
+
+                   PERLFLAGS="CCFLAGS=-DMUST_DISABLE_SIGFPE"
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ { { echo "$as_me:$LINENO: error:
+Your Compiler does not do propper IEEE math ... Please find out how to
+make IEEE math work with your compiler and let me know (tobi@oetiker.ch).
+Check config.log to see what went wrong ...
+" >&5
+echo "$as_me: error:
+Your Compiler does not do propper IEEE math ... Please find out how to
+make IEEE math work with your compiler and let me know (tobi@oetiker.ch).
+Check config.log to see what went wrong ...
+" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+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
+
+
+
+
+
+case $TERM in
+       #   for the most important terminal types we directly know the sequences
+       xterm|xterm*|vt220|vt220*)
+               T_MD=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </dev/null 2>/dev/null`
+               T_ME=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/null 2>/dev/null`
+       ;;
+       vt100|vt100*|cygwin)
+               T_MD=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' </dev/null 2>/dev/null`
+               T_ME=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' </dev/null 2>/dev/null`
+       ;;
+       *)
+               T_MD=''
+               T_ME=''
+       ;;
+esac
+  { echo "$as_me:$LINENO: result: " >&5
+echo "${ECHO_T}" >&6; }
+  { echo "$as_me:$LINENO: result: ${T_MD}Resolve Portability Issues${T_ME}" >&5
+echo "${ECHO_T}${T_MD}Resolve Portability Issues${T_ME}" >&6; }
+
+
+
+{ echo "$as_me:$LINENO: checking if realloc can deal with NULL" >&5
+echo $ECHO_N "checking if realloc can deal with NULL... $ECHO_C" >&6; }
+if test "${rd_cv_null_realloc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  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 <stdlib.h>
+             int main(void){
+              char *x = NULL;
+             x = realloc (x,10);
+             if (x==NULL) return 1;
+             return 0;
+             }
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  rd_cv_null_realloc=yes
+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 )
+rd_cv_null_realloc=nope
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $rd_cv_null_realloc" >&5
+echo "${ECHO_T}$rd_cv_null_realloc" >&6; }
+
+if test x"$rd_cv_null_realloc" = xnope; then
+cat >>confdefs.h <<\_ACEOF
+#define NO_NULL_REALLOC 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
+
+{ echo "$as_me:$LINENO: checking if ctime_r need special care to act posixly correct" >&5
+echo $ECHO_N "checking if ctime_r need special care to act posixly correct... $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 <time.h>
+int
+main ()
+{
+ctime_r(NULL,NULL,0)
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+   CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <time.h>
+int
+main ()
+{
+ctime_r(NULL,NULL)
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  { echo "$as_me:$LINENO: result: yes, this seems to be solaris style" >&5
+echo "${ECHO_T}yes, this seems to be solaris style" >&6; }
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       { { echo "$as_me:$LINENO: error: Can't figure how to compile ctime_r" >&5
+echo "$as_me: error: Can't figure how to compile ctime_r" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+        cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <time.h>
+int
+main ()
+{
+ctime_r(NULL,NULL)
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       { { echo "$as_me:$LINENO: error: Can't figure how to compile ctime_r" >&5
+echo "$as_me: error: Can't figure how to compile ctime_r" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext 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
+
+
+
+
+
+
+if test $enable_pthread != no; then
+
+
+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
+
+acx_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        { echo "$as_me:$LINENO: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5
+echo $ECHO_N "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... $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.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char pthread_join ();
+int
+main ()
+{
+return pthread_join ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  acx_pthread_ok=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+        { echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5
+echo "${ECHO_T}$acx_pthread_ok" >&6; }
+        if test x"$acx_pthread_ok" = xno; then
+                PTHREAD_LIBS=""
+                PTHREAD_CFLAGS=""
+        fi
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try.  Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important.  Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+#       other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+#      doesn't hurt to check since this sometimes defines pthreads too;
+#      also defines -D_REENTRANT)
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case "${host_cpu}-${host_os}" in
+        *solaris*)
+
+        # On Solaris (at least, for some versions), libc contains stubbed
+        # (non-functional) versions of the pthreads routines, so link-based
+        # tests will erroneously succeed.  (We need to link with -pthread or
+        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
+        # a function called by this macro, so we could check for that, but
+        # who knows whether they'll stub that too in a future libc.)  So,
+        # we'll just look for -pthreads and -lpthread first:
+
+        acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
+        ;;
+esac
+
+if test x"$acx_pthread_ok" = xno; then
+for flag in $acx_pthread_flags; do
+
+        case $flag in
+                none)
+                { echo "$as_me:$LINENO: checking whether pthreads work without any flags" >&5
+echo $ECHO_N "checking whether pthreads work without any flags... $ECHO_C" >&6; }
+                ;;
+
+                -*)
+                { echo "$as_me:$LINENO: checking whether pthreads work with $flag" >&5
+echo $ECHO_N "checking whether pthreads work with $flag... $ECHO_C" >&6; }
+                PTHREAD_CFLAGS="$flag"
+                ;;
+
+               pthread-config)
+               # Extract the first word of "pthread-config", so it can be a program name with args.
+set dummy pthread-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_prog_acx_pthread_config+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$acx_pthread_config"; then
+  ac_cv_prog_acx_pthread_config="$acx_pthread_config" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_acx_pthread_config="yes"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no"
+fi
+fi
+acx_pthread_config=$ac_cv_prog_acx_pthread_config
+if test -n "$acx_pthread_config"; then
+  { echo "$as_me:$LINENO: result: $acx_pthread_config" >&5
+echo "${ECHO_T}$acx_pthread_config" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+               if test x"$acx_pthread_config" = xno; then continue; fi
+               PTHREAD_CFLAGS="`pthread-config --cflags`"
+               PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+               ;;
+
+                *)
+                { echo "$as_me:$LINENO: checking for the pthreads library -l$flag" >&5
+echo $ECHO_N "checking for the pthreads library -l$flag... $ECHO_C" >&6; }
+                PTHREAD_LIBS="-l$flag"
+                ;;
+        esac
+
+        save_LIBS="$LIBS"
+        save_CFLAGS="$CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Check for various functions.  We must include pthread.h,
+        # since some functions may be macros.  (On the Sequent, we
+        # need a special flag -Kthread to make this header compile.)
+        # We check for pthread_join because it is in -lpthread on IRIX
+        # while pthread_create is in libc.  We check for pthread_attr_init
+        # due to DEC craziness with -lpthreads.  We check for
+        # pthread_cleanup_push because it is one of the few pthread
+        # functions on Solaris that doesn't have a non-functional libc stub.
+        # We try pthread_create on general principles.
+        cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <pthread.h>
+int
+main ()
+{
+pthread_t th; pthread_join(th, 0);
+                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
+                     pthread_create(0,0,0,0); pthread_cleanup_pop(0);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  acx_pthread_ok=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        { echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5
+echo "${ECHO_T}$acx_pthread_ok" >&6; }
+        if test "x$acx_pthread_ok" = xyes; then
+                break;
+        fi
+
+        PTHREAD_LIBS=""
+        PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$acx_pthread_ok" = xyes; then
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+       { echo "$as_me:$LINENO: checking for joinable pthread attribute" >&5
+echo $ECHO_N "checking for joinable pthread attribute... $ECHO_C" >&6; }
+       attr_name=unknown
+       for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+           cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <pthread.h>
+int
+main ()
+{
+int attr=$attr;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  attr_name=$attr; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+       done
+        { echo "$as_me:$LINENO: result: $attr_name" >&5
+echo "${ECHO_T}$attr_name" >&6; }
+        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+
+cat >>confdefs.h <<_ACEOF
+#define PTHREAD_CREATE_JOINABLE $attr_name
+_ACEOF
+
+        fi
+
+        { echo "$as_me:$LINENO: checking if more special flags are required for pthreads" >&5
+echo $ECHO_N "checking if more special flags are required for pthreads... $ECHO_C" >&6; }
+        x_rflag=no
+        case "${host_cpu}-${host_os}" in
+            *-aix* | *-freebsd* | *-darwin*) x_rflag="-D_THREAD_SAFE";;
+            *solaris* | *-osf* | *-hpux*) x_rflag="-D_REENTRANT";;
+            *-linux*)
+            if test x"$PTHREAD_CFLAGS" = "x-pthread"; then
+                # For Linux/gcc "-pthread" implies "-lpthread". We need, however, to make this explicit
+                # in PTHREAD_LIBS such that a shared library to be built properly depends on libpthread.
+                PTHREAD_LIBS="-lpthread $PTHREAD_LIBS"
+            fi;;
+        esac
+        { echo "$as_me:$LINENO: result: ${x_rflag}" >&5
+echo "${ECHO_T}${x_rflag}" >&6; }
+        if test "x$x_rflag" != xno; then
+            PTHREAD_CFLAGS="$x_rflag $PTHREAD_CFLAGS"
+        fi
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        # More AIX lossage: must compile with cc_r
+        # Extract the first word of "cc_r", so it can be a program name with args.
+set dummy cc_r; 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_PTHREAD_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$PTHREAD_CC"; then
+  ac_cv_prog_PTHREAD_CC="$PTHREAD_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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_PTHREAD_CC="cc_r"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_prog_PTHREAD_CC" && ac_cv_prog_PTHREAD_CC="${CC}"
+fi
+fi
+PTHREAD_CC=$ac_cv_prog_PTHREAD_CC
+if test -n "$PTHREAD_CC"; then
+  { echo "$as_me:$LINENO: result: $PTHREAD_CC" >&5
+echo "${ECHO_T}$PTHREAD_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+else
+        PTHREAD_CC="$CC"
+fi
+
+
+
+
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$acx_pthread_ok" = xyes; then
+
+    MULTITHREAD_CFLAGS=$PTHREAD_CFLAGS
+    MULTITHREAD_LDFLAGS=$PTHREAD_LIBS
+
+        :
+else
+        acx_pthread_ok=no
+
+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
+
+
+fi
+
+
+if test  "x$x_rflag" != "xno"; then
+   CPPFLAGS="$CPPFLAGS $x_rflag"
+fi
+
+
+
+if test $enable_pthread != no; then
+  BUILD_MULTITHREAD_TRUE=
+  BUILD_MULTITHREAD_FALSE='#'
+else
+  BUILD_MULTITHREAD_TRUE='#'
+  BUILD_MULTITHREAD_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 do we need malloc/malloc.h" >&5
+echo $ECHO_N "checking do we need malloc/malloc.h... $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 ()
+{
+malloc(1)
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+   { echo "$as_me:$LINENO: result: nope, works out of the box" >&5
+echo "${ECHO_T}nope, works out of the box" >&6; }
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+        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 <malloc/malloc.h>
+int
+main ()
+{
+malloc(1)
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  cat >>confdefs.h <<\_ACEOF
+#define NEED_MALLOC_MALLOC_H 1
+_ACEOF
+
+           { echo "$as_me:$LINENO: result: yes we do" >&5
+echo "${ECHO_T}yes we do" >&6; }
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       { { echo "$as_me:$LINENO: error: Can not figure how to compile malloc" >&5
+echo "$as_me: error: Can not figure how to compile malloc" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext 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
+
+
+
+case $TERM in
+       #   for the most important terminal types we directly know the sequences
+       xterm|xterm*|vt220|vt220*)
+               T_MD=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </dev/null 2>/dev/null`
+               T_ME=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/null 2>/dev/null`
+       ;;
+       vt100|vt100*|cygwin)
+               T_MD=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' </dev/null 2>/dev/null`
+               T_ME=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' </dev/null 2>/dev/null`
+       ;;
+       *)
+               T_MD=''
+               T_ME=''
+       ;;
+esac
+  { echo "$as_me:$LINENO: result: " >&5
+echo "${ECHO_T}" >&6; }
+  { echo "$as_me:$LINENO: result: ${T_MD}Find 3rd-Party Libraries${T_ME}" >&5
+echo "${ECHO_T}${T_MD}Find 3rd-Party Libraries${T_ME}" >&6; }
+
+
+
+
+
+if test $enable_rrdcgi != no; then
+  BUILD_RRDCGI_TRUE=
+  BUILD_RRDCGI_FALSE='#'
+else
+  BUILD_RRDCGI_TRUE='#'
+  BUILD_RRDCGI_FALSE=
+fi
+
+
+CORE_LIBS="$LIBS"
+
+
+ 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
+
+ EX_CHECK_STATE=NO
+ ex_check_save_LIBS=${LIBS}
+ ex_check_save_CPPFLAGS=${CPPFLAGS}
+ ex_check_save_LDFLAGS=${LDFLAGS}
+ if test "x/usr/include/libart-2.0" != "x"; then
+   CPPFLAGS="$CPPFLAGS -I/usr/include/libart-2.0"
+ fi
+  { echo "$as_me:$LINENO: checking for art_vpath_add_point in -lart_lgpl_2" >&5
+echo $ECHO_N "checking for art_vpath_add_point in -lart_lgpl_2... $ECHO_C" >&6; }
+if test "${ac_cv_lib_art_lgpl_2_art_vpath_add_point+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lart_lgpl_2  $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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char art_vpath_add_point ();
+int
+main ()
+{
+return art_vpath_add_point ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_art_lgpl_2_art_vpath_add_point=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_lib_art_lgpl_2_art_vpath_add_point=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_art_lgpl_2_art_vpath_add_point" >&5
+echo "${ECHO_T}$ac_cv_lib_art_lgpl_2_art_vpath_add_point" >&6; }
+if test $ac_cv_lib_art_lgpl_2_art_vpath_add_point = yes; then
+
+    if test "${ac_cv_header_libart_lgpl_libart_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for libart_lgpl/libart.h" >&5
+echo $ECHO_N "checking for libart_lgpl/libart.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_libart_lgpl_libart_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_libart_lgpl_libart_h" >&5
+echo "${ECHO_T}$ac_cv_header_libart_lgpl_libart_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking libart_lgpl/libart.h usability" >&5
+echo $ECHO_N "checking libart_lgpl/libart.h 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 <libart_lgpl/libart.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; 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 core 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 libart_lgpl/libart.h presence" >&5
+echo $ECHO_N "checking libart_lgpl/libart.h 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 <libart_lgpl/libart.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.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: libart_lgpl/libart.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: libart_lgpl/libart.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libart_lgpl/libart.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: libart_lgpl/libart.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: libart_lgpl/libart.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: libart_lgpl/libart.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libart_lgpl/libart.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: libart_lgpl/libart.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libart_lgpl/libart.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: libart_lgpl/libart.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libart_lgpl/libart.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: libart_lgpl/libart.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libart_lgpl/libart.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: libart_lgpl/libart.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libart_lgpl/libart.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: libart_lgpl/libart.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for libart_lgpl/libart.h" >&5
+echo $ECHO_N "checking for libart_lgpl/libart.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_libart_lgpl_libart_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_libart_lgpl_libart_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_libart_lgpl_libart_h" >&5
+echo "${ECHO_T}$ac_cv_header_libart_lgpl_libart_h" >&6; }
+
+fi
+if test $ac_cv_header_libart_lgpl_libart_h = yes; then
+  LIBS="-lart_lgpl_2 ${LIBS}";EX_CHECK_STATE=YES
+fi
+
+
+fi
+
+ if test $EX_CHECK_STATE = NO; then
+        for ac_prog in pkg-config
+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_PKGCONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$PKGCONFIG"; then
+  ac_cv_prog_PKGCONFIG="$PKGCONFIG" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_PKGCONFIG="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+PKGCONFIG=$ac_cv_prog_PKGCONFIG
+if test -n "$PKGCONFIG"; then
+  { echo "$as_me:$LINENO: result: $PKGCONFIG" >&5
+echo "${ECHO_T}$PKGCONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$PKGCONFIG" && break
+done
+test -n "$PKGCONFIG" || PKGCONFIG="no"
+
+    if test "$PKGCONFIG" != "no"; then
+          if $PKGCONFIG --exists libart-2.0; then
+             CPPFLAGS=${CPPFLAGS}" "`$PKGCONFIG --cflags libart-2.0`
+             LDFLAGS=${LDFLAGS}" "`$PKGCONFIG --libs-only-L libart-2.0`
+             LDFLAGS=${LDFLAGS}" "`$PKGCONFIG --libs-only-other libart-2.0`
+             LIBS=${LIBS}" "`$PKGCONFIG --libs-only-l libart-2.0`
+                    unset ac_cv_lib_art_lgpl_2_art_vpath_add_point
+             { echo "$as_me:$LINENO: checking for art_vpath_add_point in -lart_lgpl_2" >&5
+echo $ECHO_N "checking for art_vpath_add_point in -lart_lgpl_2... $ECHO_C" >&6; }
+if test "${ac_cv_lib_art_lgpl_2_art_vpath_add_point+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lart_lgpl_2  $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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char art_vpath_add_point ();
+int
+main ()
+{
+return art_vpath_add_point ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_art_lgpl_2_art_vpath_add_point=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_lib_art_lgpl_2_art_vpath_add_point=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_art_lgpl_2_art_vpath_add_point" >&5
+echo "${ECHO_T}$ac_cv_lib_art_lgpl_2_art_vpath_add_point" >&6; }
+if test $ac_cv_lib_art_lgpl_2_art_vpath_add_point = yes; then
+
+                unset ac_cv_header_`echo libart_lgpl/libart.h | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+                if test "${ac_cv_header_libart_lgpl_libart_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for libart_lgpl/libart.h" >&5
+echo $ECHO_N "checking for libart_lgpl/libart.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_libart_lgpl_libart_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_libart_lgpl_libart_h" >&5
+echo "${ECHO_T}$ac_cv_header_libart_lgpl_libart_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking libart_lgpl/libart.h usability" >&5
+echo $ECHO_N "checking libart_lgpl/libart.h 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 <libart_lgpl/libart.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; 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 core 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 libart_lgpl/libart.h presence" >&5
+echo $ECHO_N "checking libart_lgpl/libart.h 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 <libart_lgpl/libart.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.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: libart_lgpl/libart.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: libart_lgpl/libart.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libart_lgpl/libart.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: libart_lgpl/libart.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: libart_lgpl/libart.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: libart_lgpl/libart.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libart_lgpl/libart.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: libart_lgpl/libart.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libart_lgpl/libart.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: libart_lgpl/libart.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libart_lgpl/libart.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: libart_lgpl/libart.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libart_lgpl/libart.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: libart_lgpl/libart.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: libart_lgpl/libart.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: libart_lgpl/libart.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for libart_lgpl/libart.h" >&5
+echo $ECHO_N "checking for libart_lgpl/libart.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_libart_lgpl_libart_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_libart_lgpl_libart_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_libart_lgpl_libart_h" >&5
+echo "${ECHO_T}$ac_cv_header_libart_lgpl_libart_h" >&6; }
+
+fi
+if test $ac_cv_header_libart_lgpl_libart_h = yes; then
+  EX_CHECK_STATE=YES
+fi
+
+
+
+fi
+
+          else
+             { echo "$as_me:$LINENO: WARNING:
+----------------------------------------------------------------------------
+* I found a copy of pkgconfig, but there is no libart-2.0.pc file around.
+  You may want to set the PKG_CONFIG_PATH variable to point to its
+  location.
+----------------------------------------------------------------------------
+                       " >&5
+echo "$as_me: WARNING:
+----------------------------------------------------------------------------
+* I found a copy of pkgconfig, but there is no libart-2.0.pc file around.
+  You may want to set the PKG_CONFIG_PATH variable to point to its
+  location.
+----------------------------------------------------------------------------
+                       " >&2;}
+           fi
+     fi
+  fi
+
+  if test ${EX_CHECK_STATE} = NO; then
+     { echo "$as_me:$LINENO: WARNING:
+----------------------------------------------------------------------------
+* I could not find a working copy of libart-2.0. Check config.log for hints on why
+  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
+  so that compiler and the linker can find libart_lgpl_2 and its header files. If
+  you have not installed libart-2.0, you can get it either from its original home on
+
+     ftp://ftp.gnome.org/pub/GNOME/sources/libart_lgpl/2.3/
+
+  You can find also find an archive copy on
+
+     http://oss.oetiker.ch/rrdtool/pub/libs
+
+  The last tested version of libart-2.0 is 2.3.17.
+
+       LIBS=$LIBS
+   LDFLAGS=$LDFLAGS
+  CPPFLAGS=$CPPFLAGS
+
+----------------------------------------------------------------------------
+                " >&5
+echo "$as_me: WARNING:
+----------------------------------------------------------------------------
+* I could not find a working copy of libart-2.0. Check config.log for hints on why
+  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
+  so that compiler and the linker can find libart_lgpl_2 and its header files. If
+  you have not installed libart-2.0, you can get it either from its original home on
+
+     ftp://ftp.gnome.org/pub/GNOME/sources/libart_lgpl/2.3/
+
+  You can find also find an archive copy on
+
+     http://oss.oetiker.ch/rrdtool/pub/libs
+
+  The last tested version of libart-2.0 is 2.3.17.
+
+       LIBS=$LIBS
+   LDFLAGS=$LDFLAGS
+  CPPFLAGS=$CPPFLAGS
+
+----------------------------------------------------------------------------
+                " >&2;}
+       EX_CHECK_ALL_ERR=YES
+       LIBS="${ex_check_save_LIBS}"
+       CPPFLAGS="${ex_check_save_CPPFLAGS}"
+       LDFLAGS="${ex_check_save_LDFLAGS}"
+    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
+
+
+
+
+ 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
+
+ EX_CHECK_STATE=NO
+ ex_check_save_LIBS=${LIBS}
+ ex_check_save_CPPFLAGS=${CPPFLAGS}
+ ex_check_save_LDFLAGS=${LDFLAGS}
+ if test "x""" != "x"; then
+   CPPFLAGS="$CPPFLAGS -I"""
+ fi
+  { echo "$as_me:$LINENO: checking for zlibVersion in -lz" >&5
+echo $ECHO_N "checking for zlibVersion in -lz... $ECHO_C" >&6; }
+if test "${ac_cv_lib_z_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz  $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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char zlibVersion ();
+int
+main ()
+{
+return zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_z_zlibVersion=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_lib_z_zlibVersion=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_lib_z_zlibVersion" >&6; }
+if test $ac_cv_lib_z_zlibVersion = yes; then
+
+    if test "${ac_cv_header_zlib_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for zlib.h" >&5
+echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_zlib_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_zlib_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking zlib.h usability" >&5
+echo $ECHO_N "checking zlib.h 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 <zlib.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; 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 core 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 zlib.h presence" >&5
+echo $ECHO_N "checking zlib.h 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 <zlib.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.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: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: zlib.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: zlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for zlib.h" >&5
+echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_zlib_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_zlib_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_zlib_h" >&6; }
+
+fi
+if test $ac_cv_header_zlib_h = yes; then
+  LIBS="-lz ${LIBS}";EX_CHECK_STATE=YES
+fi
+
+
+fi
+
+ if test $EX_CHECK_STATE = NO; then
+        for ac_prog in pkg-config
+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_PKGCONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$PKGCONFIG"; then
+  ac_cv_prog_PKGCONFIG="$PKGCONFIG" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_PKGCONFIG="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+PKGCONFIG=$ac_cv_prog_PKGCONFIG
+if test -n "$PKGCONFIG"; then
+  { echo "$as_me:$LINENO: result: $PKGCONFIG" >&5
+echo "${ECHO_T}$PKGCONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$PKGCONFIG" && break
+done
+test -n "$PKGCONFIG" || PKGCONFIG="no"
+
+    if test "$PKGCONFIG" != "no"; then
+          if $PKGCONFIG --exists zlib; then
+             CPPFLAGS=${CPPFLAGS}" "`$PKGCONFIG --cflags zlib`
+             LDFLAGS=${LDFLAGS}" "`$PKGCONFIG --libs-only-L zlib`
+             LDFLAGS=${LDFLAGS}" "`$PKGCONFIG --libs-only-other zlib`
+             LIBS=${LIBS}" "`$PKGCONFIG --libs-only-l zlib`
+                    unset ac_cv_lib_z_zlibVersion
+             { echo "$as_me:$LINENO: checking for zlibVersion in -lz" >&5
+echo $ECHO_N "checking for zlibVersion in -lz... $ECHO_C" >&6; }
+if test "${ac_cv_lib_z_zlibVersion+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz  $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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char zlibVersion ();
+int
+main ()
+{
+return zlibVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_z_zlibVersion=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_lib_z_zlibVersion=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_zlibVersion" >&5
+echo "${ECHO_T}$ac_cv_lib_z_zlibVersion" >&6; }
+if test $ac_cv_lib_z_zlibVersion = yes; then
+
+                unset ac_cv_header_`echo zlib.h | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+                if test "${ac_cv_header_zlib_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for zlib.h" >&5
+echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_zlib_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_zlib_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking zlib.h usability" >&5
+echo $ECHO_N "checking zlib.h 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 <zlib.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; 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 core 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 zlib.h presence" >&5
+echo $ECHO_N "checking zlib.h 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 <zlib.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.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: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: zlib.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: zlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for zlib.h" >&5
+echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_zlib_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_zlib_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_zlib_h" >&6; }
+
+fi
+if test $ac_cv_header_zlib_h = yes; then
+  EX_CHECK_STATE=YES
+fi
+
+
+
+fi
+
+          else
+             { echo "$as_me:$LINENO: WARNING:
+----------------------------------------------------------------------------
+* I found a copy of pkgconfig, but there is no zlib.pc file around.
+  You may want to set the PKG_CONFIG_PATH variable to point to its
+  location.
+----------------------------------------------------------------------------
+                       " >&5
+echo "$as_me: WARNING:
+----------------------------------------------------------------------------
+* I found a copy of pkgconfig, but there is no zlib.pc file around.
+  You may want to set the PKG_CONFIG_PATH variable to point to its
+  location.
+----------------------------------------------------------------------------
+                       " >&2;}
+           fi
+     fi
+  fi
+
+  if test ${EX_CHECK_STATE} = NO; then
+     { echo "$as_me:$LINENO: WARNING:
+----------------------------------------------------------------------------
+* I could not find a working copy of zlib. Check config.log for hints on why
+  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
+  so that compiler and the linker can find libz and its header files. If
+  you have not installed zlib, you can get it either from its original home on
+
+     http://www.gzip.org/zlib/
+
+  You can find also find an archive copy on
+
+     http://oss.oetiker.ch/rrdtool/pub/libs
+
+  The last tested version of zlib is 1.2.3.
+
+       LIBS=$LIBS
+   LDFLAGS=$LDFLAGS
+  CPPFLAGS=$CPPFLAGS
+
+----------------------------------------------------------------------------
+                " >&5
+echo "$as_me: WARNING:
+----------------------------------------------------------------------------
+* I could not find a working copy of zlib. Check config.log for hints on why
+  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
+  so that compiler and the linker can find libz and its header files. If
+  you have not installed zlib, you can get it either from its original home on
+
+     http://www.gzip.org/zlib/
+
+  You can find also find an archive copy on
+
+     http://oss.oetiker.ch/rrdtool/pub/libs
+
+  The last tested version of zlib is 1.2.3.
+
+       LIBS=$LIBS
+   LDFLAGS=$LDFLAGS
+  CPPFLAGS=$CPPFLAGS
+
+----------------------------------------------------------------------------
+                " >&2;}
+       EX_CHECK_ALL_ERR=YES
+       LIBS="${ex_check_save_LIBS}"
+       CPPFLAGS="${ex_check_save_CPPFLAGS}"
+       LDFLAGS="${ex_check_save_LDFLAGS}"
+    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
+
+
+
+
+ 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
+
+ EX_CHECK_STATE=NO
+ ex_check_save_LIBS=${LIBS}
+ ex_check_save_CPPFLAGS=${CPPFLAGS}
+ ex_check_save_LDFLAGS=${LDFLAGS}
+ if test "x""" != "x"; then
+   CPPFLAGS="$CPPFLAGS -I"""
+ fi
+  { echo "$as_me:$LINENO: checking for png_access_version_number in -lpng" >&5
+echo $ECHO_N "checking for png_access_version_number in -lpng... $ECHO_C" >&6; }
+if test "${ac_cv_lib_png_png_access_version_number+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpng  $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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char png_access_version_number ();
+int
+main ()
+{
+return png_access_version_number ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_png_png_access_version_number=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_lib_png_png_access_version_number=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_png_png_access_version_number" >&5
+echo "${ECHO_T}$ac_cv_lib_png_png_access_version_number" >&6; }
+if test $ac_cv_lib_png_png_access_version_number = yes; then
+
+    if test "${ac_cv_header_png_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for png.h" >&5
+echo $ECHO_N "checking for png.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_png_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_png_h" >&5
+echo "${ECHO_T}$ac_cv_header_png_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking png.h usability" >&5
+echo $ECHO_N "checking png.h 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 <png.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; 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 core 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 png.h presence" >&5
+echo $ECHO_N "checking png.h 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 <png.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.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: png.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: png.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: png.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: png.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: png.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: png.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: png.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: png.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: png.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: png.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: png.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: png.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: png.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: png.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: png.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: png.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for png.h" >&5
+echo $ECHO_N "checking for png.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_png_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_png_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_png_h" >&5
+echo "${ECHO_T}$ac_cv_header_png_h" >&6; }
+
+fi
+if test $ac_cv_header_png_h = yes; then
+  LIBS="-lpng ${LIBS}";EX_CHECK_STATE=YES
+fi
+
+
+fi
+
+ if test $EX_CHECK_STATE = NO; then
+        for ac_prog in pkg-config
+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_PKGCONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$PKGCONFIG"; then
+  ac_cv_prog_PKGCONFIG="$PKGCONFIG" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_PKGCONFIG="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+PKGCONFIG=$ac_cv_prog_PKGCONFIG
+if test -n "$PKGCONFIG"; then
+  { echo "$as_me:$LINENO: result: $PKGCONFIG" >&5
+echo "${ECHO_T}$PKGCONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$PKGCONFIG" && break
+done
+test -n "$PKGCONFIG" || PKGCONFIG="no"
+
+    if test "$PKGCONFIG" != "no"; then
+          if $PKGCONFIG --exists libpng; then
+             CPPFLAGS=${CPPFLAGS}" "`$PKGCONFIG --cflags libpng`
+             LDFLAGS=${LDFLAGS}" "`$PKGCONFIG --libs-only-L libpng`
+             LDFLAGS=${LDFLAGS}" "`$PKGCONFIG --libs-only-other libpng`
+             LIBS=${LIBS}" "`$PKGCONFIG --libs-only-l libpng`
+                    unset ac_cv_lib_png_png_access_version_number
+             { echo "$as_me:$LINENO: checking for png_access_version_number in -lpng" >&5
+echo $ECHO_N "checking for png_access_version_number in -lpng... $ECHO_C" >&6; }
+if test "${ac_cv_lib_png_png_access_version_number+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpng  $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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char png_access_version_number ();
+int
+main ()
+{
+return png_access_version_number ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_png_png_access_version_number=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_lib_png_png_access_version_number=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_png_png_access_version_number" >&5
+echo "${ECHO_T}$ac_cv_lib_png_png_access_version_number" >&6; }
+if test $ac_cv_lib_png_png_access_version_number = yes; then
+
+                unset ac_cv_header_`echo png.h | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+                if test "${ac_cv_header_png_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for png.h" >&5
+echo $ECHO_N "checking for png.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_png_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_png_h" >&5
+echo "${ECHO_T}$ac_cv_header_png_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking png.h usability" >&5
+echo $ECHO_N "checking png.h 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 <png.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; 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 core 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 png.h presence" >&5
+echo $ECHO_N "checking png.h 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 <png.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.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: png.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: png.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: png.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: png.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: png.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: png.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: png.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: png.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: png.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: png.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: png.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: png.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: png.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: png.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: png.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: png.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for png.h" >&5
+echo $ECHO_N "checking for png.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_png_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_png_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_png_h" >&5
+echo "${ECHO_T}$ac_cv_header_png_h" >&6; }
+
+fi
+if test $ac_cv_header_png_h = yes; then
+  EX_CHECK_STATE=YES
+fi
+
+
+
+fi
+
+          else
+             { echo "$as_me:$LINENO: WARNING:
+----------------------------------------------------------------------------
+* I found a copy of pkgconfig, but there is no libpng.pc file around.
+  You may want to set the PKG_CONFIG_PATH variable to point to its
+  location.
+----------------------------------------------------------------------------
+                       " >&5
+echo "$as_me: WARNING:
+----------------------------------------------------------------------------
+* I found a copy of pkgconfig, but there is no libpng.pc file around.
+  You may want to set the PKG_CONFIG_PATH variable to point to its
+  location.
+----------------------------------------------------------------------------
+                       " >&2;}
+           fi
+     fi
+  fi
+
+  if test ${EX_CHECK_STATE} = NO; then
+     { echo "$as_me:$LINENO: WARNING:
+----------------------------------------------------------------------------
+* I could not find a working copy of libpng. Check config.log for hints on why
+  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
+  so that compiler and the linker can find libpng and its header files. If
+  you have not installed libpng, you can get it either from its original home on
+
+     http://prdownloads.sourceforge.net/libpng/
+
+  You can find also find an archive copy on
+
+     http://oss.oetiker.ch/rrdtool/pub/libs
+
+  The last tested version of libpng is 1.2.10.
+
+       LIBS=$LIBS
+   LDFLAGS=$LDFLAGS
+  CPPFLAGS=$CPPFLAGS
+
+----------------------------------------------------------------------------
+                " >&5
+echo "$as_me: WARNING:
+----------------------------------------------------------------------------
+* I could not find a working copy of libpng. Check config.log for hints on why
+  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
+  so that compiler and the linker can find libpng and its header files. If
+  you have not installed libpng, you can get it either from its original home on
+
+     http://prdownloads.sourceforge.net/libpng/
+
+  You can find also find an archive copy on
+
+     http://oss.oetiker.ch/rrdtool/pub/libs
+
+  The last tested version of libpng is 1.2.10.
+
+       LIBS=$LIBS
+   LDFLAGS=$LDFLAGS
+  CPPFLAGS=$CPPFLAGS
+
+----------------------------------------------------------------------------
+                " >&2;}
+       EX_CHECK_ALL_ERR=YES
+       LIBS="${ex_check_save_LIBS}"
+       CPPFLAGS="${ex_check_save_CPPFLAGS}"
+       LDFLAGS="${ex_check_save_LDFLAGS}"
+    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
+
+
+
+
+ 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
+
+ EX_CHECK_STATE=NO
+ ex_check_save_LIBS=${LIBS}
+ ex_check_save_CPPFLAGS=${CPPFLAGS}
+ ex_check_save_LDFLAGS=${LDFLAGS}
+ if test "x/usr/include/freetype2" != "x"; then
+   CPPFLAGS="$CPPFLAGS -I/usr/include/freetype2"
+ fi
+  { echo "$as_me:$LINENO: checking for FT_Init_FreeType in -lfreetype" >&5
+echo $ECHO_N "checking for FT_Init_FreeType in -lfreetype... $ECHO_C" >&6; }
+if test "${ac_cv_lib_freetype_FT_Init_FreeType+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lfreetype  $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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char FT_Init_FreeType ();
+int
+main ()
+{
+return FT_Init_FreeType ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_freetype_FT_Init_FreeType=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_lib_freetype_FT_Init_FreeType=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_freetype_FT_Init_FreeType" >&5
+echo "${ECHO_T}$ac_cv_lib_freetype_FT_Init_FreeType" >&6; }
+if test $ac_cv_lib_freetype_FT_Init_FreeType = yes; then
+
+    if test "${ac_cv_header_ft2build_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for ft2build.h" >&5
+echo $ECHO_N "checking for ft2build.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_ft2build_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_ft2build_h" >&5
+echo "${ECHO_T}$ac_cv_header_ft2build_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking ft2build.h usability" >&5
+echo $ECHO_N "checking ft2build.h 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 <ft2build.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; 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 core 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 ft2build.h presence" >&5
+echo $ECHO_N "checking ft2build.h 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 <ft2build.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.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: ft2build.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ft2build.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ft2build.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ft2build.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: ft2build.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ft2build.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ft2build.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ft2build.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ft2build.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ft2build.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ft2build.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ft2build.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ft2build.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ft2build.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ft2build.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ft2build.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for ft2build.h" >&5
+echo $ECHO_N "checking for ft2build.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_ft2build_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_ft2build_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_ft2build_h" >&5
+echo "${ECHO_T}$ac_cv_header_ft2build_h" >&6; }
+
+fi
+if test $ac_cv_header_ft2build_h = yes; then
+  LIBS="-lfreetype ${LIBS}";EX_CHECK_STATE=YES
+fi
+
+
+fi
+
+ if test $EX_CHECK_STATE = NO; then
+        for ac_prog in pkg-config
+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_PKGCONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$PKGCONFIG"; then
+  ac_cv_prog_PKGCONFIG="$PKGCONFIG" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_PKGCONFIG="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+PKGCONFIG=$ac_cv_prog_PKGCONFIG
+if test -n "$PKGCONFIG"; then
+  { echo "$as_me:$LINENO: result: $PKGCONFIG" >&5
+echo "${ECHO_T}$PKGCONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$PKGCONFIG" && break
+done
+test -n "$PKGCONFIG" || PKGCONFIG="no"
+
+    if test "$PKGCONFIG" != "no"; then
+          if $PKGCONFIG --exists freetype2; then
+             CPPFLAGS=${CPPFLAGS}" "`$PKGCONFIG --cflags freetype2`
+             LDFLAGS=${LDFLAGS}" "`$PKGCONFIG --libs-only-L freetype2`
+             LDFLAGS=${LDFLAGS}" "`$PKGCONFIG --libs-only-other freetype2`
+             LIBS=${LIBS}" "`$PKGCONFIG --libs-only-l freetype2`
+                    unset ac_cv_lib_freetype_FT_Init_FreeType
+             { echo "$as_me:$LINENO: checking for FT_Init_FreeType in -lfreetype" >&5
+echo $ECHO_N "checking for FT_Init_FreeType in -lfreetype... $ECHO_C" >&6; }
+if test "${ac_cv_lib_freetype_FT_Init_FreeType+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lfreetype  $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 GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char FT_Init_FreeType ();
+int
+main ()
+{
+return FT_Init_FreeType ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_freetype_FT_Init_FreeType=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_lib_freetype_FT_Init_FreeType=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_freetype_FT_Init_FreeType" >&5
+echo "${ECHO_T}$ac_cv_lib_freetype_FT_Init_FreeType" >&6; }
+if test $ac_cv_lib_freetype_FT_Init_FreeType = yes; then
+
+                unset ac_cv_header_`echo ft2build.h | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+                if test "${ac_cv_header_ft2build_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for ft2build.h" >&5
+echo $ECHO_N "checking for ft2build.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_ft2build_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_ft2build_h" >&5
+echo "${ECHO_T}$ac_cv_header_ft2build_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking ft2build.h usability" >&5
+echo $ECHO_N "checking ft2build.h 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 <ft2build.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; 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 core 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 ft2build.h presence" >&5
+echo $ECHO_N "checking ft2build.h 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 <ft2build.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.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: ft2build.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: ft2build.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ft2build.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: ft2build.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: ft2build.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: ft2build.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ft2build.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: ft2build.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ft2build.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: ft2build.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ft2build.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: ft2build.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ft2build.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: ft2build.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: ft2build.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: ft2build.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for ft2build.h" >&5
+echo $ECHO_N "checking for ft2build.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_ft2build_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_ft2build_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_ft2build_h" >&5
+echo "${ECHO_T}$ac_cv_header_ft2build_h" >&6; }
+
+fi
+if test $ac_cv_header_ft2build_h = yes; then
+  EX_CHECK_STATE=YES
+fi
+
+
+
+fi
+
+          else
+             { echo "$as_me:$LINENO: WARNING:
+----------------------------------------------------------------------------
+* I found a copy of pkgconfig, but there is no freetype2.pc file around.
+  You may want to set the PKG_CONFIG_PATH variable to point to its
+  location.
+----------------------------------------------------------------------------
+                       " >&5
+echo "$as_me: WARNING:
+----------------------------------------------------------------------------
+* I found a copy of pkgconfig, but there is no freetype2.pc file around.
+  You may want to set the PKG_CONFIG_PATH variable to point to its
+  location.
+----------------------------------------------------------------------------
+                       " >&2;}
+           fi
+     fi
+  fi
+
+  if test ${EX_CHECK_STATE} = NO; then
+     { echo "$as_me:$LINENO: WARNING:
+----------------------------------------------------------------------------
+* I could not find a working copy of freetype2. Check config.log for hints on why
+  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
+  so that compiler and the linker can find libfreetype and its header files. If
+  you have not installed freetype2, you can get it either from its original home on
+
+     http://prdownloads.sourceforge.net/freetype/
+
+  You can find also find an archive copy on
+
+     http://oss.oetiker.ch/rrdtool/pub/libs
+
+  The last tested version of freetype2 is 2.1.10.
+
+       LIBS=$LIBS
+   LDFLAGS=$LDFLAGS
+  CPPFLAGS=$CPPFLAGS
+
+----------------------------------------------------------------------------
+                " >&5
+echo "$as_me: WARNING:
+----------------------------------------------------------------------------
+* I could not find a working copy of freetype2. Check config.log for hints on why
+  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
+  so that compiler and the linker can find libfreetype and its header files. If
+  you have not installed freetype2, you can get it either from its original home on
+
+     http://prdownloads.sourceforge.net/freetype/
+
+  You can find also find an archive copy on
+
+     http://oss.oetiker.ch/rrdtool/pub/libs
+
+  The last tested version of freetype2 is 2.1.10.
+
+       LIBS=$LIBS
+   LDFLAGS=$LDFLAGS
+  CPPFLAGS=$CPPFLAGS
+
+----------------------------------------------------------------------------
+                " >&2;}
+       EX_CHECK_ALL_ERR=YES
+       LIBS="${ex_check_save_LIBS}"
+       CPPFLAGS="${ex_check_save_CPPFLAGS}"
+       LDFLAGS="${ex_check_save_LDFLAGS}"
+    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 "$EX_CHECK_ALL_ERR" = "YES"; then
+  { { echo "$as_me:$LINENO: error: Please fix the library issues listed above and try again." >&5
+echo "$as_me: error: Please fix the library issues listed above and try again." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ALL_LIBS="$LIBS"
+LIBS=
+
+
+
+
+
+case $TERM in
+       #   for the most important terminal types we directly know the sequences
+       xterm|xterm*|vt220|vt220*)
+               T_MD=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </dev/null 2>/dev/null`
+               T_ME=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/null 2>/dev/null`
+       ;;
+       vt100|vt100*|cygwin)
+               T_MD=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' </dev/null 2>/dev/null`
+               T_ME=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' </dev/null 2>/dev/null`
+       ;;
+       *)
+               T_MD=''
+               T_ME=''
+       ;;
+esac
+  { echo "$as_me:$LINENO: result: " >&5
+echo "${ECHO_T}" >&6; }
+  { echo "$as_me:$LINENO: result: ${T_MD}Prep for Building Language Bindings${T_ME}" >&5
+echo "${ECHO_T}${T_MD}Prep for Building Language Bindings${T_ME}" >&6; }
+
+
+# Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; 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_PERL+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $PERL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PERL="$PERL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PERL="$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
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_PERL" && ac_cv_path_PERL="no"
+  ;;
+esac
+fi
+PERL=$ac_cv_path_PERL
+if test -n "$PERL"; then
+  { echo "$as_me:$LINENO: result: $PERL" >&5
+echo "${ECHO_T}$PERL" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+# Check whether --enable-perl was given.
+if test "${enable_perl+set}" = set; then
+  enableval=$enable_perl;
+else
+  enable_perl=yes
+fi
+
+
+
+
+
+
+
+
+if test "x$PERL" = "xno" -o  x$enable_perl = xno; then
+       COMP_PERL=
+else
+       COMP_PERL="perl_piped perl_shared"
+        { echo "$as_me:$LINENO: checking for the perl version you are running" >&5
+echo $ECHO_N "checking for the perl version you are running... $ECHO_C" >&6; }
+       PERL_VERSION=`$PERL -MConfig -e 'print $Config{version}'`
+       { echo "$as_me:$LINENO: result: $PERL_VERSION" >&5
+echo "${ECHO_T}$PERL_VERSION" >&6; }
+        if test -z "$PERLCC"; then
+            { echo "$as_me:$LINENO: checking for the C compiler perl wants to use to build its modules" >&5
+echo $ECHO_N "checking for the C compiler perl wants to use to build its modules... $ECHO_C" >&6; }
+           perlcc=`$PERL -MConfig -e 'print $Config{cc}'`
+           { echo "$as_me:$LINENO: result: $perlcc" >&5
+echo "${ECHO_T}$perlcc" >&6; }
+           if test ! -x "$perlcc"; then
+               # Extract the first word of "${perlcc}", so it can be a program name with args.
+set dummy ${perlcc}; 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_PERL_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $PERL_CC in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PERL_CC="$PERL_CC" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PERL_CC="$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
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_PERL_CC" && ac_cv_path_PERL_CC="no"
+  ;;
+esac
+fi
+PERL_CC=$ac_cv_path_PERL_CC
+if test -n "$PERL_CC"; then
+  { echo "$as_me:$LINENO: result: $PERL_CC" >&5
+echo "${ECHO_T}$PERL_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+               if test "$PERL_CC" = "no"; then
+                    { echo "$as_me:$LINENO: WARNING:
+I would not find the Compiler ($perlcc) that was originally used to compile
+your perl binary. You should either make sure that this compiler is
+available on your system, pick an other compiler and set PERLCC
+appropriately, or use a different perl setup that was compiled locally.
+
+I will disable the compilation of the RRDs perl module for now.
+" >&5
+echo "$as_me: WARNING:
+I would not find the Compiler ($perlcc) that was originally used to compile
+your perl binary. You should either make sure that this compiler is
+available on your system, pick an other compiler and set PERLCC
+appropriately, or use a different perl setup that was compiled locally.
+
+I will disable the compilation of the RRDs perl module for now.
+" >&2;}
+                   COMP_PERL="perl_piped"
+               fi
+            fi
+        fi
+fi
+
+{ echo "$as_me:$LINENO: checking Perl Modules to build" >&5
+echo $ECHO_N "checking Perl Modules to build... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: ${COMP_PERL:-No Perl Modules will be built}" >&5
+echo "${ECHO_T}${COMP_PERL:-No Perl Modules will be built}" >&6; }
+
+# Options to pass when configuring perl module
+ppref=$prefix
+test "$ppref" = "NONE" && ppref=$ac_default_prefix
+
+PERL_MAKE_OPTIONS="PREFIX=$ppref LIB=$ppref/lib/perl/$PERL_VERSION"
+
+# Check whether --enable-perl-site-install was given.
+if test "${enable_perl_site_install+set}" = set; then
+  enableval=$enable_perl_site_install; PERL_MAKE_OPTIONS=
+fi
+
+
+if test ! -z "$PERLCC"; then
+   PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS CC=$PERLCC"
+
+   if test ! -z "$PERLCCFLAGS"; then
+       PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS CCFLAGS=$PERLCCFLAGS"
+   fi
+
+   if test -z "$PERLLD"; then
+       PERLLD=$PERLCC
+   fi
+   PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS LD=$PERLLD"
+
+   if test ! -z "$PERLLDFLAGS"; then
+       PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS LDFLAGS=$PERLLDFLAGS"
+   fi
+fi
+
+
+# Check whether --with-perl-options was given.
+if test "${with_perl_options+set}" = set; then
+  withval=$with_perl_options; PERL_MAKE_OPTIONS=$withval
+fi
+
+
+
+
+
+
+
+# Extract the first word of "ruby", so it can be a program name with args.
+set dummy ruby; 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_RUBY+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $RUBY in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_RUBY="$RUBY" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_RUBY="$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
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_RUBY" && ac_cv_path_RUBY="no"
+  ;;
+esac
+fi
+RUBY=$ac_cv_path_RUBY
+if test -n "$RUBY"; then
+  { echo "$as_me:$LINENO: result: $RUBY" >&5
+echo "${ECHO_T}$RUBY" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+# Check whether --enable-ruby was given.
+if test "${enable_ruby+set}" = set; then
+  enableval=$enable_ruby;
+else
+  enable_ruby=yes
+fi
+
+
+{ echo "$as_me:$LINENO: checking if ruby modules can be built" >&5
+echo $ECHO_N "checking if ruby modules can be built... $ECHO_C" >&6; }
+
+if test "x$RUBY" = "xno" -o  x$enable_ruby = xno; then
+       COMP_RUBY=
+       { echo "$as_me:$LINENO: result: No .. Ruby not found or disabled" >&5
+echo "${ECHO_T}No .. Ruby not found or disabled" >&6; }
+else
+       if $RUBY -e 'require "mkmf"' >/dev/null 2>&1; then
+               COMP_RUBY="ruby"
+               { echo "$as_me:$LINENO: result: YES" >&5
+echo "${ECHO_T}YES" >&6; }
+       else
+               COMP_RUBY=
+               { echo "$as_me:$LINENO: result: Ruby found but mkmf is missing! Install the -dev package" >&5
+echo "${ECHO_T}Ruby found but mkmf is missing! Install the -dev package" >&6; }
+       fi
+fi
+
+
+# Check whether --enable-ruby-site-install was given.
+if test "${enable_ruby_site_install+set}" = set; then
+  enableval=$enable_ruby_site_install; RUBY_MAKE_OPTIONS=
+else
+  RUBY_MAKE_OPTIONS="sitedir=$prefix/lib/ruby"
+fi
+
+
+
+
+# Check whether --with-ruby-options was given.
+if test "${with_ruby_options+set}" = set; then
+  withval=$with_ruby_options; RUBY_MAKE_OPTIONS=$withval
+fi
+
+
+
+
+
+
+
+enable_tcl_site=no
+
+# Check whether --enable-tcl was given.
+if test "${enable_tcl+set}" = set; then
+  enableval=$enable_tcl;
+else
+  enable_tcl=yes
+fi
+
+
+if test  "$enable_tcl" = "yes"; then
+    withval=""
+
+# Check whether --with-tcllib was given.
+if test "${with_tcllib+set}" = set; then
+  withval=$with_tcllib;
+fi
+
+  enable_tcl=no
+  for dir in $withval /usr/lib /usr/local/lib; do
+    { echo "$as_me:$LINENO: checking for tclConfig.sh in $dir" >&5
+echo $ECHO_N "checking for tclConfig.sh in $dir... $ECHO_C" >&6; }
+    if test -f "$dir/tclConfig.sh" ; then
+       tcl_config=$dir/tclConfig.sh
+        enable_tcl=yes
+        { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+        break
+    else
+        { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+    fi
+  done
+
+  if test "$enable_tcl" = "no"; then
+        { echo "$as_me:$LINENO: WARNING: tclConfig.sh not found - Tcl interface won't be built" >&5
+echo "$as_me: WARNING: tclConfig.sh not found - Tcl interface won't be built" >&2;}
+  else
+       . $tcl_config
+       TCL_PACKAGE_DIR="$TCL_PACKAGE_PATH/tclrrd$VERSION"
+  fi
+  # Check whether --enable-tcl was given.
+if test "${enable_tcl+set}" = set; then
+  enableval=$enable_tcl;
+else
+  enable_tcl_site=yes
+fi
+
+
+fi
+
+
+
+if test "$enable_tcl" = "yes" ; then
+  BUILD_TCL_TRUE=
+  BUILD_TCL_FALSE='#'
+else
+  BUILD_TCL_TRUE='#'
+  BUILD_TCL_FALSE=
+fi
+
+
+
+if test "$enable_tcl_site" = "yes" ; then
+  BUILD_TCL_SITE_TRUE=
+  BUILD_TCL_SITE_FALSE='#'
+else
+  BUILD_TCL_SITE_TRUE='#'
+  BUILD_TCL_SITE_FALSE=
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --enable-python was given.
+if test "${enable_python+set}" = set; then
+  enableval=$enable_python;
+else
+  enable_python=yes
+fi
+
+
+if test  "$enable_python" = "yes"; then
+
+
+
+
+        if test -n "$PYTHON"; then
+      # If the user set $PYTHON, use it and don't search something else.
+      { echo "$as_me:$LINENO: checking whether $PYTHON version >= 2.3" >&5
+echo $ECHO_N "checking whether $PYTHON version >= 2.3... $ECHO_C" >&6; }
+      prog="import sys, string
+# split strings by '.' and convert to numeric.  Append some zeros
+# because we need at least 4 digits for the hex conversion.
+minver = map(int, string.split('2.3', '.')) + [0, 0, 0]
+minverhex = 0
+for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[i]
+sys.exit(sys.hexversion < minverhex)"
+  if { echo "$as_me:$LINENO: $PYTHON -c "$prog"" >&5
+   ($PYTHON -c "$prog") >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+  { { echo "$as_me:$LINENO: error: too old" >&5
+echo "$as_me: error: too old" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+      am_display_PYTHON=$PYTHON
+    else
+      # Otherwise, try each interpreter until we find one that satisfies
+      # VERSION.
+      { echo "$as_me:$LINENO: checking for a Python interpreter with version >= 2.3" >&5
+echo $ECHO_N "checking for a Python interpreter with version >= 2.3... $ECHO_C" >&6; }
+if test "${am_cv_pathless_PYTHON+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+       for am_cv_pathless_PYTHON in python python2 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 none; do
+         test "$am_cv_pathless_PYTHON" = none && break
+         prog="import sys, string
+# split strings by '.' and convert to numeric.  Append some zeros
+# because we need at least 4 digits for the hex conversion.
+minver = map(int, string.split('2.3', '.')) + [0, 0, 0]
+minverhex = 0
+for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[i]
+sys.exit(sys.hexversion < minverhex)"
+  if { echo "$as_me:$LINENO: $am_cv_pathless_PYTHON -c "$prog"" >&5
+   ($am_cv_pathless_PYTHON -c "$prog") >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }; then
+  break
+fi
+
+       done
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_pathless_PYTHON" >&5
+echo "${ECHO_T}$am_cv_pathless_PYTHON" >&6; }
+      # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
+      if test "$am_cv_pathless_PYTHON" = none; then
+       PYTHON=:
+      else
+        # Extract the first word of "$am_cv_pathless_PYTHON", so it can be a program name with args.
+set dummy $am_cv_pathless_PYTHON; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_PYTHON+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $PYTHON in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PYTHON=$ac_cv_path_PYTHON
+if test -n "$PYTHON"; then
+  { echo "$as_me:$LINENO: result: $PYTHON" >&5
+echo "${ECHO_T}$PYTHON" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+      fi
+      am_display_PYTHON=$am_cv_pathless_PYTHON
+    fi
+
+
+  if test "$PYTHON" = :; then
+      enable_python=no
+  else
+
+
+  { echo "$as_me:$LINENO: checking for $am_display_PYTHON version" >&5
+echo $ECHO_N "checking for $am_display_PYTHON version... $ECHO_C" >&6; }
+if test "${am_cv_python_version+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  am_cv_python_version=`$PYTHON -c "import sys; print sys.version[:3]"`
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_python_version" >&5
+echo "${ECHO_T}$am_cv_python_version" >&6; }
+  PYTHON_VERSION=$am_cv_python_version
+
+
+
+  PYTHON_PREFIX='${prefix}'
+
+  PYTHON_EXEC_PREFIX='${exec_prefix}'
+
+
+
+  { echo "$as_me:$LINENO: checking for $am_display_PYTHON platform" >&5
+echo $ECHO_N "checking for $am_display_PYTHON platform... $ECHO_C" >&6; }
+if test "${am_cv_python_platform+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"`
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_python_platform" >&5
+echo "${ECHO_T}$am_cv_python_platform" >&6; }
+  PYTHON_PLATFORM=$am_cv_python_platform
+
+
+
+
+                { echo "$as_me:$LINENO: checking for $am_display_PYTHON script directory" >&5
+echo $ECHO_N "checking for $am_display_PYTHON script directory... $ECHO_C" >&6; }
+if test "${am_cv_python_pythondir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')" 2>/dev/null ||
+     echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_python_pythondir" >&5
+echo "${ECHO_T}$am_cv_python_pythondir" >&6; }
+  pythondir=$am_cv_python_pythondir
+
+
+
+  pkgpythondir=\${pythondir}/$PACKAGE
+
+
+            { echo "$as_me:$LINENO: checking for $am_display_PYTHON extension module directory" >&5
+echo $ECHO_N "checking for $am_display_PYTHON extension module directory... $ECHO_C" >&6; }
+if test "${am_cv_python_pyexecdir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')" 2>/dev/null ||
+     echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_python_pyexecdir" >&5
+echo "${ECHO_T}$am_cv_python_pyexecdir" >&6; }
+  pyexecdir=$am_cv_python_pyexecdir
+
+
+
+  pkgpyexecdir=\${pyexecdir}/$PACKAGE
+
+
+
+  fi
+
+
+
+{ echo "$as_me:$LINENO: checking for headers required to compile python extensions" >&5
+echo $ECHO_N "checking for headers required to compile python extensions... $ECHO_C" >&6; }
+py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
+py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
+PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
+if test "$py_prefix" != "$py_exec_prefix"; then
+  PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
+fi
+
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <Python.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
+  { echo "$as_me:$LINENO: result: found" >&5
+echo "${ECHO_T}found" >&6; }
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  { echo "$as_me:$LINENO: result: not found" >&5
+echo "${ECHO_T}not found" >&6; }
+enable_python=no;{ echo "$as_me:$LINENO: WARNING: could not find Python headers" >&5
+echo "$as_me: WARNING: could not find Python headers" >&2;}
+fi
+
+rm -f conftest.err conftest.$ac_ext
+CPPFLAGS="$save_CPPFLAGS"
+
+fi
+
+if test  x$enable_python = xno; then
+       COMP_PYTHON=
+else
+       COMP_PYTHON="python"
+fi
+
+
+
+for ac_prog in gnroff nroff
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_NROFF+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $NROFF in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_NROFF="$NROFF" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_NROFF="$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
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+NROFF=$ac_cv_path_NROFF
+if test -n "$NROFF"; then
+  { echo "$as_me:$LINENO: result: $NROFF" >&5
+echo "${ECHO_T}$NROFF" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$NROFF" && break
+done
+
+for ac_prog in groff troff
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_TROFF+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $TROFF in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_TROFF="$TROFF" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_TROFF="$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
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+TROFF=$ac_cv_path_TROFF
+if test -n "$TROFF"; then
+  { echo "$as_me:$LINENO: result: $TROFF" >&5
+echo "${ECHO_T}$TROFF" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$TROFF" && break
+done
+
+
+
+if test -z "$RRDDOCDIR"; then
+   RRDDOCDIR='${datadir}/doc/${PACKAGE}-${VERSION}'; fi
+
+
+
+case $TERM in
+       #   for the most important terminal types we directly know the sequences
+       xterm|xterm*|vt220|vt220*)
+               T_MD=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </dev/null 2>/dev/null`
+               T_ME=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/null 2>/dev/null`
+       ;;
+       vt100|vt100*|cygwin)
+               T_MD=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' </dev/null 2>/dev/null`
+               T_ME=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' </dev/null 2>/dev/null`
+       ;;
+       *)
+               T_MD=''
+               T_ME=''
+       ;;
+esac
+  { echo "$as_me:$LINENO: result: " >&5
+echo "${ECHO_T}" >&6; }
+  { echo "$as_me:$LINENO: result: ${T_MD}Apply Configuration Information${T_ME}" >&5
+echo "${ECHO_T}${T_MD}Apply Configuration Information${T_ME}" >&6; }
+
+
+ac_config_files="$ac_config_files examples/shared-demo.pl"
+
+ac_config_files="$ac_config_files examples/piped-demo.pl"
+
+ac_config_files="$ac_config_files examples/stripes.pl"
+
+ac_config_files="$ac_config_files examples/bigtops.pl"
+
+ac_config_files="$ac_config_files examples/minmax.pl"
+
+ac_config_files="$ac_config_files examples/4charts.pl"
+
+ac_config_files="$ac_config_files examples/perftest.pl"
+
+ac_config_files="$ac_config_files examples/Makefile"
+
+ac_config_files="$ac_config_files doc/Makefile"
+
+ac_config_files="$ac_config_files src/Makefile"
+
+ac_config_files="$ac_config_files bindings/Makefile"
+
+ac_config_files="$ac_config_files bindings/tcl/Makefile"
+
+ac_config_files="$ac_config_files bindings/tcl/ifOctets.tcl"
+
+ac_config_files="$ac_config_files Makefile"
+
+
+ac_config_commands="$ac_config_commands default"
+
+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, we kill variables containing newlines.
+# 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.
+(
+  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
+
+  (set) 2>&1 |
+    case $as_nl`(ac_space=' '; set) 2>&1` in #(
+    *${as_nl}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 "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+) |
+  sed '
+     /^ac_cv_env_/b end
+     t clear
+     :clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     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 "$as_me:$LINENO: updating cache $cache_file" >&5
+echo "$as_me: updating cache $cache_file" >&6;}
+    cat confcache >$cache_file
+  else
+    { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+  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}'
+
+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_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`echo "$ac_i" | sed "$ac_script"`
+  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+  #    will be set to the directory where LIBOBJS objects are built.
+  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+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 "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_MULTITHREAD_TRUE}" && test -z "${BUILD_MULTITHREAD_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_MULTITHREAD\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_MULTITHREAD\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_RRDCGI_TRUE}" && test -z "${BUILD_RRDCGI_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_RRDCGI\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_RRDCGI\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_TCL_TRUE}" && test -z "${BUILD_TCL_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_TCL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_TCL\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_TCL_SITE_TRUE}" && test -z "${BUILD_TCL_SITE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"BUILD_TCL_SITE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"BUILD_TCL_SITE\" 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 more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+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+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# 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
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" ""       $as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+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
+IFS=$as_save_IFS
+
+     ;;
+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_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+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) >/dev/null 2>&1 && $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; 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'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+  # 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 after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, 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
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\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 sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s='ln -s'
+  # ... but there are two gotchas:
+  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+  # In both cases, we have to default to `cp -p'.
+  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+    as_ln_s='cp -p'
+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$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+        test -d "$1/.";
+      else
+       case $1 in
+        -*)set "./$1";;
+       esac;
+       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+       ???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# 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'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by rrdtool $as_me 1.2.26, which was
+generated by GNU Autoconf 2.61.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+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 and configuration settings, 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="\\
+rrdtool config.status 1.2.26
+configured by $0, generated by GNU Autoconf 2.61,
+  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2006 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+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
+    ;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    echo "$ac_cs_version"; exit ;;
+  --debug | --debu | --deb | --de | --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;;
+  --he | --h)
+    # Conflict between --help and --header
+    { 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 ;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { 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"
+     ac_need_defaults=false ;;
+
+  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 CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  CONFIG_SHELL=$SHELL
+  export CONFIG_SHELL
+  exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+  case $ac_config_target in
+    "rrd_config.h") CONFIG_HEADERS="$CONFIG_HEADERS rrd_config.h" ;;
+    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "examples/shared-demo.pl") CONFIG_FILES="$CONFIG_FILES examples/shared-demo.pl" ;;
+    "examples/piped-demo.pl") CONFIG_FILES="$CONFIG_FILES examples/piped-demo.pl" ;;
+    "examples/stripes.pl") CONFIG_FILES="$CONFIG_FILES examples/stripes.pl" ;;
+    "examples/bigtops.pl") CONFIG_FILES="$CONFIG_FILES examples/bigtops.pl" ;;
+    "examples/minmax.pl") CONFIG_FILES="$CONFIG_FILES examples/minmax.pl" ;;
+    "examples/4charts.pl") CONFIG_FILES="$CONFIG_FILES examples/4charts.pl" ;;
+    "examples/perftest.pl") CONFIG_FILES="$CONFIG_FILES examples/perftest.pl" ;;
+    "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
+    "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
+    "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+    "bindings/Makefile") CONFIG_FILES="$CONFIG_FILES bindings/Makefile" ;;
+    "bindings/tcl/Makefile") CONFIG_FILES="$CONFIG_FILES bindings/tcl/Makefile" ;;
+    "bindings/tcl/ifOctets.tcl") CONFIG_FILES="$CONFIG_FILES bindings/tcl/ifOctets.tcl" ;;
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
+
+  *) { { 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 against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+  tmp=
+  trap 'exit_status=$?
+  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$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 "./confXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+#
+# Set up the sed scripts for 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
+
+_ACEOF
+
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+PERLFLAGS!$PERLFLAGS$ac_delim
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+NUMVERS!$NUMVERS$ac_delim
+build!$build$ac_delim
+build_cpu!$build_cpu$ac_delim
+build_vendor!$build_vendor$ac_delim
+build_os!$build_os$ac_delim
+host!$host$ac_delim
+host_cpu!$host_cpu$ac_delim
+host_vendor!$host_vendor$ac_delim
+host_os!$host_os$ac_delim
+target!$target$ac_delim
+target_cpu!$target_cpu$ac_delim
+target_vendor!$target_vendor$ac_delim
+target_os!$target_os$ac_delim
+INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
+INSTALL_DATA!$INSTALL_DATA$ac_delim
+CYGPATH_W!$CYGPATH_W$ac_delim
+PACKAGE!$PACKAGE$ac_delim
+VERSION!$VERSION$ac_delim
+ACLOCAL!$ACLOCAL$ac_delim
+AUTOCONF!$AUTOCONF$ac_delim
+AUTOMAKE!$AUTOMAKE$ac_delim
+AUTOHEADER!$AUTOHEADER$ac_delim
+MAKEINFO!$MAKEINFO$ac_delim
+install_sh!$install_sh$ac_delim
+STRIP!$STRIP$ac_delim
+INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
+mkdir_p!$mkdir_p$ac_delim
+AWK!$AWK$ac_delim
+SET_MAKE!$SET_MAKE$ac_delim
+am__leading_dot!$am__leading_dot$ac_delim
+AMTAR!$AMTAR$ac_delim
+am__tar!$am__tar$ac_delim
+am__untar!$am__untar$ac_delim
+RRDGRAPH_YLEGEND_ANGLE!$RRDGRAPH_YLEGEND_ANGLE$ac_delim
+CC!$CC$ac_delim
+CFLAGS!$CFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CC!$ac_ct_CC$ac_delim
+EXEEXT!$EXEEXT$ac_delim
+OBJEXT!$OBJEXT$ac_delim
+DEPDIR!$DEPDIR$ac_delim
+am__include!$am__include$ac_delim
+am__quote!$am__quote$ac_delim
+AMDEP_TRUE!$AMDEP_TRUE$ac_delim
+AMDEP_FALSE!$AMDEP_FALSE$ac_delim
+AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
+CCDEPMODE!$CCDEPMODE$ac_delim
+am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
+am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
+CPP!$CPP$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$ac_delim
+LN_S!$LN_S$ac_delim
+ECHO!$ECHO$ac_delim
+AR!$AR$ac_delim
+RANLIB!$RANLIB$ac_delim
+CXX!$CXX$ac_delim
+_ACEOF
+
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
+    break
+  elif $ac_last_try; then
+    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+  ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+CEOF$ac_eof
+_ACEOF
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+CXXFLAGS!$CXXFLAGS$ac_delim
+ac_ct_CXX!$ac_ct_CXX$ac_delim
+CXXDEPMODE!$CXXDEPMODE$ac_delim
+am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim
+am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim
+CXXCPP!$CXXCPP$ac_delim
+F77!$F77$ac_delim
+FFLAGS!$FFLAGS$ac_delim
+ac_ct_F77!$ac_ct_F77$ac_delim
+LIBTOOL!$LIBTOOL$ac_delim
+RRD_DEFAULT_FONT!$RRD_DEFAULT_FONT$ac_delim
+MULTITHREAD_CFLAGS!$MULTITHREAD_CFLAGS$ac_delim
+MULTITHREAD_LDFLAGS!$MULTITHREAD_LDFLAGS$ac_delim
+acx_pthread_config!$acx_pthread_config$ac_delim
+PTHREAD_CC!$PTHREAD_CC$ac_delim
+PTHREAD_LIBS!$PTHREAD_LIBS$ac_delim
+PTHREAD_CFLAGS!$PTHREAD_CFLAGS$ac_delim
+BUILD_MULTITHREAD_TRUE!$BUILD_MULTITHREAD_TRUE$ac_delim
+BUILD_MULTITHREAD_FALSE!$BUILD_MULTITHREAD_FALSE$ac_delim
+BUILD_RRDCGI_TRUE!$BUILD_RRDCGI_TRUE$ac_delim
+BUILD_RRDCGI_FALSE!$BUILD_RRDCGI_FALSE$ac_delim
+PKGCONFIG!$PKGCONFIG$ac_delim
+CORE_LIBS!$CORE_LIBS$ac_delim
+ALL_LIBS!$ALL_LIBS$ac_delim
+PERL!$PERL$ac_delim
+PERLCC!$PERLCC$ac_delim
+PERLCCFLAGS!$PERLCCFLAGS$ac_delim
+PERLLD!$PERLLD$ac_delim
+PERLLDFLAGS!$PERLLDFLAGS$ac_delim
+PERL_CC!$PERL_CC$ac_delim
+PERL_MAKE_OPTIONS!$PERL_MAKE_OPTIONS$ac_delim
+COMP_PERL!$COMP_PERL$ac_delim
+PERL_VERSION!$PERL_VERSION$ac_delim
+RUBY!$RUBY$ac_delim
+RUBY_MAKE_OPTIONS!$RUBY_MAKE_OPTIONS$ac_delim
+COMP_RUBY!$COMP_RUBY$ac_delim
+BUILD_TCL_TRUE!$BUILD_TCL_TRUE$ac_delim
+BUILD_TCL_FALSE!$BUILD_TCL_FALSE$ac_delim
+BUILD_TCL_SITE_TRUE!$BUILD_TCL_SITE_TRUE$ac_delim
+BUILD_TCL_SITE_FALSE!$BUILD_TCL_SITE_FALSE$ac_delim
+TCL_PREFIX!$TCL_PREFIX$ac_delim
+TCL_SHLIB_CFLAGS!$TCL_SHLIB_CFLAGS$ac_delim
+TCL_SHLIB_LD!$TCL_SHLIB_LD$ac_delim
+TCL_SHLIB_SUFFIX!$TCL_SHLIB_SUFFIX$ac_delim
+TCL_PACKAGE_PATH!$TCL_PACKAGE_PATH$ac_delim
+TCL_LD_SEARCH_FLAGS!$TCL_LD_SEARCH_FLAGS$ac_delim
+TCL_STUB_LIB_SPEC!$TCL_STUB_LIB_SPEC$ac_delim
+TCL_VERSION!$TCL_VERSION$ac_delim
+TCL_PACKAGE_DIR!$TCL_PACKAGE_DIR$ac_delim
+PYTHON!$PYTHON$ac_delim
+PYTHON_VERSION!$PYTHON_VERSION$ac_delim
+PYTHON_PREFIX!$PYTHON_PREFIX$ac_delim
+PYTHON_EXEC_PREFIX!$PYTHON_EXEC_PREFIX$ac_delim
+PYTHON_PLATFORM!$PYTHON_PLATFORM$ac_delim
+pythondir!$pythondir$ac_delim
+pkgpythondir!$pkgpythondir$ac_delim
+pyexecdir!$pyexecdir$ac_delim
+pkgpyexecdir!$pkgpyexecdir$ac_delim
+PYTHON_INCLUDES!$PYTHON_INCLUDES$ac_delim
+COMP_PYTHON!$COMP_PYTHON$ac_delim
+NROFF!$NROFF$ac_delim
+TROFF!$TROFF$ac_delim
+RRDDOCDIR!$RRDDOCDIR$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
+LTLIBOBJS!$LTLIBOBJS$ac_delim
+_ACEOF
+
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 65; then
+    break
+  elif $ac_last_try; then
+    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+  ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
+_ACEOF
+
+
+# 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
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS
+do
+  case $ac_tag in
+  :[FHLC]) ac_mode=$ac_tag; continue;;
+  esac
+  case $ac_mode$ac_tag in
+  :[FHL]*:*);;
+  :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+   { (exit 1); exit 1; }; };;
+  :[FH]-) ac_tag=-:-;;
+  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+  esac
+  ac_save_IFS=$IFS
+  IFS=:
+  set x $ac_tag
+  IFS=$ac_save_IFS
+  shift
+  ac_file=$1
+  shift
+
+  case $ac_mode in
+  :L) ac_source=$1;;
+  :[FH])
+    ac_file_inputs=
+    for ac_f
+    do
+      case $ac_f in
+      -) ac_f="$tmp/stdin";;
+      *) # Look for the file first in the build tree, then in the source tree
+        # (if the path is not absolute).  The absolute path cannot be DOS-style,
+        # because $ac_f cannot contain `:'.
+        test -f "$ac_f" ||
+          case $ac_f in
+          [\\/$]*) false;;
+          *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+          esac ||
+          { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+   { (exit 1); exit 1; }; };;
+      esac
+      ac_file_inputs="$ac_file_inputs $ac_f"
+    done
+
+    # 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.  */
+    configure_input="Generated from "`IFS=:
+         echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+    if test x"$ac_file" != x-; then
+      configure_input="$ac_file.  $configure_input"
+      { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    fi
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$tmp/stdin";;
+    esac
+    ;;
+  esac
+
+  ac_dir=`$as_dirname -- "$ac_file" ||
+$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'`
+  { as_dir="$ac_dir"
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$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'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+   { (exit 1); exit 1; }; }; }
+  ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+  case $ac_mode in
+  :F)
+  #
+  # CONFIG_FILE
+  #
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+  esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+case `sed -n '/datarootdir/ {
+  p
+  q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+' $ac_file_inputs` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+  { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  ac_datarootdir_hack='
+  s&@datadir@&$datadir&g
+  s&@docdir@&$docdir&g
+  s&@infodir@&$infodir&g
+  s&@localedir@&$localedir&g
+  s&@mandir@&$mandir&g
+    s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+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&@top_builddir@&$ac_top_builddir_sub&;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&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+$ac_datarootdir_hack
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[         ]*datarootdir[  ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&5
+echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&2;}
+
+  rm -f "$tmp/stdin"
+  case $ac_file in
+  -) cat "$tmp/out"; rm -f "$tmp/out";;
+  *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
+  esac
+ ;;
+  :H)
+  #
+  # CONFIG_HEADER
+  #
+_ACEOF
+
+# Transform confdefs.h into a sed script `conftest.defines', that
+# substitutes the proper values into config.h.in to produce config.h.
+rm -f conftest.defines conftest.tail
+# First, append a space to every undef/define line, to ease matching.
+echo 's/$/ /' >conftest.defines
+# Then, protect against being on the right side of a sed subst, or in
+# an unquoted here document, in config.status.  If some macros were
+# called several times there might be several #defines for the same
+# symbol, which is useless.  But do not sort them, since the last
+# AC_DEFINE must be honored.
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
+# NAME is the cpp macro being defined, VALUE is the value it is being given.
+# PARAMS is the parameter list in the macro definition--in most cases, it's
+# just an empty string.
+ac_dA='s,^\\([  #]*\\)[^        ]*\\([  ]*'
+ac_dB='\\)[     (].*,\\1define\\2'
+ac_dC=' '
+ac_dD=' ,'
+
+uniq confdefs.h |
+  sed -n '
+       t rset
+       :rset
+       s/^[     ]*#[    ]*define[       ][      ]*//
+       t ok
+       d
+       :ok
+       s/[\\&,]/\\&/g
+       s/^\('"$ac_word_re"'\)\(([^()]*)\)[      ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
+       s/^\('"$ac_word_re"'\)[  ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
+  ' >>conftest.defines
+
+# Remove the space that was appended to ease matching.
+# Then replace #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.
+# (The regexp can be short, since the line contains either #define or #undef.)
+echo 's/ $//
+s,^[    #]*u.*,/* & */,' >>conftest.defines
+
+# Break up conftest.defines:
+ac_max_sed_lines=50
+
+# First sed command is:         sed -f defines.sed $ac_file_inputs >"$tmp/out1"
+# Second one is:        sed -f defines.sed "$tmp/out1" >"$tmp/out2"
+# Third one will be:    sed -f defines.sed "$tmp/out2" >"$tmp/out1"
+# et cetera.
+ac_in='$ac_file_inputs'
+ac_out='"$tmp/out1"'
+ac_nxt='"$tmp/out2"'
+
+while :
+do
+  # Write a here document:
+    cat >>$CONFIG_STATUS <<_ACEOF
+    # First, check the format of the line:
+    cat >"\$tmp/defines.sed" <<\\CEOF
+/^[     ]*#[    ]*undef[        ][      ]*$ac_word_re[  ]*\$/b def
+/^[     ]*#[    ]*define[       ][      ]*$ac_word_re[(         ]/b def
+b
+:def
+_ACEOF
+  sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
+  echo 'CEOF
+    sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
+  ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
+  sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
+  grep . conftest.tail >/dev/null || break
+  rm -f conftest.defines
+  mv conftest.tail conftest.defines
+done
+rm -f conftest.defines conftest.tail
+
+echo "ac_result=$ac_in" >>$CONFIG_STATUS
+cat >>$CONFIG_STATUS <<\_ACEOF
+  if test x"$ac_file" != x-; then
+    echo "/* $configure_input  */" >"$tmp/config.h"
+    cat "$ac_result" >>"$tmp/config.h"
+    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
+      rm -f $ac_file
+      mv "$tmp/config.h" $ac_file
+    fi
+  else
+    echo "/* $configure_input  */"
+    cat "$ac_result"
+  fi
+  rm -f "$tmp/out12"
+# 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" >`$as_dirname -- $ac_file ||
+$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
+ ;;
+
+  :C)  { echo "$as_me:$LINENO: executing $ac_file commands" >&5
+echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+  esac
+
+
+  case $ac_file$ac_mode in
+    "depfiles":C) 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=`$as_dirname -- "$mf" ||
+$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=`$as_dirname -- "$file" ||
+$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'`
+    { as_dir=$dirpart/$fdir
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$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'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+   { (exit 1); exit 1; }; }; }
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+ ;;
+    "default":C)  chmod +x examples/*.pl ;;
+
+  esac
+done # for ac_tag
+
+
+{ (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
+
+
+{ echo "$as_me:$LINENO: checking in" >&5
+echo $ECHO_N "checking in... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: and out again" >&5
+echo "${ECHO_T}and out again" >&6; }
+
+echo $ECHO_N "ordering CD from http://tobi.oetiker.ch/wish $ECHO_C" 1>&6
+sleep 1
+echo $ECHO_N ".$ECHO_C" 1>&6
+sleep 1
+echo $ECHO_N ".$ECHO_C" 1>&6
+sleep 1
+echo $ECHO_N ".$ECHO_C" 1>&6
+sleep 1
+echo $ECHO_N ".$ECHO_C" 1>&6
+sleep 1
+{ echo "$as_me:$LINENO: result:  just kidding ;-)" >&5
+echo "${ECHO_T} just kidding ;-)" >&6; }
+echo
+echo "----------------------------------------------------------------"
+echo "Config is DONE!"
+echo
+echo "          With MMAP IO: $ac_cv_func_mmap_fixed_mapped"
+echo "          Perl Modules: $COMP_PERL"
+echo "           Perl Binary: $PERL"
+echo "          Perl Version: $PERL_VERSION"
+echo "          Perl Options: $PERL_MAKE_OPTIONS"
+echo "          Ruby Modules: $COMP_RUBY"
+echo "           Ruby Binary: $RUBY"
+echo "          Ruby Options: $RUBY_MAKE_OPTIONS"
+echo "    Build Tcl Bindings: $enable_tcl"
+echo " Build Python Bindings: $enable_python"
+echo "          Build rrdcgi: $enable_rrdcgi"
+echo "       Build librrd MT: $enable_pthread"
+echo
+echo
+echo "Type 'make' to compile the software and use 'make install' to "
+echo "install everything to: $prefix."
+echo
+echo "       ... that wishlist is NO JOKE. If you find RRDtool useful"
+echo "make me happy. Go to http://tobi.oetiker.ch/wish and"
+echo "place an order."
+echo
+echo "                               -- Tobi Oetiker <tobi@oetiker.ch>"
+echo "----------------------------------------------------------------"
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..e09c051
--- /dev/null
@@ -0,0 +1,676 @@
+dnl RRDtool AutoConf script ... 
+dnl ---------------------------
+dnl
+dnl Created by Jeff Allen, Tobi Oetiker, Blair Zajac
+dnl
+dnl Inspiration from http://autoconf-archive.cryp.to
+dnl tell automake the this script is for rrdtool
+dnl the official version number is
+dnl a.b.c
+AC_INIT([rrdtool],[1.2.26])
+dnl for testing a numberical version number comes handy
+dnl the released version are
+dnl a.bccc
+dnl the devl versions will be something like
+dnl a.b999yymmddhh 
+NUMVERS=1.2026
+AC_SUBST(NUMVERS)
+AC_CANONICAL_TARGET
+AM_INIT_AUTOMAKE
+AC_CONFIG_HEADERS([rrd_config.h])
+
+dnl all our local stuff like install scripts and include files
+dnl is in there
+
+
+dnl determine the type of system we are running on
+
+AC_SUBST(VERSION)
+
+AC_PREFIX_DEFAULT( /usr/local/rrdtool-$PACKAGE_VERSION )
+
+dnl Minimum Autoconf version required.
+AC_PREREQ(2.59)
+
+dnl At the TOP of the HEADER
+
+AH_TOP([
+
+#ifndef RRD_CONFIG_H
+#define RRD_CONFIG_H
+/* IEEE can be prevented from raising signals with fpsetmask(0) */
+#undef MUST_DISABLE_FPMASK
+
+/* IEEE math only works if SIGFPE gets actively set to IGNORE */
+
+#undef MUST_DISABLE_SIGFPE
+
+/* realloc does not support NULL as argument */
+#undef NO_NULL_REALLOC
+
+ ])
+
+AH_BOTTOM([
+/* enable posix_fadvise on linux */
+#if defined(HAVE_POSIX_FADVISE) && defined(HAVE_FCNTL_H)
+#define _XOPEN_SOURCE 600
+#include <fcntl.h>
+#endif
+
+/* define strrchr, strchr and memcpy, memmove in terms of bsd funcs
+   make sure you are NOT using bcopy, index or rindex in the code */
+      
+#ifdef STDC_HEADERS
+# include <string.h>
+#else
+# ifndef HAVE_STRCHR
+#  define strchr index
+#  define strrchr rindex
+# endif
+char *strchr (), *strrchr ();
+# ifndef HAVE_MEMMOVE
+#  define memcpy(d, s, n) bcopy ((s), (d), (n))
+#  define memmove(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
+
+#ifdef NO_NULL_REALLOC
+# define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) ))
+#else
+# define rrd_realloc(a,b) realloc((a), (b))
+#endif
+
+#ifdef NEED_MALLOC_MALLOC_H
+#  include <malloc/malloc.h>
+#endif
+
+#ifdef HAVE_MATH_H
+#  include <math.h>
+#endif
+
+#ifdef HAVE_FLOAT_H
+#  include <float.h>
+#endif
+
+#ifdef HAVE_IEEEFP_H
+#  include <ieeefp.h>
+#endif
+
+#ifdef HAVE_FP_CLASS_H
+#  include <fp_class.h>
+#endif
+
+/* for Solaris */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
+#endif
+
+/* solaris 10 it defines isnan such that only forte can compile it ... bad bad  */
+#if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS))
+#  undef isnan
+#  define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN)
+#endif
+
+/* for OSF1 Digital Unix */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FP_CLASS) && defined(HAVE_FP_CLASS_H))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fp_class(a) == FP_NEG_INF || fp_class(a) == FP_POS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_PLUS_INF) && defined(FP_MINUS_INF))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_MINUS_INF || fpclassify(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_INFINITE))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_INFINITE)
+#endif
+
+/* for AIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_CLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (class(a) == FP_MINUS_INF || class(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined (HAVE_FINITE) && defined (HAVE_ISFINITE))
+#  define HAVE_FINITE 1
+#  define finite(a) isfinite(a)
+#endif
+
+#if (! defined(HAVE_FINITE) && defined(HAVE_ISNAN) && defined(HAVE_ISINF))
+#  define HAVE_FINITE 1
+#  define finite(a) (! isnan(a) && ! isinf(a))
+#endif
+
+#ifndef HAVE_FINITE
+#error "Can't compile without finite function"
+#endif
+
+#ifndef HAVE_ISINF
+#error "Can't compile without isinf function"
+#endif
+
+#endif /* RRD_CONFIG_H */
+])
+
+dnl Process Special Options
+dnl -----------------------------------
+
+dnl How the vertical axis label is printed
+AC_ARG_VAR(RRDGRAPH_YLEGEND_ANGLE, 
+ [Vertical label angle: 90.0 (default) or 270.0])
+AC_DEFINE_UNQUOTED(RRDGRAPH_YLEGEND_ANGLE,${RRDGRAPH_YLEGEND_ANGLE:-90.0},
+ [Vertical label angle: 90.0 (default) or 270.0])
+
+AC_ARG_ENABLE(rrdcgi,[  --disable-rrdcgi        disable building of rrdcgi],
+[],[enable_rrdcgi=yes])
+
+dnl Check if we run on a system that has fonts
+AC_ARG_WITH(rrd-default-font,
+[  --with-rrd-default-font=[OPTIONS]  set the full path to your default font.],
+[RRD_DEFAULT_FONT=$withval],[
+  if test -d ${WINDIR:-nodir}/cour.ttf ; then
+       RRD_DEFAULT_FONT=`cd $WINDIR;pwd`/cour.ttf
+  else
+       RRD_DEFAULT_FONT='$(fontsdir)/$(fonts_DATA)'
+  fi
+])
+
+dnl Use mmap in rrd_update instead of seek+write
+AC_ARG_ENABLE([mmap],
+[  --disable-mmap          disable mmap in rrd_update, use seek+write instead],
+[],
+[enable_mmap=yes])
+
+
+ AC_ARG_ENABLE(pthread,[  --disable-pthread       disable multithread support],
+[],[enable_pthread=yes])
+
+
+
+CONFIGURE_PART(Audit Compilation Environment)
+
+
+dnl Check for the compiler and static/shared library creation.
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_LIBTOOL
+
+dnl which flags does the compile support?
+if test "$GCC" = "yes"; then
+  for flag in -fno-strict-aliasing -Wall -std=gnu99 -pedantic -Wshadow -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -W; do
+    oCFLAGS=$CFLAGS
+    CFLAGS="$CFLAGS $flag"
+    cachename=rd_cv_gcc_flag_`echo $flag|sed 's/[[^A-Za-z]]/_/g'`
+    AC_CACHE_CHECK([if gcc likes the $flag flag], $cachename,
+       [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0 ]])],[eval $cachename=yes],[eval $cachename=no])])
+    if eval test \$$cachename = no; then
+         CFLAGS=$oCFLAGS
+    fi
+  done
+fi
+
+
+
+AC_SUBST(RRD_DEFAULT_FONT)
+
+CONFIGURE_PART(Checking for Header Files)
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_HEADER_DIRENT
+AC_CHECK_HEADERS(sys/stat.h sys/types.h fcntl.h locale.h fp_class.h malloc.h unistd.h ieeefp.h math.h sys/times.h sys/param.h sys/resource.h float.h strings.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_HEADER_TIME
+AC_STRUCT_TM
+
+dnl Checks for libraries.
+AC_CHECK_FUNC(acos, , AC_CHECK_LIB(m, acos))
+
+dnl add pic flag in any case this makes sure all our code is relocatable
+eval `./libtool --config | grep pic_flag`
+CFLAGS="$CFLAGS $pic_flag"
+
+CONFIGURE_PART(Test Library Functions)
+
+dnl Checks for library functions.
+AC_FUNC_STRFTIME
+AC_FUNC_VPRINTF
+
+AC_C_BIGENDIAN
+
+dnl for each function found we get a definition in config.h 
+dnl of the form HAVE_FUNCTION
+
+AC_CHECK_FUNCS(tzset mbstowcs opendir readdir chdir chroot getuid setlocale strerror strerror_r snprintf vsnprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday posix_fadvise madvise)
+
+AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
+AC_CHECK_DECLS(posix_fadvise, [], [], [#define _XOPEN_SOURCE 600
+#include <fcntl.h>])
+AC_CHECK_DECLS(madvise, [], [], [#include <sys/mman.h>])
+
+if test "x$enable_mmap" = xyes; then
+  case "$host" in
+    *cygwin*)
+       # the normal mmap test does not work in cygwin
+       AC_CHECK_FUNCS(mmap)
+       if [ "x${ac_cv_func_mmap}" = xyes ]; then
+         ac_cv_func_mmap_fixed_mapped=yes
+       fi
+    ;;
+    *)
+       AC_FUNC_MMAP
+    ;;
+  esac
+fi
+
+
+CONFIGURE_PART(IEEE Math Checks)
+dnl HP-UX 11.00 does not have finite but does have isfinite as a macro so we need
+dnl actual code to check if this works
+AC_CHECK_FUNCS(fpclassify, ,
+  [AC_MSG_CHECKING(for fpclassify with <math.h>)
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>
+volatile int x;volatile float f; ]], [[x = fpclassify(f)]])],[AC_MSG_RESULT(yes)
+      AC_DEFINE(HAVE_FPCLASSIFY)],[AC_MSG_RESULT(no)])])
+AC_CHECK_FUNCS(finite, ,
+  [AC_CHECK_FUNCS(isfinite, ,
+    [AC_MSG_CHECKING(for isfinite with <math.h>)
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>
+volatile int x;volatile float f;  ]], [[x = isfinite(f)]])],[AC_MSG_RESULT(yes)
+      AC_DEFINE(HAVE_ISFINITE)],[AC_MSG_RESULT(no)])])])
+AC_CHECK_FUNCS(isinf, ,
+  [AC_MSG_CHECKING(for isinf with <math.h>)
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>
+volatile int x;volatile float f;  ]], [[x = isinf(f)]])],[AC_MSG_RESULT(yes)
+      AC_DEFINE(HAVE_ISINF)],[AC_MSG_RESULT(no)])])
+
+AC_FULL_IEEE
+
+CONFIGURE_PART(Resolve Portability Issues)
+
+dnl what does realloc do if it gets called with a NULL pointer
+
+AC_CACHE_CHECK([if realloc can deal with NULL], rd_cv_null_realloc,
+[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
+             int main(void){
+              char *x = NULL;
+             x = realloc (x,10);
+             if (x==NULL) return 1;
+             return 0;
+             }]])],[rd_cv_null_realloc=yes],[rd_cv_null_realloc=nope],[:])])
+
+if test x"$rd_cv_null_realloc" = xnope; then
+AC_DEFINE(NO_NULL_REALLOC)
+fi
+
+AC_LANG_PUSH(C)
+dnl solaris has some odd defines it needs in order to propperly compile ctime_r
+AC_MSG_CHECKING([if ctime_r need special care to act posixly correct])
+AC_LINK_IFELSE(
+    AC_LANG_PROGRAM(
+           [[#include <time.h>]],
+           [[ctime_r(NULL,NULL,0)]]
+                   ),
+    [ CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
+      AC_LINK_IFELSE(
+          AC_LANG_PROGRAM(
+                [[#include <time.h>]],
+                [[ctime_r(NULL,NULL)]]
+                        ),
+          [AC_MSG_RESULT([yes, this seems to be solaris style])],
+          [AC_MSG_ERROR([Can't figure how to compile ctime_r])]
+      )
+    ],  
+    [ AC_LINK_IFELSE(
+          AC_LANG_PROGRAM(
+                [[#include <time.h>]],
+                [[ctime_r(NULL,NULL)]]
+                        ),
+          [AC_MSG_RESULT(no)],
+          [AC_MSG_ERROR([Can't figure how to compile ctime_r])]
+      )
+    ]  
+)
+AC_LANG_POP(C)
+
+dnl Check for pthreads
+dnl http://autoconf-archive.cryp.to/acx_pthread.m4
+AC_SUBST(MULTITHREAD_CFLAGS)
+AC_SUBST(MULTITHREAD_LDFLAGS)
+
+if test $enable_pthread != no; then 
+ ACX_PTHREAD([
+    MULTITHREAD_CFLAGS=$PTHREAD_CFLAGS
+    MULTITHREAD_LDFLAGS=$PTHREAD_LIBS
+            ],
+            [])
+fi
+
+dnl since we use lots of *_r functions all over the code we better
+dnl make sure they are known
+
+if test  "x$x_rflag" != "xno"; then
+   CPPFLAGS="$CPPFLAGS $x_rflag"
+fi
+
+AM_CONDITIONAL(BUILD_MULTITHREAD,[test $enable_pthread != no])
+
+AC_LANG_PUSH(C)
+dnl see if we have to include malloc/malloc.h
+AC_MSG_CHECKING([do we need malloc/malloc.h])
+AC_LINK_IFELSE(
+    AC_LANG_PROGRAM(
+           [[#include <stdlib.h>]],
+           [[malloc(1)]]
+                   ),
+    [ AC_MSG_RESULT([nope, works out of the box]) ],
+    [ AC_LINK_IFELSE(
+          AC_LANG_PROGRAM(
+                [[#include <stdlib.h>
+                  #include <malloc/malloc.h>]],
+                [[malloc(1)]]
+                        ),
+          [AC_DEFINE(NEED_MALLOC_MALLOC_H)
+           AC_MSG_RESULT([yes we do])],
+          [AC_MSG_ERROR([Can not figure how to compile malloc])]
+      )
+    ]  
+)
+AC_LANG_POP(C)
+
+CONFIGURE_PART(Find 3rd-Party Libraries)
+
+
+AM_CONDITIONAL(BUILD_RRDCGI,[test $enable_rrdcgi != no])
+
+CORE_LIBS="$LIBS"
+
+EX_CHECK_ALL(art_lgpl_2, art_vpath_add_point,       libart_lgpl/libart.h,   libart-2.0,  2.3.17, ftp://ftp.gnome.org/pub/GNOME/sources/libart_lgpl/2.3/, /usr/include/libart-2.0)
+EX_CHECK_ALL(z,          zlibVersion,               zlib.h,                 zlib,        1.2.3,  http://www.gzip.org/zlib/, "")
+EX_CHECK_ALL(png,        png_access_version_number, png.h,                  libpng,      1.2.10,  http://prdownloads.sourceforge.net/libpng/, "")
+EX_CHECK_ALL(freetype,   FT_Init_FreeType,          ft2build.h,                    freetype2,   2.1.10,  http://prdownloads.sourceforge.net/freetype/, /usr/include/freetype2)
+
+if test "$EX_CHECK_ALL_ERR" = "YES"; then
+  AC_MSG_ERROR([Please fix the library issues listed above and try again.])
+fi
+
+ALL_LIBS="$LIBS"
+LIBS=
+
+AC_SUBST(CORE_LIBS)
+AC_SUBST(ALL_LIBS)
+
+CONFIGURE_PART(Prep for Building Language Bindings)
+  
+dnl Check for Perl.
+AC_PATH_PROG(PERL, perl, no)
+
+AC_ARG_ENABLE(perl,[  --disable-perl          do not build the perl modules],
+[],[enable_perl=yes])
+
+
+AC_ARG_VAR(PERLCC, [[] C compiler for Perl modules])
+AC_ARG_VAR(PERLCCFLAGS, [[] CC flags for Perl modules])
+AC_ARG_VAR(PERLLD, [[same as PERLCC] Linker for Perl modules])
+AC_ARG_VAR(PERLLDFLAGS, [[] LD flags for Perl modules])
+
+if test "x$PERL" = "xno" -o  x$enable_perl = xno; then
+       COMP_PERL=
+else
+       COMP_PERL="perl_piped perl_shared"
+        AC_MSG_CHECKING(for the perl version you are running)
+       PERL_VERSION=`$PERL -MConfig -e 'print $Config{version}'`
+       AC_MSG_RESULT($PERL_VERSION)
+        if test -z "$PERLCC"; then
+            AC_MSG_CHECKING(for the C compiler perl wants to use to build its modules)
+           perlcc=`$PERL -MConfig -e 'print $Config{cc}'`
+           AC_MSG_RESULT($perlcc)
+           if test ! -x "$perlcc"; then
+               AC_PATH_PROG(PERL_CC, ${perlcc}, no)
+               if test "$PERL_CC" = "no"; then
+                    AC_MSG_WARN([
+I would not find the Compiler ($perlcc) that was originally used to compile
+your perl binary. You should either make sure that this compiler is
+available on your system, pick an other compiler and set PERLCC
+appropriately, or use a different perl setup that was compiled locally.
+
+I will disable the compilation of the RRDs perl module for now.
+])
+                   COMP_PERL="perl_piped"
+               fi
+            fi    
+        fi
+fi
+
+AC_MSG_CHECKING(Perl Modules to build)
+AC_MSG_RESULT(${COMP_PERL:-No Perl Modules will be built})
+
+# Options to pass when configuring perl module
+ppref=$prefix
+test "$ppref" = "NONE" && ppref=$ac_default_prefix
+
+PERL_MAKE_OPTIONS="PREFIX=$ppref LIB=$ppref/lib/perl/$PERL_VERSION"
+
+dnl pass additional perl options when generating Makefile from Makefile.PL
+AC_ARG_ENABLE(perl-site-install,
+[  --enable-perl-site-install   by default the rrdtool perl modules are installed
+                         together with rrdtool in $prefix/lib/perl. You have to
+                          put a 'use lib qw($prefix/lib/perl)' into your scripts
+                          when you want to use them. When you set this option
+                          the perl modules will get installed wherever
+                          your perl setup thinks it is best.],
+[PERL_MAKE_OPTIONS=],[])
+
+if test ! -z "$PERLCC"; then
+   PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS CC=$PERLCC"
+
+   if test ! -z "$PERLCCFLAGS"; then
+       PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS CCFLAGS=$PERLCCFLAGS"
+   fi
+   
+   if test -z "$PERLLD"; then
+       PERLLD=$PERLCC
+   fi
+   PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS LD=$PERLLD"
+  
+   if test ! -z "$PERLLDFLAGS"; then
+       PERL_MAKE_OPTIONS="$PERL_MAKE_OPTIONS LDFLAGS=$PERLLDFLAGS"
+   fi
+fi
+        
+AC_ARG_WITH(perl-options,
+[  --with-perl-options=[OPTIONS]  options to pass on command-line when
+                          generating Makefile from Makefile.PL. If you set this
+                          option, interesting things may happen unless you know
+                          what you are doing!],
+[PERL_MAKE_OPTIONS=$withval])
+
+AC_SUBST(PERL_MAKE_OPTIONS)
+AC_SUBST(PERL)
+AC_SUBST(COMP_PERL)
+AC_SUBST(PERL_VERSION)
+
+dnl Check for Ruby.
+AC_PATH_PROG(RUBY, ruby, no)
+
+AC_ARG_ENABLE(ruby,[  --disable-ruby          do not build the ruby modules],
+[],[enable_ruby=yes])
+
+AC_MSG_CHECKING(if ruby modules can be built)
+
+if test "x$RUBY" = "xno" -o  x$enable_ruby = xno; then
+       COMP_RUBY=
+       AC_MSG_RESULT(No .. Ruby not found or disabled)
+else
+       if $RUBY -e 'require "mkmf"' >/dev/null 2>&1; then
+               COMP_RUBY="ruby"
+               AC_MSG_RESULT(YES)
+       else
+               COMP_RUBY=
+               AC_MSG_RESULT(Ruby found but mkmf is missing! Install the -dev package)         
+       fi                              
+fi
+
+
+dnl pass additional ruby options when generating Makefile from Makefile.PL
+AC_ARG_ENABLE(ruby-site-install,
+[  --enable-ruby-site-install   by default the rrdtool ruby modules are installed
+                         together with rrdtool in $prefix/lib/ruby. You have to
+                          add $prefix/lib/ruby/$ruby_version/$sitearch to you $: variable
+                          for ruby to find the RRD.so file.],
+[RUBY_MAKE_OPTIONS=],[RUBY_MAKE_OPTIONS="sitedir=$prefix/lib/ruby"])
+
+    
+AC_ARG_WITH(ruby-options,
+[  --with-ruby-options=[OPTIONS]  options to pass on command-line when
+                          generating Makefile from extconf.rb. If you set this
+                          option, interesting things may happen unless you know
+                          what you are doing!],
+[RUBY_MAKE_OPTIONS=$withval])
+
+AC_SUBST(RUBY_MAKE_OPTIONS)
+AC_SUBST(RUBY)
+AC_SUBST(COMP_RUBY)
+
+
+enable_tcl_site=no
+
+AC_ARG_ENABLE(tcl,[  --disable-tcl           do not build the tcl modules],
+[],[enable_tcl=yes])
+
+if test  "$enable_tcl" = "yes"; then
+  dnl Check for Tcl.
+  withval=""
+  AC_ARG_WITH(tcllib,[  --with-tcllib=DIR       location of the tclConfig.sh])
+  enable_tcl=no
+  for dir in $withval /usr/lib /usr/local/lib; do
+    AC_MSG_CHECKING(for tclConfig.sh in $dir)
+    if test -f "$dir/tclConfig.sh" ; then
+       tcl_config=$dir/tclConfig.sh
+        enable_tcl=yes
+        AC_MSG_RESULT(yes)
+        break
+    else
+        AC_MSG_RESULT(no)
+    fi
+  done
+
+  if test "$enable_tcl" = "no"; then
+        AC_MSG_WARN([tclConfig.sh not found - Tcl interface won't be built])
+  else
+       . $tcl_config
+       TCL_PACKAGE_DIR="$TCL_PACKAGE_PATH/tclrrd$VERSION"
+  fi
+  AC_ARG_ENABLE(tcl,[  --enable-tcl-site        install the tcl extension in the tcl tree],
+  [],[enable_tcl_site=yes])
+
+fi
+
+AM_CONDITIONAL(BUILD_TCL, test "$enable_tcl" = "yes" )
+AM_CONDITIONAL(BUILD_TCL_SITE, test "$enable_tcl_site" = "yes" )
+
+AC_SUBST(TCL_PREFIX)
+AC_SUBST(TCL_SHLIB_CFLAGS)
+AC_SUBST(TCL_SHLIB_LD)
+AC_SUBST(TCL_SHLIB_SUFFIX)
+AC_SUBST(TCL_PACKAGE_PATH)
+AC_SUBST(TCL_LD_SEARCH_FLAGS)
+AC_SUBST(TCL_STUB_LIB_SPEC)
+AC_SUBST(TCL_VERSION)
+AC_SUBST(TCL_PACKAGE_DIR)
+
+AC_ARG_ENABLE(python,[  --disable-python        do not build the python modules],
+[],[enable_python=yes])
+
+if test  "$enable_python" = "yes"; then
+dnl Check for python
+AM_PATH_PYTHON(2.3,[],[enable_python=no])
+AM_CHECK_PYTHON_HEADERS(,[enable_python=no;AC_MSG_WARN(could not find Python headers)])
+fi
+
+if test  x$enable_python = xno; then
+       COMP_PYTHON=
+else
+       COMP_PYTHON="python"
+fi
+
+AC_SUBST(COMP_PYTHON)
+
+dnl Check for nroff
+AC_PATH_PROGS(NROFF, gnroff nroff)
+AC_PATH_PROGS(TROFF, groff troff)
+
+AC_ARG_VAR(RRDDOCDIR, [[DATADIR/doc/PACKAGE-VERSION] Documentation directory])
+if test -z "$RRDDOCDIR"; then
+   RRDDOCDIR='${datadir}/doc/${PACKAGE}-${VERSION}'; fi
+
+
+CONFIGURE_PART(Apply Configuration Information)
+AC_CONFIG_FILES([examples/shared-demo.pl])
+AC_CONFIG_FILES([examples/piped-demo.pl])
+AC_CONFIG_FILES([examples/stripes.pl])
+AC_CONFIG_FILES([examples/bigtops.pl])
+AC_CONFIG_FILES([examples/minmax.pl])
+AC_CONFIG_FILES([examples/4charts.pl])
+AC_CONFIG_FILES([examples/perftest.pl])
+AC_CONFIG_FILES([examples/Makefile])
+AC_CONFIG_FILES([doc/Makefile])
+AC_CONFIG_FILES([src/Makefile])
+AC_CONFIG_FILES([bindings/Makefile])
+AC_CONFIG_FILES([bindings/tcl/Makefile])
+AC_CONFIG_FILES([bindings/tcl/ifOctets.tcl])
+AC_CONFIG_FILES([Makefile])          
+
+AC_CONFIG_COMMANDS([default],[[ chmod +x examples/*.pl]],[[]])
+AC_OUTPUT
+
+AC_MSG_CHECKING(in)
+AC_MSG_RESULT(and out again)
+
+echo $ECHO_N "ordering CD from http://tobi.oetiker.ch/wish $ECHO_C" 1>&6
+sleep 1
+echo $ECHO_N ".$ECHO_C" 1>&6
+sleep 1
+echo $ECHO_N ".$ECHO_C" 1>&6
+sleep 1
+echo $ECHO_N ".$ECHO_C" 1>&6
+sleep 1
+echo $ECHO_N ".$ECHO_C" 1>&6
+sleep 1
+AC_MSG_RESULT([ just kidding ;-)])
+echo
+echo "----------------------------------------------------------------"
+echo "Config is DONE!"
+echo
+echo "          With MMAP IO: $ac_cv_func_mmap_fixed_mapped"
+echo "          Perl Modules: $COMP_PERL"
+echo "           Perl Binary: $PERL"
+echo "          Perl Version: $PERL_VERSION"
+echo "          Perl Options: $PERL_MAKE_OPTIONS"
+echo "          Ruby Modules: $COMP_RUBY"
+echo "           Ruby Binary: $RUBY"
+echo "          Ruby Options: $RUBY_MAKE_OPTIONS"
+echo "    Build Tcl Bindings: $enable_tcl"
+echo " Build Python Bindings: $enable_python"
+echo "          Build rrdcgi: $enable_rrdcgi"
+echo "       Build librrd MT: $enable_pthread"
+echo
+echo
+echo "Type 'make' to compile the software and use 'make install' to "
+echo "install everything to: $prefix."
+echo 
+echo "       ... that wishlist is NO JOKE. If you find RRDtool useful"
+echo "make me happy. Go to http://tobi.oetiker.ch/wish and"
+echo "place an order."
+echo 
+echo "                               -- Tobi Oetiker <tobi@oetiker.ch>"
+echo "----------------------------------------------------------------"
diff --git a/depcomp b/depcomp
new file mode 100755 (executable)
index 0000000..04701da
--- /dev/null
+++ b/depcomp
@@ -0,0 +1,530 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-07-09.11
+
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, 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 -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [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/doc/Makefile.am b/doc/Makefile.am
new file mode 100644 (file)
index 0000000..70f456c
--- /dev/null
@@ -0,0 +1,72 @@
+## Process this file with automake to produce Makefile.in
+
+SUFFIXES = .pod .1 .man .html .txt .pm .pdf .inc
+
+#AUTOMAKE_OPTIONS        =  foreign
+
+#ACLOCAL_M4 = $(top_srcdir)/config/aclocal.m4
+
+CLEANFILES = *.1 *.html *.txt *-dircache RRD?.pod *.pdf *~ core *itemcache *.rej *.orig *.tmp
+
+POD = bin_dec_hex.pod        rrddump.pod            rrdgraph_examples.pod  rrdrestore.pod         rrdupdate.pod  \
+      cdeftutorial.pod       rrdfetch.pod           rrdgraph_graph.pod     rrdthreads.pod         rrdxport.pod   \
+      rpntutorial.pod        rrdfirst.pod           rrdgraph_rpn.pod       rrdtool.pod                           \
+      rrd-beginners.pod      rrdinfo.pod            rrdtune.pod            rrdbuild.pod                          \
+      rrdcgi.pod             rrdgraph.pod           rrdlast.pod            rrdlastupdate.pod                     \
+      rrdcreate.pod          rrdgraph_data.pod      rrdresize.pod          rrdtutorial.pod                       
+
+
+PMP = RRDs.pod RRDp.pod
+
+MAN = $(POD:.pod=.1)
+TXT = $(MAN:.1=.txt)
+HTML = $(POD:.pod=.html) $(PMP:.pod=.html)
+PDF = $(MAN:.1=.pdf)
+
+# what should go into the distribution
+EXTRA_DIST= $(POD) $(HTML) $(MAN) $(TXT) rrdtool-dump.dtd rrdtool-xport.dtd
+
+idocdir = $(RRDDOCDIR)/txt
+idoc_DATA = $(POD) $(TXT)
+ihtmldir = $(RRDDOCDIR)/html
+ihtml_DATA = $(HTML)
+imandir = $(mandir)/man1
+iman_DATA = $(MAN)
+
+all-local: link txt man html-local
+
+.src.pod:
+       perl -n -e 'if (/^=include\s+(\S+)/){open F,"$$1.inc" || die $$?;print <F>; close F} else {print}'  $<  > $@
+
+.pod.1 .pm.1 .pl.1:
+       pod2man --release=$(VERSION) --center=rrdtool $<  > $@
+
+.1.txt:
+       GROFF_NO_SGR=1 @NROFF@ -man -Tlp $< > $@
+
+.1.pdf:
+       @TROFF@ -man $< | ps2pdf - $@
+
+.pm.html .pod.html .pl.html:
+       pod2html --infile=$< --outfile=$@ --noindex --htmlroot=. --podpath=. --title=$*
+
+RRDs.pod:
+       $(LN_S) $(top_srcdir)/bindings/perl-shared/RRDs.pm RRDs.pod
+
+RRDp.pod:
+       $(LN_S) $(top_srcdir)/bindings/perl-piped/RRDp.pm RRDp.pod
+
+link: RRDp.pod RRDs.pod
+
+man: $(MAN)
+
+html-local: $(HTML)
+
+txt: $(TXT)
+
+pdf-local: $(PDF)
+
+pod: $(POD)
+
+install-data-hook:
+       cd $(DESTDIR)$(ihtmldir) && rm -f index.html && $(LN_S) rrdtool.html index.html
diff --git a/doc/Makefile.in b/doc/Makefile.in
new file mode 100644 (file)
index 0000000..180d4bc
--- /dev/null
@@ -0,0 +1,517 @@
+# Makefile.in generated by automake 1.9.6 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@
+
+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 = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = doc
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+       $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/rrd_config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(idocdir)" "$(DESTDIR)$(ihtmldir)" \
+       "$(DESTDIR)$(imandir)"
+idocDATA_INSTALL = $(INSTALL_DATA)
+ihtmlDATA_INSTALL = $(INSTALL_DATA)
+imanDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(idoc_DATA) $(ihtml_DATA) $(iman_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALL_LIBS = @ALL_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_MULTITHREAD_FALSE = @BUILD_MULTITHREAD_FALSE@
+BUILD_MULTITHREAD_TRUE = @BUILD_MULTITHREAD_TRUE@
+BUILD_RRDCGI_FALSE = @BUILD_RRDCGI_FALSE@
+BUILD_RRDCGI_TRUE = @BUILD_RRDCGI_TRUE@
+BUILD_TCL_FALSE = @BUILD_TCL_FALSE@
+BUILD_TCL_SITE_FALSE = @BUILD_TCL_SITE_FALSE@
+BUILD_TCL_SITE_TRUE = @BUILD_TCL_SITE_TRUE@
+BUILD_TCL_TRUE = @BUILD_TCL_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMP_PERL = @COMP_PERL@
+COMP_PYTHON = @COMP_PYTHON@
+COMP_RUBY = @COMP_RUBY@
+CORE_LIBS = @CORE_LIBS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MULTITHREAD_CFLAGS = @MULTITHREAD_CFLAGS@
+MULTITHREAD_LDFLAGS = @MULTITHREAD_LDFLAGS@
+NROFF = @NROFF@
+NUMVERS = @NUMVERS@
+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@
+PERL = @PERL@
+PERLCC = @PERLCC@
+PERLCCFLAGS = @PERLCCFLAGS@
+PERLFLAGS = @PERLFLAGS@
+PERLLD = @PERLLD@
+PERLLDFLAGS = @PERLLDFLAGS@
+PERL_CC = @PERL_CC@
+PERL_MAKE_OPTIONS = @PERL_MAKE_OPTIONS@
+PERL_VERSION = @PERL_VERSION@
+PKGCONFIG = @PKGCONFIG@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+RRDDOCDIR = @RRDDOCDIR@
+RRDGRAPH_YLEGEND_ANGLE = @RRDGRAPH_YLEGEND_ANGLE@
+RRD_DEFAULT_FONT = @RRD_DEFAULT_FONT@
+RUBY = @RUBY@
+RUBY_MAKE_OPTIONS = @RUBY_MAKE_OPTIONS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@
+TCL_PACKAGE_DIR = @TCL_PACKAGE_DIR@
+TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@
+TCL_PREFIX = @TCL_PREFIX@
+TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@
+TCL_SHLIB_LD = @TCL_SHLIB_LD@
+TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@
+TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
+TCL_VERSION = @TCL_VERSION@
+TROFF = @TROFF@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_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 = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+SUFFIXES = .pod .1 .man .html .txt .pm .pdf .inc
+
+#AUTOMAKE_OPTIONS        =  foreign
+
+#ACLOCAL_M4 = $(top_srcdir)/config/aclocal.m4
+CLEANFILES = *.1 *.html *.txt *-dircache RRD?.pod *.pdf *~ core *itemcache *.rej *.orig *.tmp
+POD = bin_dec_hex.pod        rrddump.pod            rrdgraph_examples.pod  rrdrestore.pod         rrdupdate.pod  \
+      cdeftutorial.pod       rrdfetch.pod           rrdgraph_graph.pod     rrdthreads.pod         rrdxport.pod   \
+      rpntutorial.pod        rrdfirst.pod           rrdgraph_rpn.pod       rrdtool.pod                           \
+      rrd-beginners.pod      rrdinfo.pod            rrdtune.pod            rrdbuild.pod                          \
+      rrdcgi.pod             rrdgraph.pod           rrdlast.pod            rrdlastupdate.pod                     \
+      rrdcreate.pod          rrdgraph_data.pod      rrdresize.pod          rrdtutorial.pod                       
+
+PMP = RRDs.pod RRDp.pod
+MAN = $(POD:.pod=.1)
+TXT = $(MAN:.1=.txt)
+HTML = $(POD:.pod=.html) $(PMP:.pod=.html)
+PDF = $(MAN:.1=.pdf)
+
+# what should go into the distribution
+EXTRA_DIST = $(POD) $(HTML) $(MAN) $(TXT) rrdtool-dump.dtd rrdtool-xport.dtd
+idocdir = $(RRDDOCDIR)/txt
+idoc_DATA = $(POD) $(TXT)
+ihtmldir = $(RRDDOCDIR)/html
+ihtml_DATA = $(HTML)
+imandir = $(mandir)/man1
+iman_DATA = $(MAN)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .pod .1 .man .html .txt .pm .pdf .inc .pl .src
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  doc/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --foreign  doc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+distclean-libtool:
+       -rm -f libtool
+uninstall-info-am:
+install-idocDATA: $(idoc_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(idocdir)" || $(mkdir_p) "$(DESTDIR)$(idocdir)"
+       @list='$(idoc_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(idocDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(idocdir)/$$f'"; \
+         $(idocDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(idocdir)/$$f"; \
+       done
+
+uninstall-idocDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(idoc_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(idocdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(idocdir)/$$f"; \
+       done
+install-ihtmlDATA: $(ihtml_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(ihtmldir)" || $(mkdir_p) "$(DESTDIR)$(ihtmldir)"
+       @list='$(ihtml_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(ihtmlDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(ihtmldir)/$$f'"; \
+         $(ihtmlDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(ihtmldir)/$$f"; \
+       done
+
+uninstall-ihtmlDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(ihtml_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(ihtmldir)/$$f'"; \
+         rm -f "$(DESTDIR)$(ihtmldir)/$$f"; \
+       done
+install-imanDATA: $(iman_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(imandir)" || $(mkdir_p) "$(DESTDIR)$(imandir)"
+       @list='$(iman_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(imanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(imandir)/$$f'"; \
+         $(imanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(imandir)/$$f"; \
+       done
+
+uninstall-imanDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(iman_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(imandir)/$$f'"; \
+         rm -f "$(DESTDIR)$(imandir)/$$f"; \
+       done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+       @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
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA) all-local
+installdirs:
+       for dir in "$(DESTDIR)$(idocdir)" "$(DESTDIR)$(ihtmldir)" "$(DESTDIR)$(imandir)"; 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:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+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-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am: html-local
+
+info: info-am
+
+info-am:
+
+install-data-am: install-idocDATA install-ihtmlDATA install-imanDATA
+       @$(NORMAL_INSTALL)
+       $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am: pdf-local
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-idocDATA uninstall-ihtmlDATA \
+       uninstall-imanDATA uninstall-info-am
+
+.PHONY: all all-am all-local check check-am clean clean-generic \
+       clean-libtool distclean distclean-generic distclean-libtool \
+       distdir dvi dvi-am html html-am html-local info info-am \
+       install install-am install-data install-data-am \
+       install-data-hook install-exec install-exec-am \
+       install-idocDATA install-ihtmlDATA install-imanDATA \
+       install-info install-info-am install-man install-strip \
+       installcheck installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-generic \
+       mostlyclean-libtool pdf pdf-am pdf-local ps ps-am uninstall \
+       uninstall-am uninstall-idocDATA uninstall-ihtmlDATA \
+       uninstall-imanDATA uninstall-info-am
+
+
+all-local: link txt man html-local
+
+.src.pod:
+       perl -n -e 'if (/^=include\s+(\S+)/){open F,"$$1.inc" || die $$?;print <F>; close F} else {print}'  $<  > $@
+
+.pod.1 .pm.1 .pl.1:
+       pod2man --release=$(VERSION) --center=rrdtool $<  > $@
+
+.1.txt:
+       GROFF_NO_SGR=1 @NROFF@ -man -Tlp $< > $@
+
+.1.pdf:
+       @TROFF@ -man $< | ps2pdf - $@
+
+.pm.html .pod.html .pl.html:
+       pod2html --infile=$< --outfile=$@ --noindex --htmlroot=. --podpath=. --title=$*
+
+RRDs.pod:
+       $(LN_S) $(top_srcdir)/bindings/perl-shared/RRDs.pm RRDs.pod
+
+RRDp.pod:
+       $(LN_S) $(top_srcdir)/bindings/perl-piped/RRDp.pm RRDp.pod
+
+link: RRDp.pod RRDs.pod
+
+man: $(MAN)
+
+html-local: $(HTML)
+
+txt: $(TXT)
+
+pdf-local: $(PDF)
+
+pod: $(POD)
+
+install-data-hook:
+       cd $(DESTDIR)$(ihtmldir) && rm -f index.html && $(LN_S) rrdtool.html index.html
+# 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/doc/RRDp.html b/doc/RRDp.html
new file mode 100644 (file)
index 0000000..a9185aa
--- /dev/null
@@ -0,0 +1,145 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>RRDp</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#example">EXAMPLE</a></li>
+       <li><a href="#see_also">SEE ALSO</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>RRDp - Attach RRDtool from within a perl script via a set of pipes;</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p>use <strong>RRDp</strong></p>
+<p><strong>RRDp::start</strong> <em>path to RRDtool executable</em></p>
+<p><strong>RRDp::cmd</strong>  <em>rrdtool commandline</em></p>
+<p>$answer = <strong>RRD::read</strong></p>
+<p>$status = <strong>RRD::end</strong></p>
+<p><strong>$RRDp::user</strong>,  <strong>$RRDp::sys</strong>, <strong>$RRDp::real</strong>, <strong>$RRDp::error_mode</strong>, <strong>$RRDp::error</strong></p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>With this module you can safely communicate with the RRDtool.</p>
+<p>After every <strong>RRDp::cmd</strong> you have to issue an <strong>RRDp::read</strong> command to get
+<strong>RRDtool</strong>s answer to your command. The answer is returned as a pointer,
+in order to speed things up. If the last command did not return any
+data, <strong>RRDp::read</strong> will return an undefined variable.</p>
+<p>If you import the PERFORMANCE variables into your namespace, 
+you can access RRDtool's internal performance measurements.</p>
+<dl>
+<dt><strong><a name="item_use_rrdp">use <strong>RRDp</strong></a></strong>
+
+<dd>
+<p>Load the RRDp::pipe module.</p>
+</dd>
+</li>
+<dt><strong><a name="item_rrdp_3a_3astart_path_to_rrdtool_executable"><strong>RRDp::start</strong> <em>path to RRDtool executable</em></a></strong>
+
+<dd>
+<p>start RRDtool. The argument must be the path to the RRDtool executable</p>
+</dd>
+</li>
+<dt><strong><a name="item_rrdp_3a_3acmd_rrdtool_commandline"><strong>RRDp::cmd</strong> <em>rrdtool commandline</em></a></strong>
+
+<dd>
+<p>pass commands on to RRDtool. check the RRDtool documentation for
+more info on the RRDtool commands.</p>
+</dd>
+</li>
+<dt><strong><a name="item__answer">$answer = <strong>RRDp::read</strong></a></strong>
+
+<dd>
+<p>read RRDtool's response to your command. Note that the $answer variable will
+only contain a pointer to the returned data. The reason for this is, that
+RRDtool can potentially return quite excessive amounts of data
+and we don't want to copy this around in memory. So when you want to 
+access the contents of $answer you have to use $$answer which dereferences
+the variable.</p>
+</dd>
+</li>
+<dt><strong><a name="item__status">$status = <strong>RRDp::end</strong></a></strong>
+
+<dd>
+<p>terminates RRDtool and returns RRDtool's status ...</p>
+</dd>
+</li>
+<dt><strong><a name="item__rrdp__user_"><strong>$RRDp::user</strong>,  <strong>$RRDp::sys</strong>, <strong>$RRDp::real</strong></a></strong>
+
+<dd>
+<p>these variables will contain totals of the user time, system time and
+real time as seen by RRDtool.  User time is the time RRDtool is
+running, System time is the time spend in system calls and real time
+is the total time RRDtool has been running.</p>
+</dd>
+<dd>
+<p>The difference between user + system and real is the time spent
+waiting for things like the hard disk and new input from the perl
+script.</p>
+</dd>
+</li>
+<dt><strong><a name="item__rrdp__error_mode"><strong>$RRDp::error_mode</strong> and <strong>$RRDp::error</strong></a></strong>
+
+<dd>
+<p>If you set the variable $RRDp::error_mode to the value 'catch' before you run RRDp::read a potential
+ERROR message will not cause the program to abort but will be returned in this variable. If no error
+occurs the variable will be empty.</p>
+</dd>
+<dd>
+<pre>
+ $RRDp::error_mode = 'catch';
+ RRDp::cmd qw(info file.rrd);
+ print $RRDp::error if $RRDp::error;</pre>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<hr />
+<h1><a name="example">EXAMPLE</a></h1>
+<pre>
+ use RRDp;
+ RRDp::start &quot;/usr/local/bin/rrdtool&quot;;
+ RRDp::cmd   qw(create demo.rrd --step 100 
+               DS:in:GAUGE:100:U:U
+               RRA:AVERAGE:0.5:1:10);
+ $answer = RRDp::read;
+ print $$answer;
+ ($usertime,$systemtime,$realtime) =  ($RRDp::user,$RRDp::sys,$RRDp::real);</pre>
+<p>
+</p>
+<hr />
+<h1><a name="see_also">SEE ALSO</a></h1>
+<p>For more information on how to use RRDtool, check the manpages.</p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/RRDs.html b/doc/RRDs.html
new file mode 100644 (file)
index 0000000..d7876b5
--- /dev/null
@@ -0,0 +1,158 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>RRDs</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <ul>
+
+               <li><a href="#calling_sequence">Calling Sequence</a></li>
+               <li><a href="#error_handling">Error Handling</a></li>
+               <li><a href="#return_values">Return Values</a></li>
+       </ul>
+
+       <li><a href="#note">NOTE</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>RRDs - Access RRDtool as a shared module</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<pre>
+  use RRDs;
+  RRDs::error
+  RRDs::last ...
+  RRDs::info ...
+  RRDs::create ...
+  RRDs::update ...
+  RRDs::updatev ...
+  RRDs::graph ...
+  RRDs::fetch ...
+  RRDs::tune ...
+  RRDs::times(start, end)
+  RRDs::dump ...
+  RRDs::restore ...</pre>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>
+</p>
+<h2><a name="calling_sequence">Calling Sequence</a></h2>
+<p>This module accesses RRDtool functionality directly from within perl. The
+arguments to the functions listed in the SYNOPSIS are explained in the regular
+RRDtool documentation. The commandline call</p>
+<pre>
+ rrdtool update mydemo.rrd --template in:out N:12:13</pre>
+<p>gets turned into</p>
+<pre>
+ RRDs::update (&quot;mydemo.rrd&quot;, &quot;--template&quot;, &quot;in:out&quot;, &quot;N:12:13&quot;);</pre>
+<p>Note that</p>
+<pre>
+ --template=in:out</pre>
+<p>is also valid.</p>
+<p>The RRDs::times function takes two parameters:  a ``start'' and ``end'' time.
+These should be specified in the <strong>AT-STYLE TIME SPECIFICATION</strong> format
+used by RRDtool.  See the <strong>rrdfetch</strong> documentation for a detailed
+explanation on how to specify time.</p>
+<p>
+</p>
+<h2><a name="error_handling">Error Handling</a></h2>
+<p>The RRD functions will not abort your program even when they can not make
+sense out of the arguments you fed them.</p>
+<p>The function RRDs::error should be called to get the error status
+after each function call. If RRDs::error does not return anything
+then the previous function has completed its task successfully.</p>
+<pre>
+ use RRDs;
+ RRDs::update (&quot;mydemo.rrd&quot;,&quot;N:12:13&quot;);
+ my $ERR=RRDs::error;
+ die &quot;ERROR while updating mydemo.rrd: $ERR\n&quot; if $ERR;</pre>
+<p>
+</p>
+<h2><a name="return_values">Return Values</a></h2>
+<p>The functions RRDs::last, RRDs::graph, RRDs::info, RRDs::fetch and RRDs::times
+return their findings.</p>
+<p><strong>RRDs::last</strong> returns a single INTEGER representing the last update time.</p>
+<pre>
+ $lastupdate = RRDs::last ...</pre>
+<p><strong>RRDs::graph</strong> returns an pointer to an ARRAY containing the x-size and y-size of the
+created image and results of the PRINT arguments.</p>
+<pre>
+ ($averages,$xsize,$ysize) = RRDs::graph ...
+ print &quot;Imagesize: ${xsize}x${ysize}\n&quot;;
+ print &quot;Averages: &quot;, (join &quot;, &quot;, @$averages);</pre>
+<p><strong>RRDs::info</strong> returns a pointer to a hash. The keys of the hash
+represent the property names of the RRD and the values of the hash are
+the values of the properties.</p>
+<pre>
+ $hash = RRDs::info &quot;example.rrd&quot;;
+ foreach my $key (keys %$hash){
+   print &quot;$key = $$hash{$key}\n&quot;;
+ }</pre>
+<p><strong>RRDs::updatev</strong> also returns a pointer to hash. The keys of the hash
+are concatenated strings of a timestamp, RRA index, and data source name for
+each consolidated data point (CDP) written to disk as a result of the
+current update call. The hash values are CDP values.</p>
+<p><strong>RRDs::fetch</strong> is the most complex of
+the pack regarding return values. There are 4 values. Two normal
+integers, a pointer to an array and a pointer to a array of pointers.</p>
+<pre>
+  my ($start,$step,$names,$data) = RRDs::fetch ... 
+  print &quot;Start:       &quot;, scalar localtime($start), &quot; ($start)\n&quot;;
+  print &quot;Step size:   $step seconds\n&quot;;
+  print &quot;DS names:    &quot;, join (&quot;, &quot;, @$names).&quot;\n&quot;;
+  print &quot;Data points: &quot;, $#$data + 1, &quot;\n&quot;;
+  print &quot;Data:\n&quot;;
+  foreach my $line (@$data) {
+    print &quot;  &quot;, scalar localtime($start), &quot; ($start) &quot;;
+    $start += $step;
+    foreach my $val (@$line) {
+      printf &quot;%12.1f &quot;, $val;
+    }
+    print &quot;\n&quot;;
+  }</pre>
+<p><strong>RRDs::times</strong> returns two integers which are the number of seconds since
+epoch (1970-01-01) for the supplied ``start'' and ``end'' arguments, respectively.</p>
+<p>See the examples directory for more ways to use this extension.</p>
+<p>
+</p>
+<hr />
+<h1><a name="note">NOTE</a></h1>
+<p>If you are manipulating the TZ variable you should also call the posixs
+function tzset to initialize all internal state of the library for properly
+operating in the timezone of your choice.</p>
+<pre>
+ use POSIX qw(tzset);
+ $ENV{TZ} = 'CET';   
+ POSIX::tzset();</pre>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/bin_dec_hex.1 b/doc/bin_dec_hex.1
new file mode 100644 (file)
index 0000000..7744188
--- /dev/null
@@ -0,0 +1,535 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "BIN_DEC_HEX 1"
+.TH BIN_DEC_HEX 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+bin_dec_hex \- How to use binary, decimal, and hexadecimal notation.
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+Most people use the decimal numbering system. This system uses ten
+symbols to represent numbers. When those ten symbols are used up, they
+start all over again and increment the position to the left. The
+digit 0 is only shown if it is the only symbol in the sequence, or if
+it is not the first one.
+.PP
+If this sounds cryptic to you, this is what I've just said in numbers:
+.PP
+.Vb 14
+\&     0
+\&     1
+\&     2
+\&     3
+\&     4
+\&     5
+\&     6
+\&     7
+\&     8
+\&     9
+\&    10
+\&    11
+\&    12
+\&    13
+.Ve
+.PP
+and so on.
+.PP
+Each time the digit nine is incremented, it is reset to 0 and the
+position before (to the left) is incremented (from 0 to 1). Then
+number 9 can be seen as \*(L"00009\*(R" and when we should increment 9, we
+reset it to zero and increment the digit just before the 9 so the
+number becomes \*(L"00010\*(R". Leading zeros we don't write except if it is
+the only digit (number 0). And of course, we write zeros if they occur
+anywhere inside or at the end of a number:
+.PP
+.Vb 1
+\& "00010" \-> " 0010" \-> " 010" \-> "  10", but not "  1 ".
+.Ve
+.PP
+This was pretty basic, you already knew this. Why did I tell it?
+Well, computers usually do not represent numbers with 10 different
+digits. They only use two different symbols, namely \*(L"0\*(R" and \*(L"1\*(R". Apply
+the same rules to this set of digits and you get the binary numbering
+system:
+.PP
+.Vb 14
+\&     0
+\&     1
+\&    10
+\&    11
+\&   100
+\&   101
+\&   110
+\&   111
+\&  1000
+\&  1001
+\&  1010
+\&  1011
+\&  1100
+\&  1101
+.Ve
+.PP
+and so on.
+.PP
+If you count the number of rows, you'll see that these are again 14
+different numbers. The numbers are the same and mean the same as in
+the first list, we just used a different representation. This means
+that you have to know the representation used, or as it is called the
+numbering system or base.  Normally, if we do not explicitly specify
+the numbering system used, we implicitly use the decimal system. If we
+want to use any other numbering system, we'll have to make that
+clear. There are a few widely adopted methods to do so. One common
+form is to write 1010(2) which means that you wrote down a number in
+its binary representation. It is the number ten. If you would write
+1010 without specifying the base, the number is interpreted as one
+thousand and ten using base 10.
+.PP
+In books, another form is common. It uses subscripts (little
+characters, more or less in between two rows). You can leave out the
+parentheses in that case and write down the number in normal
+characters followed by a little two just behind it.
+.PP
+As the numbering system used is also called the base, we talk of the
+number 1100 base 2, the number 12 base 10.
+.PP
+Within the binary system, it is common to write leading zeros. The
+numbers are written down in series of four, eight or sixteen depending
+on the context.
+.PP
+We can use the binary form when talking to computers
+(...programming...), but the numbers will have large
+representations. The number 65'535 (often in the decimal system a ' is
+used to separate blocks of three digits for readability) would be
+written down as 1111111111111111(2) which is 16 times the digit 1.
+This is difficult and prone to errors. Therefore, we usually would use
+another base, called hexadecimal. It uses 16 different symbols. First
+the symbols from the decimal system are used, thereafter we continue
+with alphabetic characters. We get 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+A, B, C, D, E and F. This system is chosen because the hexadecimal
+form can be converted into the binary system very easily (and back).
+.PP
+There is yet another system in use, called the octal system. This was
+more common in the old days, but is not used very often anymore. As
+you might find it in use sometimes, you should get used to it and
+we'll show it below. It's the same story as with the other
+representations, but with eight different symbols.
+.PP
+.Vb 4
+\& Binary      (2)
+\& Octal       (8)
+\& Decimal     (10)
+\& Hexadecimal (16)
+.Ve
+.PP
+.Vb 23
+\& (2)    (8) (10) (16)
+\& 00000   0    0    0
+\& 00001   1    1    1
+\& 00010   2    2    2
+\& 00011   3    3    3
+\& 00100   4    4    4
+\& 00101   5    5    5
+\& 00110   6    6    6
+\& 00111   7    7    7
+\& 01000  10    8    8
+\& 01001  11    9    9
+\& 01010  12   10    A
+\& 01011  13   11    B
+\& 01100  14   12    C
+\& 01101  15   13    D
+\& 01110  16   14    E
+\& 01111  17   15    F
+\& 10000  20   16   10
+\& 10001  21   17   11
+\& 10010  22   18   12
+\& 10011  23   19   13
+\& 10100  24   20   14
+\& 10101  25   21   15
+.Ve
+.PP
+Most computers used nowadays are using bytes of eight bits. This means
+that they store eight bits at a time. You can see why the octal system
+is not the most practical for that: You'd need three digits to represent
+the eight bits and this means that you'd have to use one complete digit
+to represent only two bits (2+3+3=8). This is a waste. For hexadecimal
+digits, you need only two digits which are used completely:
+.PP
+.Vb 2
+\& (2)      (8)  (10) (16)
+\& 11111111 377  255   FF
+.Ve
+.PP
+You can see why binary and hexadecimal can be converted quickly: For
+each hexadecimal digit there are exactly four binary digits.  Take a
+binary number: take four digits from the right and make a hexadecimal
+digit from it (see the table above). Repeat this until there are no
+more digits. And the other way around: Take a hexadecimal number. For
+each digit, write down its binary equivalent.
+.PP
+Computers (or rather the parsers running on them) would have a hard
+time converting a number like 1234(16). Therefore hexadecimal numbers
+are specified with a prefix. This prefix depends on the language
+you're writing in. Some of the prefixes are \*(L"0x\*(R" for C, \*(L"$\*(R" for
+Pascal, \*(L"#\*(R" for \s-1HTML\s0.  It is common to assume that if a number starts
+with a zero, it is octal. It does not matter what is used as long as
+you know what it is. I will use \*(L"0x\*(R" for hexadecimal, \*(L"%\*(R" for binary
+and \*(L"0\*(R" for octal.  The following numbers are all the same, just their represenatation (base) is different: 021 0x11 17 \f(CW%00010001\fR
+.PP
+To do arithmetics and conversions you need to understand one more thing.
+It is something you already know but perhaps you do not \*(L"see\*(R" it yet:
+.PP
+If you write down 1234, (no prefix, so it is decimal) you are talking
+about the number one thousand, two hundred and thirty four. In sort of
+a formula:
+.PP
+.Vb 4
+\& 1 * 1000 = 1000
+\& 2 *  100 =  200
+\& 3 *   10 =   30
+\& 4 *    1 =    4
+.Ve
+.PP
+This can also be written as:
+.PP
+.Vb 4
+\& 1 * 10^3
+\& 2 * 10^2
+\& 3 * 10^1
+\& 4 * 10^0
+.Ve
+.PP
+where ^ means \*(L"to the power of\*(R".
+.PP
+We are using the base 10, and the positions 0,1,2 and 3.
+The right-most position should \s-1NOT\s0 be multiplied with 10. The second
+from the right should be multiplied one time with 10. The third from
+the right is multiplied with 10 two times. This continues for whatever
+positions are used.
+.PP
+It is the same in all other representations:
+.PP
+0x1234 will be
+.PP
+.Vb 4
+\& 1 * 16^3
+\& 2 * 16^2
+\& 3 * 16^1
+\& 4 * 16^0
+.Ve
+.PP
+01234 would be
+.PP
+.Vb 4
+\& 1 * 8^3
+\& 2 * 8^2
+\& 3 * 8^1
+\& 4 * 8^0
+.Ve
+.PP
+This example can not be done for binary as that system only uses two
+symbols. Another example:
+.PP
+%1010 would be
+.PP
+.Vb 4
+\& 1 * 2^3
+\& 0 * 2^2
+\& 1 * 2^1
+\& 0 * 2^0
+.Ve
+.PP
+It would have been easier to convert it to its hexadecimal form and
+just translate \f(CW%1010\fR into 0xA. After a while you get used to it. You will
+not need to do any calculations anymore, but just know that 0xA means 10.
+.PP
+To convert a decimal number into a hexadecimal you could use the next
+method. It will take some time to be able to do the estimates, but it
+will be easier when you use the system more frequently. We'll look at
+yet another way afterwards.
+.PP
+First you need to know how many positions will be used in the other
+system. To do so, you need to know the maximum numbers you'll be
+using. Well, that's not as hard as it looks. In decimal, the maximum
+number that you can form with two digits is \*(L"99\*(R". The maximum for
+three: \*(L"999\*(R". The next number would need an extra position. Reverse
+this idea and you will see that the number can be found by taking 10^3
+(10*10*10 is 1000) minus 1 or 10^2 minus one.
+.PP
+This can be done for hexadecimal as well:
+.PP
+.Vb 4
+\& 16^4 = 0x10000 = 65536
+\& 16^3 =  0x1000 =  4096
+\& 16^2 =   0x100 =   256
+\& 16^1 =    0x10 =    16
+.Ve
+.PP
+If a number is smaller than 65'536 it will fit in four positions.
+If the number is bigger than 4'095, you must use position 4.
+How many times you can subtract 4'096 from the number without going below
+zero is the first digit you write down. This will always be a number
+from 1 to 15 (0x1 to 0xF). Do the same for the other positions.
+.PP
+Let's try with 41'029. It is smaller than 16^4 but bigger than 16^3\-1. This
+means that we have to use four positions.
+We can subtract 16^3 from 41'029 ten times without going below zero.
+The left-most digit will therefore be \*(L"A\*(R", so we have 0xA????.
+The number is reduced to 41'029 \- 10*4'096 = 41'029\-40'960 = 69.
+69 is smaller than 16^3 but not bigger than 16^2\-1. The second digit
+is therefore \*(L"0\*(R" and we now have 0xA0??.
+69 is smaller than 16^2 and bigger than 16^1\-1. We can subtract 16^1
+(which is just plain 16) four times and write down \*(L"4\*(R" to get 0xA04?.
+Subtract 64 from 69 (69 \- 4*16) and the last digit is 5 \-\-> 0xA045.
+.PP
+The other method builds ub the number from the right. Let's try 41'029
+again.  Divide by 16 and do not use fractions (only whole numbers).
+.PP
+.Vb 4
+\& 41'029 / 16 is 2'564 with a remainder of 5. Write down 5.
+\& 2'564 / 16 is 160 with a remainder of 4. Write the 4 before the 5.
+\& 160 / 16 is 10 with no remainder. Prepend 45 with 0.
+\& 10 / 16 is below one. End here and prepend 0xA. End up with 0xA045.
+.Ve
+.PP
+Which method to use is up to you. Use whatever works for you.  I use
+them both without being able to tell what method I use in each case,
+it just depends on the number, I think. Fact is, some numbers will
+occur frequently while programming. If the number is close to one I am
+familiar with, then I will use the first method (like 32'770 which is
+into 32'768 + 2 and I just know that it is 0x8000 + 0x2 = 0x8002).
+.PP
+For binary the same approach can be used. The base is 2 and not 16,
+and the number of positions will grow rapidly. Using the second method
+has the advantage that you can see very easily if you should write down
+a zero or a one: if you divide by two the remainder will be zero if it
+is an even number and one if it is an odd number:
+.PP
+.Vb 16
+\& 41029 / 2 = 20514 remainder 1
+\& 20514 / 2 = 10257 remainder 0
+\& 10257 / 2 =  5128 remainder 1
+\&  5128 / 2 =  2564 remainder 0
+\&  2564 / 2 =  1282 remainder 0
+\&  1282 / 2 =   641 remainder 0
+\&   641 / 2 =   320 remainder 1
+\&   320 / 2 =   160 remainder 0
+\&   160 / 2 =    80 remainder 0
+\&    80 / 2 =    40 remainder 0
+\&    40 / 2 =    20 remainder 0
+\&    20 / 2 =    10 remainder 0
+\&    10 / 2 =     5 remainder 0
+\&     5 / 2 =     2 remainder 1
+\&     2 / 2 =     1 remainder 0
+\&     1 / 2 below 0 remainder 1
+.Ve
+.PP
+Write down the results from right to left: \f(CW%1010000001000101\fR
+.PP
+Group by four:
+.PP
+.Vb 4
+\& %1010000001000101
+\& %101000000100 0101
+\& %10100000 0100 0101
+\& %1010 0000 0100 0101
+.Ve
+.PP
+Convert into hexadecimal: 0xA045
+.PP
+Group \f(CW%1010000001000101\fR by three and convert into octal:
+.PP
+.Vb 8
+\& %1010000001000101
+\& %1010000001000 101
+\& %1010000001 000 101
+\& %1010000 001 000 101
+\& %1010 000 001 000 101
+\& %1 010 000 001 000 101
+\& %001 010 000 001 000 101
+\&    1   2   0   1   0   5 \-\-> 0120105
+.Ve
+.PP
+.Vb 3
+\& So: %1010000001000101 = 0120105 = 0xA045 = 41029
+\& Or: 1010000001000101(2) = 120105(8) = A045(16) = 41029(10)
+\& Or: 1010000001000101(2) = 120105(8) = A045(16) = 41029
+.Ve
+.PP
+At first while adding numbers, you'll convert them to their decimal
+form and then back into their original form after doing the addition.
+If you use the other numbering system often, you will see that you'll
+be able to do arithmetics directly in the base that is used.
+In any representation it is the same, add the numbers on the right,
+write down the right-most digit from the result, remember the other
+digits and use them in the next round. Continue with the second digit
+from the right and so on:
+.PP
+.Vb 1
+\&    %1010 + %0111 \-\-> 10 + 7 \-\-> 17 \-\-> %00010001
+.Ve
+.PP
+will become
+.PP
+.Vb 10
+\&    %1010
+\&    %0111 +
+\&     ||||
+\&     |||+\-\- add 0 + 1, result is 1, nothing to remember
+\&     ||+\-\-\- add 1 + 1, result is %10, write down 0 and remember 1
+\&     |+\-\-\-\- add 0 + 1 + 1(remembered), result = 0, remember 1
+\&     +\-\-\-\-\- add 1 + 0 + 1(remembered), result = 0, remember 1
+\&            nothing to add, 1 remembered, result = 1
+\& \-\-\-\-\-\-\-\-
+\&   %10001 is the result, I like to write it as %00010001
+.Ve
+.PP
+For low values, try to do the calculations yourself, then check them with
+a calculator. The more you do the calculations yourself, the more you'll
+find that you didn't make mistakes. In the end, you'll do calculi in
+other bases as easily as you do them in decimal.
+.PP
+When the numbers get bigger, you'll have to realize that a computer is
+not called a computer just to have a nice name. There are many
+different calculators available, use them. For Unix you could use \*(L"bc\*(R"
+which is short for Binary Calculator. It calculates not only in
+decimal, but in all bases you'll ever want to use (among them Binary).
+.PP
+For people on Windows:
+Start the calculator (start\->programs\->accessories\->calculator)
+and if necessary click view\->scientific. You now have a scientific
+calculator and can compute in binary or hexadecimal.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+I hope you enjoyed the examples and their descriptions. If you do, help
+other people by pointing them to this document when they are asking
+basic questions. They will not only get their answer, but at the same
+time learn a whole lot more.
+.PP
+Alex van den Bogaerdt  <alex@ergens.op.het.net>
diff --git a/doc/bin_dec_hex.html b/doc/bin_dec_hex.html
new file mode 100644 (file)
index 0000000..7fcc027
--- /dev/null
@@ -0,0 +1,356 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>bin_dec_hex</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>bin_dec_hex - How to use binary, decimal, and hexadecimal notation.</p>
+<div align="right"><a href="bin_dec_hex.pdf">PDF</a> version.</div><p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>Most people use the decimal numbering system. This system uses ten
+symbols to represent numbers. When those ten symbols are used up, they
+start all over again and increment the position to the left. The
+digit 0 is only shown if it is the only symbol in the sequence, or if
+it is not the first one.</p>
+<p>If this sounds cryptic to you, this is what I've just said in numbers:</p>
+<pre>
+     0
+     1
+     2
+     3
+     4
+     5
+     6
+     7
+     8
+     9
+    10
+    11
+    12
+    13</pre>
+<p>and so on.</p>
+<p>Each time the digit nine is incremented, it is reset to 0 and the
+position before (to the left) is incremented (from 0 to 1). Then
+number 9 can be seen as ``00009'' and when we should increment 9, we
+reset it to zero and increment the digit just before the 9 so the
+number becomes ``00010''. Leading zeros we don't write except if it is
+the only digit (number 0). And of course, we write zeros if they occur
+anywhere inside or at the end of a number:</p>
+<pre>
+ &quot;00010&quot; -&gt; &quot; 0010&quot; -&gt; &quot; 010&quot; -&gt; &quot;  10&quot;, but not &quot;  1 &quot;.</pre>
+<p>This was pretty basic, you already knew this. Why did I tell it?
+Well, computers usually do not represent numbers with 10 different
+digits. They only use two different symbols, namely ``0'' and ``1''. Apply
+the same rules to this set of digits and you get the binary numbering
+system:</p>
+<pre>
+     0
+     1
+    10
+    11
+   100
+   101
+   110
+   111
+  1000
+  1001
+  1010
+  1011
+  1100
+  1101</pre>
+<p>and so on.</p>
+<p>If you count the number of rows, you'll see that these are again 14
+different numbers. The numbers are the same and mean the same as in
+the first list, we just used a different representation. This means
+that you have to know the representation used, or as it is called the
+numbering system or base.  Normally, if we do not explicitly specify
+the numbering system used, we implicitly use the decimal system. If we
+want to use any other numbering system, we'll have to make that
+clear. There are a few widely adopted methods to do so. One common
+form is to write <code>1010(2)</code> which means that you wrote down a number in
+its binary representation. It is the number ten. If you would write
+1010 without specifying the base, the number is interpreted as one
+thousand and ten using base 10.</p>
+<p>In books, another form is common. It uses subscripts (little
+characters, more or less in between two rows). You can leave out the
+parentheses in that case and write down the number in normal
+characters followed by a little two just behind it.</p>
+<p>As the numbering system used is also called the base, we talk of the
+number 1100 base 2, the number 12 base 10.</p>
+<p>Within the binary system, it is common to write leading zeros. The
+numbers are written down in series of four, eight or sixteen depending
+on the context.</p>
+<p>We can use the binary form when talking to computers
+(...programming...), but the numbers will have large
+representations. The number 65'535 (often in the decimal system a ' is
+used to separate blocks of three digits for readability) would be
+written down as <code>1111111111111111(2)</code> which is 16 times the digit 1.
+This is difficult and prone to errors. Therefore, we usually would use
+another base, called hexadecimal. It uses 16 different symbols. First
+the symbols from the decimal system are used, thereafter we continue
+with alphabetic characters. We get 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+A, B, C, D, E and F. This system is chosen because the hexadecimal
+form can be converted into the binary system very easily (and back).</p>
+<p>There is yet another system in use, called the octal system. This was
+more common in the old days, but is not used very often anymore. As
+you might find it in use sometimes, you should get used to it and
+we'll show it below. It's the same story as with the other
+representations, but with eight different symbols.</p>
+<pre>
+ Binary      (2)
+ Octal       (8)
+ Decimal     (10)
+ Hexadecimal (16)</pre>
+<pre>
+ (2)    (8) (10) (16)
+ 00000   0    0    0
+ 00001   1    1    1
+ 00010   2    2    2
+ 00011   3    3    3
+ 00100   4    4    4
+ 00101   5    5    5
+ 00110   6    6    6
+ 00111   7    7    7
+ 01000  10    8    8
+ 01001  11    9    9
+ 01010  12   10    A
+ 01011  13   11    B
+ 01100  14   12    C
+ 01101  15   13    D
+ 01110  16   14    E
+ 01111  17   15    F
+ 10000  20   16   10
+ 10001  21   17   11
+ 10010  22   18   12
+ 10011  23   19   13
+ 10100  24   20   14
+ 10101  25   21   15</pre>
+<p>Most computers used nowadays are using bytes of eight bits. This means
+that they store eight bits at a time. You can see why the octal system
+is not the most practical for that: You'd need three digits to represent
+the eight bits and this means that you'd have to use one complete digit
+to represent only two bits (2+3+3=8). This is a waste. For hexadecimal
+digits, you need only two digits which are used completely:</p>
+<pre>
+ (2)      (8)  (10) (16)
+ 11111111 377  255   FF</pre>
+<p>You can see why binary and hexadecimal can be converted quickly: For
+each hexadecimal digit there are exactly four binary digits.  Take a
+binary number: take four digits from the right and make a hexadecimal
+digit from it (see the table above). Repeat this until there are no
+more digits. And the other way around: Take a hexadecimal number. For
+each digit, write down its binary equivalent.</p>
+<p>Computers (or rather the parsers running on them) would have a hard
+time converting a number like 1234(16). Therefore hexadecimal numbers
+are specified with a prefix. This prefix depends on the language
+you're writing in. Some of the prefixes are ``0x'' for C, ``$'' for
+Pascal, ``#'' for HTML.  It is common to assume that if a number starts
+with a zero, it is octal. It does not matter what is used as long as
+you know what it is. I will use ``0x'' for hexadecimal, ``%'' for binary
+and ``0'' for octal.  The following numbers are all the same, just their represenatation (base) is different: 021 0x11 17 %00010001</p>
+<p>To do arithmetics and conversions you need to understand one more thing.
+It is something you already know but perhaps you do not ``see'' it yet:</p>
+<p>If you write down 1234, (no prefix, so it is decimal) you are talking
+about the number one thousand, two hundred and thirty four. In sort of
+a formula:</p>
+<pre>
+ 1 * 1000 = 1000
+ 2 *  100 =  200
+ 3 *   10 =   30
+ 4 *    1 =    4</pre>
+<p>This can also be written as:</p>
+<pre>
+ 1 * 10^3
+ 2 * 10^2
+ 3 * 10^1
+ 4 * 10^0</pre>
+<p>where ^ means ``to the power of''.</p>
+<p>We are using the base 10, and the positions 0,1,2 and 3.
+The right-most position should NOT be multiplied with 10. The second
+from the right should be multiplied one time with 10. The third from
+the right is multiplied with 10 two times. This continues for whatever
+positions are used.</p>
+<p>It is the same in all other representations:</p>
+<p>0x1234 will be</p>
+<pre>
+ 1 * 16^3
+ 2 * 16^2
+ 3 * 16^1
+ 4 * 16^0</pre>
+<p>01234 would be</p>
+<pre>
+ 1 * 8^3
+ 2 * 8^2
+ 3 * 8^1
+ 4 * 8^0</pre>
+<p>This example can not be done for binary as that system only uses two
+symbols. Another example:</p>
+<p>%1010 would be</p>
+<pre>
+ 1 * 2^3
+ 0 * 2^2
+ 1 * 2^1
+ 0 * 2^0</pre>
+<p>It would have been easier to convert it to its hexadecimal form and
+just translate %1010 into 0xA. After a while you get used to it. You will
+not need to do any calculations anymore, but just know that 0xA means 10.</p>
+<p>To convert a decimal number into a hexadecimal you could use the next
+method. It will take some time to be able to do the estimates, but it
+will be easier when you use the system more frequently. We'll look at
+yet another way afterwards.</p>
+<p>First you need to know how many positions will be used in the other
+system. To do so, you need to know the maximum numbers you'll be
+using. Well, that's not as hard as it looks. In decimal, the maximum
+number that you can form with two digits is ``99''. The maximum for
+three: ``999''. The next number would need an extra position. Reverse
+this idea and you will see that the number can be found by taking 10^3
+(10*10*10 is 1000) minus 1 or 10^2 minus one.</p>
+<p>This can be done for hexadecimal as well:</p>
+<pre>
+ 16^4 = 0x10000 = 65536
+ 16^3 =  0x1000 =  4096
+ 16^2 =   0x100 =   256
+ 16^1 =    0x10 =    16</pre>
+<p>If a number is smaller than 65'536 it will fit in four positions.
+If the number is bigger than 4'095, you must use position 4.
+How many times you can subtract 4'096 from the number without going below
+zero is the first digit you write down. This will always be a number
+from 1 to 15 (0x1 to 0xF). Do the same for the other positions.</p>
+<p>Let's try with 41'029. It is smaller than 16^4 but bigger than 16^3-1. This
+means that we have to use four positions.
+We can subtract 16^3 from 41'029 ten times without going below zero.
+The left-most digit will therefore be ``A'', so we have 0xA????.
+The number is reduced to 41'029 - 10*4'096 = 41'029-40'960 = 69.
+69 is smaller than 16^3 but not bigger than 16^2-1. The second digit
+is therefore ``0'' and we now have 0xA0??.
+69 is smaller than 16^2 and bigger than 16^1-1. We can subtract 16^1
+(which is just plain 16) four times and write down ``4'' to get 0xA04?.
+Subtract 64 from 69 (69 - 4*16) and the last digit is 5 --&gt; 0xA045.</p>
+<p>The other method builds ub the number from the right. Let's try 41'029
+again.  Divide by 16 and do not use fractions (only whole numbers).</p>
+<pre>
+ 41'029 / 16 is 2'564 with a remainder of 5. Write down 5.
+ 2'564 / 16 is 160 with a remainder of 4. Write the 4 before the 5.
+ 160 / 16 is 10 with no remainder. Prepend 45 with 0.
+ 10 / 16 is below one. End here and prepend 0xA. End up with 0xA045.</pre>
+<p>Which method to use is up to you. Use whatever works for you.  I use
+them both without being able to tell what method I use in each case,
+it just depends on the number, I think. Fact is, some numbers will
+occur frequently while programming. If the number is close to one I am
+familiar with, then I will use the first method (like 32'770 which is
+into 32'768 + 2 and I just know that it is 0x8000 + 0x2 = 0x8002).</p>
+<p>For binary the same approach can be used. The base is 2 and not 16,
+and the number of positions will grow rapidly. Using the second method
+has the advantage that you can see very easily if you should write down
+a zero or a one: if you divide by two the remainder will be zero if it
+is an even number and one if it is an odd number:</p>
+<pre>
+ 41029 / 2 = 20514 remainder 1
+ 20514 / 2 = 10257 remainder 0
+ 10257 / 2 =  5128 remainder 1
+  5128 / 2 =  2564 remainder 0
+  2564 / 2 =  1282 remainder 0
+  1282 / 2 =   641 remainder 0
+   641 / 2 =   320 remainder 1
+   320 / 2 =   160 remainder 0
+   160 / 2 =    80 remainder 0
+    80 / 2 =    40 remainder 0
+    40 / 2 =    20 remainder 0
+    20 / 2 =    10 remainder 0
+    10 / 2 =     5 remainder 0
+     5 / 2 =     2 remainder 1
+     2 / 2 =     1 remainder 0
+     1 / 2 below 0 remainder 1</pre>
+<p>Write down the results from right to left: %1010000001000101</p>
+<p>Group by four:</p>
+<pre>
+ %1010000001000101
+ %101000000100 0101
+ %10100000 0100 0101
+ %1010 0000 0100 0101</pre>
+<p>Convert into hexadecimal: 0xA045</p>
+<p>Group %1010000001000101 by three and convert into octal:</p>
+<pre>
+ %1010000001000101
+ %1010000001000 101
+ %1010000001 000 101
+ %1010000 001 000 101
+ %1010 000 001 000 101
+ %1 010 000 001 000 101
+ %001 010 000 001 000 101
+    1   2   0   1   0   5 --&gt; 0120105</pre>
+<pre>
+ So: %1010000001000101 = 0120105 = 0xA045 = 41029
+ Or: 1010000001000101(2) = 120105(8) = A045(16) = 41029(10)
+ Or: 1010000001000101(2) = 120105(8) = A045(16) = 41029</pre>
+<p>At first while adding numbers, you'll convert them to their decimal
+form and then back into their original form after doing the addition.
+If you use the other numbering system often, you will see that you'll
+be able to do arithmetics directly in the base that is used.
+In any representation it is the same, add the numbers on the right,
+write down the right-most digit from the result, remember the other
+digits and use them in the next round. Continue with the second digit
+from the right and so on:</p>
+<pre>
+    %1010 + %0111 --&gt; 10 + 7 --&gt; 17 --&gt; %00010001</pre>
+<p>will become</p>
+<pre>
+    %1010
+    %0111 +
+     ||||
+     |||+-- add 0 + 1, result is 1, nothing to remember
+     ||+--- add 1 + 1, result is %10, write down 0 and remember 1
+     |+---- add 0 + 1 + 1(remembered), result = 0, remember 1
+     +----- add 1 + 0 + 1(remembered), result = 0, remember 1
+            nothing to add, 1 remembered, result = 1
+ --------
+   %10001 is the result, I like to write it as %00010001</pre>
+<p>For low values, try to do the calculations yourself, then check them with
+a calculator. The more you do the calculations yourself, the more you'll
+find that you didn't make mistakes. In the end, you'll do calculi in
+other bases as easily as you do them in decimal.</p>
+<p>When the numbers get bigger, you'll have to realize that a computer is
+not called a computer just to have a nice name. There are many
+different calculators available, use them. For Unix you could use ``bc''
+which is short for Binary Calculator. It calculates not only in
+decimal, but in all bases you'll ever want to use (among them Binary).</p>
+<p>For people on Windows:
+Start the calculator (start-&gt;programs-&gt;accessories-&gt;calculator)
+and if necessary click view-&gt;scientific. You now have a scientific
+calculator and can compute in binary or hexadecimal.</p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>I hope you enjoyed the examples and their descriptions. If you do, help
+other people by pointing them to this document when they are asking
+basic questions. They will not only get their answer, but at the same
+time learn a whole lot more.</p>
+<p>Alex van den Bogaerdt  &lt;<a href="mailto:alex@ergens.op.het.net">alex@ergens.op.het.net</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/bin_dec_hex.pod b/doc/bin_dec_hex.pod
new file mode 100644 (file)
index 0000000..7a2adf5
--- /dev/null
@@ -0,0 +1,371 @@
+=head1 NAME
+
+bin_dec_hex - How to use binary, decimal, and hexadecimal notation.
+
+=for html <div align="right"><a href="bin_dec_hex.pdf">PDF</a> version.</div>
+
+=head1 DESCRIPTION
+
+Most people use the decimal numbering system. This system uses ten
+symbols to represent numbers. When those ten symbols are used up, they
+start all over again and increment the position to the left. The
+digit 0 is only shown if it is the only symbol in the sequence, or if
+it is not the first one.
+
+If this sounds cryptic to you, this is what I've just said in numbers:
+
+     0
+     1
+     2
+     3
+     4
+     5
+     6
+     7
+     8
+     9
+    10
+    11
+    12
+    13
+
+and so on.
+
+Each time the digit nine is incremented, it is reset to 0 and the
+position before (to the left) is incremented (from 0 to 1). Then
+number 9 can be seen as "00009" and when we should increment 9, we
+reset it to zero and increment the digit just before the 9 so the
+number becomes "00010". Leading zeros we don't write except if it is
+the only digit (number 0). And of course, we write zeros if they occur
+anywhere inside or at the end of a number:
+
+ "00010" -> " 0010" -> " 010" -> "  10", but not "  1 ".
+
+This was pretty basic, you already knew this. Why did I tell it?
+Well, computers usually do not represent numbers with 10 different
+digits. They only use two different symbols, namely "0" and "1". Apply
+the same rules to this set of digits and you get the binary numbering
+system:
+
+     0
+     1
+    10
+    11
+   100
+   101
+   110
+   111
+  1000
+  1001
+  1010
+  1011
+  1100
+  1101
+
+and so on.
+
+If you count the number of rows, you'll see that these are again 14
+different numbers. The numbers are the same and mean the same as in
+the first list, we just used a different representation. This means
+that you have to know the representation used, or as it is called the
+numbering system or base.  Normally, if we do not explicitly specify
+the numbering system used, we implicitly use the decimal system. If we
+want to use any other numbering system, we'll have to make that
+clear. There are a few widely adopted methods to do so. One common
+form is to write 1010(2) which means that you wrote down a number in
+its binary representation. It is the number ten. If you would write
+1010 without specifying the base, the number is interpreted as one
+thousand and ten using base 10.
+
+In books, another form is common. It uses subscripts (little
+characters, more or less in between two rows). You can leave out the
+parentheses in that case and write down the number in normal
+characters followed by a little two just behind it.
+
+As the numbering system used is also called the base, we talk of the
+number 1100 base 2, the number 12 base 10.
+
+Within the binary system, it is common to write leading zeros. The
+numbers are written down in series of four, eight or sixteen depending
+on the context.
+
+We can use the binary form when talking to computers
+(...programming...), but the numbers will have large
+representations. The number 65'535 (often in the decimal system a ' is
+used to separate blocks of three digits for readability) would be
+written down as 1111111111111111(2) which is 16 times the digit 1.
+This is difficult and prone to errors. Therefore, we usually would use
+another base, called hexadecimal. It uses 16 different symbols. First
+the symbols from the decimal system are used, thereafter we continue
+with alphabetic characters. We get 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+A, B, C, D, E and F. This system is chosen because the hexadecimal
+form can be converted into the binary system very easily (and back).
+
+There is yet another system in use, called the octal system. This was
+more common in the old days, but is not used very often anymore. As
+you might find it in use sometimes, you should get used to it and
+we'll show it below. It's the same story as with the other
+representations, but with eight different symbols.
+
+ Binary      (2)
+ Octal       (8)
+ Decimal     (10)
+ Hexadecimal (16)
+
+ (2)    (8) (10) (16)
+ 00000   0    0    0
+ 00001   1    1    1
+ 00010   2    2    2
+ 00011   3    3    3
+ 00100   4    4    4
+ 00101   5    5    5
+ 00110   6    6    6
+ 00111   7    7    7
+ 01000  10    8    8
+ 01001  11    9    9
+ 01010  12   10    A
+ 01011  13   11    B
+ 01100  14   12    C
+ 01101  15   13    D
+ 01110  16   14    E
+ 01111  17   15    F
+ 10000  20   16   10
+ 10001  21   17   11
+ 10010  22   18   12
+ 10011  23   19   13
+ 10100  24   20   14
+ 10101  25   21   15
+
+Most computers used nowadays are using bytes of eight bits. This means
+that they store eight bits at a time. You can see why the octal system
+is not the most practical for that: You'd need three digits to represent
+the eight bits and this means that you'd have to use one complete digit
+to represent only two bits (2+3+3=8). This is a waste. For hexadecimal
+digits, you need only two digits which are used completely:
+
+ (2)      (8)  (10) (16)
+ 11111111 377  255   FF
+
+You can see why binary and hexadecimal can be converted quickly: For
+each hexadecimal digit there are exactly four binary digits.  Take a
+binary number: take four digits from the right and make a hexadecimal
+digit from it (see the table above). Repeat this until there are no
+more digits. And the other way around: Take a hexadecimal number. For
+each digit, write down its binary equivalent.
+
+Computers (or rather the parsers running on them) would have a hard
+time converting a number like 1234(16). Therefore hexadecimal numbers
+are specified with a prefix. This prefix depends on the language
+you're writing in. Some of the prefixes are "0x" for C, "$" for
+Pascal, "#" for HTML.  It is common to assume that if a number starts
+with a zero, it is octal. It does not matter what is used as long as
+you know what it is. I will use "0x" for hexadecimal, "%" for binary
+and "0" for octal.  The following numbers are all the same, just their represenatation (base) is different: 021 0x11 17 %00010001
+
+To do arithmetics and conversions you need to understand one more thing.
+It is something you already know but perhaps you do not "see" it yet:
+
+If you write down 1234, (no prefix, so it is decimal) you are talking
+about the number one thousand, two hundred and thirty four. In sort of
+a formula:
+
+ 1 * 1000 = 1000
+ 2 *  100 =  200
+ 3 *   10 =   30
+ 4 *    1 =    4
+
+This can also be written as:
+
+ 1 * 10^3
+ 2 * 10^2
+ 3 * 10^1
+ 4 * 10^0
+
+where ^ means "to the power of".
+
+We are using the base 10, and the positions 0,1,2 and 3.
+The right-most position should NOT be multiplied with 10. The second
+from the right should be multiplied one time with 10. The third from
+the right is multiplied with 10 two times. This continues for whatever
+positions are used.
+
+It is the same in all other representations:
+
+0x1234 will be
+
+ 1 * 16^3
+ 2 * 16^2
+ 3 * 16^1
+ 4 * 16^0
+
+01234 would be
+
+ 1 * 8^3
+ 2 * 8^2
+ 3 * 8^1
+ 4 * 8^0
+
+This example can not be done for binary as that system only uses two
+symbols. Another example:
+
+%1010 would be
+
+ 1 * 2^3
+ 0 * 2^2
+ 1 * 2^1
+ 0 * 2^0
+
+It would have been easier to convert it to its hexadecimal form and
+just translate %1010 into 0xA. After a while you get used to it. You will
+not need to do any calculations anymore, but just know that 0xA means 10.
+
+To convert a decimal number into a hexadecimal you could use the next
+method. It will take some time to be able to do the estimates, but it
+will be easier when you use the system more frequently. We'll look at
+yet another way afterwards.
+
+First you need to know how many positions will be used in the other
+system. To do so, you need to know the maximum numbers you'll be
+using. Well, that's not as hard as it looks. In decimal, the maximum
+number that you can form with two digits is "99". The maximum for
+three: "999". The next number would need an extra position. Reverse
+this idea and you will see that the number can be found by taking 10^3
+(10*10*10 is 1000) minus 1 or 10^2 minus one.
+
+This can be done for hexadecimal as well:
+
+ 16^4 = 0x10000 = 65536
+ 16^3 =  0x1000 =  4096
+ 16^2 =   0x100 =   256
+ 16^1 =    0x10 =    16
+
+If a number is smaller than 65'536 it will fit in four positions.
+If the number is bigger than 4'095, you must use position 4.
+How many times you can subtract 4'096 from the number without going below
+zero is the first digit you write down. This will always be a number
+from 1 to 15 (0x1 to 0xF). Do the same for the other positions.
+
+Let's try with 41'029. It is smaller than 16^4 but bigger than 16^3-1. This
+means that we have to use four positions.
+We can subtract 16^3 from 41'029 ten times without going below zero.
+The left-most digit will therefore be "A", so we have 0xA????.
+The number is reduced to 41'029 - 10*4'096 = 41'029-40'960 = 69.
+69 is smaller than 16^3 but not bigger than 16^2-1. The second digit
+is therefore "0" and we now have 0xA0??.
+69 is smaller than 16^2 and bigger than 16^1-1. We can subtract 16^1
+(which is just plain 16) four times and write down "4" to get 0xA04?.
+Subtract 64 from 69 (69 - 4*16) and the last digit is 5 --> 0xA045.
+
+The other method builds ub the number from the right. Let's try 41'029
+again.  Divide by 16 and do not use fractions (only whole numbers).
+
+ 41'029 / 16 is 2'564 with a remainder of 5. Write down 5.
+ 2'564 / 16 is 160 with a remainder of 4. Write the 4 before the 5.
+ 160 / 16 is 10 with no remainder. Prepend 45 with 0.
+ 10 / 16 is below one. End here and prepend 0xA. End up with 0xA045.
+
+Which method to use is up to you. Use whatever works for you.  I use
+them both without being able to tell what method I use in each case,
+it just depends on the number, I think. Fact is, some numbers will
+occur frequently while programming. If the number is close to one I am
+familiar with, then I will use the first method (like 32'770 which is
+into 32'768 + 2 and I just know that it is 0x8000 + 0x2 = 0x8002).
+
+For binary the same approach can be used. The base is 2 and not 16,
+and the number of positions will grow rapidly. Using the second method
+has the advantage that you can see very easily if you should write down
+a zero or a one: if you divide by two the remainder will be zero if it
+is an even number and one if it is an odd number:
+
+ 41029 / 2 = 20514 remainder 1
+ 20514 / 2 = 10257 remainder 0
+ 10257 / 2 =  5128 remainder 1
+  5128 / 2 =  2564 remainder 0
+  2564 / 2 =  1282 remainder 0
+  1282 / 2 =   641 remainder 0
+   641 / 2 =   320 remainder 1
+   320 / 2 =   160 remainder 0
+   160 / 2 =    80 remainder 0
+    80 / 2 =    40 remainder 0
+    40 / 2 =    20 remainder 0
+    20 / 2 =    10 remainder 0
+    10 / 2 =     5 remainder 0
+     5 / 2 =     2 remainder 1
+     2 / 2 =     1 remainder 0
+     1 / 2 below 0 remainder 1
+
+Write down the results from right to left: %1010000001000101
+
+Group by four:
+
+ %1010000001000101
+ %101000000100 0101
+ %10100000 0100 0101
+ %1010 0000 0100 0101
+
+Convert into hexadecimal: 0xA045
+
+Group %1010000001000101 by three and convert into octal:
+
+ %1010000001000101
+ %1010000001000 101
+ %1010000001 000 101
+ %1010000 001 000 101
+ %1010 000 001 000 101
+ %1 010 000 001 000 101
+ %001 010 000 001 000 101
+    1   2   0   1   0   5 --> 0120105
+
+ So: %1010000001000101 = 0120105 = 0xA045 = 41029
+ Or: 1010000001000101(2) = 120105(8) = A045(16) = 41029(10)
+ Or: 1010000001000101(2) = 120105(8) = A045(16) = 41029
+
+
+At first while adding numbers, you'll convert them to their decimal
+form and then back into their original form after doing the addition.
+If you use the other numbering system often, you will see that you'll
+be able to do arithmetics directly in the base that is used.
+In any representation it is the same, add the numbers on the right,
+write down the right-most digit from the result, remember the other
+digits and use them in the next round. Continue with the second digit
+from the right and so on:
+
+    %1010 + %0111 --> 10 + 7 --> 17 --> %00010001
+
+will become
+
+    %1010
+    %0111 +
+     ||||
+     |||+-- add 0 + 1, result is 1, nothing to remember
+     ||+--- add 1 + 1, result is %10, write down 0 and remember 1
+     |+---- add 0 + 1 + 1(remembered), result = 0, remember 1
+     +----- add 1 + 0 + 1(remembered), result = 0, remember 1
+            nothing to add, 1 remembered, result = 1
+ --------
+   %10001 is the result, I like to write it as %00010001
+
+For low values, try to do the calculations yourself, then check them with
+a calculator. The more you do the calculations yourself, the more you'll
+find that you didn't make mistakes. In the end, you'll do calculi in
+other bases as easily as you do them in decimal.
+
+When the numbers get bigger, you'll have to realize that a computer is
+not called a computer just to have a nice name. There are many
+different calculators available, use them. For Unix you could use "bc"
+which is short for Binary Calculator. It calculates not only in
+decimal, but in all bases you'll ever want to use (among them Binary).
+
+For people on Windows:
+Start the calculator (start->programs->accessories->calculator)
+and if necessary click view->scientific. You now have a scientific
+calculator and can compute in binary or hexadecimal.
+
+=head1 AUTHOR
+
+I hope you enjoyed the examples and their descriptions. If you do, help
+other people by pointing them to this document when they are asking
+basic questions. They will not only get their answer, but at the same
+time learn a whole lot more.
+
+Alex van den Bogaerdt  E<lt>alex@ergens.op.het.netE<gt>
diff --git a/doc/bin_dec_hex.txt b/doc/bin_dec_hex.txt
new file mode 100644 (file)
index 0000000..3063ee6
--- /dev/null
@@ -0,0 +1,374 @@
+BIN_DEC_HEX(1)                      rrdtool                     BIN_DEC_HEX(1)
+
+
+
+N\bNA\bAM\bME\bE
+       bin_dec_hex - How to use binary, decimal, and hexadecimal notation.
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       Most people use the decimal numbering system. This system uses ten sym-
+       bols to represent numbers. When those ten symbols are used up, they
+       start all over again and increment the position to the left. The digit
+       0 is only shown if it is the only symbol in the sequence, or if it is
+       not the first one.
+
+       If this sounds cryptic to you, this is what I've just said in numbers:
+
+            0
+            1
+            2
+            3
+            4
+            5
+            6
+            7
+            8
+            9
+           10
+           11
+           12
+           13
+
+       and so on.
+
+       Each time the digit nine is incremented, it is reset to 0 and the posi-
+       tion before (to the left) is incremented (from 0 to 1). Then number 9
+       can be seen as "00009" and when we should increment 9, we reset it to
+       zero and increment the digit just before the 9 so the number becomes
+       "00010". Leading zeros we don't write except if it is the only digit
+       (number 0). And of course, we write zeros if they occur anywhere inside
+       or at the end of a number:
+
+        "00010" -> " 0010" -> " 010" -> "  10", but not "  1 ".
+
+       This was pretty basic, you already knew this. Why did I tell it?  Well,
+       computers usually do not represent numbers with 10 different digits.
+       They only use two different symbols, namely "0" and "1". Apply the same
+       rules to this set of digits and you get the binary numbering system:
+
+            0
+            1
+           10
+           11
+          100
+          101
+          110
+          111
+         1000
+         1001
+         1010
+         1011
+         1100
+         1101
+
+       and so on.
+
+       If you count the number of rows, you'll see that these are again 14
+       different numbers. The numbers are the same and mean the same as in the
+       first list, we just used a different representation. This means that
+       you have to know the representation used, or as it is called the num-
+       bering system or base.  Normally, if we do not explicitly specify the
+       numbering system used, we implicitly use the decimal system. If we want
+       to use any other numbering system, we'll have to make that clear. There
+       are a few widely adopted methods to do so. One common form is to write
+       1010(2) which means that you wrote down a number in its binary repre-
+       sentation. It is the number ten. If you would write 1010 without speci-
+       fying the base, the number is interpreted as one thousand and ten using
+       base 10.
+
+       In books, another form is common. It uses subscripts (little charac-
+       ters, more or less in between two rows). You can leave out the paren-
+       theses in that case and write down the number in normal characters fol-
+       lowed by a little two just behind it.
+
+       As the numbering system used is also called the base, we talk of the
+       number 1100 base 2, the number 12 base 10.
+
+       Within the binary system, it is common to write leading zeros. The num-
+       bers are written down in series of four, eight or sixteen depending on
+       the context.
+
+       We can use the binary form when talking to computers (...program-
+       ming...), but the numbers will have large representations. The number
+       65'535 (often in the decimal system a ' is used to separate blocks of
+       three digits for readability) would be written down as
+       1111111111111111(2) which is 16 times the digit 1.  This is difficult
+       and prone to errors. Therefore, we usually would use another base,
+       called hexadecimal. It uses 16 different symbols. First the symbols
+       from the decimal system are used, thereafter we continue with alpha-
+       betic characters. We get 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E
+       and F. This system is chosen because the hexadecimal form can be con-
+       verted into the binary system very easily (and back).
+
+       There is yet another system in use, called the octal system. This was
+       more common in the old days, but is not used very often anymore. As you
+       might find it in use sometimes, you should get used to it and we'll
+       show it below. It's the same story as with the other representations,
+       but with eight different symbols.
+
+        Binary      (2)
+        Octal       (8)
+        Decimal     (10)
+        Hexadecimal (16)
+
+        (2)    (8) (10) (16)
+        00000   0    0    0
+        00001   1    1    1
+        00010   2    2    2
+        00011   3    3    3
+        00100   4    4    4
+        00101   5    5    5
+        00110   6    6    6
+        00111   7    7    7
+        01000  10    8    8
+        01001  11    9    9
+        01010  12   10    A
+        01011  13   11    B
+        01100  14   12    C
+        01101  15   13    D
+        01110  16   14    E
+        01111  17   15    F
+        10000  20   16   10
+        10001  21   17   11
+        10010  22   18   12
+        10011  23   19   13
+        10100  24   20   14
+        10101  25   21   15
+
+       Most computers used nowadays are using bytes of eight bits. This means
+       that they store eight bits at a time. You can see why the octal system
+       is not the most practical for that: You'd need three digits to repre-
+       sent the eight bits and this means that you'd have to use one complete
+       digit to represent only two bits (2+3+3=8). This is a waste. For hex-
+       adecimal digits, you need only two digits which are used completely:
+
+        (2)      (8)  (10) (16)
+        11111111 377  255   FF
+
+       You can see why binary and hexadecimal can be converted quickly: For
+       each hexadecimal digit there are exactly four binary digits.  Take a
+       binary number: take four digits from the right and make a hexadecimal
+       digit from it (see the table above). Repeat this until there are no
+       more digits. And the other way around: Take a hexadecimal number. For
+       each digit, write down its binary equivalent.
+
+       Computers (or rather the parsers running on them) would have a hard
+       time converting a number like 1234(16). Therefore hexadecimal numbers
+       are specified with a prefix. This prefix depends on the language you're
+       writing in. Some of the prefixes are "0x" for C, "$" for Pascal, "#"
+       for HTML.  It is common to assume that if a number starts with a zero,
+       it is octal. It does not matter what is used as long as you know what
+       it is. I will use "0x" for hexadecimal, "%" for binary and "0" for
+       octal.  The following numbers are all the same, just their represenata-
+       tion (base) is different: 021 0x11 17 %00010001
+
+       To do arithmetics and conversions you need to understand one more
+       thing.  It is something you already know but perhaps you do not "see"
+       it yet:
+
+       If you write down 1234, (no prefix, so it is decimal) you are talking
+       about the number one thousand, two hundred and thirty four. In sort of
+       a formula:
+
+        1 * 1000 = 1000
+        2 *  100 =  200
+        3 *   10 =   30
+        4 *    1 =    4
+
+       This can also be written as:
+
+        1 * 10^3
+        2 * 10^2
+        3 * 10^1
+        4 * 10^0
+
+       where ^ means "to the power of".
+
+       We are using the base 10, and the positions 0,1,2 and 3.  The right-
+       most position should NOT be multiplied with 10. The second from the
+       right should be multiplied one time with 10. The third from the right
+       is multiplied with 10 two times. This continues for whatever positions
+       are used.
+
+       It is the same in all other representations:
+
+       0x1234 will be
+
+        1 * 16^3
+        2 * 16^2
+        3 * 16^1
+        4 * 16^0
+
+       01234 would be
+
+        1 * 8^3
+        2 * 8^2
+        3 * 8^1
+        4 * 8^0
+
+       This example can not be done for binary as that system only uses two
+       symbols. Another example:
+
+       %1010 would be
+
+        1 * 2^3
+        0 * 2^2
+        1 * 2^1
+        0 * 2^0
+
+       It would have been easier to convert it to its hexadecimal form and
+       just translate %1010 into 0xA. After a while you get used to it. You
+       will not need to do any calculations anymore, but just know that 0xA
+       means 10.
+
+       To convert a decimal number into a hexadecimal you could use the next
+       method. It will take some time to be able to do the estimates, but it
+       will be easier when you use the system more frequently. We'll look at
+       yet another way afterwards.
+
+       First you need to know how many positions will be used in the other
+       system. To do so, you need to know the maximum numbers you'll be using.
+       Well, that's not as hard as it looks. In decimal, the maximum number
+       that you can form with two digits is "99". The maximum for three:
+       "999". The next number would need an extra position. Reverse this idea
+       and you will see that the number can be found by taking 10^3 (10*10*10
+       is 1000) minus 1 or 10^2 minus one.
+
+       This can be done for hexadecimal as well:
+
+        16^4 = 0x10000 = 65536
+        16^3 =  0x1000 =  4096
+        16^2 =   0x100 =   256
+        16^1 =    0x10 =    16
+
+       If a number is smaller than 65'536 it will fit in four positions.  If
+       the number is bigger than 4'095, you must use position 4.  How many
+       times you can subtract 4'096 from the number without going below zero
+       is the first digit you write down. This will always be a number from 1
+       to 15 (0x1 to 0xF). Do the same for the other positions.
+
+       Let's try with 41'029. It is smaller than 16^4 but bigger than 16^3-1.
+       This means that we have to use four positions.  We can subtract 16^3
+       from 41'029 ten times without going below zero.  The left-most digit
+       will therefore be "A", so we have 0xA????.  The number is reduced to
+       41'029 - 10*4'096 = 41'029-40'960 = 69.  69 is smaller than 16^3 but
+       not bigger than 16^2-1. The second digit is therefore "0" and we now
+       have 0xA0??.  69 is smaller than 16^2 and bigger than 16^1-1. We can
+       subtract 16^1 (which is just plain 16) four times and write down "4" to
+       get 0xA04?.  Subtract 64 from 69 (69 - 4*16) and the last digit is 5
+       --> 0xA045.
+
+       The other method builds ub the number from the right. Let's try 41'029
+       again.  Divide by 16 and do not use fractions (only whole numbers).
+
+        41'029 / 16 is 2'564 with a remainder of 5. Write down 5.
+        2'564 / 16 is 160 with a remainder of 4. Write the 4 before the 5.
+        160 / 16 is 10 with no remainder. Prepend 45 with 0.
+        10 / 16 is below one. End here and prepend 0xA. End up with 0xA045.
+
+       Which method to use is up to you. Use whatever works for you.  I use
+       them both without being able to tell what method I use in each case, it
+       just depends on the number, I think. Fact is, some numbers will occur
+       frequently while programming. If the number is close to one I am famil-
+       iar with, then I will use the first method (like 32'770 which is into
+       32'768 + 2 and I just know that it is 0x8000 + 0x2 = 0x8002).
+
+       For binary the same approach can be used. The base is 2 and not 16, and
+       the number of positions will grow rapidly. Using the second method has
+       the advantage that you can see very easily if you should write down a
+       zero or a one: if you divide by two the remainder will be zero if it is
+       an even number and one if it is an odd number:
+
+        41029 / 2 = 20514 remainder 1
+        20514 / 2 = 10257 remainder 0
+        10257 / 2 =  5128 remainder 1
+         5128 / 2 =  2564 remainder 0
+         2564 / 2 =  1282 remainder 0
+         1282 / 2 =   641 remainder 0
+          641 / 2 =   320 remainder 1
+          320 / 2 =   160 remainder 0
+          160 / 2 =    80 remainder 0
+           80 / 2 =    40 remainder 0
+           40 / 2 =    20 remainder 0
+           20 / 2 =    10 remainder 0
+           10 / 2 =     5 remainder 0
+            5 / 2 =     2 remainder 1
+            2 / 2 =     1 remainder 0
+            1 / 2 below 0 remainder 1
+
+       Write down the results from right to left: %1010000001000101
+
+       Group by four:
+
+        %1010000001000101
+        %101000000100 0101
+        %10100000 0100 0101
+        %1010 0000 0100 0101
+
+       Convert into hexadecimal: 0xA045
+
+       Group %1010000001000101 by three and convert into octal:
+
+        %1010000001000101
+        %1010000001000 101
+        %1010000001 000 101
+        %1010000 001 000 101
+        %1010 000 001 000 101
+        %1 010 000 001 000 101
+        %001 010 000 001 000 101
+           1   2   0   1   0   5 --> 0120105
+
+        So: %1010000001000101 = 0120105 = 0xA045 = 41029
+        Or: 1010000001000101(2) = 120105(8) = A045(16) = 41029(10)
+        Or: 1010000001000101(2) = 120105(8) = A045(16) = 41029
+
+       At first while adding numbers, you'll convert them to their decimal
+       form and then back into their original form after doing the addition.
+       If you use the other numbering system often, you will see that you'll
+       be able to do arithmetics directly in the base that is used.  In any
+       representation it is the same, add the numbers on the right, write down
+       the right-most digit from the result, remember the other digits and use
+       them in the next round. Continue with the second digit from the right
+       and so on:
+
+           %1010 + %0111 --> 10 + 7 --> 17 --> %00010001
+
+       will become
+
+           %1010
+           %0111 +
+            ||||
+            |||+-- add 0 + 1, result is 1, nothing to remember
+            ||+--- add 1 + 1, result is %10, write down 0 and remember 1
+            |+---- add 0 + 1 + 1(remembered), result = 0, remember 1
+            +----- add 1 + 0 + 1(remembered), result = 0, remember 1
+                   nothing to add, 1 remembered, result = 1
+        --------
+          %10001 is the result, I like to write it as %00010001
+
+       For low values, try to do the calculations yourself, then check them
+       with a calculator. The more you do the calculations yourself, the more
+       you'll find that you didn't make mistakes. In the end, you'll do cal-
+       culi in other bases as easily as you do them in decimal.
+
+       When the numbers get bigger, you'll have to realize that a computer is
+       not called a computer just to have a nice name. There are many differ-
+       ent calculators available, use them. For Unix you could use "bc" which
+       is short for Binary Calculator. It calculates not only in decimal, but
+       in all bases you'll ever want to use (among them Binary).
+
+       For people on Windows: Start the calculator (start->programs->acces-
+       sories->calculator) and if necessary click view->scientific. You now
+       have a scientific calculator and can compute in binary or hexadecimal.
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       I hope you enjoyed the examples and their descriptions. If you do, help
+       other people by pointing them to this document when they are asking
+       basic questions. They will not only get their answer, but at the same
+       time learn a whole lot more.
+
+       Alex van den Bogaerdt  <alex@ergens.op.het.net>
+
+
+
+1.2.26                            2007-11-20                    BIN_DEC_HEX(1)
diff --git a/doc/cdeftutorial.1 b/doc/cdeftutorial.1
new file mode 100644 (file)
index 0000000..052edf5
--- /dev/null
@@ -0,0 +1,990 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "CDEFTUTORIAL 1"
+.TH CDEFTUTORIAL 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+cdeftutorial \- Alex van den Bogaerdt's CDEF tutorial
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+Intention of this document: to provide some examples of the commonly
+used parts of RRDtool's \s-1CDEF\s0 language.
+.PP
+If you think some important feature is not explained properly, and if
+adding it to this document would benefit most users, please do ask me
+to add it.  I will then try to provide an answer in the next release
+of this tutorial.  No feedback equals no changes! Additions to
+this document are also welcome.  \*(-- Alex van den Bogaerdt
+<alex@ergens.op.het.net>
+.Sh "Why this tutorial?"
+.IX Subsection "Why this tutorial?"
+One of the powerful parts of RRDtool is its ability to do all sorts
+of calculations on the data retrieved from its databases. However,
+RRDtool's many options and syntax make it difficult for the average
+user to understand. The manuals are good at explaining what these
+options do; however they do not (and should not) explain in detail
+why they are useful. As with my RRDtool tutorial: if you want a
+simple document in simple language you should read this tutorial.
+If you are happy with the official documentation, you may find this
+document too simple or even boring. If you do choose to read this
+tutorial, I also expect you to have read and fully understand my
+other tutorial.
+.Sh "More reading"
+.IX Subsection "More reading"
+If you have difficulties with the way I try to explain it please read
+Steve Rader's rpntutorial. It may help you understand how this all works.
+.SH "What are CDEFs?"
+.IX Header "What are CDEFs?"
+When retrieving data from an \s-1RRD\s0, you are using a \*(L"\s-1DEF\s0\*(R" to work with
+that data. Think of it as a variable that changes over time (where
+time is the x\-axis). The value of this variable is what is found in
+the database at that particular time and you can't do any
+modifications on it. This is what CDEFs are for: they takes values
+from DEFs and perform calculations on them.
+.SH "Syntax"
+.IX Header "Syntax"
+.Vb 2
+\&   DEF:var_name_1=some.rrd:ds_name:CF
+\&   CDEF:var_name_2=RPN_expression
+.Ve
+.PP
+You first define \*(L"var_name_1\*(R" to be data collected from data source
+\&\*(L"ds_name\*(R" found in \s-1RRD\s0 \*(L"some.rrd\*(R" with consolidation function \*(L"\s-1CF\s0\*(R".
+.PP
+Assume the ifInOctets \s-1SNMP\s0 counter is saved in mrtg.rrd as the \s-1DS\s0 \*(L"in\*(R".
+Then the following \s-1DEF\s0 defines a variable for the average of that
+data source:
+.PP
+.Vb 1
+\&   DEF:inbytes=mrtg.rrd:in:AVERAGE
+.Ve
+.PP
+Say you want to display bits per second (instead of bytes per second
+as stored in the database.)  You have to define a calculation
+(hence \*(L"\s-1CDEF\s0\*(R") on variable \*(L"inbytes\*(R" and use that variable (inbits)
+instead of the original:
+.PP
+.Vb 1
+\&   CDEF:inbits=inbytes,8,*
+.Ve
+.PP
+This tells RRDtool to multiply inbytes by eight to get inbits. I'll
+explain later how this works. In the graphing or printing functions,
+you can now use inbits where you would use inbytes otherwise.
+.PP
+Note that the variable name used in the \s-1CDEF\s0 (inbits) must not be the
+same as the variable named in the \s-1DEF\s0 (inbytes)!
+.SH "RPN-expressions"
+.IX Header "RPN-expressions"
+\&\s-1RPN\s0 is short-hand for Reverse Polish Notation. It works as follows.
+You put the variables or numbers on a stack. You also put operations
+(things\-to\-do) on the stack and this stack is then processed. The result
+will be placed on the stack. At the end, there should be exactly one
+number left: the outcome of the series of operations. If there is not
+exactly one number left, RRDtool will complain loudly.
+.PP
+Above multiplication by eight will look like:
+.IP "1." 4
+Start with an empty stack
+.IP "2." 4
+Put the content of variable inbytes on the stack
+.IP "3." 4
+Put the number eight on the stack
+.IP "4." 4
+Put the operation multiply on the stack
+.IP "5." 4
+Process the stack
+.IP "6." 4
+Retrieve the value from the stack and put it in variable inbits
+.PP
+We will now do an example with real numbers. Suppose the variable
+inbytes would have value 10, the stack would be:
+.IP "1." 4
+||
+.IP "2." 4
+|10|
+.IP "3." 4
+|10|8|
+.IP "4." 4
+|10|8|*|
+.IP "5." 4
+|80|
+.IP "6." 4
+||
+.PP
+Processing the stack (step 5) will retrieve one value from the stack
+(from the right at step 4). This is the operation multiply and this
+takes two values off the stack as input. The result is put back on the
+stack (the value 80 in this case). For multiplication the order doesn't
+matter, but for other operations like subtraction and division it does.
+Generally speaking you have the following order:
+.PP
+.Vb 1
+\&   y = A \- B  \-\->  y=minus(A,B)  \-\->  CDEF:y=A,B,\-
+.Ve
+.PP
+This is not very intuitive (at least most people don't think so). For
+the function f(A,B) you reverse the position of \*(L"f\*(R", but you do not
+reverse the order of the variables.
+.SH "Converting your wishes to RPN"
+.IX Header "Converting your wishes to RPN"
+First, get a clear picture of what you want to do. Break down the problem
+in smaller portions until they cannot be split anymore. Then it is rather
+simple to convert your ideas into \s-1RPN\s0.
+.PP
+Suppose you have several RRDs and would like to add up some counters in
+them. These could be, for instance, the counters for every \s-1WAN\s0 link you
+are monitoring.
+.PP
+You have:
+.PP
+.Vb 3
+\&   router1.rrd with link1in link2in
+\&   router2.rrd with link1in link2in
+\&   router3.rrd with link1in link2in
+.Ve
+.PP
+Suppose you would like to add up all these counters, except for link2in
+inside router2.rrd. You need to do:
+.PP
+(in this example, \*(L"router1.rrd:link1in\*(R" means the \s-1DS\s0 link1in inside the
+\&\s-1RRD\s0 router1.rrd)
+.PP
+.Vb 7
+\&   router1.rrd:link1in
+\&   router1.rrd:link2in
+\&   router2.rrd:link1in
+\&   router3.rrd:link1in
+\&   router3.rrd:link2in
+\&   \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-   +
+\&   (outcome of the sum)
+.Ve
+.PP
+As a mathematical function, this could be written:
+.PP
+\&\f(CW\*(C`add(router1.rrd:link1in , router1.rrd:link2in , router2.rrd:link1in , router3.rrd:link1in , router3.rrd:link2.in)\*(C'\fR
+.PP
+With RRDtool and \s-1RPN\s0, first, define the inputs:
+.PP
+.Vb 5
+\&   DEF:a=router1.rrd:link1in:AVERAGE
+\&   DEF:b=router1.rrd:link2in:AVERAGE
+\&   DEF:c=router2.rrd:link1in:AVERAGE
+\&   DEF:d=router3.rrd:link1in:AVERAGE
+\&   DEF:e=router3.rrd:link2in:AVERAGE
+.Ve
+.PP
+Now, the mathematical function becomes: \f(CW\*(C`add(a,b,c,d,e)\*(C'\fR
+.PP
+In \s-1RPN\s0, there's no operator that sums more than two values so you need
+to do several additions. You add a and b, add c to the result, add d
+to the result and add e to the result.
+.PP
+.Vb 5
+\&   push a:         a     stack contains the value of a
+\&   push b and add: b,+   stack contains the result of a+b
+\&   push c and add: c,+   stack contains the result of a+b+c
+\&   push d and add: d,+   stack contains the result of a+b+c+d
+\&   push e and add: e,+   stack contains the result of a+b+c+d+e
+.Ve
+.PP
+What was calculated here would be written down as:
+.PP
+.Vb 1
+\&   ( ( ( (a+b) + c) + d) + e) >
+.Ve
+.PP
+This is in \s-1RPN:\s0  \f(CW\*(C`CDEF:result=a,b,+,c,+,d,+,e,+\*(C'\fR
+.PP
+This is correct but it can be made more clear to humans. It does
+not matter if you add a to b and then add c to the result or first
+add b to c and then add a to the result. This makes it possible to
+rewrite the \s-1RPN\s0 into \f(CW\*(C`CDEF:result=a,b,c,d,e,+,+,+,+\*(C'\fR which is
+evaluated differently:
+.PP
+.Vb 13
+\&   push value of variable a on the stack: a
+\&   push value of variable b on the stack: a b
+\&   push value of variable c on the stack: a b c
+\&   push value of variable d on the stack: a b c d
+\&   push value of variable e on the stack: a b c d e
+\&   push operator + on the stack:          a b c d e +
+\&   and process it:                        a b c P   (where P == d+e)
+\&   push operator + on the stack:          a b c P +
+\&   and process it:                        a b Q     (where Q == c+P)
+\&   push operator + on the stack:          a b Q +
+\&   and process it:                        a R       (where R == b+Q)
+\&   push operator + on the stack:          a R +
+\&   and process it:                        S         (where S == a+R)
+.Ve
+.PP
+As you can see the \s-1RPN\s0 expression \f(CW\*(C`a,b,c,d,e,+,+,+,+,+\*(C'\fR will evaluate in
+\&\f(CW\*(C`((((d+e)+c)+b)+a)\*(C'\fR and it has the same outcome as \f(CW\*(C`a,b,+,c,+,d,+,e,+\*(C'\fR.
+This is called the commutative law of addition,
+but you may forget this right away, as long as you remember what it
+means.
+.PP
+Now look at an expression that contains a multiplication:
+.PP
+First in normal math: \f(CW\*(C`let result = a+b*c\*(C'\fR. In this case you can't
+choose the order yourself, you have to start with the multiplication
+and then add a to it. You may alter the position of b and c, you must
+not alter the position of a and b.
+.PP
+You have to take this in consideration when converting this expression
+into \s-1RPN\s0. Read it as: \*(L"Add the outcome of b*c to a\*(R" and then it is
+easy to write the \s-1RPN\s0 expression: \f(CW\*(C`result=a,b,c,*,+\*(C'\fR
+Another expression that would return the same: \f(CW\*(C`result=b,c,*,a,+\*(C'\fR
+.PP
+In normal math, you may encounter something like \*(L"a*(b+c)\*(R" and this
+can also be converted into \s-1RPN\s0. The parenthesis just tell you to first
+add b and c, and then multiply a with the result. Again, now it is
+easy to write it in \s-1RPN:\s0 \f(CW\*(C`result=a,b,c,+,*\*(C'\fR. Note that this is very
+similar to one of the expressions in the previous paragraph, only the
+multiplication and the addition changed places.
+.PP
+When you have problems with \s-1RPN\s0 or when RRDtool is complaining, it's
+usually a good thing to write down the stack on a piece of paper
+and see what happens. Have the manual ready and pretend to be RRDtool.
+Just do all the math by hand to see what happens, I'm sure this will
+solve most, if not all, problems you encounter.
+.SH "Some special numbers"
+.IX Header "Some special numbers"
+.Sh "The unknown value"
+.IX Subsection "The unknown value"
+Sometimes collecting your data will fail. This can be very common,
+especially when querying over busy links. RRDtool can be configured
+to allow for one (or even more) unknown value(s) and calculate the missing
+update. You can, for instance, query your device every minute. This is
+creating one so called \s-1PDP\s0 or primary data point per minute. If you
+defined your \s-1RRD\s0 to contain an \s-1RRA\s0 that stores 5\-minute values, you need
+five of those PDPs to create one \s-1CDP\s0 (consolidated data point).
+These PDPs can become unknown in two cases:
+.IP "1." 4
+The updates are too far apart. This is tuned using the \*(L"heartbeat\*(R" setting.
+.IP "2." 4
+The update was set to unknown on purpose by inserting no value (using the
+template option) or by using \*(L"U\*(R" as the value to insert.
+.PP
+When a \s-1CDP\s0 is calculated, another mechanism determines if this \s-1CDP\s0 is valid
+or not. If there are too many PDPs unknown, the \s-1CDP\s0 is unknown as well.
+This is determined by the xff factor. Please note that one unknown counter
+update can result in two unknown PDPs! If you only allow for one unknown
+\&\s-1PDP\s0 per \s-1CDP\s0, this makes the \s-1CDP\s0 go unknown!
+.PP
+Suppose the counter increments with one per second and you retrieve it
+every minute:
+.PP
+.Vb 7
+\&   counter value    resulting rate
+\&   10'000
+\&   10'060            1; (10'060\-10'000)/60 == 1
+\&   10'120            1; (10'120\-10'060)/60 == 1
+\&   unknown           unknown; you don't know the last value
+\&   10'240            unknown; you don't know the previous value
+\&   10'300            1; (10'300\-10'240)/60 == 1
+.Ve
+.PP
+If the \s-1CDP\s0 was to be calculated from the last five updates, it would get
+two unknown PDPs and three known PDPs. If xff would have been set to 0.5
+which by the way is a commonly used factor, the \s-1CDP\s0 would have a known
+value of 1. If xff would have been set to 0.2 then the resulting \s-1CDP\s0
+would be unknown.
+.PP
+You have to decide the proper values for heartbeat, number of PDPs per
+\&\s-1CDP\s0 and the xff factor. As you can see from the previous text they define
+the behavior of your \s-1RRA\s0.
+.Sh "Working with unknown data in your database"
+.IX Subsection "Working with unknown data in your database"
+As you have read in the previous chapter, entries in an \s-1RRA\s0 can be
+set to the unknown value. If you do calculations with this type of
+value, the result has to be unknown too. This means that an expression
+such as \f(CW\*(C`result=a,b,+\*(C'\fR will be unknown if either a or b is unknown.
+It would be wrong to just ignore the unknown value and return the value
+of the other parameter. By doing so, you would assume \*(L"unknown\*(R" means \*(L"zero\*(R"
+and this is not true.
+.PP
+There has been a case where somebody was collecting data for over a year.
+A new piece of equipment was installed, a new \s-1RRD\s0 was created and the
+scripts were changed to add a counter from the old database and a counter
+from the new database. The result was disappointing, a large part of
+the statistics seemed to have vanished mysteriously ...
+They of course didn't, values from the old database (known values) were
+added to values from the new database (unknown values) and the result was
+unknown.
+.PP
+In this case, it is fairly reasonable to use a \s-1CDEF\s0 that alters unknown
+data into zero. The counters of the device were unknown (after all, it
+wasn't installed yet!) but you know that the data rate through the device
+had to be zero (because of the same reason: it was not installed).
+.PP
+There are some examples below that make this change.
+.Sh "Infinity"
+.IX Subsection "Infinity"
+Infinite data is another form of a special number. It cannot be
+graphed because by definition you would never reach the infinite
+value. You can think of positive and negative infinity depending on
+the position relative to zero.
+.PP
+RRDtool is capable of representing (\-not\- graphing!) infinity by stopping
+at its current maximum (for positive infinity) or minimum (for negative
+infinity) without knowing this maximum (minimum).
+.PP
+Infinity in RRDtool is mostly used to draw an \s-1AREA\s0 without knowing its
+vertical dimensions. You can think of it as drawing an \s-1AREA\s0 with an
+infinite height and displaying only the part that is visible in the
+current graph. This is probably a good way to approximate infinity
+and it sure allows for some neat tricks. See below for examples.
+.Sh "Working with unknown data and infinity"
+.IX Subsection "Working with unknown data and infinity"
+Sometimes you would like to discard unknown data and pretend it is zero
+(or any other value for that matter) and sometimes you would like to
+pretend that known data is unknown (to discard known-to-be-wrong data).
+This is why CDEFs have support for unknown data. There are also examples
+available that show unknown data by using infinity.
+.SH "Some examples"
+.IX Header "Some examples"
+.Sh "Example: using a recently created \s-1RRD\s0"
+.IX Subsection "Example: using a recently created RRD"
+You are keeping statistics on your router for over a year now. Recently
+you installed an extra router and you would like to show the combined
+throughput for these two devices.
+.PP
+If you just add up the counters from router.rrd and router2.rrd, you
+will add known data (from router.rrd) to unknown data (from router2.rrd) for
+the bigger part of your stats. You could solve this in a few ways:
+.IP "\(bu" 4
+While creating the new database, fill it with zeros from the start to now.
+You have to make the database start at or before the least recent time in
+the other database.
+.IP "\(bu" 4
+Alternatively, you could use \s-1CDEF\s0 and alter unknown data to zero.
+.PP
+Both methods have their pros and cons. The first method is troublesome and
+if you want to do that you have to figure it out yourself. It is not
+possible to create a database filled with zeros, you have to put them in
+manually. Implementing the second method is described next:
+.PP
+What we want is: \*(L"if the value is unknown, replace it with zero\*(R". This
+could be written in pseudo-code as:  if (value is unknown) then (zero)
+else (value). When reading the rrdgraph manual you notice the \*(L"\s-1UN\s0\*(R"
+function that returns zero or one. You also notice the \*(L"\s-1IF\s0\*(R" function
+that takes zero or one as input.
+.PP
+First look at the \*(L"\s-1IF\s0\*(R" function. It takes three values from the stack,
+the first value is the decision point, the second value is returned to
+the stack if the evaluation is \*(L"true\*(R" and if not, the third value is
+returned to the stack. We want the \*(L"\s-1UN\s0\*(R" function to decide what happens
+so we combine those two functions in one \s-1CDEF\s0.
+.PP
+Lets write down the two possible paths for the \*(L"\s-1IF\s0\*(R" function:
+.PP
+.Vb 2
+\&   if true  return a
+\&   if false return b
+.Ve
+.PP
+In \s-1RPN:\s0  \f(CW\*(C`result=x,a,b,IF\*(C'\fR where \*(L"x\*(R" is either true or false.
+.PP
+Now we have to fill in \*(L"x\*(R", this should be the \*(L"(value is unknown)\*(R" part
+and this is in \s-1RPN:\s0  \f(CW\*(C`result=value,UN\*(C'\fR
+.PP
+We now combine them: \f(CW\*(C`result=value,UN,a,b,IF\*(C'\fR and when we fill in the
+appropriate things for \*(L"a\*(R" and \*(L"b\*(R" we're finished:
+.PP
+\&\f(CW\*(C`CDEF:result=value,UN,0,value,IF\*(C'\fR
+.PP
+You may want to read Steve Rader's \s-1RPN\s0 guide if you have difficulties
+with the way I explained this last example.
+.PP
+If you want to check this \s-1RPN\s0 expression, just mimic RRDtool behavior:
+.PP
+.Vb 4
+\&   For any known value, the expression evaluates as follows:
+\&   CDEF:result=value,UN,0,value,IF  (value,UN) is not true so it becomes 0
+\&   CDEF:result=0,0,value,IF         "IF" will return the 3rd value
+\&   CDEF:result=value                The known value is returned
+.Ve
+.PP
+.Vb 4
+\&   For the unknown value, this happens:
+\&   CDEF:result=value,UN,0,value,IF  (value,UN) is true so it becomes 1
+\&   CDEF:result=1,0,value,IF         "IF" sees 1 and returns the 2nd value
+\&   CDEF:result=0                    Zero is returned
+.Ve
+.PP
+Of course, if you would like to see another value instead of zero, you
+can use that other value.
+.PP
+Eventually, when all unknown data is removed from the \s-1RRD\s0, you may want
+to remove this rule so that unknown data is properly displayed.
+.Sh "Example: better handling of unknown data, by using time"
+.IX Subsection "Example: better handling of unknown data, by using time"
+The above example has one drawback. If you do log unknown data in
+your database after installing your new equipment, it will also be
+translated into zero and therefore you won't see that there was a
+problem. This is not good and what you really want to do is:
+.IP "\(bu" 4
+If there is unknown data, look at the time that this sample was taken.
+.IP "\(bu" 4
+If the unknown value is before time xxx, make it zero.
+.IP "\(bu" 4
+If it is after time xxx, leave it as unknown data.
+.PP
+This is doable: you can compare the time that the sample was taken
+to some known time. Assuming you started to monitor your device on
+Friday September 17, 1999, 00:35:57 \s-1MET\s0 \s-1DST\s0. Translate this time in seconds
+since 1970\-01\-01 and it becomes 937'521'357. If you process unknown values
+that were received after this time, you want to leave them unknown and
+if they were \*(L"received\*(R" before this time, you want to translate them
+into zero (so you can effectively ignore them while adding them to your
+other routers counters).
+.PP
+Translating Friday September 17, 1999, 00:35:57 \s-1MET\s0 \s-1DST\s0 into 937'521'357 can
+be done by, for instance, using gnu date:
+.PP
+.Vb 1
+\&   date \-d "19990917 00:35:57" +%s
+.Ve
+.PP
+You could also dump the database and see where the data starts to be
+known. There are several other ways of doing this, just pick one.
+.PP
+Now we have to create the magic that allows us to process unknown
+values different depending on the time that the sample was taken.
+This is a three step process:
+.IP "1." 4
+If the timestamp of the value is after 937'521'357, leave it as is.
+.IP "2." 4
+If the value is a known value, leave it as is.
+.IP "3." 4
+Change the unknown value into zero.
+.PP
+Lets look at part one:
+.PP
+.Vb 1
+\&    if (true) return the original value
+.Ve
+.PP
+We rewrite this:
+.PP
+.Vb 2
+\&    if (true) return "a"
+\&    if (false) return "b"
+.Ve
+.PP
+We need to calculate true or false from step 1. There is a function
+available that returns the timestamp for the current sample. It is
+called, how surprisingly, \*(L"\s-1TIME\s0\*(R". This time has to be compared to
+a constant number, we need \*(L"\s-1GT\s0\*(R". The output of \*(L"\s-1GT\s0\*(R" is true or false
+and this is good input to \*(L"\s-1IF\s0\*(R". We want \*(L"if (time > 937521357) then
+(return a) else (return b)\*(R".
+.PP
+This process was already described thoroughly in the previous chapter
+so lets do it quick:
+.PP
+.Vb 4
+\&   if (x) then a else b
+\&      where x represents "time>937521357"
+\&      where a represents the original value
+\&      where b represents the outcome of the previous example
+.Ve
+.PP
+.Vb 1
+\&   time>937521357       \-\-> TIME,937521357,GT
+.Ve
+.PP
+.Vb 4
+\&   if (x) then a else b \-\-> x,a,b,IF
+\&   substitute x         \-\-> TIME,937521357,GT,a,b,IF
+\&   substitute a         \-\-> TIME,937521357,GT,value,b,IF
+\&   substitute b         \-\-> TIME,937521357,GT,value,value,UN,0,value,IF,IF
+.Ve
+.PP
+We end up with:
+\&\f(CW\*(C`CDEF:result=TIME,937521357,GT,value,value,UN,0,value,IF,IF\*(C'\fR
+.PP
+This looks very complex, however, as you can see, it was not too hard to
+come up with.
+.Sh "Example: Pretending weird data isn't there"
+.IX Subsection "Example: Pretending weird data isn't there"
+Suppose you have a problem that shows up as huge spikes in your graph.
+You know this happens and why, so you decide to work around the problem.
+Perhaps you're using your network to do a backup at night and by doing
+so you get almost 10mb/s while the rest of your network activity does
+not produce numbers higher than 100kb/s.
+.PP
+There are two options:
+.IP "1." 4
+If the number exceeds 100kb/s it is wrong and you want it masked out
+by changing it into unknown.
+.IP "2." 4
+You don't want the graph to show more than 100kb/s.
+.PP
+Pseudo code: if (number > 100) then unknown else number
+or
+Pseudo code: if (number > 100) then 100 else number.
+.PP
+The second \*(L"problem\*(R" may also be solved by using the rigid option of
+RRDtool graph, however this has not the same result. In this example
+you can end up with a graph that does autoscaling. Also, if you use
+the numbers to display maxima they will be set to 100kb/s.
+.PP
+We use \*(L"\s-1IF\s0\*(R" and \*(L"\s-1GT\s0\*(R" again. \*(L"if (x) then (y) else (z)\*(R" is written
+down as \*(L"CDEF:result=x,y,z,IF\*(R"; now fill in x, y and z.
+For x you fill in \*(L"number greater than 100kb/s\*(R" becoming
+\&\*(L"number,100000,GT\*(R" (kilo is 1'000 and b/s is what we measure!).
+The \*(L"z\*(R" part is \*(L"number\*(R" in both cases and the \*(L"y\*(R" part is either
+\&\*(L"\s-1UNKN\s0\*(R" for unknown or \*(L"100000\*(R" for 100kb/s.
+.PP
+The two \s-1CDEF\s0 expressions would be:
+.PP
+.Vb 2
+\&    CDEF:result=number,100000,GT,UNKN,number,IF
+\&    CDEF:result=number,100000,GT,100000,number,IF
+.Ve
+.Sh "Example: working on a certain time span"
+.IX Subsection "Example: working on a certain time span"
+If you want a graph that spans a few weeks, but would only want to
+see some routers' data for one week, you need to \*(L"hide\*(R" the rest of
+the time frame. Don't ask me when this would be useful, it's just
+here for the example :)
+.PP
+We need to compare the time stamp to a begin date and an end date.
+Comparing isn't difficult:
+.PP
+.Vb 2
+\&        TIME,begintime,GE
+\&        TIME,endtime,LE
+.Ve
+.PP
+These two parts of the \s-1CDEF\s0 produce either 0 for false or 1 for true.
+We can now check if they are both 0 (or 1) using a few \s-1IF\s0 statements
+but, as Wataru Satoh pointed out, we can use the \*(L"*\*(R" or \*(L"+\*(R" functions
+as logical \s-1AND\s0 and logical \s-1OR\s0.
+.PP
+For \*(L"*\*(R", the result will be zero (false) if either one of the two
+operators is zero.  For \*(L"+\*(R", the result will only be false (0) when
+two false (0) operators will be added.  Warning: *any* number not
+equal to 0 will be considered \*(L"true\*(R". This means that, for instance,
+\&\*(L"\-1,1,+\*(R" (which should be \*(L"true or true\*(R") will become \s-1FALSE\s0 ...
+In other words, use \*(L"+\*(R" only if you know for sure that you have positive
+numbers (or zero) only.
+.PP
+Let's compile the complete \s-1CDEF:\s0
+.PP
+.Vb 2
+\&        DEF:ds0=router1.rrd:AVERAGE
+\&        CDEF:ds0modified=TIME,begintime,GE,TIME,endtime,LE,*,UNKN,ds0,IF
+.Ve
+.PP
+This will return the value of ds0 if both comparisons return true. You
+could also do it the other way around:
+.PP
+.Vb 2
+\&        DEF:ds0=router1.rrd:AVERAGE
+\&        CDEF:ds0modified=TIME,begintime,LT,TIME,endtime,GT,+,UNKN,ds0,IF
+.Ve
+.PP
+This will return an \s-1UNKNOWN\s0 if either comparison returns true.
+.Sh "Example: You suspect to have problems and want to see unknown data."
+.IX Subsection "Example: You suspect to have problems and want to see unknown data."
+Suppose you add up the number of active users on several terminal servers.
+If one of them doesn't give an answer (or an incorrect one) you get \*(L"NaN\*(R"
+in the database (\*(L"Not a Number\*(R") and NaN is evaluated as Unknown.
+.PP
+In this case, you would like to be alerted to it and the sum of the
+remaining values is of no value to you.
+.PP
+It would be something like:
+.PP
+.Vb 5
+\&    DEF:users1=location1.rrd:onlineTS1:LAST
+\&    DEF:users2=location1.rrd:onlineTS2:LAST
+\&    DEF:users3=location2.rrd:onlineTS1:LAST
+\&    DEF:users4=location2.rrd:onlineTS2:LAST
+\&    CDEF:allusers=users1,users2,users3,users4,+,+,+
+.Ve
+.PP
+If you now plot allusers, unknown data in one of users1..users4 will
+show up as a gap in your graph. You want to modify this to show a
+bright red line, not a gap.
+.PP
+Define an extra \s-1CDEF\s0 that is unknown if all is okay and is infinite if
+there is an unknown value:
+.PP
+.Vb 1
+\&    CDEF:wrongdata=allusers,UN,INF,UNKN,IF
+.Ve
+.PP
+\&\*(L"allusers,UN\*(R" will evaluate to either true or false, it is the (x) part
+of the \*(L"\s-1IF\s0\*(R" function and it checks if allusers is unknown.
+The (y) part of the \*(L"\s-1IF\s0\*(R" function is set to \*(L"\s-1INF\s0\*(R" (which means infinity)
+and the (z) part of the function returns \*(L"\s-1UNKN\s0\*(R".
+.PP
+The logic is: if (allusers == unknown) then return \s-1INF\s0 else return \s-1UNKN\s0.
+.PP
+You can now use \s-1AREA\s0 to display this \*(L"wrongdata\*(R" in bright red. If it
+is unknown (because allusers is known) then the red \s-1AREA\s0 won't show up.
+If the value is \s-1INF\s0 (because allusers is unknown) then the red \s-1AREA\s0 will
+be filled in on the graph at that particular time.
+.PP
+.Vb 2
+\&   AREA:allusers#0000FF:combined user count
+\&   AREA:wrongdata#FF0000:unknown data
+.Ve
+.Sh "Same example useful with STACKed data:"
+.IX Subsection "Same example useful with STACKed data:"
+If you use stack in the previous example (as I would do) then you don't
+add up the values. Therefore, there is no relationship between the
+four values and you don't get a single value to test.
+Suppose users3 would be unknown at one point in time: users1 is plotted,
+users2 is stacked on top of users1, users3 is unknown and therefore
+nothing happens, users4 is stacked on top of users2.
+Add the extra CDEFs anyway and use them to overlay the \*(L"normal\*(R" graph:
+.PP
+.Vb 11
+\&   DEF:users1=location1.rrd:onlineTS1:LAST
+\&   DEF:users2=location1.rrd:onlineTS2:LAST
+\&   DEF:users3=location2.rrd:onlineTS1:LAST
+\&   DEF:users4=location2.rrd:onlineTS2:LAST
+\&   CDEF:allusers=users1,users2,users3,users4,+,+,+
+\&   CDEF:wrongdata=allusers,UN,INF,UNKN,IF
+\&   AREA:users1#0000FF:users at ts1
+\&   STACK:users2#00FF00:users at ts2
+\&   STACK:users3#00FFFF:users at ts3
+\&   STACK:users4#FFFF00:users at ts4
+\&   AREA:wrongdata#FF0000:unknown data
+.Ve
+.PP
+If there is unknown data in one of users1..users4, the \*(L"wrongdata\*(R" \s-1AREA\s0
+will be drawn and because it starts at the X\-axis and has infinite height
+it will effectively overwrite the STACKed parts.
+.PP
+You could combine the two \s-1CDEF\s0 lines into one (we don't use \*(L"allusers\*(R")
+if you like.  But there are good reasons for writing two \s-1CDEFS:\s0
+.IP "\(bu" 4
+It improves the readability of the script.
+.IP "\(bu" 4
+It can be used inside \s-1GPRINT\s0 to display the total number of users.
+.PP
+If you choose to combine them, you can substitute the \*(L"allusers\*(R" in the
+second \s-1CDEF\s0 with the part after the equal sign from the first line:
+.PP
+.Vb 1
+\&   CDEF:wrongdata=users1,users2,users3,users4,+,+,+,UN,INF,UNKN,IF
+.Ve
+.PP
+If you do so, you won't be able to use these next GPRINTs:
+.PP
+.Vb 5
+\&   COMMENT:"Total number of users seen"
+\&   GPRINT:allusers:MAX:"Maximum: %6.0lf"
+\&   GPRINT:allusers:MIN:"Minimum: %6.0lf"
+\&   GPRINT:allusers:AVERAGE:"Average: %6.0lf"
+\&   GPRINT:allusers:LAST:"Current: %6.0lf\en"
+.Ve
+.SH "The examples from the RRD graph manual page"
+.IX Header "The examples from the RRD graph manual page"
+.Sh "Degrees Celsius vs. Degrees Fahrenheit"
+.IX Subsection "Degrees Celsius vs. Degrees Fahrenheit"
+To convert Celsius into Fahrenheit use the formula
+F=9/5*C+32
+.PP
+.Vb 5
+\&   rrdtool graph demo.png \-\-title="Demo Graph" \e
+\&      DEF:cel=demo.rrd:exhaust:AVERAGE \e
+\&      CDEF:far=9,5,/,cel,*,32,+ \e
+\&      LINE2:cel#00a000:"D. Celsius" \e
+\&      LINE2:far#ff0000:"D. Fahrenheit\ec"
+.Ve
+.PP
+This example gets the \s-1DS\s0 called \*(L"exhaust\*(R" from database \*(L"demo.rrd\*(R"
+and puts the values in variable \*(L"cel\*(R". The \s-1CDEF\s0 used is evaluated
+as follows:
+.PP
+.Vb 10
+\&   CDEF:far=9,5,/,cel,*,32,+
+\&   1. push 9, push 5
+\&   2. push function "divide" and process it
+\&      the stack now contains 9/5
+\&   3. push variable "cel"
+\&   4. push function "multiply" and process it
+\&      the stack now contains 9/5*cel
+\&   5. push 32
+\&   6. push function "plus" and process it
+\&      the stack contains now the temperature in Fahrenheit
+.Ve
+.Sh "Changing unknown into zero"
+.IX Subsection "Changing unknown into zero"
+.Vb 9
+\&   rrdtool graph demo.png \-\-title="Demo Graph" \e
+\&      DEF:idat1=interface1.rrd:ds0:AVERAGE \e
+\&      DEF:idat2=interface2.rrd:ds0:AVERAGE \e
+\&      DEF:odat1=interface1.rrd:ds1:AVERAGE \e
+\&      DEF:odat2=interface2.rrd:ds1:AVERAGE \e
+\&      CDEF:agginput=idat1,UN,0,idat1,IF,idat2,UN,0,idat2,IF,+,8,* \e
+\&      CDEF:aggoutput=odat1,UN,0,odat1,IF,odat2,UN,0,odat2,IF,+,8,* \e
+\&      AREA:agginput#00cc00:Input Aggregate \e
+\&      LINE1:aggoutput#0000FF:Output Aggregate
+.Ve
+.PP
+These two CDEFs are built from several functions. It helps to split
+them when viewing what they do. Starting with the first \s-1CDEF\s0 we would
+get:
+.PP
+.Vb 4
+\& idat1,UN \-\-> a
+\& 0        \-\-> b
+\& idat1    \-\-> c
+\& if (a) then (b) else (c)
+.Ve
+.PP
+The result is therefore \*(L"0\*(R" if it is true that \*(L"idat1\*(R" equals \*(L"\s-1UN\s0\*(R".
+If not, the original value of \*(L"idat1\*(R" is put back on the stack.
+Lets call this answer \*(L"d\*(R". The process is repeated for the next
+five items on the stack, it is done the same and will return answer
+\&\*(L"h\*(R". The resulting stack is therefore \*(L"d,h\*(R".
+The expression has been simplified to \*(L"d,h,+,8,*\*(R" and it will now be
+easy to see that we add \*(L"d\*(R" and \*(L"h\*(R", and multiply the result with eight.
+.PP
+The end result is that we have added \*(L"idat1\*(R" and \*(L"idat2\*(R" and in the
+process we effectively ignored unknown values. The result is multiplied
+by eight, most likely to convert bytes/s to bits/s.
+.Sh "Infinity demo"
+.IX Subsection "Infinity demo"
+.Vb 13
+\&   rrdtool graph example.png \-\-title="INF demo" \e
+\&      DEF:val1=some.rrd:ds0:AVERAGE \e
+\&      DEF:val2=some.rrd:ds1:AVERAGE \e
+\&      DEF:val3=some.rrd:ds2:AVERAGE \e
+\&      DEF:val4=other.rrd:ds0:AVERAGE \e
+\&      CDEF:background=val4,POP,TIME,7200,%,3600,LE,INF,UNKN,IF \e
+\&      CDEF:wipeout=val1,val2,val3,val4,+,+,+,UN,INF,UNKN,IF \e
+\&      AREA:background#F0F0F0 \e
+\&      AREA:val1#0000FF:Value1 \e
+\&      STACK:val2#00C000:Value2 \e
+\&      STACK:val3#FFFF00:Value3 \e
+\&      STACK:val4#FFC000:Value4 \e
+\&      AREA:whipeout#FF0000:Unknown
+.Ve
+.PP
+This demo demonstrates two ways to use infinity. It is a bit tricky
+to see what happens in the \*(L"background\*(R" \s-1CDEF\s0.
+.PP
+.Vb 1
+\&   "val4,POP,TIME,7200,%,3600,LE,INF,UNKN,IF"
+.Ve
+.PP
+This \s-1RPN\s0 takes the value of \*(L"val4\*(R" as input and then immediately
+removes it from the stack using \*(L"\s-1POP\s0\*(R". The stack is now empty but
+as a side effect we now know the time that this sample was taken.
+This time is put on the stack by the \*(L"\s-1TIME\s0\*(R" function.
+.PP
+\&\*(L"\s-1TIME\s0,7200,%\*(R" takes the modulo of time and 7'200 (which is two hours).
+The resulting value on the stack will be a number in the range from
+0 to 7199.
+.PP
+For people who don't know the modulo function: it is the remainder
+after an integer division. If you divide 16 by 3, the answer would
+be 5 and the remainder would be 1. So, \*(L"16,3,%\*(R" returns 1.
+.PP
+We have the result of \*(L"\s-1TIME\s0,7200,%\*(R" on the stack, lets call this
+\&\*(L"a\*(R". The start of the \s-1RPN\s0 has become \*(L"a,3600,LE\*(R" and this checks
+if \*(L"a\*(R" is less or equal than \*(L"3600\*(R". It is true half of the time.
+We now have to process the rest of the \s-1RPN\s0 and this is only a simple
+\&\*(L"\s-1IF\s0\*(R" function that returns either \*(L"\s-1INF\s0\*(R" or \*(L"\s-1UNKN\s0\*(R" depending on the
+time. This is returned to variable \*(L"background\*(R".
+.PP
+The second \s-1CDEF\s0 has been discussed earlier in this document so we
+won't do that here.
+.PP
+Now you can draw the different layers. Start with the background
+that is either unknown (nothing to see) or infinite (the whole
+positive part of the graph gets filled).
+.PP
+Next you draw the data on top of this background, it will overlay
+the background. Suppose one of val1..val4 would be unknown, in that
+case you end up with only three bars stacked on top of each other.
+You don't want to see this because the data is only valid when all
+four variables are valid. This is why you use the second \s-1CDEF\s0, it
+will overlay the data with an \s-1AREA\s0 so the data cannot be seen anymore.
+.PP
+If your data can also have negative values you also need to overwrite
+the other half of your graph. This can be done in a relatively simple
+way: what you need is the \*(L"wipeout\*(R" variable and place a negative
+sign before it:  \*(L"CDEF:wipeout2=wipeout,\-1,*\*(R"
+.Sh "Filtering data"
+.IX Subsection "Filtering data"
+You may do some complex data filtering:
+.PP
+.Vb 1
+\&  MEDIAN FILTER: filters shot noise
+.Ve
+.PP
+.Vb 7
+\&    DEF:var=database.rrd:traffic:AVERAGE
+\&    CDEF:prev1=PREV(var)
+\&    CDEF:prev2=PREV(prev1)
+\&    CDEF:prev3=PREV(prev2)
+\&    CDEF:median=prev1,prev2,prev3,+,+,3,/
+\&    LINE3:median#000077:filtered
+\&    LINE1:prev2#007700:'raw data'
+.Ve
+.PP
+.Vb 1
+\&  DERIVATE:
+.Ve
+.PP
+.Vb 7
+\&    DEF:var=database.rrd:traffic:AVERAGE
+\&    CDEF:prev1=PREV(var)
+\&    CDEF:time=TIME
+\&    CDEF:prevtime=PREV(time)
+\&    CDEF:derivate=var,prev1,\-,time,prevtime,\-,/
+\&    LINE3:derivate#000077:derivate
+\&    LINE1:var#007700:'raw data'
+.Ve
+.SH "Out of ideas for now"
+.IX Header "Out of ideas for now"
+This document was created from questions asked by either myself or by
+other people on the RRDtool mailing list. Please let me know if you
+find errors in it or if you have trouble understanding it. If you
+think there should be an addition, mail me:
+<alex@ergens.op.het.net>
+.PP
+Remember: \fBNo feedback equals no changes!\fR
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+The RRDtool manpages
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Alex van den Bogaerdt
+<alex@ergens.op.het.net>
diff --git a/doc/cdeftutorial.html b/doc/cdeftutorial.html
new file mode 100644 (file)
index 0000000..aa323aa
--- /dev/null
@@ -0,0 +1,834 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>cdeftutorial</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <ul>
+
+               <li><a href="#why_this_tutorial">Why this tutorial?</a></li>
+               <li><a href="#more_reading">More reading</a></li>
+       </ul>
+
+       <li><a href="#what_are_cdefs">What are CDEFs?</a></li>
+       <li><a href="#syntax">Syntax</a></li>
+       <li><a href="#rpnexpressions">RPN-expressions</a></li>
+       <li><a href="#converting_your_wishes_to_rpn">Converting your wishes to RPN</a></li>
+       <li><a href="#some_special_numbers">Some special numbers</a></li>
+       <ul>
+
+               <li><a href="#the_unknown_value">The unknown value</a></li>
+               <li><a href="#working_with_unknown_data_in_your_database">Working with unknown data in your database</a></li>
+               <li><a href="#infinity">Infinity</a></li>
+               <li><a href="#working_with_unknown_data_and_infinity">Working with unknown data and infinity</a></li>
+       </ul>
+
+       <li><a href="#some_examples">Some examples</a></li>
+       <ul>
+
+               <li><a href="#example__using_a_recently_created_rrd">Example: using a recently created RRD</a></li>
+               <li><a href="#example__better_handling_of_unknown_data__by_using_time">Example: better handling of unknown data, by using time</a></li>
+               <li><a href="#example__pretending_weird_data_isn_t_there">Example: Pretending weird data isn't there</a></li>
+               <li><a href="#example__working_on_a_certain_time_span">Example: working on a certain time span</a></li>
+               <li><a href="#example__you_suspect_to_have_problems_and_want_to_see_unknown_data_">Example: You suspect to have problems and want to see unknown data.</a></li>
+               <li><a href="#same_example_useful_with_stacked_data_">Same example useful with STACKed data:</a></li>
+       </ul>
+
+       <li><a href="#the_examples_from_the_rrd_graph_manual_page">The examples from the RRD graph manual page</a></li>
+       <ul>
+
+               <li><a href="#degrees_celsius_vs__degrees_fahrenheit">Degrees Celsius vs. Degrees Fahrenheit</a></li>
+               <li><a href="#infinity_demo">Infinity demo</a></li>
+               <li><a href="#filtering_data">Filtering data</a></li>
+       </ul>
+
+       <li><a href="#out_of_ideas_for_now">Out of ideas for now</a></li>
+       <li><a href="#see_also">SEE ALSO</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>cdeftutorial - Alex van den Bogaerdt's CDEF tutorial</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>Intention of this document: to provide some examples of the commonly
+used parts of RRDtool's CDEF language.</p>
+<p>If you think some important feature is not explained properly, and if
+adding it to this document would benefit most users, please do ask me
+to add it.  I will then try to provide an answer in the next release
+of this tutorial.  No feedback equals no changes! Additions to
+this document are also welcome.  -- Alex van den Bogaerdt
+&lt;<a href="mailto:alex@ergens.op.het.net">alex@ergens.op.het.net</a>&gt;</p>
+<p>
+</p>
+<h2><a name="why_this_tutorial">Why this tutorial?</a></h2>
+<p>One of the powerful parts of RRDtool is its ability to do all sorts
+of calculations on the data retrieved from its databases. However,
+RRDtool's many options and syntax make it difficult for the average
+user to understand. The manuals are good at explaining what these
+options do; however they do not (and should not) explain in detail
+why they are useful. As with my RRDtool tutorial: if you want a
+simple document in simple language you should read this tutorial.
+If you are happy with the official documentation, you may find this
+document too simple or even boring. If you do choose to read this
+tutorial, I also expect you to have read and fully understand my
+other tutorial.</p>
+<p>
+</p>
+<h2><a name="more_reading">More reading</a></h2>
+<p>If you have difficulties with the way I try to explain it please read
+Steve Rader's <a href="././rpntutorial.html">the rpntutorial manpage</a>. It may help you understand how this all works.</p>
+<p>
+</p>
+<hr />
+<h1><a name="what_are_cdefs">What are CDEFs?</a></h1>
+<p>When retrieving data from an RRD, you are using a ``DEF'' to work with
+that data. Think of it as a variable that changes over time (where
+time is the x-axis). The value of this variable is what is found in
+the database at that particular time and you can't do any
+modifications on it. This is what CDEFs are for: they takes values
+from DEFs and perform calculations on them.</p>
+<p>
+</p>
+<hr />
+<h1><a name="syntax">Syntax</a></h1>
+<pre>
+   DEF:var_name_1=some.rrd:ds_name:CF
+   CDEF:var_name_2=RPN_expression</pre>
+<p>You first define ``var_name_1'' to be data collected from data source
+``ds_name'' found in RRD ``some.rrd'' with consolidation function ``CF''.</p>
+<p>Assume the ifInOctets SNMP counter is saved in mrtg.rrd as the DS ``in''.
+Then the following DEF defines a variable for the average of that
+data source:</p>
+<pre>
+   DEF:inbytes=mrtg.rrd:in:AVERAGE</pre>
+<p>Say you want to display bits per second (instead of bytes per second
+as stored in the database.)  You have to define a calculation
+(hence ``CDEF'') on variable ``inbytes'' and use that variable (inbits)
+instead of the original:</p>
+<pre>
+   CDEF:inbits=inbytes,8,*</pre>
+<p>This tells RRDtool to multiply inbytes by eight to get inbits. I'll
+explain later how this works. In the graphing or printing functions,
+you can now use inbits where you would use inbytes otherwise.</p>
+<p>Note that the variable name used in the CDEF (inbits) must not be the
+same as the variable named in the DEF (inbytes)!</p>
+<p>
+</p>
+<hr />
+<h1><a name="rpnexpressions">RPN-expressions</a></h1>
+<p>RPN is short-hand for Reverse Polish Notation. It works as follows.
+You put the variables or numbers on a stack. You also put operations
+(things-to-do) on the stack and this stack is then processed. The result
+will be placed on the stack. At the end, there should be exactly one
+number left: the outcome of the series of operations. If there is not
+exactly one number left, RRDtool will complain loudly.</p>
+<p>Above multiplication by eight will look like:</p>
+<ol>
+<li>
+<p>Start with an empty stack</p>
+</li>
+<li>
+<p>Put the content of variable inbytes on the stack</p>
+</li>
+<li>
+<p>Put the number eight on the stack</p>
+</li>
+<li>
+<p>Put the operation multiply on the stack</p>
+</li>
+<li>
+<p>Process the stack</p>
+</li>
+<li>
+<p>Retrieve the value from the stack and put it in variable inbits</p>
+</li>
+</ol>
+<p>We will now do an example with real numbers. Suppose the variable
+inbytes would have value 10, the stack would be:</p>
+<ol>
+<li>
+<p>||</p>
+</li>
+<li>
+<p>|10|</p>
+</li>
+<li>
+<p>|10|8|</p>
+</li>
+<li>
+<p>|10|8|*|</p>
+</li>
+<li>
+<p>|80|</p>
+</li>
+<li>
+<p>||</p>
+</li>
+</ol>
+<p>Processing the stack (step 5) will retrieve one value from the stack
+(from the right at step 4). This is the operation multiply and this
+takes two values off the stack as input. The result is put back on the
+stack (the value 80 in this case). For multiplication the order doesn't
+matter, but for other operations like subtraction and division it does.
+Generally speaking you have the following order:</p>
+<pre>
+   y = A - B  --&gt;  y=minus(A,B)  --&gt;  CDEF:y=A,B,-</pre>
+<p>This is not very intuitive (at least most people don't think so). For
+the function <code>f(A,B)</code> you reverse the position of ``f'', but you do not
+reverse the order of the variables.</p>
+<p>
+</p>
+<hr />
+<h1><a name="converting_your_wishes_to_rpn">Converting your wishes to RPN</a></h1>
+<p>First, get a clear picture of what you want to do. Break down the problem
+in smaller portions until they cannot be split anymore. Then it is rather
+simple to convert your ideas into RPN.</p>
+<p>Suppose you have several RRDs and would like to add up some counters in
+them. These could be, for instance, the counters for every WAN link you
+are monitoring.</p>
+<p>You have:</p>
+<pre>
+   router1.rrd with link1in link2in
+   router2.rrd with link1in link2in
+   router3.rrd with link1in link2in</pre>
+<p>Suppose you would like to add up all these counters, except for link2in
+inside router2.rrd. You need to do:</p>
+<p>(in this example, ``router1.rrd:link1in'' means the DS link1in inside the
+RRD router1.rrd)</p>
+<pre>
+   router1.rrd:link1in
+   router1.rrd:link2in
+   router2.rrd:link1in
+   router3.rrd:link1in
+   router3.rrd:link2in
+   --------------------   +
+   (outcome of the sum)</pre>
+<p>As a mathematical function, this could be written:</p>
+<p><code>add(router1.rrd:link1in , router1.rrd:link2in , router2.rrd:link1in , router3.rrd:link1in , router3.rrd:link2.in)</code></p>
+<p>With RRDtool and RPN, first, define the inputs:</p>
+<pre>
+   DEF:a=router1.rrd:link1in:AVERAGE
+   DEF:b=router1.rrd:link2in:AVERAGE
+   DEF:c=router2.rrd:link1in:AVERAGE
+   DEF:d=router3.rrd:link1in:AVERAGE
+   DEF:e=router3.rrd:link2in:AVERAGE</pre>
+<p>Now, the mathematical function becomes: <code>add(a,b,c,d,e)</code></p>
+<p>In RPN, there's no operator that sums more than two values so you need
+to do several additions. You add a and b, add c to the result, add d
+to the result and add e to the result.</p>
+<pre>
+   push a:         a     stack contains the value of a
+   push b and add: b,+   stack contains the result of a+b
+   push c and add: c,+   stack contains the result of a+b+c
+   push d and add: d,+   stack contains the result of a+b+c+d
+   push e and add: e,+   stack contains the result of a+b+c+d+e</pre>
+<p>What was calculated here would be written down as:</p>
+<pre>
+   ( ( ( (a+b) + c) + d) + e) &gt;</pre>
+<p>This is in RPN:  <code>CDEF:result=a,b,+,c,+,d,+,e,+</code></p>
+<p>This is correct but it can be made more clear to humans. It does
+not matter if you add a to b and then add c to the result or first
+add b to c and then add a to the result. This makes it possible to
+rewrite the RPN into <code>CDEF:result=a,b,c,d,e,+,+,+,+</code> which is
+evaluated differently:</p>
+<pre>
+   push value of variable a on the stack: a
+   push value of variable b on the stack: a b
+   push value of variable c on the stack: a b c
+   push value of variable d on the stack: a b c d
+   push value of variable e on the stack: a b c d e
+   push operator + on the stack:          a b c d e +
+   and process it:                        a b c P   (where P == d+e)
+   push operator + on the stack:          a b c P +
+   and process it:                        a b Q     (where Q == c+P)
+   push operator + on the stack:          a b Q +
+   and process it:                        a R       (where R == b+Q)
+   push operator + on the stack:          a R +
+   and process it:                        S         (where S == a+R)</pre>
+<p>As you can see the RPN expression <code>a,b,c,d,e,+,+,+,+,+</code> will evaluate in
+<code>((((d+e)+c)+b)+a)</code> and it has the same outcome as <code>a,b,+,c,+,d,+,e,+</code>.
+This is called the commutative law of addition,
+but you may forget this right away, as long as you remember what it
+means.</p>
+<p>Now look at an expression that contains a multiplication:</p>
+<p>First in normal math: <code>let result = a+b*c</code>. In this case you can't
+choose the order yourself, you have to start with the multiplication
+and then add a to it. You may alter the position of b and c, you must
+not alter the position of a and b.</p>
+<p>You have to take this in consideration when converting this expression
+into RPN. Read it as: ``Add the outcome of b*c to a'' and then it is
+easy to write the RPN expression: <code>result=a,b,c,*,+</code>
+Another expression that would return the same: <code>result=b,c,*,a,+</code></p>
+<p>In normal math, you may encounter something like ``a*(b+c)'' and this
+can also be converted into RPN. The parenthesis just tell you to first
+add b and c, and then multiply a with the result. Again, now it is
+easy to write it in RPN: <code>result=a,b,c,+,*</code>. Note that this is very
+similar to one of the expressions in the previous paragraph, only the
+multiplication and the addition changed places.</p>
+<p>When you have problems with RPN or when RRDtool is complaining, it's
+usually a good thing to write down the stack on a piece of paper
+and see what happens. Have the manual ready and pretend to be RRDtool.
+Just do all the math by hand to see what happens, I'm sure this will
+solve most, if not all, problems you encounter.</p>
+<p>
+</p>
+<hr />
+<h1><a name="some_special_numbers">Some special numbers</a></h1>
+<p>
+</p>
+<h2><a name="the_unknown_value">The unknown value</a></h2>
+<p>Sometimes collecting your data will fail. This can be very common,
+especially when querying over busy links. RRDtool can be configured
+to allow for one (or even more) unknown <code>value(s)</code> and calculate the missing
+update. You can, for instance, query your device every minute. This is
+creating one so called PDP or primary data point per minute. If you
+defined your RRD to contain an RRA that stores 5-minute values, you need
+five of those PDPs to create one CDP (consolidated data point).
+These PDPs can become unknown in two cases:</p>
+<ol>
+<li>
+<p>The updates are too far apart. This is tuned using the ``heartbeat'' setting.</p>
+</li>
+<li>
+<p>The update was set to unknown on purpose by inserting no value (using the
+template option) or by using ``U'' as the value to insert.</p>
+</li>
+</ol>
+<p>When a CDP is calculated, another mechanism determines if this CDP is valid
+or not. If there are too many PDPs unknown, the CDP is unknown as well.
+This is determined by the xff factor. Please note that one unknown counter
+update can result in two unknown PDPs! If you only allow for one unknown
+PDP per CDP, this makes the CDP go unknown!</p>
+<p>Suppose the counter increments with one per second and you retrieve it
+every minute:</p>
+<pre>
+   counter value    resulting rate
+   10'000
+   10'060            1; (10'060-10'000)/60 == 1
+   10'120            1; (10'120-10'060)/60 == 1
+   unknown           unknown; you don't know the last value
+   10'240            unknown; you don't know the previous value
+   10'300            1; (10'300-10'240)/60 == 1</pre>
+<p>If the CDP was to be calculated from the last five updates, it would get
+two unknown PDPs and three known PDPs. If xff would have been set to 0.5
+which by the way is a commonly used factor, the CDP would have a known
+value of 1. If xff would have been set to 0.2 then the resulting CDP
+would be unknown.</p>
+<p>You have to decide the proper values for heartbeat, number of PDPs per
+CDP and the xff factor. As you can see from the previous text they define
+the behavior of your RRA.</p>
+<p>
+</p>
+<h2><a name="working_with_unknown_data_in_your_database">Working with unknown data in your database</a></h2>
+<p>As you have read in the previous chapter, entries in an RRA can be
+set to the unknown value. If you do calculations with this type of
+value, the result has to be unknown too. This means that an expression
+such as <code>result=a,b,+</code> will be unknown if either a or b is unknown.
+It would be wrong to just ignore the unknown value and return the value
+of the other parameter. By doing so, you would assume ``unknown'' means ``zero''
+and this is not true.</p>
+<p>There has been a case where somebody was collecting data for over a year.
+A new piece of equipment was installed, a new RRD was created and the
+scripts were changed to add a counter from the old database and a counter
+from the new database. The result was disappointing, a large part of
+the statistics seemed to have vanished mysteriously ...
+They of course didn't, values from the old database (known values) were
+added to values from the new database (unknown values) and the result was
+unknown.</p>
+<p>In this case, it is fairly reasonable to use a CDEF that alters unknown
+data into zero. The counters of the device were unknown (after all, it
+wasn't installed yet!) but you know that the data rate through the device
+had to be zero (because of the same reason: it was not installed).</p>
+<p>There are some examples below that make this change.</p>
+<p>
+</p>
+<h2><a name="infinity">Infinity</a></h2>
+<p>Infinite data is another form of a special number. It cannot be
+graphed because by definition you would never reach the infinite
+value. You can think of positive and negative infinity depending on
+the position relative to zero.</p>
+<p>RRDtool is capable of representing (-not- graphing!) infinity by stopping
+at its current maximum (for positive infinity) or minimum (for negative
+infinity) without knowing this maximum (minimum).</p>
+<p>Infinity in RRDtool is mostly used to draw an AREA without knowing its
+vertical dimensions. You can think of it as drawing an AREA with an
+infinite height and displaying only the part that is visible in the
+current graph. This is probably a good way to approximate infinity
+and it sure allows for some neat tricks. See below for examples.</p>
+<p>
+</p>
+<h2><a name="working_with_unknown_data_and_infinity">Working with unknown data and infinity</a></h2>
+<p>Sometimes you would like to discard unknown data and pretend it is zero
+(or any other value for that matter) and sometimes you would like to
+pretend that known data is unknown (to discard known-to-be-wrong data).
+This is why CDEFs have support for unknown data. There are also examples
+available that show unknown data by using infinity.</p>
+<p>
+</p>
+<hr />
+<h1><a name="some_examples">Some examples</a></h1>
+<p>
+</p>
+<h2><a name="example__using_a_recently_created_rrd">Example: using a recently created RRD</a></h2>
+<p>You are keeping statistics on your router for over a year now. Recently
+you installed an extra router and you would like to show the combined
+throughput for these two devices.</p>
+<p>If you just add up the counters from router.rrd and router2.rrd, you
+will add known data (from router.rrd) to unknown data (from router2.rrd) for
+the bigger part of your stats. You could solve this in a few ways:</p>
+<ul>
+<li>
+<p>While creating the new database, fill it with zeros from the start to now.
+You have to make the database start at or before the least recent time in
+the other database.</p>
+</li>
+<li>
+<p>Alternatively, you could use CDEF and alter unknown data to zero.</p>
+</li>
+</ul>
+<p>Both methods have their pros and cons. The first method is troublesome and
+if you want to do that you have to figure it out yourself. It is not
+possible to create a database filled with zeros, you have to put them in
+manually. Implementing the second method is described next:</p>
+<p>What we want is: ``if the value is unknown, replace it with zero''. This
+could be written in pseudo-code as:  if (value is unknown) then (zero)
+else (value). When reading the <a href="././rrdgraph.html">the rrdgraph manpage</a> manual you notice the ``UN''
+function that returns zero or one. You also notice the ``IF'' function
+that takes zero or one as input.</p>
+<p>First look at the ``IF'' function. It takes three values from the stack,
+the first value is the decision point, the second value is returned to
+the stack if the evaluation is ``true'' and if not, the third value is
+returned to the stack. We want the ``UN'' function to decide what happens
+so we combine those two functions in one CDEF.</p>
+<p>Lets write down the two possible paths for the ``IF'' function:</p>
+<pre>
+   if true  return a
+   if false return b</pre>
+<p>In RPN:  <code>result=x,a,b,IF</code> where ``x'' is either true or false.</p>
+<p>Now we have to fill in ``x'', this should be the ``(value is unknown)'' part
+and this is in RPN:  <code>result=value,UN</code></p>
+<p>We now combine them: <code>result=value,UN,a,b,IF</code> and when we fill in the
+appropriate things for ``a'' and ``b'' we're finished:</p>
+<p><code>CDEF:result=value,UN,0,value,IF</code></p>
+<p>You may want to read Steve Rader's RPN guide if you have difficulties
+with the way I explained this last example.</p>
+<p>If you want to check this RPN expression, just mimic RRDtool behavior:</p>
+<pre>
+   For any known value, the expression evaluates as follows:
+   CDEF:result=value,UN,0,value,IF  (value,UN) is not true so it becomes 0
+   CDEF:result=0,0,value,IF         &quot;IF&quot; will return the 3rd value
+   CDEF:result=value                The known value is returned</pre>
+<pre>
+   For the unknown value, this happens:
+   CDEF:result=value,UN,0,value,IF  (value,UN) is true so it becomes 1
+   CDEF:result=1,0,value,IF         &quot;IF&quot; sees 1 and returns the 2nd value
+   CDEF:result=0                    Zero is returned</pre>
+<p>Of course, if you would like to see another value instead of zero, you
+can use that other value.</p>
+<p>Eventually, when all unknown data is removed from the RRD, you may want
+to remove this rule so that unknown data is properly displayed.</p>
+<p>
+</p>
+<h2><a name="example__better_handling_of_unknown_data__by_using_time">Example: better handling of unknown data, by using time</a></h2>
+<p>The above example has one drawback. If you do log unknown data in
+your database after installing your new equipment, it will also be
+translated into zero and therefore you won't see that there was a
+problem. This is not good and what you really want to do is:</p>
+<ul>
+<li>
+<p>If there is unknown data, look at the time that this sample was taken.</p>
+</li>
+<li>
+<p>If the unknown value is before time xxx, make it zero.</p>
+</li>
+<li>
+<p>If it is after time xxx, leave it as unknown data.</p>
+</li>
+</ul>
+<p>This is doable: you can compare the time that the sample was taken
+to some known time. Assuming you started to monitor your device on
+Friday September 17, 1999, 00:35:57 MET DST. Translate this time in seconds
+since 1970-01-01 and it becomes 937'521'357. If you process unknown values
+that were received after this time, you want to leave them unknown and
+if they were ``received'' before this time, you want to translate them
+into zero (so you can effectively ignore them while adding them to your
+other routers counters).</p>
+<p>Translating Friday September 17, 1999, 00:35:57 MET DST into 937'521'357 can
+be done by, for instance, using gnu date:</p>
+<pre>
+   date -d &quot;19990917 00:35:57&quot; +%s</pre>
+<p>You could also dump the database and see where the data starts to be
+known. There are several other ways of doing this, just pick one.</p>
+<p>Now we have to create the magic that allows us to process unknown
+values different depending on the time that the sample was taken.
+This is a three step process:</p>
+<ol>
+<li>
+<p>If the timestamp of the value is after 937'521'357, leave it as is.</p>
+</li>
+<li>
+<p>If the value is a known value, leave it as is.</p>
+</li>
+<li>
+<p>Change the unknown value into zero.</p>
+</li>
+</ol>
+<p>Lets look at part one:</p>
+<pre>
+    if (true) return the original value</pre>
+<p>We rewrite this:</p>
+<pre>
+    if (true) return &quot;a&quot;
+    if (false) return &quot;b&quot;</pre>
+<p>We need to calculate true or false from step 1. There is a function
+available that returns the timestamp for the current sample. It is
+called, how surprisingly, ``TIME''. This time has to be compared to
+a constant number, we need ``GT''. The output of ``GT'' is true or false
+and this is good input to ``IF''. We want ``if (time &gt; 937521357) then
+(return a) else (return b)''.</p>
+<p>This process was already described thoroughly in the previous chapter
+so lets do it quick:</p>
+<pre>
+   if (x) then a else b
+      where x represents &quot;time&gt;937521357&quot;
+      where a represents the original value
+      where b represents the outcome of the previous example</pre>
+<pre>
+   time&gt;937521357       --&gt; TIME,937521357,GT</pre>
+<pre>
+   if (x) then a else b --&gt; x,a,b,IF
+   substitute x         --&gt; TIME,937521357,GT,a,b,IF
+   substitute a         --&gt; TIME,937521357,GT,value,b,IF
+   substitute b         --&gt; TIME,937521357,GT,value,value,UN,0,value,IF,IF</pre>
+<p>We end up with:
+<code>CDEF:result=TIME,937521357,GT,value,value,UN,0,value,IF,IF</code></p>
+<p>This looks very complex, however, as you can see, it was not too hard to
+come up with.</p>
+<p>
+</p>
+<h2><a name="example__pretending_weird_data_isn_t_there">Example: Pretending weird data isn't there</a></h2>
+<p>Suppose you have a problem that shows up as huge spikes in your graph.
+You know this happens and why, so you decide to work around the problem.
+Perhaps you're using your network to do a backup at night and by doing
+so you get almost 10mb/s while the rest of your network activity does
+not produce numbers higher than 100kb/s.</p>
+<p>There are two options:</p>
+<ol>
+<li>
+<p>If the number exceeds 100kb/s it is wrong and you want it masked out
+by changing it into unknown.</p>
+</li>
+<li>
+<p>You don't want the graph to show more than 100kb/s.</p>
+</li>
+</ol>
+<p>Pseudo code: if (number &gt; 100) then unknown else number
+or
+Pseudo code: if (number &gt; 100) then 100 else number.</p>
+<p>The second ``problem'' may also be solved by using the rigid option of
+RRDtool graph, however this has not the same result. In this example
+you can end up with a graph that does autoscaling. Also, if you use
+the numbers to display maxima they will be set to 100kb/s.</p>
+<p>We use ``IF'' and ``GT'' again. ``if (x) then (y) else (z)'' is written
+down as ``CDEF:result=x,y,z,IF''; now fill in x, y and z.
+For x you fill in ``number greater than 100kb/s'' becoming
+``number,100000,GT'' (kilo is 1'000 and b/s is what we measure!).
+The ``z'' part is ``number'' in both cases and the ``y'' part is either
+``UNKN'' for unknown or ``100000'' for 100kb/s.</p>
+<p>The two CDEF expressions would be:</p>
+<pre>
+    CDEF:result=number,100000,GT,UNKN,number,IF
+    CDEF:result=number,100000,GT,100000,number,IF</pre>
+<p>
+</p>
+<h2><a name="example__working_on_a_certain_time_span">Example: working on a certain time span</a></h2>
+<p>If you want a graph that spans a few weeks, but would only want to
+see some routers' data for one week, you need to ``hide'' the rest of
+the time frame. Don't ask me when this would be useful, it's just
+here for the example :)</p>
+<p>We need to compare the time stamp to a begin date and an end date.
+Comparing isn't difficult:</p>
+<pre>
+        TIME,begintime,GE
+        TIME,endtime,LE</pre>
+<p>These two parts of the CDEF produce either 0 for false or 1 for true.
+We can now check if they are both 0 (or 1) using a few IF statements
+but, as Wataru Satoh pointed out, we can use the ``*'' or ``+'' functions
+as logical AND and logical OR.</p>
+<p>For ``*'', the result will be zero (false) if either one of the two
+operators is zero.  For ``+'', the result will only be false (0) when
+two false (0) operators will be added.  Warning: *any* number not
+equal to 0 will be considered ``true''. This means that, for instance,
+``-1,1,+'' (which should be ``true or true'') will become FALSE ...
+In other words, use ``+'' only if you know for sure that you have positive
+numbers (or zero) only.</p>
+<p>Let's compile the complete CDEF:</p>
+<pre>
+        DEF:ds0=router1.rrd:AVERAGE
+        CDEF:ds0modified=TIME,begintime,GE,TIME,endtime,LE,*,UNKN,ds0,IF</pre>
+<p>This will return the value of ds0 if both comparisons return true. You
+could also do it the other way around:</p>
+<pre>
+        DEF:ds0=router1.rrd:AVERAGE
+        CDEF:ds0modified=TIME,begintime,LT,TIME,endtime,GT,+,UNKN,ds0,IF</pre>
+<p>This will return an UNKNOWN if either comparison returns true.</p>
+<p>
+</p>
+<h2><a name="example__you_suspect_to_have_problems_and_want_to_see_unknown_data_">Example: You suspect to have problems and want to see unknown data.</a></h2>
+<p>Suppose you add up the number of active users on several terminal servers.
+If one of them doesn't give an answer (or an incorrect one) you get ``NaN''
+in the database (``Not a Number'') and NaN is evaluated as Unknown.</p>
+<p>In this case, you would like to be alerted to it and the sum of the
+remaining values is of no value to you.</p>
+<p>It would be something like:</p>
+<pre>
+    DEF:users1=location1.rrd:onlineTS1:LAST
+    DEF:users2=location1.rrd:onlineTS2:LAST
+    DEF:users3=location2.rrd:onlineTS1:LAST
+    DEF:users4=location2.rrd:onlineTS2:LAST
+    CDEF:allusers=users1,users2,users3,users4,+,+,+</pre>
+<p>If you now plot allusers, unknown data in one of users1..users4 will
+show up as a gap in your graph. You want to modify this to show a
+bright red line, not a gap.</p>
+<p>Define an extra CDEF that is unknown if all is okay and is infinite if
+there is an unknown value:</p>
+<pre>
+    CDEF:wrongdata=allusers,UN,INF,UNKN,IF</pre>
+<p>``allusers,UN'' will evaluate to either true or false, it is the (x) part
+of the ``IF'' function and it checks if allusers is unknown.
+The (y) part of the ``IF'' function is set to ``INF'' (which means infinity)
+and the (z) part of the function returns ``UNKN''.</p>
+<p>The logic is: if (allusers == unknown) then return INF else return UNKN.</p>
+<p>You can now use AREA to display this ``wrongdata'' in bright red. If it
+is unknown (because allusers is known) then the red AREA won't show up.
+If the value is INF (because allusers is unknown) then the red AREA will
+be filled in on the graph at that particular time.</p>
+<pre>
+   AREA:allusers#0000FF:combined user count
+   AREA:wrongdata#FF0000:unknown data</pre>
+<p>
+</p>
+<h2><a name="same_example_useful_with_stacked_data_">Same example useful with STACKed data:</a></h2>
+<p>If you use stack in the previous example (as I would do) then you don't
+add up the values. Therefore, there is no relationship between the
+four values and you don't get a single value to test.
+Suppose users3 would be unknown at one point in time: users1 is plotted,
+users2 is stacked on top of users1, users3 is unknown and therefore
+nothing happens, users4 is stacked on top of users2.
+Add the extra CDEFs anyway and use them to overlay the ``normal'' graph:</p>
+<pre>
+   DEF:users1=location1.rrd:onlineTS1:LAST
+   DEF:users2=location1.rrd:onlineTS2:LAST
+   DEF:users3=location2.rrd:onlineTS1:LAST
+   DEF:users4=location2.rrd:onlineTS2:LAST
+   CDEF:allusers=users1,users2,users3,users4,+,+,+
+   CDEF:wrongdata=allusers,UN,INF,UNKN,IF
+   AREA:users1#0000FF:users at ts1
+   STACK:users2#00FF00:users at ts2
+   STACK:users3#00FFFF:users at ts3
+   STACK:users4#FFFF00:users at ts4
+   AREA:wrongdata#FF0000:unknown data</pre>
+<p>If there is unknown data in one of users1..users4, the ``wrongdata'' AREA
+will be drawn and because it starts at the X-axis and has infinite height
+it will effectively overwrite the STACKed parts.</p>
+<p>You could combine the two CDEF lines into one (we don't use ``allusers'')
+if you like.  But there are good reasons for writing two CDEFS:</p>
+<ul>
+<li>
+<p>It improves the readability of the script.</p>
+</li>
+<li>
+<p>It can be used inside GPRINT to display the total number of users.</p>
+</li>
+</ul>
+<p>If you choose to combine them, you can substitute the ``allusers'' in the
+second CDEF with the part after the equal sign from the first line:</p>
+<pre>
+   CDEF:wrongdata=users1,users2,users3,users4,+,+,+,UN,INF,UNKN,IF</pre>
+<p>If you do so, you won't be able to use these next GPRINTs:</p>
+<pre>
+   COMMENT:&quot;Total number of users seen&quot;
+   GPRINT:allusers:MAX:&quot;Maximum: %6.0lf&quot;
+   GPRINT:allusers:MIN:&quot;Minimum: %6.0lf&quot;
+   GPRINT:allusers:AVERAGE:&quot;Average: %6.0lf&quot;
+   GPRINT:allusers:LAST:&quot;Current: %6.0lf\n&quot;</pre>
+<p>
+</p>
+<hr />
+<h1><a name="the_examples_from_the_rrd_graph_manual_page">The examples from the RRD graph manual page</a></h1>
+<p>
+</p>
+<h2><a name="degrees_celsius_vs__degrees_fahrenheit">Degrees Celsius vs. Degrees Fahrenheit</a></h2>
+<p>To convert Celsius into Fahrenheit use the formula
+F=9/5*C+32</p>
+<pre>
+   rrdtool graph demo.png --title=&quot;Demo Graph&quot; \
+      DEF:cel=demo.rrd:exhaust:AVERAGE \
+      CDEF:far=9,5,/,cel,*,32,+ \
+      LINE2:cel#00a000:&quot;D. Celsius&quot; \
+      LINE2:far#ff0000:&quot;D. Fahrenheit\c&quot;</pre>
+<p>This example gets the DS called ``exhaust'' from database ``demo.rrd''
+and puts the values in variable ``cel''. The CDEF used is evaluated
+as follows:</p>
+<pre>
+   CDEF:far=9,5,/,cel,*,32,+
+   1. push 9, push 5
+   2. push function &quot;divide&quot; and process it
+      the stack now contains 9/5
+   3. push variable &quot;cel&quot;
+   4. push function &quot;multiply&quot; and process it
+      the stack now contains 9/5*cel
+   5. push 32
+   6. push function &quot;plus&quot; and process it
+      the stack contains now the temperature in Fahrenheit
+   
+=head2 Changing unknown into zero</pre>
+<pre>
+   rrdtool graph demo.png --title=&quot;Demo Graph&quot; \
+      DEF:idat1=interface1.rrd:ds0:AVERAGE \
+      DEF:idat2=interface2.rrd:ds0:AVERAGE \
+      DEF:odat1=interface1.rrd:ds1:AVERAGE \
+      DEF:odat2=interface2.rrd:ds1:AVERAGE \
+      CDEF:agginput=idat1,UN,0,idat1,IF,idat2,UN,0,idat2,IF,+,8,* \
+      CDEF:aggoutput=odat1,UN,0,odat1,IF,odat2,UN,0,odat2,IF,+,8,* \
+      AREA:agginput#00cc00:Input Aggregate \
+      LINE1:aggoutput#0000FF:Output Aggregate</pre>
+<p>These two CDEFs are built from several functions. It helps to split
+them when viewing what they do. Starting with the first CDEF we would
+get:</p>
+<pre>
+ idat1,UN --&gt; a
+ 0        --&gt; b
+ idat1    --&gt; c
+ if (a) then (b) else (c)</pre>
+<p>The result is therefore ``0'' if it is true that ``idat1'' equals ``UN''.
+If not, the original value of ``idat1'' is put back on the stack.
+Lets call this answer ``d''. The process is repeated for the next
+five items on the stack, it is done the same and will return answer
+``h''. The resulting stack is therefore ``d,h''.
+The expression has been simplified to ``d,h,+,8,*'' and it will now be
+easy to see that we add ``d'' and ``h'', and multiply the result with eight.</p>
+<p>The end result is that we have added ``idat1'' and ``idat2'' and in the
+process we effectively ignored unknown values. The result is multiplied
+by eight, most likely to convert bytes/s to bits/s.</p>
+<p>
+</p>
+<h2><a name="infinity_demo">Infinity demo</a></h2>
+<pre>
+   rrdtool graph example.png --title=&quot;INF demo&quot; \
+      DEF:val1=some.rrd:ds0:AVERAGE \
+      DEF:val2=some.rrd:ds1:AVERAGE \
+      DEF:val3=some.rrd:ds2:AVERAGE \
+      DEF:val4=other.rrd:ds0:AVERAGE \
+      CDEF:background=val4,POP,TIME,7200,%,3600,LE,INF,UNKN,IF \
+      CDEF:wipeout=val1,val2,val3,val4,+,+,+,UN,INF,UNKN,IF \
+      AREA:background#F0F0F0 \
+      AREA:val1#0000FF:Value1 \
+      STACK:val2#00C000:Value2 \
+      STACK:val3#FFFF00:Value3 \
+      STACK:val4#FFC000:Value4 \
+      AREA:whipeout#FF0000:Unknown</pre>
+<p>This demo demonstrates two ways to use infinity. It is a bit tricky
+to see what happens in the ``background'' CDEF.</p>
+<pre>
+   &quot;val4,POP,TIME,7200,%,3600,LE,INF,UNKN,IF&quot;</pre>
+<p>This RPN takes the value of ``val4'' as input and then immediately
+removes it from the stack using ``POP''. The stack is now empty but
+as a side effect we now know the time that this sample was taken.
+This time is put on the stack by the ``TIME'' function.</p>
+<p>``TIME,7200,%'' takes the modulo of time and 7'200 (which is two hours).
+The resulting value on the stack will be a number in the range from
+0 to 7199.</p>
+<p>For people who don't know the modulo function: it is the remainder
+after an integer division. If you divide 16 by 3, the answer would
+be 5 and the remainder would be 1. So, ``16,3,%'' returns 1.</p>
+<p>We have the result of ``TIME,7200,%'' on the stack, lets call this
+``a''. The start of the RPN has become ``a,3600,LE'' and this checks
+if ``a'' is less or equal than ``3600''. It is true half of the time.
+We now have to process the rest of the RPN and this is only a simple
+``IF'' function that returns either ``INF'' or ``UNKN'' depending on the
+time. This is returned to variable ``background''.</p>
+<p>The second CDEF has been discussed earlier in this document so we
+won't do that here.</p>
+<p>Now you can draw the different layers. Start with the background
+that is either unknown (nothing to see) or infinite (the whole
+positive part of the graph gets filled).</p>
+<p>Next you draw the data on top of this background, it will overlay
+the background. Suppose one of val1..val4 would be unknown, in that
+case you end up with only three bars stacked on top of each other.
+You don't want to see this because the data is only valid when all
+four variables are valid. This is why you use the second CDEF, it
+will overlay the data with an AREA so the data cannot be seen anymore.</p>
+<p>If your data can also have negative values you also need to overwrite
+the other half of your graph. This can be done in a relatively simple
+way: what you need is the ``wipeout'' variable and place a negative
+sign before it:  ``CDEF:wipeout2=wipeout,-1,*''</p>
+<p>
+</p>
+<h2><a name="filtering_data">Filtering data</a></h2>
+<p>You may do some complex data filtering:</p>
+<pre>
+  MEDIAN FILTER: filters shot noise</pre>
+<pre>
+    DEF:var=database.rrd:traffic:AVERAGE
+    CDEF:prev1=PREV(var)
+    CDEF:prev2=PREV(prev1)
+    CDEF:prev3=PREV(prev2)
+    CDEF:median=prev1,prev2,prev3,+,+,3,/
+    LINE3:median#000077:filtered
+    LINE1:prev2#007700:'raw data'</pre>
+<pre>
+  DERIVATE:</pre>
+<pre>
+    DEF:var=database.rrd:traffic:AVERAGE
+    CDEF:prev1=PREV(var)
+    CDEF:time=TIME
+    CDEF:prevtime=PREV(time)
+    CDEF:derivate=var,prev1,-,time,prevtime,-,/
+    LINE3:derivate#000077:derivate
+    LINE1:var#007700:'raw data'</pre>
+<p>
+</p>
+<hr />
+<h1><a name="out_of_ideas_for_now">Out of ideas for now</a></h1>
+<p>This document was created from questions asked by either myself or by
+other people on the RRDtool mailing list. Please let me know if you
+find errors in it or if you have trouble understanding it. If you
+think there should be an addition, mail me:
+&lt;<a href="mailto:alex@ergens.op.het.net">alex@ergens.op.het.net</a>&gt;</p>
+<p>Remember: <strong>No feedback equals no changes!</strong></p>
+<p>
+</p>
+<hr />
+<h1><a name="see_also">SEE ALSO</a></h1>
+<p>The RRDtool manpages</p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Alex van den Bogaerdt
+&lt;<a href="mailto:alex@ergens.op.het.net">alex@ergens.op.het.net</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/cdeftutorial.pod b/doc/cdeftutorial.pod
new file mode 100644 (file)
index 0000000..6a45ef4
--- /dev/null
@@ -0,0 +1,889 @@
+=head1 NAME
+
+cdeftutorial - Alex van den Bogaerdt's CDEF tutorial
+
+=head1 DESCRIPTION
+
+Intention of this document: to provide some examples of the commonly
+used parts of RRDtool's CDEF language.
+
+If you think some important feature is not explained properly, and if
+adding it to this document would benefit most users, please do ask me
+to add it.  I will then try to provide an answer in the next release
+of this tutorial.  No feedback equals no changes! Additions to
+this document are also welcome.  -- Alex van den Bogaerdt
+E<lt>alex@ergens.op.het.netE<gt>
+
+=head2 Why this tutorial?
+
+One of the powerful parts of RRDtool is its ability to do all sorts
+of calculations on the data retrieved from its databases. However,
+RRDtool's many options and syntax make it difficult for the average
+user to understand. The manuals are good at explaining what these
+options do; however they do not (and should not) explain in detail
+why they are useful. As with my RRDtool tutorial: if you want a
+simple document in simple language you should read this tutorial.
+If you are happy with the official documentation, you may find this
+document too simple or even boring. If you do choose to read this
+tutorial, I also expect you to have read and fully understand my
+other tutorial.
+
+=head2 More reading
+
+If you have difficulties with the way I try to explain it please read
+Steve Rader's L<rpntutorial>. It may help you understand how this all works.
+
+=head1 What are CDEFs?
+
+When retrieving data from an RRD, you are using a "DEF" to work with
+that data. Think of it as a variable that changes over time (where
+time is the x-axis). The value of this variable is what is found in
+the database at that particular time and you can't do any
+modifications on it. This is what CDEFs are for: they takes values
+from DEFs and perform calculations on them.
+
+=head1 Syntax
+
+   DEF:var_name_1=some.rrd:ds_name:CF
+   CDEF:var_name_2=RPN_expression
+
+You first define "var_name_1" to be data collected from data source
+"ds_name" found in RRD "some.rrd" with consolidation function "CF".
+
+Assume the ifInOctets SNMP counter is saved in mrtg.rrd as the DS "in".
+Then the following DEF defines a variable for the average of that
+data source:
+
+   DEF:inbytes=mrtg.rrd:in:AVERAGE
+
+Say you want to display bits per second (instead of bytes per second
+as stored in the database.)  You have to define a calculation
+(hence "CDEF") on variable "inbytes" and use that variable (inbits)
+instead of the original:
+
+   CDEF:inbits=inbytes,8,*
+
+This tells RRDtool to multiply inbytes by eight to get inbits. I'll
+explain later how this works. In the graphing or printing functions,
+you can now use inbits where you would use inbytes otherwise.
+
+Note that the variable name used in the CDEF (inbits) must not be the
+same as the variable named in the DEF (inbytes)!
+
+=head1 RPN-expressions
+
+RPN is short-hand for Reverse Polish Notation. It works as follows.
+You put the variables or numbers on a stack. You also put operations
+(things-to-do) on the stack and this stack is then processed. The result
+will be placed on the stack. At the end, there should be exactly one
+number left: the outcome of the series of operations. If there is not
+exactly one number left, RRDtool will complain loudly.
+
+Above multiplication by eight will look like:
+
+=over 4
+
+=item 1.
+
+Start with an empty stack
+
+=item 2.
+
+Put the content of variable inbytes on the stack
+
+=item 3.
+
+Put the number eight on the stack
+
+=item 4.
+
+Put the operation multiply on the stack
+
+=item 5.
+
+Process the stack
+
+=item 6.
+
+Retrieve the value from the stack and put it in variable inbits
+
+=back
+
+We will now do an example with real numbers. Suppose the variable
+inbytes would have value 10, the stack would be:
+
+=over 4
+
+=item 1.
+
+||
+
+=item 2.
+
+|10|
+
+=item 3.
+
+|10|8|
+
+=item 4.
+
+|10|8|*|
+
+=item 5.
+
+|80|
+
+=item 6.
+
+||
+
+=back
+
+Processing the stack (step 5) will retrieve one value from the stack
+(from the right at step 4). This is the operation multiply and this
+takes two values off the stack as input. The result is put back on the
+stack (the value 80 in this case). For multiplication the order doesn't
+matter, but for other operations like subtraction and division it does.
+Generally speaking you have the following order:
+
+   y = A - B  -->  y=minus(A,B)  -->  CDEF:y=A,B,-
+
+This is not very intuitive (at least most people don't think so). For
+the function f(A,B) you reverse the position of "f", but you do not
+reverse the order of the variables.
+
+=head1 Converting your wishes to RPN
+
+First, get a clear picture of what you want to do. Break down the problem
+in smaller portions until they cannot be split anymore. Then it is rather
+simple to convert your ideas into RPN.
+
+Suppose you have several RRDs and would like to add up some counters in
+them. These could be, for instance, the counters for every WAN link you
+are monitoring.
+
+You have:
+
+   router1.rrd with link1in link2in
+   router2.rrd with link1in link2in
+   router3.rrd with link1in link2in
+
+Suppose you would like to add up all these counters, except for link2in
+inside router2.rrd. You need to do:
+
+(in this example, "router1.rrd:link1in" means the DS link1in inside the
+RRD router1.rrd)
+
+   router1.rrd:link1in
+   router1.rrd:link2in
+   router2.rrd:link1in
+   router3.rrd:link1in
+   router3.rrd:link2in
+   --------------------   +
+   (outcome of the sum)
+
+As a mathematical function, this could be written:
+
+C<add(router1.rrd:link1in , router1.rrd:link2in , router2.rrd:link1in , router3.rrd:link1in , router3.rrd:link2.in)>
+
+With RRDtool and RPN, first, define the inputs:
+
+   DEF:a=router1.rrd:link1in:AVERAGE
+   DEF:b=router1.rrd:link2in:AVERAGE
+   DEF:c=router2.rrd:link1in:AVERAGE
+   DEF:d=router3.rrd:link1in:AVERAGE
+   DEF:e=router3.rrd:link2in:AVERAGE
+
+Now, the mathematical function becomes: C<add(a,b,c,d,e)>
+
+In RPN, there's no operator that sums more than two values so you need
+to do several additions. You add a and b, add c to the result, add d
+to the result and add e to the result.
+
+   push a:         a     stack contains the value of a
+   push b and add: b,+   stack contains the result of a+b
+   push c and add: c,+   stack contains the result of a+b+c
+   push d and add: d,+   stack contains the result of a+b+c+d
+   push e and add: e,+   stack contains the result of a+b+c+d+e
+
+What was calculated here would be written down as:
+
+   ( ( ( (a+b) + c) + d) + e) >
+
+This is in RPN:  C<CDEF:result=a,b,+,c,+,d,+,e,+>
+
+This is correct but it can be made more clear to humans. It does
+not matter if you add a to b and then add c to the result or first
+add b to c and then add a to the result. This makes it possible to
+rewrite the RPN into C<CDEF:result=a,b,c,d,e,+,+,+,+> which is
+evaluated differently:
+
+   push value of variable a on the stack: a
+   push value of variable b on the stack: a b
+   push value of variable c on the stack: a b c
+   push value of variable d on the stack: a b c d
+   push value of variable e on the stack: a b c d e
+   push operator + on the stack:          a b c d e +
+   and process it:                        a b c P   (where P == d+e)
+   push operator + on the stack:          a b c P +
+   and process it:                        a b Q     (where Q == c+P)
+   push operator + on the stack:          a b Q +
+   and process it:                        a R       (where R == b+Q)
+   push operator + on the stack:          a R +
+   and process it:                        S         (where S == a+R)
+
+As you can see the RPN expression C<a,b,c,d,e,+,+,+,+,+> will evaluate in
+C<((((d+e)+c)+b)+a)> and it has the same outcome as C<a,b,+,c,+,d,+,e,+>.
+This is called the commutative law of addition,
+but you may forget this right away, as long as you remember what it
+means.
+
+Now look at an expression that contains a multiplication:
+
+First in normal math: C<let result = a+b*c>. In this case you can't
+choose the order yourself, you have to start with the multiplication
+and then add a to it. You may alter the position of b and c, you must
+not alter the position of a and b.
+
+You have to take this in consideration when converting this expression
+into RPN. Read it as: "Add the outcome of b*c to a" and then it is
+easy to write the RPN expression: C<result=a,b,c,*,+>
+Another expression that would return the same: C<result=b,c,*,a,+>
+
+In normal math, you may encounter something like "a*(b+c)" and this
+can also be converted into RPN. The parenthesis just tell you to first
+add b and c, and then multiply a with the result. Again, now it is
+easy to write it in RPN: C<result=a,b,c,+,*>. Note that this is very
+similar to one of the expressions in the previous paragraph, only the
+multiplication and the addition changed places.
+
+When you have problems with RPN or when RRDtool is complaining, it's
+usually a good thing to write down the stack on a piece of paper
+and see what happens. Have the manual ready and pretend to be RRDtool.
+Just do all the math by hand to see what happens, I'm sure this will
+solve most, if not all, problems you encounter.
+
+=head1 Some special numbers
+
+=head2 The unknown value
+
+Sometimes collecting your data will fail. This can be very common,
+especially when querying over busy links. RRDtool can be configured
+to allow for one (or even more) unknown value(s) and calculate the missing
+update. You can, for instance, query your device every minute. This is
+creating one so called PDP or primary data point per minute. If you
+defined your RRD to contain an RRA that stores 5-minute values, you need
+five of those PDPs to create one CDP (consolidated data point).
+These PDPs can become unknown in two cases:
+
+=over 4
+
+=item 1.
+
+The updates are too far apart. This is tuned using the "heartbeat" setting.
+
+=item 2.
+
+The update was set to unknown on purpose by inserting no value (using the
+template option) or by using "U" as the value to insert.
+
+=back
+
+When a CDP is calculated, another mechanism determines if this CDP is valid
+or not. If there are too many PDPs unknown, the CDP is unknown as well.
+This is determined by the xff factor. Please note that one unknown counter
+update can result in two unknown PDPs! If you only allow for one unknown
+PDP per CDP, this makes the CDP go unknown!
+
+Suppose the counter increments with one per second and you retrieve it
+every minute:
+
+   counter value    resulting rate
+   10'000
+   10'060            1; (10'060-10'000)/60 == 1
+   10'120            1; (10'120-10'060)/60 == 1
+   unknown           unknown; you don't know the last value
+   10'240            unknown; you don't know the previous value
+   10'300            1; (10'300-10'240)/60 == 1
+
+If the CDP was to be calculated from the last five updates, it would get
+two unknown PDPs and three known PDPs. If xff would have been set to 0.5
+which by the way is a commonly used factor, the CDP would have a known
+value of 1. If xff would have been set to 0.2 then the resulting CDP
+would be unknown.
+
+You have to decide the proper values for heartbeat, number of PDPs per
+CDP and the xff factor. As you can see from the previous text they define
+the behavior of your RRA.
+
+=head2 Working with unknown data in your database
+
+As you have read in the previous chapter, entries in an RRA can be
+set to the unknown value. If you do calculations with this type of
+value, the result has to be unknown too. This means that an expression
+such as C<result=a,b,+> will be unknown if either a or b is unknown.
+It would be wrong to just ignore the unknown value and return the value
+of the other parameter. By doing so, you would assume "unknown" means "zero"
+and this is not true.
+
+There has been a case where somebody was collecting data for over a year.
+A new piece of equipment was installed, a new RRD was created and the
+scripts were changed to add a counter from the old database and a counter
+from the new database. The result was disappointing, a large part of
+the statistics seemed to have vanished mysteriously ...
+They of course didn't, values from the old database (known values) were
+added to values from the new database (unknown values) and the result was
+unknown.
+
+In this case, it is fairly reasonable to use a CDEF that alters unknown
+data into zero. The counters of the device were unknown (after all, it
+wasn't installed yet!) but you know that the data rate through the device
+had to be zero (because of the same reason: it was not installed).
+
+There are some examples below that make this change.
+
+=head2 Infinity
+
+Infinite data is another form of a special number. It cannot be
+graphed because by definition you would never reach the infinite
+value. You can think of positive and negative infinity depending on
+the position relative to zero.
+
+RRDtool is capable of representing (-not- graphing!) infinity by stopping
+at its current maximum (for positive infinity) or minimum (for negative
+infinity) without knowing this maximum (minimum).
+
+Infinity in RRDtool is mostly used to draw an AREA without knowing its
+vertical dimensions. You can think of it as drawing an AREA with an
+infinite height and displaying only the part that is visible in the
+current graph. This is probably a good way to approximate infinity
+and it sure allows for some neat tricks. See below for examples.
+
+=head2 Working with unknown data and infinity
+
+Sometimes you would like to discard unknown data and pretend it is zero
+(or any other value for that matter) and sometimes you would like to
+pretend that known data is unknown (to discard known-to-be-wrong data).
+This is why CDEFs have support for unknown data. There are also examples
+available that show unknown data by using infinity.
+
+=head1 Some examples
+
+=head2 Example: using a recently created RRD
+
+You are keeping statistics on your router for over a year now. Recently
+you installed an extra router and you would like to show the combined
+throughput for these two devices.
+
+If you just add up the counters from router.rrd and router2.rrd, you
+will add known data (from router.rrd) to unknown data (from router2.rrd) for
+the bigger part of your stats. You could solve this in a few ways:
+
+=over 4
+
+=item *
+
+While creating the new database, fill it with zeros from the start to now.
+You have to make the database start at or before the least recent time in
+the other database.
+
+=item *
+
+Alternatively, you could use CDEF and alter unknown data to zero.
+
+=back
+
+Both methods have their pros and cons. The first method is troublesome and
+if you want to do that you have to figure it out yourself. It is not
+possible to create a database filled with zeros, you have to put them in
+manually. Implementing the second method is described next:
+
+What we want is: "if the value is unknown, replace it with zero". This
+could be written in pseudo-code as:  if (value is unknown) then (zero)
+else (value). When reading the L<rrdgraph> manual you notice the "UN"
+function that returns zero or one. You also notice the "IF" function
+that takes zero or one as input.
+
+First look at the "IF" function. It takes three values from the stack,
+the first value is the decision point, the second value is returned to
+the stack if the evaluation is "true" and if not, the third value is
+returned to the stack. We want the "UN" function to decide what happens
+so we combine those two functions in one CDEF.
+
+Lets write down the two possible paths for the "IF" function:
+
+   if true  return a
+   if false return b
+
+In RPN:  C<result=x,a,b,IF> where "x" is either true or false.
+
+Now we have to fill in "x", this should be the "(value is unknown)" part
+and this is in RPN:  C<result=value,UN>
+
+We now combine them: C<result=value,UN,a,b,IF> and when we fill in the
+appropriate things for "a" and "b" we're finished:
+
+C<CDEF:result=value,UN,0,value,IF>
+
+You may want to read Steve Rader's RPN guide if you have difficulties
+with the way I explained this last example.
+
+If you want to check this RPN expression, just mimic RRDtool behavior:
+
+   For any known value, the expression evaluates as follows:
+   CDEF:result=value,UN,0,value,IF  (value,UN) is not true so it becomes 0
+   CDEF:result=0,0,value,IF         "IF" will return the 3rd value
+   CDEF:result=value                The known value is returned
+
+   For the unknown value, this happens:
+   CDEF:result=value,UN,0,value,IF  (value,UN) is true so it becomes 1
+   CDEF:result=1,0,value,IF         "IF" sees 1 and returns the 2nd value
+   CDEF:result=0                    Zero is returned
+
+Of course, if you would like to see another value instead of zero, you
+can use that other value.
+
+Eventually, when all unknown data is removed from the RRD, you may want
+to remove this rule so that unknown data is properly displayed.
+
+=head2 Example: better handling of unknown data, by using time
+
+The above example has one drawback. If you do log unknown data in
+your database after installing your new equipment, it will also be
+translated into zero and therefore you won't see that there was a
+problem. This is not good and what you really want to do is:
+
+=over 4
+
+=item *
+
+If there is unknown data, look at the time that this sample was taken.
+
+=item *
+
+If the unknown value is before time xxx, make it zero.
+
+=item *
+
+If it is after time xxx, leave it as unknown data.
+
+=back
+
+This is doable: you can compare the time that the sample was taken
+to some known time. Assuming you started to monitor your device on
+Friday September 17, 1999, 00:35:57 MET DST. Translate this time in seconds
+since 1970-01-01 and it becomes 937'521'357. If you process unknown values
+that were received after this time, you want to leave them unknown and
+if they were "received" before this time, you want to translate them
+into zero (so you can effectively ignore them while adding them to your
+other routers counters).
+
+Translating Friday September 17, 1999, 00:35:57 MET DST into 937'521'357 can
+be done by, for instance, using gnu date:
+
+   date -d "19990917 00:35:57" +%s
+
+You could also dump the database and see where the data starts to be
+known. There are several other ways of doing this, just pick one.
+
+Now we have to create the magic that allows us to process unknown
+values different depending on the time that the sample was taken.
+This is a three step process:
+
+=over 4
+
+=item 1.
+
+If the timestamp of the value is after 937'521'357, leave it as is.
+
+=item 2.
+
+If the value is a known value, leave it as is.
+
+=item 3.
+
+Change the unknown value into zero.
+
+=back
+
+Lets look at part one:
+
+    if (true) return the original value
+
+We rewrite this:
+
+    if (true) return "a"
+    if (false) return "b"
+
+We need to calculate true or false from step 1. There is a function
+available that returns the timestamp for the current sample. It is
+called, how surprisingly, "TIME". This time has to be compared to
+a constant number, we need "GT". The output of "GT" is true or false
+and this is good input to "IF". We want "if (time > 937521357) then
+(return a) else (return b)".
+
+This process was already described thoroughly in the previous chapter
+so lets do it quick:
+
+   if (x) then a else b
+      where x represents "time>937521357"
+      where a represents the original value
+      where b represents the outcome of the previous example
+
+   time>937521357       --> TIME,937521357,GT
+
+   if (x) then a else b --> x,a,b,IF
+   substitute x         --> TIME,937521357,GT,a,b,IF
+   substitute a         --> TIME,937521357,GT,value,b,IF
+   substitute b         --> TIME,937521357,GT,value,value,UN,0,value,IF,IF
+
+We end up with:
+C<CDEF:result=TIME,937521357,GT,value,value,UN,0,value,IF,IF>
+
+This looks very complex, however, as you can see, it was not too hard to
+come up with.
+
+=head2 Example: Pretending weird data isn't there
+
+Suppose you have a problem that shows up as huge spikes in your graph.
+You know this happens and why, so you decide to work around the problem.
+Perhaps you're using your network to do a backup at night and by doing
+so you get almost 10mb/s while the rest of your network activity does
+not produce numbers higher than 100kb/s.
+
+There are two options:
+
+=over 4
+
+=item 1.
+
+If the number exceeds 100kb/s it is wrong and you want it masked out
+by changing it into unknown.
+
+=item 2.
+
+You don't want the graph to show more than 100kb/s.
+
+=back
+
+Pseudo code: if (number > 100) then unknown else number
+or
+Pseudo code: if (number > 100) then 100 else number.
+
+The second "problem" may also be solved by using the rigid option of
+RRDtool graph, however this has not the same result. In this example
+you can end up with a graph that does autoscaling. Also, if you use
+the numbers to display maxima they will be set to 100kb/s.
+
+We use "IF" and "GT" again. "if (x) then (y) else (z)" is written
+down as "CDEF:result=x,y,z,IF"; now fill in x, y and z.
+For x you fill in "number greater than 100kb/s" becoming
+"number,100000,GT" (kilo is 1'000 and b/s is what we measure!).
+The "z" part is "number" in both cases and the "y" part is either
+"UNKN" for unknown or "100000" for 100kb/s.
+
+The two CDEF expressions would be:
+
+    CDEF:result=number,100000,GT,UNKN,number,IF
+    CDEF:result=number,100000,GT,100000,number,IF
+
+=head2 Example: working on a certain time span
+
+If you want a graph that spans a few weeks, but would only want to
+see some routers' data for one week, you need to "hide" the rest of
+the time frame. Don't ask me when this would be useful, it's just
+here for the example :)
+
+We need to compare the time stamp to a begin date and an end date.
+Comparing isn't difficult:
+
+       TIME,begintime,GE
+       TIME,endtime,LE
+
+These two parts of the CDEF produce either 0 for false or 1 for true.
+We can now check if they are both 0 (or 1) using a few IF statements
+but, as Wataru Satoh pointed out, we can use the "*" or "+" functions
+as logical AND and logical OR.
+
+For "*", the result will be zero (false) if either one of the two
+operators is zero.  For "+", the result will only be false (0) when
+two false (0) operators will be added.  Warning: *any* number not
+equal to 0 will be considered "true". This means that, for instance,
+"-1,1,+" (which should be "true or true") will become FALSE ...
+In other words, use "+" only if you know for sure that you have positive
+numbers (or zero) only.
+
+Let's compile the complete CDEF:
+
+       DEF:ds0=router1.rrd:AVERAGE
+       CDEF:ds0modified=TIME,begintime,GE,TIME,endtime,LE,*,UNKN,ds0,IF
+
+This will return the value of ds0 if both comparisons return true. You
+could also do it the other way around:
+
+       DEF:ds0=router1.rrd:AVERAGE
+       CDEF:ds0modified=TIME,begintime,LT,TIME,endtime,GT,+,UNKN,ds0,IF
+
+This will return an UNKNOWN if either comparison returns true.
+
+=head2 Example: You suspect to have problems and want to see unknown data.
+
+Suppose you add up the number of active users on several terminal servers.
+If one of them doesn't give an answer (or an incorrect one) you get "NaN"
+in the database ("Not a Number") and NaN is evaluated as Unknown.
+
+In this case, you would like to be alerted to it and the sum of the
+remaining values is of no value to you.
+
+It would be something like:
+
+    DEF:users1=location1.rrd:onlineTS1:LAST
+    DEF:users2=location1.rrd:onlineTS2:LAST
+    DEF:users3=location2.rrd:onlineTS1:LAST
+    DEF:users4=location2.rrd:onlineTS2:LAST
+    CDEF:allusers=users1,users2,users3,users4,+,+,+
+
+If you now plot allusers, unknown data in one of users1..users4 will
+show up as a gap in your graph. You want to modify this to show a
+bright red line, not a gap.
+
+Define an extra CDEF that is unknown if all is okay and is infinite if
+there is an unknown value:
+
+    CDEF:wrongdata=allusers,UN,INF,UNKN,IF
+
+"allusers,UN" will evaluate to either true or false, it is the (x) part
+of the "IF" function and it checks if allusers is unknown.
+The (y) part of the "IF" function is set to "INF" (which means infinity)
+and the (z) part of the function returns "UNKN".
+
+The logic is: if (allusers == unknown) then return INF else return UNKN.
+
+You can now use AREA to display this "wrongdata" in bright red. If it
+is unknown (because allusers is known) then the red AREA won't show up.
+If the value is INF (because allusers is unknown) then the red AREA will
+be filled in on the graph at that particular time.
+
+   AREA:allusers#0000FF:combined user count
+   AREA:wrongdata#FF0000:unknown data
+
+=head2 Same example useful with STACKed data:
+
+If you use stack in the previous example (as I would do) then you don't
+add up the values. Therefore, there is no relationship between the
+four values and you don't get a single value to test.
+Suppose users3 would be unknown at one point in time: users1 is plotted,
+users2 is stacked on top of users1, users3 is unknown and therefore
+nothing happens, users4 is stacked on top of users2.
+Add the extra CDEFs anyway and use them to overlay the "normal" graph:
+
+   DEF:users1=location1.rrd:onlineTS1:LAST
+   DEF:users2=location1.rrd:onlineTS2:LAST
+   DEF:users3=location2.rrd:onlineTS1:LAST
+   DEF:users4=location2.rrd:onlineTS2:LAST
+   CDEF:allusers=users1,users2,users3,users4,+,+,+
+   CDEF:wrongdata=allusers,UN,INF,UNKN,IF
+   AREA:users1#0000FF:users at ts1
+   STACK:users2#00FF00:users at ts2
+   STACK:users3#00FFFF:users at ts3
+   STACK:users4#FFFF00:users at ts4
+   AREA:wrongdata#FF0000:unknown data
+
+If there is unknown data in one of users1..users4, the "wrongdata" AREA
+will be drawn and because it starts at the X-axis and has infinite height
+it will effectively overwrite the STACKed parts.
+
+You could combine the two CDEF lines into one (we don't use "allusers")
+if you like.  But there are good reasons for writing two CDEFS:
+
+=over 4
+
+=item *
+
+It improves the readability of the script.
+
+=item *
+
+It can be used inside GPRINT to display the total number of users.
+
+=back
+
+If you choose to combine them, you can substitute the "allusers" in the
+second CDEF with the part after the equal sign from the first line:
+
+   CDEF:wrongdata=users1,users2,users3,users4,+,+,+,UN,INF,UNKN,IF
+
+If you do so, you won't be able to use these next GPRINTs:
+
+   COMMENT:"Total number of users seen"
+   GPRINT:allusers:MAX:"Maximum: %6.0lf"
+   GPRINT:allusers:MIN:"Minimum: %6.0lf"
+   GPRINT:allusers:AVERAGE:"Average: %6.0lf"
+   GPRINT:allusers:LAST:"Current: %6.0lf\n"
+
+=head1 The examples from the RRD graph manual page
+
+=head2 Degrees Celsius vs. Degrees Fahrenheit
+
+To convert Celsius into Fahrenheit use the formula
+F=9/5*C+32
+
+   rrdtool graph demo.png --title="Demo Graph" \
+      DEF:cel=demo.rrd:exhaust:AVERAGE \
+      CDEF:far=9,5,/,cel,*,32,+ \
+      LINE2:cel#00a000:"D. Celsius" \
+      LINE2:far#ff0000:"D. Fahrenheit\c"
+
+This example gets the DS called "exhaust" from database "demo.rrd"
+and puts the values in variable "cel". The CDEF used is evaluated
+as follows:
+
+   CDEF:far=9,5,/,cel,*,32,+
+   1. push 9, push 5
+   2. push function "divide" and process it
+      the stack now contains 9/5
+   3. push variable "cel"
+   4. push function "multiply" and process it
+      the stack now contains 9/5*cel
+   5. push 32
+   6. push function "plus" and process it
+      the stack contains now the temperature in Fahrenheit
+   
+=head2 Changing unknown into zero
+
+   rrdtool graph demo.png --title="Demo Graph" \
+      DEF:idat1=interface1.rrd:ds0:AVERAGE \
+      DEF:idat2=interface2.rrd:ds0:AVERAGE \
+      DEF:odat1=interface1.rrd:ds1:AVERAGE \
+      DEF:odat2=interface2.rrd:ds1:AVERAGE \
+      CDEF:agginput=idat1,UN,0,idat1,IF,idat2,UN,0,idat2,IF,+,8,* \
+      CDEF:aggoutput=odat1,UN,0,odat1,IF,odat2,UN,0,odat2,IF,+,8,* \
+      AREA:agginput#00cc00:Input Aggregate \
+      LINE1:aggoutput#0000FF:Output Aggregate
+
+These two CDEFs are built from several functions. It helps to split
+them when viewing what they do. Starting with the first CDEF we would
+get:
+
+ idat1,UN --> a
+ 0        --> b
+ idat1    --> c
+ if (a) then (b) else (c)
+
+The result is therefore "0" if it is true that "idat1" equals "UN".
+If not, the original value of "idat1" is put back on the stack.
+Lets call this answer "d". The process is repeated for the next
+five items on the stack, it is done the same and will return answer
+"h". The resulting stack is therefore "d,h".
+The expression has been simplified to "d,h,+,8,*" and it will now be
+easy to see that we add "d" and "h", and multiply the result with eight.
+
+The end result is that we have added "idat1" and "idat2" and in the
+process we effectively ignored unknown values. The result is multiplied
+by eight, most likely to convert bytes/s to bits/s.
+
+=head2 Infinity demo
+
+   rrdtool graph example.png --title="INF demo" \
+      DEF:val1=some.rrd:ds0:AVERAGE \
+      DEF:val2=some.rrd:ds1:AVERAGE \
+      DEF:val3=some.rrd:ds2:AVERAGE \
+      DEF:val4=other.rrd:ds0:AVERAGE \
+      CDEF:background=val4,POP,TIME,7200,%,3600,LE,INF,UNKN,IF \
+      CDEF:wipeout=val1,val2,val3,val4,+,+,+,UN,INF,UNKN,IF \
+      AREA:background#F0F0F0 \
+      AREA:val1#0000FF:Value1 \
+      STACK:val2#00C000:Value2 \
+      STACK:val3#FFFF00:Value3 \
+      STACK:val4#FFC000:Value4 \
+      AREA:whipeout#FF0000:Unknown
+
+This demo demonstrates two ways to use infinity. It is a bit tricky
+to see what happens in the "background" CDEF.
+
+   "val4,POP,TIME,7200,%,3600,LE,INF,UNKN,IF"
+
+This RPN takes the value of "val4" as input and then immediately
+removes it from the stack using "POP". The stack is now empty but
+as a side effect we now know the time that this sample was taken.
+This time is put on the stack by the "TIME" function.
+
+"TIME,7200,%" takes the modulo of time and 7'200 (which is two hours).
+The resulting value on the stack will be a number in the range from
+0 to 7199.
+
+For people who don't know the modulo function: it is the remainder
+after an integer division. If you divide 16 by 3, the answer would
+be 5 and the remainder would be 1. So, "16,3,%" returns 1.
+
+We have the result of "TIME,7200,%" on the stack, lets call this
+"a". The start of the RPN has become "a,3600,LE" and this checks
+if "a" is less or equal than "3600". It is true half of the time.
+We now have to process the rest of the RPN and this is only a simple
+"IF" function that returns either "INF" or "UNKN" depending on the
+time. This is returned to variable "background".
+
+The second CDEF has been discussed earlier in this document so we
+won't do that here.
+
+Now you can draw the different layers. Start with the background
+that is either unknown (nothing to see) or infinite (the whole
+positive part of the graph gets filled).
+
+Next you draw the data on top of this background, it will overlay
+the background. Suppose one of val1..val4 would be unknown, in that
+case you end up with only three bars stacked on top of each other.
+You don't want to see this because the data is only valid when all
+four variables are valid. This is why you use the second CDEF, it
+will overlay the data with an AREA so the data cannot be seen anymore.
+
+If your data can also have negative values you also need to overwrite
+the other half of your graph. This can be done in a relatively simple
+way: what you need is the "wipeout" variable and place a negative
+sign before it:  "CDEF:wipeout2=wipeout,-1,*"
+
+=head2 Filtering data
+
+You may do some complex data filtering:
+
+  MEDIAN FILTER: filters shot noise
+
+    DEF:var=database.rrd:traffic:AVERAGE
+    CDEF:prev1=PREV(var)
+    CDEF:prev2=PREV(prev1)
+    CDEF:prev3=PREV(prev2)
+    CDEF:median=prev1,prev2,prev3,+,+,3,/
+    LINE3:median#000077:filtered
+    LINE1:prev2#007700:'raw data'
+
+
+  DERIVATE:
+
+    DEF:var=database.rrd:traffic:AVERAGE
+    CDEF:prev1=PREV(var)
+    CDEF:time=TIME
+    CDEF:prevtime=PREV(time)
+    CDEF:derivate=var,prev1,-,time,prevtime,-,/
+    LINE3:derivate#000077:derivate
+    LINE1:var#007700:'raw data'
+
+
+=head1 Out of ideas for now
+
+This document was created from questions asked by either myself or by
+other people on the RRDtool mailing list. Please let me know if you
+find errors in it or if you have trouble understanding it. If you
+think there should be an addition, mail me:
+E<lt>alex@ergens.op.het.netE<gt>
+
+Remember: B<No feedback equals no changes!>
+
+=head1 SEE ALSO
+
+The RRDtool manpages
+
+=head1 AUTHOR
+
+Alex van den Bogaerdt
+E<lt>alex@ergens.op.het.netE<gt>
diff --git a/doc/cdeftutorial.txt b/doc/cdeftutorial.txt
new file mode 100644 (file)
index 0000000..3d01aa7
--- /dev/null
@@ -0,0 +1,802 @@
+CDEFTUTORIAL(1)                     rrdtool                    CDEFTUTORIAL(1)
+
+
+
+N\bNA\bAM\bME\bE
+       cdeftutorial - Alex van den Bogaerdt's CDEF tutorial
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       Intention of this document: to provide some examples of the commonly
+       used parts of RRDtool's CDEF language.
+
+       If you think some important feature is not explained properly, and if
+       adding it to this document would benefit most users, please do ask me
+       to add it.  I will then try to provide an answer in the next release of
+       this tutorial.  No feedback equals no changes! Additions to this docu-
+       ment are also welcome.  -- Alex van den Bogaerdt
+       <alex@ergens.op.het.net>
+
+       W\bWh\bhy\by t\bth\bhi\bis\bs t\btu\but\bto\bor\bri\bia\bal\bl?\b?
+
+       One of the powerful parts of RRDtool is its ability to do all sorts of
+       calculations on the data retrieved from its databases. However, RRD-
+       tool's many options and syntax make it difficult for the average user
+       to understand. The manuals are good at explaining what these options
+       do; however they do not (and should not) explain in detail why they are
+       useful. As with my RRDtool tutorial: if you want a simple document in
+       simple language you should read this tutorial.  If you are happy with
+       the official documentation, you may find this document too simple or
+       even boring. If you do choose to read this tutorial, I also expect you
+       to have read and fully understand my other tutorial.
+
+       M\bMo\bor\bre\be r\bre\bea\bad\bdi\bin\bng\bg
+
+       If you have difficulties with the way I try to explain it please read
+       Steve Rader's rpntutorial. It may help you understand how this all
+       works.
+
+W\bWh\bha\bat\bt a\bar\bre\be C\bCD\bDE\bEF\bFs\bs?\b?
+       When retrieving data from an RRD, you are using a "DEF" to work with
+       that data. Think of it as a variable that changes over time (where time
+       is the x-axis). The value of this variable is what is found in the
+       database at that particular time and you can't do any modifications on
+       it. This is what CDEFs are for: they takes values from DEFs and perform
+       calculations on them.
+
+S\bSy\byn\bnt\bta\bax\bx
+          DEF:var_name_1=some.rrd:ds_name:CF
+          CDEF:var_name_2=RPN_expression
+
+       You first define "var_name_1" to be data collected from data source
+       "ds_name" found in RRD "some.rrd" with consolidation function "CF".
+
+       Assume the ifInOctets SNMP counter is saved in mrtg.rrd as the DS "in".
+       Then the following DEF defines a variable for the average of that data
+       source:
+
+          DEF:inbytes=mrtg.rrd:in:AVERAGE
+
+       Say you want to display bits per second (instead of bytes per second as
+       stored in the database.)  You have to define a calculation (hence
+       "CDEF") on variable "inbytes" and use that variable (inbits) instead of
+       the original:
+
+          CDEF:inbits=inbytes,8,*
+
+       This tells RRDtool to multiply inbytes by eight to get inbits. I'll
+       explain later how this works. In the graphing or printing functions,
+       you can now use inbits where you would use inbytes otherwise.
+
+       Note that the variable name used in the CDEF (inbits) must not be the
+       same as the variable named in the DEF (inbytes)!
+
+R\bRP\bPN\bN-\b-e\bex\bxp\bpr\bre\bes\bss\bsi\bio\bon\bns\bs
+       RPN is short-hand for Reverse Polish Notation. It works as follows.
+       You put the variables or numbers on a stack. You also put operations
+       (things-to-do) on the stack and this stack is then processed. The
+       result will be placed on the stack. At the end, there should be exactly
+       one number left: the outcome of the series of operations. If there is
+       not exactly one number left, RRDtool will complain loudly.
+
+       Above multiplication by eight will look like:
+
+       1.  Start with an empty stack
+
+       2.  Put the content of variable inbytes on the stack
+
+       3.  Put the number eight on the stack
+
+       4.  Put the operation multiply on the stack
+
+       5.  Process the stack
+
+       6.  Retrieve the value from the stack and put it in variable inbits
+
+       We will now do an example with real numbers. Suppose the variable
+       inbytes would have value 10, the stack would be:
+
+       1.  ||
+
+       2.  |10|
+
+       3.  |10|8|
+
+       4.  |10|8|*|
+
+       5.  |80|
+
+       6.  ||
+
+       Processing the stack (step 5) will retrieve one value from the stack
+       (from the right at step 4). This is the operation multiply and this
+       takes two values off the stack as input. The result is put back on the
+       stack (the value 80 in this case). For multiplication the order doesn't
+       matter, but for other operations like subtraction and division it does.
+       Generally speaking you have the following order:
+
+          y = A - B  -->  y=minus(A,B)  -->  CDEF:y=A,B,-
+
+       This is not very intuitive (at least most people don't think so). For
+       the function f(A,B) you reverse the position of "f", but you do not
+       reverse the order of the variables.
+
+C\bCo\bon\bnv\bve\ber\brt\bti\bin\bng\bg y\byo\bou\bur\br w\bwi\bis\bsh\bhe\bes\bs t\bto\bo R\bRP\bPN\bN
+       First, get a clear picture of what you want to do. Break down the prob-
+       lem in smaller portions until they cannot be split anymore. Then it is
+       rather simple to convert your ideas into RPN.
+
+       Suppose you have several RRDs and would like to add up some counters in
+       them. These could be, for instance, the counters for every WAN link you
+       are monitoring.
+
+       You have:
+
+          router1.rrd with link1in link2in
+          router2.rrd with link1in link2in
+          router3.rrd with link1in link2in
+
+       Suppose you would like to add up all these counters, except for link2in
+       inside router2.rrd. You need to do:
+
+       (in this example, "router1.rrd:link1in" means the DS link1in inside the
+       RRD router1.rrd)
+
+          router1.rrd:link1in
+          router1.rrd:link2in
+          router2.rrd:link1in
+          router3.rrd:link1in
+          router3.rrd:link2in
+          --------------------   +
+          (outcome of the sum)
+
+       As a mathematical function, this could be written:
+
+       "add(router1.rrd:link1in , router1.rrd:link2in , router2.rrd:link1in ,
+       router3.rrd:link1in , router3.rrd:link2.in)"
+
+       With RRDtool and RPN, first, define the inputs:
+
+          DEF:a=router1.rrd:link1in:AVERAGE
+          DEF:b=router1.rrd:link2in:AVERAGE
+          DEF:c=router2.rrd:link1in:AVERAGE
+          DEF:d=router3.rrd:link1in:AVERAGE
+          DEF:e=router3.rrd:link2in:AVERAGE
+
+       Now, the mathematical function becomes: "add(a,b,c,d,e)"
+
+       In RPN, there's no operator that sums more than two values so you need
+       to do several additions. You add a and b, add c to the result, add d to
+       the result and add e to the result.
+
+          push a:         a     stack contains the value of a
+          push b and add: b,+   stack contains the result of a+b
+          push c and add: c,+   stack contains the result of a+b+c
+          push d and add: d,+   stack contains the result of a+b+c+d
+          push e and add: e,+   stack contains the result of a+b+c+d+e
+
+       What was calculated here would be written down as:
+
+          ( ( ( (a+b) + c) + d) + e) >
+
+       This is in RPN:  "CDEF:result=a,b,+,c,+,d,+,e,+"
+
+       This is correct but it can be made more clear to humans. It does not
+       matter if you add a to b and then add c to the result or first add b to
+       c and then add a to the result. This makes it possible to rewrite the
+       RPN into "CDEF:result=a,b,c,d,e,+,+,+,+" which is evaluated differ-
+       ently:
+
+          push value of variable a on the stack: a
+          push value of variable b on the stack: a b
+          push value of variable c on the stack: a b c
+          push value of variable d on the stack: a b c d
+          push value of variable e on the stack: a b c d e
+          push operator + on the stack:          a b c d e +
+          and process it:                        a b c P   (where P == d+e)
+          push operator + on the stack:          a b c P +
+          and process it:                        a b Q     (where Q == c+P)
+          push operator + on the stack:          a b Q +
+          and process it:                        a R       (where R == b+Q)
+          push operator + on the stack:          a R +
+          and process it:                        S         (where S == a+R)
+
+       As you can see the RPN expression "a,b,c,d,e,+,+,+,+,+" will evaluate
+       in "((((d+e)+c)+b)+a)" and it has the same outcome as
+       "a,b,+,c,+,d,+,e,+".  This is called the commutative law of addition,
+       but you may forget this right away, as long as you remember what it
+       means.
+
+       Now look at an expression that contains a multiplication:
+
+       First in normal math: "let result = a+b*c". In this case you can't
+       choose the order yourself, you have to start with the multiplication
+       and then add a to it. You may alter the position of b and c, you must
+       not alter the position of a and b.
+
+       You have to take this in consideration when converting this expression
+       into RPN. Read it as: "Add the outcome of b*c to a" and then it is easy
+       to write the RPN expression: "result=a,b,c,*,+" Another expression that
+       would return the same: "result=b,c,*,a,+"
+
+       In normal math, you may encounter something like "a*(b+c)" and this can
+       also be converted into RPN. The parenthesis just tell you to first add
+       b and c, and then multiply a with the result. Again, now it is easy to
+       write it in RPN: "result=a,b,c,+,*". Note that this is very similar to
+       one of the expressions in the previous paragraph, only the multiplica-
+       tion and the addition changed places.
+
+       When you have problems with RPN or when RRDtool is complaining, it's
+       usually a good thing to write down the stack on a piece of paper and
+       see what happens. Have the manual ready and pretend to be RRDtool.
+       Just do all the math by hand to see what happens, I'm sure this will
+       solve most, if not all, problems you encounter.
+
+S\bSo\bom\bme\be s\bsp\bpe\bec\bci\bia\bal\bl n\bnu\bum\bmb\bbe\ber\brs\bs
+       T\bTh\bhe\be u\bun\bnk\bkn\bno\bow\bwn\bn v\bva\bal\blu\bue\be
+
+       Sometimes collecting your data will fail. This can be very common,
+       especially when querying over busy links. RRDtool can be configured to
+       allow for one (or even more) unknown value(s) and calculate the missing
+       update. You can, for instance, query your device every minute. This is
+       creating one so called PDP or primary data point per minute. If you
+       defined your RRD to contain an RRA that stores 5-minute values, you
+       need five of those PDPs to create one CDP (consolidated data point).
+       These PDPs can become unknown in two cases:
+
+       1.  The updates are too far apart. This is tuned using the "heartbeat"
+           setting.
+
+       2.  The update was set to unknown on purpose by inserting no value
+           (using the template option) or by using "U" as the value to insert.
+
+       When a CDP is calculated, another mechanism determines if this CDP is
+       valid or not. If there are too many PDPs unknown, the CDP is unknown as
+       well.  This is determined by the xff factor. Please note that one
+       unknown counter update can result in two unknown PDPs! If you only
+       allow for one unknown PDP per CDP, this makes the CDP go unknown!
+
+       Suppose the counter increments with one per second and you retrieve it
+       every minute:
+
+          counter value    resulting rate
+          10'000
+          10'060            1; (10'060-10'000)/60 == 1
+          10'120            1; (10'120-10'060)/60 == 1
+          unknown           unknown; you don't know the last value
+          10'240            unknown; you don't know the previous value
+          10'300            1; (10'300-10'240)/60 == 1
+
+       If the CDP was to be calculated from the last five updates, it would
+       get two unknown PDPs and three known PDPs. If xff would have been set
+       to 0.5 which by the way is a commonly used factor, the CDP would have a
+       known value of 1. If xff would have been set to 0.2 then the resulting
+       CDP would be unknown.
+
+       You have to decide the proper values for heartbeat, number of PDPs per
+       CDP and the xff factor. As you can see from the previous text they
+       define the behavior of your RRA.
+
+       W\bWo\bor\brk\bki\bin\bng\bg w\bwi\bit\bth\bh u\bun\bnk\bkn\bno\bow\bwn\bn d\bda\bat\bta\ba i\bin\bn y\byo\bou\bur\br d\bda\bat\bta\bab\bba\bas\bse\be
+
+       As you have read in the previous chapter, entries in an RRA can be set
+       to the unknown value. If you do calculations with this type of value,
+       the result has to be unknown too. This means that an expression such as
+       "result=a,b,+" will be unknown if either a or b is unknown.  It would
+       be wrong to just ignore the unknown value and return the value of the
+       other parameter. By doing so, you would assume "unknown" means "zero"
+       and this is not true.
+
+       There has been a case where somebody was collecting data for over a
+       year.  A new piece of equipment was installed, a new RRD was created
+       and the scripts were changed to add a counter from the old database and
+       a counter from the new database. The result was disappointing, a large
+       part of the statistics seemed to have vanished mysteriously ...  They
+       of course didn't, values from the old database (known values) were
+       added to values from the new database (unknown values) and the result
+       was unknown.
+
+       In this case, it is fairly reasonable to use a CDEF that alters unknown
+       data into zero. The counters of the device were unknown (after all, it
+       wasn't installed yet!) but you know that the data rate through the
+       device had to be zero (because of the same reason: it was not
+       installed).
+
+       There are some examples below that make this change.
+
+       I\bIn\bnf\bfi\bin\bni\bit\bty\by
+
+       Infinite data is another form of a special number. It cannot be graphed
+       because by definition you would never reach the infinite value. You can
+       think of positive and negative infinity depending on the position rela-
+       tive to zero.
+
+       RRDtool is capable of representing (-not- graphing!) infinity by stop-
+       ping at its current maximum (for positive infinity) or minimum (for
+       negative infinity) without knowing this maximum (minimum).
+
+       Infinity in RRDtool is mostly used to draw an AREA without knowing its
+       vertical dimensions. You can think of it as drawing an AREA with an
+       infinite height and displaying only the part that is visible in the
+       current graph. This is probably a good way to approximate infinity and
+       it sure allows for some neat tricks. See below for examples.
+
+       W\bWo\bor\brk\bki\bin\bng\bg w\bwi\bit\bth\bh u\bun\bnk\bkn\bno\bow\bwn\bn d\bda\bat\bta\ba a\ban\bnd\bd i\bin\bnf\bfi\bin\bni\bit\bty\by
+
+       Sometimes you would like to discard unknown data and pretend it is zero
+       (or any other value for that matter) and sometimes you would like to
+       pretend that known data is unknown (to discard known-to-be-wrong data).
+       This is why CDEFs have support for unknown data. There are also exam-
+       ples available that show unknown data by using infinity.
+
+S\bSo\bom\bme\be e\bex\bxa\bam\bmp\bpl\ble\bes\bs
+       E\bEx\bxa\bam\bmp\bpl\ble\be:\b: u\bus\bsi\bin\bng\bg a\ba r\bre\bec\bce\ben\bnt\btl\bly\by c\bcr\bre\bea\bat\bte\bed\bd R\bRR\bRD\bD
+
+       You are keeping statistics on your router for over a year now. Recently
+       you installed an extra router and you would like to show the combined
+       throughput for these two devices.
+
+       If you just add up the counters from router.rrd and router2.rrd, you
+       will add known data (from router.rrd) to unknown data (from
+       router2.rrd) for the bigger part of your stats. You could solve this in
+       a few ways:
+
+       Â·   While creating the new database, fill it with zeros from the start
+           to now.  You have to make the database start at or before the least
+           recent time in the other database.
+
+       Â·   Alternatively, you could use CDEF and alter unknown data to zero.
+
+       Both methods have their pros and cons. The first method is troublesome
+       and if you want to do that you have to figure it out yourself. It is
+       not possible to create a database filled with zeros, you have to put
+       them in manually. Implementing the second method is described next:
+
+       What we want is: "if the value is unknown, replace it with zero". This
+       could be written in pseudo-code as:  if (value is unknown) then (zero)
+       else (value). When reading the rrdgraph manual you notice the "UN"
+       function that returns zero or one. You also notice the "IF" function
+       that takes zero or one as input.
+
+       First look at the "IF" function. It takes three values from the stack,
+       the first value is the decision point, the second value is returned to
+       the stack if the evaluation is "true" and if not, the third value is
+       returned to the stack. We want the "UN" function to decide what happens
+       so we combine those two functions in one CDEF.
+
+       Lets write down the two possible paths for the "IF" function:
+
+          if true  return a
+          if false return b
+
+       In RPN:  "result=x,a,b,IF" where "x" is either true or false.
+
+       Now we have to fill in "x", this should be the "(value is unknown)"
+       part and this is in RPN:  "result=value,UN"
+
+       We now combine them: "result=value,UN,a,b,IF" and when we fill in the
+       appropriate things for "a" and "b" we're finished:
+
+       "CDEF:result=value,UN,0,value,IF"
+
+       You may want to read Steve Rader's RPN guide if you have difficulties
+       with the way I explained this last example.
+
+       If you want to check this RPN expression, just mimic RRDtool behavior:
+
+          For any known value, the expression evaluates as follows:
+          CDEF:result=value,UN,0,value,IF  (value,UN) is not true so it becomes 0
+          CDEF:result=0,0,value,IF         "IF" will return the 3rd value
+          CDEF:result=value                The known value is returned
+
+          For the unknown value, this happens:
+          CDEF:result=value,UN,0,value,IF  (value,UN) is true so it becomes 1
+          CDEF:result=1,0,value,IF         "IF" sees 1 and returns the 2nd value
+          CDEF:result=0                    Zero is returned
+
+       Of course, if you would like to see another value instead of zero, you
+       can use that other value.
+
+       Eventually, when all unknown data is removed from the RRD, you may want
+       to remove this rule so that unknown data is properly displayed.
+
+       E\bEx\bxa\bam\bmp\bpl\ble\be:\b: b\bbe\bet\btt\bte\ber\br h\bha\ban\bnd\bdl\bli\bin\bng\bg o\bof\bf u\bun\bnk\bkn\bno\bow\bwn\bn d\bda\bat\bta\ba,\b, b\bby\by u\bus\bsi\bin\bng\bg t\bti\bim\bme\be
+
+       The above example has one drawback. If you do log unknown data in your
+       database after installing your new equipment, it will also be trans-
+       lated into zero and therefore you won't see that there was a problem.
+       This is not good and what you really want to do is:
+
+       Â·   If there is unknown data, look at the time that this sample was
+           taken.
+
+       Â·   If the unknown value is before time xxx, make it zero.
+
+       Â·   If it is after time xxx, leave it as unknown data.
+
+       This is doable: you can compare the time that the sample was taken to
+       some known time. Assuming you started to monitor your device on Friday
+       September 17, 1999, 00:35:57 MET DST. Translate this time in seconds
+       since 1970-01-01 and it becomes 937'521'357. If you process unknown
+       values that were received after this time, you want to leave them
+       unknown and if they were "received" before this time, you want to
+       translate them into zero (so you can effectively ignore them while
+       adding them to your other routers counters).
+
+       Translating Friday September 17, 1999, 00:35:57 MET DST into
+       937'521'357 can be done by, for instance, using gnu date:
+
+          date -d "19990917 00:35:57" +%s
+
+       You could also dump the database and see where the data starts to be
+       known. There are several other ways of doing this, just pick one.
+
+       Now we have to create the magic that allows us to process unknown val-
+       ues different depending on the time that the sample was taken.  This is
+       a three step process:
+
+       1.  If the timestamp of the value is after 937'521'357, leave it as is.
+
+       2.  If the value is a known value, leave it as is.
+
+       3.  Change the unknown value into zero.
+
+       Lets look at part one:
+
+           if (true) return the original value
+
+       We rewrite this:
+
+           if (true) return "a"
+           if (false) return "b"
+
+       We need to calculate true or false from step 1. There is a function
+       available that returns the timestamp for the current sample. It is
+       called, how surprisingly, "TIME". This time has to be compared to a
+       constant number, we need "GT". The output of "GT" is true or false and
+       this is good input to "IF". We want "if (time > 937521357) then (return
+       a) else (return b)".
+
+       This process was already described thoroughly in the previous chapter
+       so lets do it quick:
+
+          if (x) then a else b
+             where x represents "time>937521357"
+             where a represents the original value
+             where b represents the outcome of the previous example
+
+          time>937521357       --> TIME,937521357,GT
+
+          if (x) then a else b --> x,a,b,IF
+          substitute x         --> TIME,937521357,GT,a,b,IF
+          substitute a         --> TIME,937521357,GT,value,b,IF
+          substitute b         --> TIME,937521357,GT,value,value,UN,0,value,IF,IF
+
+       We end up with:
+       "CDEF:result=TIME,937521357,GT,value,value,UN,0,value,IF,IF"
+
+       This looks very complex, however, as you can see, it was not too hard
+       to come up with.
+
+       E\bEx\bxa\bam\bmp\bpl\ble\be:\b: P\bPr\bre\bet\bte\ben\bnd\bdi\bin\bng\bg w\bwe\bei\bir\brd\bd d\bda\bat\bta\ba i\bis\bsn\bn'\b't\bt t\bth\bhe\ber\bre\be
+
+       Suppose you have a problem that shows up as huge spikes in your graph.
+       You know this happens and why, so you decide to work around the prob-
+       lem.  Perhaps you're using your network to do a backup at night and by
+       doing so you get almost 10mb/s while the rest of your network activity
+       does not produce numbers higher than 100kb/s.
+
+       There are two options:
+
+       1.  If the number exceeds 100kb/s it is wrong and you want it masked
+           out by changing it into unknown.
+
+       2.  You don't want the graph to show more than 100kb/s.
+
+       Pseudo code: if (number > 100) then unknown else number or Pseudo code:
+       if (number > 100) then 100 else number.
+
+       The second "problem" may also be solved by using the rigid option of
+       RRDtool graph, however this has not the same result. In this example
+       you can end up with a graph that does autoscaling. Also, if you use the
+       numbers to display maxima they will be set to 100kb/s.
+
+       We use "IF" and "GT" again. "if (x) then (y) else (z)" is written down
+       as "CDEF:result=x,y,z,IF"; now fill in x, y and z.  For x you fill in
+       "number greater than 100kb/s" becoming "number,100000,GT" (kilo is
+       1'000 and b/s is what we measure!).  The "z" part is "number" in both
+       cases and the "y" part is either "UNKN" for unknown or "100000" for
+       100kb/s.
+
+       The two CDEF expressions would be:
+
+           CDEF:result=number,100000,GT,UNKN,number,IF
+           CDEF:result=number,100000,GT,100000,number,IF
+
+       E\bEx\bxa\bam\bmp\bpl\ble\be:\b: w\bwo\bor\brk\bki\bin\bng\bg o\bon\bn a\ba c\bce\ber\brt\bta\bai\bin\bn t\bti\bim\bme\be s\bsp\bpa\ban\bn
+
+       If you want a graph that spans a few weeks, but would only want to see
+       some routers' data for one week, you need to "hide" the rest of the
+       time frame. Don't ask me when this would be useful, it's just here for
+       the example :)
+
+       We need to compare the time stamp to a begin date and an end date.
+       Comparing isn't difficult:
+
+               TIME,begintime,GE
+               TIME,endtime,LE
+
+       These two parts of the CDEF produce either 0 for false or 1 for true.
+       We can now check if they are both 0 (or 1) using a few IF statements
+       but, as Wataru Satoh pointed out, we can use the "*" or "+" functions
+       as logical AND and logical OR.
+
+       For "*", the result will be zero (false) if either one of the two oper-
+       ators is zero.  For "+", the result will only be false (0) when two
+       false (0) operators will be added.  Warning: *any* number not equal to
+       0 will be considered "true". This means that, for instance, "-1,1,+"
+       (which should be "true or true") will become FALSE ...  In other words,
+       use "+" only if you know for sure that you have positive numbers (or
+       zero) only.
+
+       Let's compile the complete CDEF:
+
+               DEF:ds0=router1.rrd:AVERAGE
+               CDEF:ds0modified=TIME,begintime,GE,TIME,endtime,LE,*,UNKN,ds0,IF
+
+       This will return the value of ds0 if both comparisons return true. You
+       could also do it the other way around:
+
+               DEF:ds0=router1.rrd:AVERAGE
+               CDEF:ds0modified=TIME,begintime,LT,TIME,endtime,GT,+,UNKN,ds0,IF
+
+       This will return an UNKNOWN if either comparison returns true.
+
+       E\bEx\bxa\bam\bmp\bpl\ble\be:\b: Y\bYo\bou\bu s\bsu\bus\bsp\bpe\bec\bct\bt t\bto\bo h\bha\bav\bve\be p\bpr\bro\bob\bbl\ble\bem\bms\bs a\ban\bnd\bd w\bwa\ban\bnt\bt t\bto\bo s\bse\bee\be u\bun\bnk\bkn\bno\bow\bwn\bn d\bda\bat\bta\ba.\b.
+
+       Suppose you add up the number of active users on several terminal
+       servers.  If one of them doesn't give an answer (or an incorrect one)
+       you get "NaN" in the database ("Not a Number") and NaN is evaluated as
+       Unknown.
+
+       In this case, you would like to be alerted to it and the sum of the
+       remaining values is of no value to you.
+
+       It would be something like:
+
+           DEF:users1=location1.rrd:onlineTS1:LAST
+           DEF:users2=location1.rrd:onlineTS2:LAST
+           DEF:users3=location2.rrd:onlineTS1:LAST
+           DEF:users4=location2.rrd:onlineTS2:LAST
+           CDEF:allusers=users1,users2,users3,users4,+,+,+
+
+       If you now plot allusers, unknown data in one of users1..users4 will
+       show up as a gap in your graph. You want to modify this to show a
+       bright red line, not a gap.
+
+       Define an extra CDEF that is unknown if all is okay and is infinite if
+       there is an unknown value:
+
+           CDEF:wrongdata=allusers,UN,INF,UNKN,IF
+
+       "allusers,UN" will evaluate to either true or false, it is the (x) part
+       of the "IF" function and it checks if allusers is unknown.  The (y)
+       part of the "IF" function is set to "INF" (which means infinity) and
+       the (z) part of the function returns "UNKN".
+
+       The logic is: if (allusers == unknown) then return INF else return
+       UNKN.
+
+       You can now use AREA to display this "wrongdata" in bright red. If it
+       is unknown (because allusers is known) then the red AREA won't show up.
+       If the value is INF (because allusers is unknown) then the red AREA
+       will be filled in on the graph at that particular time.
+
+          AREA:allusers#0000FF:combined user count
+          AREA:wrongdata#FF0000:unknown data
+
+       S\bSa\bam\bme\be e\bex\bxa\bam\bmp\bpl\ble\be u\bus\bse\bef\bfu\bul\bl w\bwi\bit\bth\bh S\bST\bTA\bAC\bCK\bKe\bed\bd d\bda\bat\bta\ba:\b:
+
+       If you use stack in the previous example (as I would do) then you don't
+       add up the values. Therefore, there is no relationship between the four
+       values and you don't get a single value to test.  Suppose users3 would
+       be unknown at one point in time: users1 is plotted, users2 is stacked
+       on top of users1, users3 is unknown and therefore nothing happens,
+       users4 is stacked on top of users2.  Add the extra CDEFs anyway and use
+       them to overlay the "normal" graph:
+
+          DEF:users1=location1.rrd:onlineTS1:LAST
+          DEF:users2=location1.rrd:onlineTS2:LAST
+          DEF:users3=location2.rrd:onlineTS1:LAST
+          DEF:users4=location2.rrd:onlineTS2:LAST
+          CDEF:allusers=users1,users2,users3,users4,+,+,+
+          CDEF:wrongdata=allusers,UN,INF,UNKN,IF
+          AREA:users1#0000FF:users at ts1
+          STACK:users2#00FF00:users at ts2
+          STACK:users3#00FFFF:users at ts3
+          STACK:users4#FFFF00:users at ts4
+          AREA:wrongdata#FF0000:unknown data
+
+       If there is unknown data in one of users1..users4, the "wrongdata" AREA
+       will be drawn and because it starts at the X-axis and has infinite
+       height it will effectively overwrite the STACKed parts.
+
+       You could combine the two CDEF lines into one (we don't use "allusers")
+       if you like.  But there are good reasons for writing two CDEFS:
+
+       Â·   It improves the readability of the script.
+
+       Â·   It can be used inside GPRINT to display the total number of users.
+
+       If you choose to combine them, you can substitute the "allusers" in the
+       second CDEF with the part after the equal sign from the first line:
+
+          CDEF:wrongdata=users1,users2,users3,users4,+,+,+,UN,INF,UNKN,IF
+
+       If you do so, you won't be able to use these next GPRINTs:
+
+          COMMENT:"Total number of users seen"
+          GPRINT:allusers:MAX:"Maximum: %6.0lf"
+          GPRINT:allusers:MIN:"Minimum: %6.0lf"
+          GPRINT:allusers:AVERAGE:"Average: %6.0lf"
+          GPRINT:allusers:LAST:"Current: %6.0lf\n"
+
+T\bTh\bhe\be e\bex\bxa\bam\bmp\bpl\ble\bes\bs f\bfr\bro\bom\bm t\bth\bhe\be R\bRR\bRD\bD g\bgr\bra\bap\bph\bh m\bma\ban\bnu\bua\bal\bl p\bpa\bag\bge\be
+       D\bDe\beg\bgr\bre\bee\bes\bs C\bCe\bel\bls\bsi\biu\bus\bs v\bvs\bs.\b. D\bDe\beg\bgr\bre\bee\bes\bs F\bFa\bah\bhr\bre\ben\bnh\bhe\bei\bit\bt
+
+       To convert Celsius into Fahrenheit use the formula F=9/5*C+32
+
+          rrdtool graph demo.png --title="Demo Graph" \
+             DEF:cel=demo.rrd:exhaust:AVERAGE \
+             CDEF:far=9,5,/,cel,*,32,+ \
+             LINE2:cel#00a000:"D. Celsius" \
+             LINE2:far#ff0000:"D. Fahrenheit\c"
+
+       This example gets the DS called "exhaust" from database "demo.rrd" and
+       puts the values in variable "cel". The CDEF used is evaluated as fol-
+       lows:
+
+          CDEF:far=9,5,/,cel,*,32,+
+          1. push 9, push 5
+          2. push function "divide" and process it
+             the stack now contains 9/5
+          3. push variable "cel"
+          4. push function "multiply" and process it
+             the stack now contains 9/5*cel
+          5. push 32
+          6. push function "plus" and process it
+             the stack contains now the temperature in Fahrenheit
+
+       C\bCh\bha\ban\bng\bgi\bin\bng\bg u\bun\bnk\bkn\bno\bow\bwn\bn i\bin\bnt\bto\bo z\bze\ber\bro\bo
+
+          rrdtool graph demo.png --title="Demo Graph" \
+             DEF:idat1=interface1.rrd:ds0:AVERAGE \
+             DEF:idat2=interface2.rrd:ds0:AVERAGE \
+             DEF:odat1=interface1.rrd:ds1:AVERAGE \
+             DEF:odat2=interface2.rrd:ds1:AVERAGE \
+             CDEF:agginput=idat1,UN,0,idat1,IF,idat2,UN,0,idat2,IF,+,8,* \
+             CDEF:aggoutput=odat1,UN,0,odat1,IF,odat2,UN,0,odat2,IF,+,8,* \
+             AREA:agginput#00cc00:Input Aggregate \
+             LINE1:aggoutput#0000FF:Output Aggregate
+
+       These two CDEFs are built from several functions. It helps to split
+       them when viewing what they do. Starting with the first CDEF we would
+       get:
+
+        idat1,UN --> a
+        0        --> b
+        idat1    --> c
+        if (a) then (b) else (c)
+
+       The result is therefore "0" if it is true that "idat1" equals "UN".  If
+       not, the original value of "idat1" is put back on the stack.  Lets call
+       this answer "d". The process is repeated for the next five items on the
+       stack, it is done the same and will return answer "h". The resulting
+       stack is therefore "d,h".  The expression has been simplified to
+       "d,h,+,8,*" and it will now be easy to see that we add "d" and "h", and
+       multiply the result with eight.
+
+       The end result is that we have added "idat1" and "idat2" and in the
+       process we effectively ignored unknown values. The result is multiplied
+       by eight, most likely to convert bytes/s to bits/s.
+
+       I\bIn\bnf\bfi\bin\bni\bit\bty\by d\bde\bem\bmo\bo
+
+          rrdtool graph example.png --title="INF demo" \
+             DEF:val1=some.rrd:ds0:AVERAGE \
+             DEF:val2=some.rrd:ds1:AVERAGE \
+             DEF:val3=some.rrd:ds2:AVERAGE \
+             DEF:val4=other.rrd:ds0:AVERAGE \
+             CDEF:background=val4,POP,TIME,7200,%,3600,LE,INF,UNKN,IF \
+             CDEF:wipeout=val1,val2,val3,val4,+,+,+,UN,INF,UNKN,IF \
+             AREA:background#F0F0F0 \
+             AREA:val1#0000FF:Value1 \
+             STACK:val2#00C000:Value2 \
+             STACK:val3#FFFF00:Value3 \
+             STACK:val4#FFC000:Value4 \
+             AREA:whipeout#FF0000:Unknown
+
+       This demo demonstrates two ways to use infinity. It is a bit tricky to
+       see what happens in the "background" CDEF.
+
+          "val4,POP,TIME,7200,%,3600,LE,INF,UNKN,IF"
+
+       This RPN takes the value of "val4" as input and then immediately
+       removes it from the stack using "POP". The stack is now empty but as a
+       side effect we now know the time that this sample was taken.  This time
+       is put on the stack by the "TIME" function.
+
+       "TIME,7200,%" takes the modulo of time and 7'200 (which is two hours).
+       The resulting value on the stack will be a number in the range from 0
+       to 7199.
+
+       For people who don't know the modulo function: it is the remainder
+       after an integer division. If you divide 16 by 3, the answer would be 5
+       and the remainder would be 1. So, "16,3,%" returns 1.
+
+       We have the result of "TIME,7200,%" on the stack, lets call this "a".
+       The start of the RPN has become "a,3600,LE" and this checks if "a" is
+       less or equal than "3600". It is true half of the time.  We now have to
+       process the rest of the RPN and this is only a simple "IF" function
+       that returns either "INF" or "UNKN" depending on the time. This is
+       returned to variable "background".
+
+       The second CDEF has been discussed earlier in this document so we won't
+       do that here.
+
+       Now you can draw the different layers. Start with the background that
+       is either unknown (nothing to see) or infinite (the whole positive part
+       of the graph gets filled).
+
+       Next you draw the data on top of this background, it will overlay the
+       background. Suppose one of val1..val4 would be unknown, in that case
+       you end up with only three bars stacked on top of each other.  You
+       don't want to see this because the data is only valid when all four
+       variables are valid. This is why you use the second CDEF, it will over-
+       lay the data with an AREA so the data cannot be seen anymore.
+
+       If your data can also have negative values you also need to overwrite
+       the other half of your graph. This can be done in a relatively simple
+       way: what you need is the "wipeout" variable and place a negative sign
+       before it:  "CDEF:wipeout2=wipeout,-1,*"
+
+       F\bFi\bil\blt\bte\ber\bri\bin\bng\bg d\bda\bat\bta\ba
+
+       You may do some complex data filtering:
+
+         MEDIAN FILTER: filters shot noise
+
+           DEF:var=database.rrd:traffic:AVERAGE
+           CDEF:prev1=PREV(var)
+           CDEF:prev2=PREV(prev1)
+           CDEF:prev3=PREV(prev2)
+           CDEF:median=prev1,prev2,prev3,+,+,3,/
+           LINE3:median#000077:filtered
+           LINE1:prev2#007700:'raw data'
+
+         DERIVATE:
+
+           DEF:var=database.rrd:traffic:AVERAGE
+           CDEF:prev1=PREV(var)
+           CDEF:time=TIME
+           CDEF:prevtime=PREV(time)
+           CDEF:derivate=var,prev1,-,time,prevtime,-,/
+           LINE3:derivate#000077:derivate
+           LINE1:var#007700:'raw data'
+
+O\bOu\but\bt o\bof\bf i\bid\bde\bea\bas\bs f\bfo\bor\br n\bno\bow\bw
+       This document was created from questions asked by either myself or by
+       other people on the RRDtool mailing list. Please let me know if you
+       find errors in it or if you have trouble understanding it. If you think
+       there should be an addition, mail me: <alex@ergens.op.het.net>
+
+       Remember: N\bNo\bo f\bfe\bee\bed\bdb\bba\bac\bck\bk e\beq\bqu\bua\bal\bls\bs n\bno\bo c\bch\bha\ban\bng\bge\bes\bs!\b!
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+       The RRDtool manpages
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Alex van den Bogaerdt <alex@ergens.op.het.net>
+
+
+
+1.2.26                            2007-11-20                   CDEFTUTORIAL(1)
diff --git a/doc/rpntutorial.1 b/doc/rpntutorial.1
new file mode 100644 (file)
index 0000000..a3b0707
--- /dev/null
@@ -0,0 +1,353 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RPNTUTORIAL 1"
+.TH RPNTUTORIAL 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rpntutorial \- Reading RRDtool RPN Expressions by Steve Rader
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+This tutorial should help you get to grips with RRDtool \s-1RPN\s0 expressions
+as seen in \s-1CDEF\s0 arguments of RRDtool graph.
+.SH "Reading Comparison Operators"
+.IX Header "Reading Comparison Operators"
+The \s-1LT\s0, \s-1LE\s0, \s-1GT\s0, \s-1GE\s0 and \s-1EQ\s0 \s-1RPN\s0 logic operators are not as tricky as
+they appear.  These operators act on the two values on the stack
+preceding them (to the left).  Read these two values on the stack
+from left to right inserting the operator in the middle.  If the
+resulting statement is true, then replace the three values from the
+stack with \*(L"1\*(R".  If the statement if false, replace the three values
+with \*(L"0\*(R".
+.PP
+For example, think about \*(L"2,1,GT\*(R".  This \s-1RPN\s0 expression could be
+read as \*(L"is two greater than one?\*(R"  The answer to that question is
+\&\*(L"true\*(R".  So the three values should be replaced with \*(L"1\*(R".  Thus the
+\&\s-1RPN\s0 expression 2,1,GT evaluates to 1.
+.PP
+Now consider \*(L"2,1,LE\*(R".  This \s-1RPN\s0 expression could be read as \*(L"is
+two less than or equal to one?\*(R".   The natural response is \*(L"no\*(R"
+and thus the \s-1RPN\s0 expression 2,1,LE evaluates to 0.
+.SH "Reading the IF Operator"
+.IX Header "Reading the IF Operator"
+The \s-1IF\s0 \s-1RPN\s0 logic operator can be straightforward also.  The key
+to reading \s-1IF\s0 operators is to understand that the condition part
+of the traditional \*(L"if X than Y else Z\*(R" notation has *already*
+been evaluated.  So the \s-1IF\s0 operator acts on only one value on the
+stack: the third value to the left of the \s-1IF\s0 value.  The second
+value to the left of the \s-1IF\s0 corresponds to the true (\*(L"Y\*(R") branch.
+And the first value to the left of the \s-1IF\s0 corresponds to the false
+(\*(L"Z\*(R") branch.  Read the \s-1RPN\s0 expression \*(L"X,Y,Z,IF\*(R" from left to
+right like so: \*(L"if X then Y else Z\*(R".
+.PP
+For example, consider \*(L"1,10,100,IF\*(R".  It looks bizarre to me.
+But when I read \*(L"if 1 then 10 else 100\*(R" it's crystal clear: 1 is true
+so the answer is 10.  Note that only zero is false; all other values
+are true.  \*(L"2,20,200,IF\*(R" (\*(L"if 2 then 20 else 200\*(R") evaluates to 20.
+And \*(L"0,1,2,IF\*(R" ("if 0 then 1 else 2) evaluates to 2.
+.PP
+Notice that none of the above examples really simulate the whole
+\&\*(L"if X then Y else Z\*(R" statement.  This is because computer programmers
+read this statement as \*(L"if Some Condition then Y else Z\*(R".  So it's
+important to be able to read \s-1IF\s0 operators along with the \s-1LT\s0, \s-1LE\s0,
+\&\s-1GT\s0, \s-1GE\s0 and \s-1EQ\s0 operators.
+.SH "Some Examples"
+.IX Header "Some Examples"
+While compound expressions can look overly complex, they can be
+considered elegantly simple.  To quickly comprehend \s-1RPN\s0 expressions,
+you must know the the algorithm for evaluating \s-1RPN\s0 expressions:
+iterate searches from the left to the right looking for an operator.
+When it's found, apply that operator by popping the operator and some
+number of values (and by definition, not operators) off the stack.
+.PP
+For example, the stack \*(L"1,2,3,+,+\*(R" gets \*(L"2,3,+\*(R" evaluated (as \*(L"2+3\*(R")
+during the first iteration and is replaced by 5.  This results in
+the stack \*(L"1,5,+\*(R".  Finally, \*(L"1,5,+\*(R" is evaluated resulting in the
+answer 6.  For convenience, it's useful to write this set of
+operations as:
+.PP
+.Vb 3
+\& 1) 1,2,3,+,+    eval is 2,3,+ = 5    result is 1,5,+
+\& 2) 1,5,+        eval is 1,5,+ = 6    result is 6
+\& 3) 6
+.Ve
+.PP
+Let's use that notation to conveniently solve some complex \s-1RPN\s0 expressions
+with multiple logic operators:
+.PP
+.Vb 1
+\& 1) 20,10,GT,10,20,IF  eval is 20,10,GT = 1     result is 1,10,20,IF
+.Ve
+.PP
+read the eval as pop \*(L"20 is greater than 10\*(R" so push 1
+.PP
+.Vb 1
+\& 2) 1,10,20,IF         eval is 1,10,20,IF = 10  result is 10
+.Ve
+.PP
+read pop \*(L"if 1 then 10 else 20\*(R" so push 10.  Only 10 is left so
+10 is the answer.
+.PP
+Let's read a complex \s-1RPN\s0 expression that also has the traditional
+multiplication operator:
+.PP
+.Vb 4
+\& 1) 128,8,*,7000,GT,7000,128,8,*,IF  eval 128,8,*       result is 1024
+\& 2) 1024,7000,GT,7000,128,8,*,IF     eval 1024,7000,GT  result is 0
+\& 3) 0,128,8,*,IF                     eval 128,8,*       result is 1024
+\& 4) 0,7000,1024,IF                                      result is 1024
+.Ve
+.PP
+Now let's go back to the first example of multiple logic operators,
+but replace the value 20 with the variable \*(L"input\*(R":
+.PP
+.Vb 1
+\& 1) input,10,GT,10,input,IF  eval is input,10,GT  ( lets call this A )
+.Ve
+.PP
+Read eval as \*(L"if input > 10 then true\*(R" and replace \*(L"input,10,GT\*(R"
+with \*(L"A\*(R":
+.PP
+.Vb 1
+\& 2) A,10,input,IF            eval is A,10,input,IF
+.Ve
+.PP
+read \*(L"if A then 10 else input\*(R".  Now replace A with it's verbose
+description againg and\*(--voila!\-\-you have a easily readable description
+of the expression:
+.PP
+.Vb 1
+\& if input > 10 then 10 else input
+.Ve
+.PP
+Finally, let's go back to the first most complex example and replace
+the value 128 with \*(L"input\*(R":
+.PP
+.Vb 1
+\& 1) input,8,*,7000,GT,7000,input,8,*,IF  eval input,8,*     result is A
+.Ve
+.PP
+where A is \*(L"input * 8\*(R"
+.PP
+.Vb 1
+\& 2) A,7000,GT,7000,input,8,*,IF          eval is A,7000,GT  result is B
+.Ve
+.PP
+where B is \*(L"if ((input * 8) > 7000) then true\*(R"
+.PP
+.Vb 1
+\& 3) B,7000,input,8,*,IF                  eval is input,8,*  result is C
+.Ve
+.PP
+where C is \*(L"input * 8\*(R"
+.PP
+.Vb 1
+\& 4) B,7000,C,IF
+.Ve
+.PP
+At last we have a readable decoding of the complex \s-1RPN\s0 expression with
+a variable:
+.PP
+.Vb 1
+\& if ((input * 8) > 7000) then 7000 else (input * 8)
+.Ve
+.SH "Exercises"
+.IX Header "Exercises"
+Exercise 1:
+.PP
+Compute \*(L"3,2,*,1,+ and \*(R"3,2,1,+,*" by hand.  Rewrite them in
+traditional notation.  Explain why they have different answers.
+.PP
+Answer 1:
+.PP
+.Vb 3
+\&    3*2+1 = 7 and 3*(2+1) = 9.  These expressions have
+\&    different answers because the altering of the plus and
+\&    times operators alter the order of their evaluation.
+.Ve
+.PP
+Exercise 2:
+.PP
+One may be tempted to shorten the expression
+.PP
+.Vb 1
+\& input,8,*,56000,GT,56000,input,*,8,IF
+.Ve
+.PP
+by removing the redundant use of \*(L"input,8,*\*(R" like so:
+.PP
+.Vb 1
+\& input,56000,GT,56000,input,IF,8,*
+.Ve
+.PP
+Use traditional notation to show these expressions are not the same.
+Write an expression that's equivalent to the first expression, but
+uses the \s-1LE\s0 and \s-1DIV\s0 operators.
+.PP
+Answer 2:
+.PP
+.Vb 2
+\&    if (input <= 56000/8 ) { input*8 } else { 56000 }
+\&    input,56000,8,DIV,LT,input,8,*,56000,IF
+.Ve
+.PP
+Exercise 3:
+.PP
+Briefly explain why traditional mathematic notation requires the
+use of parentheses.  Explain why \s-1RPN\s0 notation does not require
+the use of parentheses.
+.PP
+Answer 3:
+.PP
+.Vb 6
+\&    Traditional mathematic expressions are evaluated by
+\&    doing multiplication and division first, then addition and
+\&    subtraction.  Parentheses are used to force the evaluation of
+\&    addition before multiplication (etc).  RPN does not require
+\&    parentheses because the ordering of objects on the stack
+\&    can force the evaluation of addition before multiplication.
+.Ve
+.PP
+Exercise 4:
+.PP
+Explain why it was desirable for the RRDtool developers to implement
+\&\s-1RPN\s0 notation instead of traditional mathematical notation.
+.PP
+Answer 4:
+.PP
+.Vb 5
+\&    The algorithm that implements traditional mathematical
+\&    notation is more complex then algorithm used for RPN.
+\&    So implementing RPN allowed Tobias Oetiker to write less
+\&    code!  (The code is also less complex and therefore less
+\&    likely to have bugs.)
+.Ve
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Steve Rader <rader@wiscnet.net>
diff --git a/doc/rpntutorial.html b/doc/rpntutorial.html
new file mode 100644 (file)
index 0000000..d3c0956
--- /dev/null
@@ -0,0 +1,201 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rpntutorial</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#reading_comparison_operators">Reading Comparison Operators</a></li>
+       <li><a href="#reading_the_if_operator">Reading the IF Operator</a></li>
+       <li><a href="#some_examples">Some Examples</a></li>
+       <li><a href="#exercises">Exercises</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rpntutorial - Reading RRDtool RPN Expressions by Steve Rader</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>This tutorial should help you get to grips with RRDtool RPN expressions
+as seen in CDEF arguments of RRDtool graph.</p>
+<p>
+</p>
+<hr />
+<h1><a name="reading_comparison_operators">Reading Comparison Operators</a></h1>
+<p>The LT, LE, GT, GE and EQ RPN logic operators are not as tricky as
+they appear.  These operators act on the two values on the stack
+preceding them (to the left).  Read these two values on the stack
+from left to right inserting the operator in the middle.  If the
+resulting statement is true, then replace the three values from the
+stack with ``1''.  If the statement if false, replace the three values
+with ``0''.</p>
+<p>For example, think about ``2,1,GT''.  This RPN expression could be
+read as ``is two greater than one?''  The answer to that question is
+``true''.  So the three values should be replaced with ``1''.  Thus the
+RPN expression 2,1,GT evaluates to 1.</p>
+<p>Now consider ``2,1,LE''.  This RPN expression could be read as ``is
+two less than or equal to one?''.   The natural response is ``no''
+and thus the RPN expression 2,1,LE evaluates to 0.</p>
+<p>
+</p>
+<hr />
+<h1><a name="reading_the_if_operator">Reading the IF Operator</a></h1>
+<p>The IF RPN logic operator can be straightforward also.  The key
+to reading IF operators is to understand that the condition part
+of the traditional ``if X than Y else Z'' notation has *already*
+been evaluated.  So the IF operator acts on only one value on the
+stack: the third value to the left of the IF value.  The second
+value to the left of the IF corresponds to the true (``Y'') branch.
+And the first value to the left of the IF corresponds to the false
+(``Z'') branch.  Read the RPN expression ``X,Y,Z,IF'' from left to
+right like so: ``if X then Y else Z''.</p>
+<p>For example, consider ``1,10,100,IF''.  It looks bizarre to me.
+But when I read ``if 1 then 10 else 100'' it's crystal clear: 1 is true
+so the answer is 10.  Note that only zero is false; all other values
+are true.  ``2,20,200,IF'' (``if 2 then 20 else 200'') evaluates to 20.
+And ``0,1,2,IF'' (``if 0 then 1 else 2) evaluates to 2.</p>
+<p>Notice that none of the above examples really simulate the whole
+``if X then Y else Z'' statement.  This is because computer programmers
+read this statement as ``if Some Condition then Y else Z''.  So it's
+important to be able to read IF operators along with the LT, LE,
+GT, GE and EQ operators.</p>
+<p>
+</p>
+<hr />
+<h1><a name="some_examples">Some Examples</a></h1>
+<p>While compound expressions can look overly complex, they can be
+considered elegantly simple.  To quickly comprehend RPN expressions,
+you must know the the algorithm for evaluating RPN expressions:
+iterate searches from the left to the right looking for an operator.
+When it's found, apply that operator by popping the operator and some
+number of values (and by definition, not operators) off the stack.</p>
+<p>For example, the stack ``1,2,3,+,+'' gets ``2,3,+'' evaluated (as ``2+3'')
+during the first iteration and is replaced by 5.  This results in
+the stack ``1,5,+''.  Finally, ``1,5,+'' is evaluated resulting in the
+answer 6.  For convenience, it's useful to write this set of
+operations as:</p>
+<pre>
+ 1) 1,2,3,+,+    eval is 2,3,+ = 5    result is 1,5,+
+ 2) 1,5,+        eval is 1,5,+ = 6    result is 6
+ 3) 6</pre>
+<p>Let's use that notation to conveniently solve some complex RPN expressions
+with multiple logic operators:</p>
+<pre>
+ 1) 20,10,GT,10,20,IF  eval is 20,10,GT = 1     result is 1,10,20,IF</pre>
+<p>read the eval as pop ``20 is greater than 10'' so push 1</p>
+<pre>
+ 2) 1,10,20,IF         eval is 1,10,20,IF = 10  result is 10</pre>
+<p>read pop ``if 1 then 10 else 20'' so push 10.  Only 10 is left so
+10 is the answer.</p>
+<p>Let's read a complex RPN expression that also has the traditional
+multiplication operator:</p>
+<pre>
+ 1) 128,8,*,7000,GT,7000,128,8,*,IF  eval 128,8,*       result is 1024
+ 2) 1024,7000,GT,7000,128,8,*,IF     eval 1024,7000,GT  result is 0
+ 3) 0,128,8,*,IF                     eval 128,8,*       result is 1024
+ 4) 0,7000,1024,IF                                      result is 1024</pre>
+<p>Now let's go back to the first example of multiple logic operators,
+but replace the value 20 with the variable ``input'':</p>
+<pre>
+ 1) input,10,GT,10,input,IF  eval is input,10,GT  ( lets call this A )</pre>
+<p>Read eval as ``if input &gt; 10 then true'' and replace ``input,10,GT''
+with ``A'':</p>
+<pre>
+ 2) A,10,input,IF            eval is A,10,input,IF</pre>
+<p>read ``if A then 10 else input''.  Now replace A with it's verbose
+description againg and--voila!--you have a easily readable description
+of the expression:</p>
+<pre>
+ if input &gt; 10 then 10 else input</pre>
+<p>Finally, let's go back to the first most complex example and replace
+the value 128 with ``input'':</p>
+<pre>
+ 1) input,8,*,7000,GT,7000,input,8,*,IF  eval input,8,*     result is A</pre>
+<p>where A is ``input * 8''</p>
+<pre>
+ 2) A,7000,GT,7000,input,8,*,IF          eval is A,7000,GT  result is B</pre>
+<p>where B is ``if ((input * 8) &gt; 7000) then true''</p>
+<pre>
+ 3) B,7000,input,8,*,IF                  eval is input,8,*  result is C</pre>
+<p>where C is ``input * 8''</p>
+<pre>
+ 4) B,7000,C,IF</pre>
+<p>At last we have a readable decoding of the complex RPN expression with
+a variable:</p>
+<pre>
+ if ((input * 8) &gt; 7000) then 7000 else (input * 8)</pre>
+<p>
+</p>
+<hr />
+<h1><a name="exercises">Exercises</a></h1>
+<p>Exercise 1:</p>
+<p>Compute ``3,2,*,1,+ and ''3,2,1,+,*`` by hand.  Rewrite them in
+traditional notation.  Explain why they have different answers.</p>
+<p>Answer 1:</p>
+<pre>
+    3*2+1 = 7 and 3*(2+1) = 9.  These expressions have
+    different answers because the altering of the plus and
+    times operators alter the order of their evaluation.</pre>
+<p>Exercise 2:</p>
+<p>One may be tempted to shorten the expression</p>
+<pre>
+ input,8,*,56000,GT,56000,input,*,8,IF</pre>
+<p>by removing the redundant use of ``input,8,*'' like so:</p>
+<pre>
+ input,56000,GT,56000,input,IF,8,*</pre>
+<p>Use traditional notation to show these expressions are not the same.
+Write an expression that's equivalent to the first expression, but
+uses the LE and DIV operators.</p>
+<p>Answer 2:</p>
+<pre>
+    if (input &lt;= 56000/8 ) { input*8 } else { 56000 }
+    input,56000,8,DIV,LT,input,8,*,56000,IF</pre>
+<p>Exercise 3:</p>
+<p>Briefly explain why traditional mathematic notation requires the
+use of parentheses.  Explain why RPN notation does not require
+the use of parentheses.</p>
+<p>Answer 3:</p>
+<pre>
+    Traditional mathematic expressions are evaluated by
+    doing multiplication and division first, then addition and
+    subtraction.  Parentheses are used to force the evaluation of
+    addition before multiplication (etc).  RPN does not require
+    parentheses because the ordering of objects on the stack
+    can force the evaluation of addition before multiplication.</pre>
+<p>Exercise 4:</p>
+<p>Explain why it was desirable for the RRDtool developers to implement
+RPN notation instead of traditional mathematical notation.</p>
+<p>Answer 4:</p>
+<pre>
+    The algorithm that implements traditional mathematical
+    notation is more complex then algorithm used for RPN.
+    So implementing RPN allowed Tobias Oetiker to write less
+    code!  (The code is also less complex and therefore less
+    likely to have bugs.)</pre>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Steve Rader &lt;<a href="mailto:rader@wiscnet.net">rader@wiscnet.net</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rpntutorial.pod b/doc/rpntutorial.pod
new file mode 100644 (file)
index 0000000..b3beac1
--- /dev/null
@@ -0,0 +1,198 @@
+=head1 NAME
+
+rpntutorial - Reading RRDtool RPN Expressions by Steve Rader
+
+=head1 DESCRIPTION
+
+This tutorial should help you get to grips with RRDtool RPN expressions
+as seen in CDEF arguments of RRDtool graph.
+
+=head1 Reading Comparison Operators
+
+The LT, LE, GT, GE and EQ RPN logic operators are not as tricky as
+they appear.  These operators act on the two values on the stack
+preceding them (to the left).  Read these two values on the stack
+from left to right inserting the operator in the middle.  If the
+resulting statement is true, then replace the three values from the
+stack with "1".  If the statement if false, replace the three values
+with "0".
+
+For example, think about "2,1,GT".  This RPN expression could be
+read as "is two greater than one?"  The answer to that question is
+"true".  So the three values should be replaced with "1".  Thus the
+RPN expression 2,1,GT evaluates to 1.
+
+Now consider "2,1,LE".  This RPN expression could be read as "is
+two less than or equal to one?".   The natural response is "no"
+and thus the RPN expression 2,1,LE evaluates to 0.
+
+=head1 Reading the IF Operator
+
+The IF RPN logic operator can be straightforward also.  The key
+to reading IF operators is to understand that the condition part
+of the traditional "if X than Y else Z" notation has *already*
+been evaluated.  So the IF operator acts on only one value on the
+stack: the third value to the left of the IF value.  The second
+value to the left of the IF corresponds to the true ("Y") branch.
+And the first value to the left of the IF corresponds to the false
+("Z") branch.  Read the RPN expression "X,Y,Z,IF" from left to
+right like so: "if X then Y else Z".
+
+For example, consider "1,10,100,IF".  It looks bizarre to me.
+But when I read "if 1 then 10 else 100" it's crystal clear: 1 is true
+so the answer is 10.  Note that only zero is false; all other values
+are true.  "2,20,200,IF" ("if 2 then 20 else 200") evaluates to 20.
+And "0,1,2,IF" ("if 0 then 1 else 2) evaluates to 2.
+
+
+Notice that none of the above examples really simulate the whole
+"if X then Y else Z" statement.  This is because computer programmers
+read this statement as "if Some Condition then Y else Z".  So it's
+important to be able to read IF operators along with the LT, LE,
+GT, GE and EQ operators.
+
+=head1 Some Examples
+
+While compound expressions can look overly complex, they can be
+considered elegantly simple.  To quickly comprehend RPN expressions,
+you must know the the algorithm for evaluating RPN expressions:
+iterate searches from the left to the right looking for an operator.
+When it's found, apply that operator by popping the operator and some
+number of values (and by definition, not operators) off the stack.
+
+For example, the stack "1,2,3,+,+" gets "2,3,+" evaluated (as "2+3")
+during the first iteration and is replaced by 5.  This results in
+the stack "1,5,+".  Finally, "1,5,+" is evaluated resulting in the
+answer 6.  For convenience, it's useful to write this set of
+operations as:
+
+ 1) 1,2,3,+,+    eval is 2,3,+ = 5    result is 1,5,+
+ 2) 1,5,+        eval is 1,5,+ = 6    result is 6
+ 3) 6
+
+Let's use that notation to conveniently solve some complex RPN expressions
+with multiple logic operators:
+
+ 1) 20,10,GT,10,20,IF  eval is 20,10,GT = 1     result is 1,10,20,IF
+
+read the eval as pop "20 is greater than 10" so push 1
+
+ 2) 1,10,20,IF         eval is 1,10,20,IF = 10  result is 10
+
+read pop "if 1 then 10 else 20" so push 10.  Only 10 is left so
+10 is the answer.
+
+Let's read a complex RPN expression that also has the traditional
+multiplication operator:
+
+ 1) 128,8,*,7000,GT,7000,128,8,*,IF  eval 128,8,*       result is 1024
+ 2) 1024,7000,GT,7000,128,8,*,IF     eval 1024,7000,GT  result is 0
+ 3) 0,128,8,*,IF                     eval 128,8,*       result is 1024
+ 4) 0,7000,1024,IF                                      result is 1024
+
+
+Now let's go back to the first example of multiple logic operators,
+but replace the value 20 with the variable "input":
+
+ 1) input,10,GT,10,input,IF  eval is input,10,GT  ( lets call this A )
+
+Read eval as "if input > 10 then true" and replace "input,10,GT"
+with "A":
+
+ 2) A,10,input,IF            eval is A,10,input,IF
+
+read "if A then 10 else input".  Now replace A with it's verbose
+description againg and--voila!--you have a easily readable description
+of the expression:
+
+ if input > 10 then 10 else input
+
+Finally, let's go back to the first most complex example and replace
+the value 128 with "input":
+
+ 1) input,8,*,7000,GT,7000,input,8,*,IF  eval input,8,*     result is A
+
+where A is "input * 8"
+
+ 2) A,7000,GT,7000,input,8,*,IF          eval is A,7000,GT  result is B
+
+where B is "if ((input * 8) > 7000) then true"
+
+ 3) B,7000,input,8,*,IF                  eval is input,8,*  result is C
+
+where C is "input * 8"
+
+ 4) B,7000,C,IF
+
+At last we have a readable decoding of the complex RPN expression with
+a variable:
+
+ if ((input * 8) > 7000) then 7000 else (input * 8)
+
+=head1 Exercises
+
+Exercise 1:
+
+Compute "3,2,*,1,+ and "3,2,1,+,*" by hand.  Rewrite them in
+traditional notation.  Explain why they have different answers.
+
+Answer 1:
+
+    3*2+1 = 7 and 3*(2+1) = 9.  These expressions have
+    different answers because the altering of the plus and
+    times operators alter the order of their evaluation.
+
+
+Exercise 2:
+
+One may be tempted to shorten the expression
+
+ input,8,*,56000,GT,56000,input,*,8,IF
+
+by removing the redundant use of "input,8,*" like so:
+
+ input,56000,GT,56000,input,IF,8,*
+
+Use traditional notation to show these expressions are not the same.
+Write an expression that's equivalent to the first expression, but
+uses the LE and DIV operators.
+
+Answer 2:
+
+    if (input <= 56000/8 ) { input*8 } else { 56000 }
+    input,56000,8,DIV,LT,input,8,*,56000,IF
+
+
+Exercise 3:
+
+Briefly explain why traditional mathematic notation requires the
+use of parentheses.  Explain why RPN notation does not require
+the use of parentheses.
+
+Answer 3:
+
+    Traditional mathematic expressions are evaluated by
+    doing multiplication and division first, then addition and
+    subtraction.  Parentheses are used to force the evaluation of
+    addition before multiplication (etc).  RPN does not require
+    parentheses because the ordering of objects on the stack
+    can force the evaluation of addition before multiplication.
+
+
+Exercise 4:
+
+Explain why it was desirable for the RRDtool developers to implement
+RPN notation instead of traditional mathematical notation.
+
+Answer 4:
+
+    The algorithm that implements traditional mathematical
+    notation is more complex then algorithm used for RPN.
+    So implementing RPN allowed Tobias Oetiker to write less
+    code!  (The code is also less complex and therefore less
+    likely to have bugs.)
+
+
+=head1 AUTHOR
+
+Steve Rader E<lt>rader@wiscnet.netE<gt>
diff --git a/doc/rpntutorial.txt b/doc/rpntutorial.txt
new file mode 100644 (file)
index 0000000..0e733c2
--- /dev/null
@@ -0,0 +1,190 @@
+RPNTUTORIAL(1)                      rrdtool                     RPNTUTORIAL(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rpntutorial - Reading RRDtool RPN Expressions by Steve Rader
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       This tutorial should help you get to grips with RRDtool RPN expressions
+       as seen in CDEF arguments of RRDtool graph.
+
+R\bRe\bea\bad\bdi\bin\bng\bg C\bCo\bom\bmp\bpa\bar\bri\bis\bso\bon\bn O\bOp\bpe\ber\bra\bat\bto\bor\brs\bs
+       The LT, LE, GT, GE and EQ RPN logic operators are not as tricky as they
+       appear.  These operators act on the two values on the stack preceding
+       them (to the left).  Read these two values on the stack from left to
+       right inserting the operator in the middle.  If the resulting statement
+       is true, then replace the three values from the stack with "1".  If the
+       statement if false, replace the three values with "0".
+
+       For example, think about "2,1,GT".  This RPN expression could be read
+       as "is two greater than one?"  The answer to that question is "true".
+       So the three values should be replaced with "1".  Thus the RPN expres-
+       sion 2,1,GT evaluates to 1.
+
+       Now consider "2,1,LE".  This RPN expression could be read as "is two
+       less than or equal to one?".   The natural response is "no" and thus
+       the RPN expression 2,1,LE evaluates to 0.
+
+R\bRe\bea\bad\bdi\bin\bng\bg t\bth\bhe\be I\bIF\bF O\bOp\bpe\ber\bra\bat\bto\bor\br
+       The IF RPN logic operator can be straightforward also.  The key to
+       reading IF operators is to understand that the condition part of the
+       traditional "if X than Y else Z" notation has *already* been evaluated.
+       So the IF operator acts on only one value on the stack: the third value
+       to the left of the IF value.  The second value to the left of the IF
+       corresponds to the true ("Y") branch.  And the first value to the left
+       of the IF corresponds to the false ("Z") branch.  Read the RPN expres-
+       sion "X,Y,Z,IF" from left to right like so: "if X then Y else Z".
+
+       For example, consider "1,10,100,IF".  It looks bizarre to me.  But when
+       I read "if 1 then 10 else 100" it's crystal clear: 1 is true so the
+       answer is 10.  Note that only zero is false; all other values are true.
+       "2,20,200,IF" ("if 2 then 20 else 200") evaluates to 20.  And
+       "0,1,2,IF" ("if 0 then 1 else 2) evaluates to 2.
+
+       Notice that none of the above examples really simulate the whole "if X
+       then Y else Z" statement.  This is because computer programmers read
+       this statement as "if Some Condition then Y else Z".  So it's important
+       to be able to read IF operators along with the LT, LE, GT, GE and EQ
+       operators.
+
+S\bSo\bom\bme\be E\bEx\bxa\bam\bmp\bpl\ble\bes\bs
+       While compound expressions can look overly complex, they can be consid-
+       ered elegantly simple.  To quickly comprehend RPN expressions, you must
+       know the the algorithm for evaluating RPN expressions: iterate searches
+       from the left to the right looking for an operator.  When it's found,
+       apply that operator by popping the operator and some number of values
+       (and by definition, not operators) off the stack.
+
+       For example, the stack "1,2,3,+,+" gets "2,3,+" evaluated (as "2+3")
+       during the first iteration and is replaced by 5.  This results in the
+       stack "1,5,+".  Finally, "1,5,+" is evaluated resulting in the answer
+       6.  For convenience, it's useful to write this set of operations as:
+
+        1) 1,2,3,+,+    eval is 2,3,+ = 5    result is 1,5,+
+        2) 1,5,+        eval is 1,5,+ = 6    result is 6
+        3) 6
+
+       Let's use that notation to conveniently solve some complex RPN expres-
+       sions with multiple logic operators:
+
+        1) 20,10,GT,10,20,IF  eval is 20,10,GT = 1     result is 1,10,20,IF
+
+       read the eval as pop "20 is greater than 10" so push 1
+
+        2) 1,10,20,IF         eval is 1,10,20,IF = 10  result is 10
+
+       read pop "if 1 then 10 else 20" so push 10.  Only 10 is left so 10 is
+       the answer.
+
+       Let's read a complex RPN expression that also has the traditional mul-
+       tiplication operator:
+
+        1) 128,8,*,7000,GT,7000,128,8,*,IF  eval 128,8,*       result is 1024
+        2) 1024,7000,GT,7000,128,8,*,IF     eval 1024,7000,GT  result is 0
+        3) 0,128,8,*,IF                     eval 128,8,*       result is 1024
+        4) 0,7000,1024,IF                                      result is 1024
+
+       Now let's go back to the first example of multiple logic operators, but
+       replace the value 20 with the variable "input":
+
+        1) input,10,GT,10,input,IF  eval is input,10,GT  ( lets call this A )
+
+       Read eval as "if input > 10 then true" and replace "input,10,GT" with
+       "A":
+
+        2) A,10,input,IF            eval is A,10,input,IF
+
+       read "if A then 10 else input".  Now replace A with it's verbose
+       description againg and--voila!--you have a easily readable description
+       of the expression:
+
+        if input > 10 then 10 else input
+
+       Finally, let's go back to the first most complex example and replace
+       the value 128 with "input":
+
+        1) input,8,*,7000,GT,7000,input,8,*,IF  eval input,8,*     result is A
+
+       where A is "input * 8"
+
+        2) A,7000,GT,7000,input,8,*,IF          eval is A,7000,GT  result is B
+
+       where B is "if ((input * 8) > 7000) then true"
+
+        3) B,7000,input,8,*,IF                  eval is input,8,*  result is C
+
+       where C is "input * 8"
+
+        4) B,7000,C,IF
+
+       At last we have a readable decoding of the complex RPN expression with
+       a variable:
+
+        if ((input * 8) > 7000) then 7000 else (input * 8)
+
+E\bEx\bxe\ber\brc\bci\bis\bse\bes\bs
+       Exercise 1:
+
+       Compute "3,2,*,1,+ and "3,2,1,+,*" by hand.  Rewrite them in tradi-
+       tional notation.  Explain why they have different answers.
+
+       Answer 1:
+
+           3*2+1 = 7 and 3*(2+1) = 9.  These expressions have
+           different answers because the altering of the plus and
+           times operators alter the order of their evaluation.
+
+       Exercise 2:
+
+       One may be tempted to shorten the expression
+
+        input,8,*,56000,GT,56000,input,*,8,IF
+
+       by removing the redundant use of "input,8,*" like so:
+
+        input,56000,GT,56000,input,IF,8,*
+
+       Use traditional notation to show these expressions are not the same.
+       Write an expression that's equivalent to the first expression, but uses
+       the LE and DIV operators.
+
+       Answer 2:
+
+           if (input <= 56000/8 ) { input*8 } else { 56000 }
+           input,56000,8,DIV,LT,input,8,*,56000,IF
+
+       Exercise 3:
+
+       Briefly explain why traditional mathematic notation requires the use of
+       parentheses.  Explain why RPN notation does not require the use of
+       parentheses.
+
+       Answer 3:
+
+           Traditional mathematic expressions are evaluated by
+           doing multiplication and division first, then addition and
+           subtraction.  Parentheses are used to force the evaluation of
+           addition before multiplication (etc).  RPN does not require
+           parentheses because the ordering of objects on the stack
+           can force the evaluation of addition before multiplication.
+
+       Exercise 4:
+
+       Explain why it was desirable for the RRDtool developers to implement
+       RPN notation instead of traditional mathematical notation.
+
+       Answer 4:
+
+           The algorithm that implements traditional mathematical
+           notation is more complex then algorithm used for RPN.
+           So implementing RPN allowed Tobias Oetiker to write less
+           code!  (The code is also less complex and therefore less
+           likely to have bugs.)
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Steve Rader <rader@wiscnet.net>
+
+
+
+1.2.26                            2007-11-20                    RPNTUTORIAL(1)
diff --git a/doc/rrd-beginners.1 b/doc/rrd-beginners.1
new file mode 100644 (file)
index 0000000..9a2772a
--- /dev/null
@@ -0,0 +1,455 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRD-BEGINNERS 1"
+.TH RRD-BEGINNERS 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrd\-beginners \- RRDtool Beginners' Guide
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+Helping new RRDtool users to understand the basics of RRDtool
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+This manual is an attempt to assist beginners in understanding the concepts
+of RRDtool. It sheds a light on differences between RRDtool and other
+databases. With help of an example, it explains the structure of RRDtool
+database. This is followed by an overview of the \*(L"graph\*(R" feature of RRDtool.
+At the end, it has sample scripts that illustrate the
+usage/wrapping of RRDtool within Shell or Perl scripts.
+.Sh "What makes RRDtool so special?"
+.IX Subsection "What makes RRDtool so special?"
+RRDtool is \s-1GNU\s0 licensed software developed by Tobias Oetiker, a system
+manager at the Swiss Federal Institute of Technology. Though it is a
+database, there are distinct differences between RRDtool databases and other
+databases as listed below:
+.IP "\(bu" 4
+RRDtool stores data; that makes it a back-end tool. The RRDtool command set
+allows the creation of graphs; that makes it a front-end tool as well. Other
+databases just store data and can not create graphs.
+.IP "\(bu" 4
+In case of linear databases, new data gets appended at the bottom of
+the database table. Thus its size keeps on increasing, whereas the size of
+an RRDtool database is determined at creation time. Imagine an RRDtool
+database as the perimeter of a circle. Data is added along the
+perimeter. When new data reaches the starting point, it overwrites
+existing data. This way, the size of an RRDtool database always
+remains constant. The name \*(L"Round Robin\*(R" stems from this behavior.
+.IP "\(bu" 4
+Other databases store the values as supplied. RRDtool can be configured to
+calculate the rate of change from the previous to the current value and
+store this information instead.
+.IP "\(bu" 4
+Other databases get updated when values are supplied. The RRDtool database
+is structured in such a way that it needs data at predefined time
+intervals. If it does not get a new value during the interval, it stores an
+\&\s-1UNKNOWN\s0 value for that interval. So, when using the RRDtool database, it is
+imperative to use scripts that run at regular intervals to ensure a constant
+data flow to update the RRDtool database.
+.PP
+RRDtool is designed to store time series of data. With every data
+update, an associated time stamp is stored. Time is always expressed
+in seconds passed since epoch (01\-01\-1970). RRDtool can be installed
+on Unix as well as Windows. It comes with a command set to carry out
+various operations on \s-1RRD\s0 databases. This command set can be accessed
+from the command line, as well as from Shell or Perl scripts. The
+scripts act as wrappers for accessing data stored in RRDtool
+databases.
+.Sh "Understanding by an example"
+.IX Subsection "Understanding by an example"
+The structure of an \s-1RRD\s0 database is different than other linear databases.
+Other databases define tables with columns, and many other parameters. These
+definitions sometimes are very complex, especially in large databases.
+RRDtool databases are primarily used for monitoring purposes and
+hence are very simple in structure. The parameters
+that need to be defined are variables that hold values and archives of those
+values. Being time sensitive, a couple of time related parameters are also
+defined. Because of its structure, the definition of an RRDtool database also
+includes a provision to specify specific actions to take in the absence of
+update values. Data Source (\s-1DS\s0), heartbeat, Date Source Type (\s-1DST\s0), Round
+Robin Archive (\s-1RRA\s0), and Consolidation Function (\s-1CF\s0) are some of the
+terminologies related to RRDtool databases.
+.PP
+The structure of a database and the terminology associated with it can be
+best explained with an example.
+.PP
+.Vb 6
+\& rrdtool create target.rrd \e
+\&         \-\-start 1023654125 \e
+\&         \-\-step 300 \e
+\&         DS:mem:GAUGE:600:0:671744 \e
+\&         RRA:AVERAGE:0.5:12:24 \e
+\&         RRA:AVERAGE:0.5:288:31
+.Ve
+.PP
+This example creates a database named \fItarget.rrd\fR. Start time
+(1'023'654'125) is specified in total number of seconds since epoch
+(time in seconds since 01\-01\-1970). While updating the database, the
+update time is also specified.  This update time \s-1MUST\s0 be large (later)
+then start time and \s-1MUST\s0 be in seconds since epoch.
+.PP
+The step of 300 seconds indicates that database expects new values every
+300 seconds. The wrapper script should be scheduled to run every \fBstep\fR
+seconds so that it updates the database every \fBstep\fR seconds.
+.PP
+\&\s-1DS\s0 (Data Source) is the actual variable which relates to the parameter on
+the device that is monitored. Its syntax is
+.PP
+.Vb 1
+\& DS:variable_name:DST:heartbeat:min:max
+.Ve
+.PP
+\&\fB\s-1DS\s0\fR is a key word. \f(CW\*(C`variable_name\*(C'\fR is a name under which the parameter is
+saved in the database. There can be as many DSs in a database as needed. After
+every step interval, a new value of \s-1DS\s0 is supplied to update the database.
+This value is also called Primary Data Point \fB(\s-1PDP\s0)\fR. In our example
+mentioned above, a new \s-1PDP\s0 is generated every 300 seconds.
+.PP
+Note, that if you do \s-1NOT\s0 supply new datapoints exactly every 300 seconds,
+this is not a problem, RRDtool will interpolate the data accordingly.
+.PP
+\&\fB\s-1DST\s0\fR (Data Source Type) defines the type of the \s-1DS\s0. It can be
+\&\s-1COUNTER\s0, \s-1DERIVE\s0, \s-1ABSOLUTE\s0, \s-1GAUGE\s0. A \s-1DS\s0 declared as \s-1COUNTER\s0 will save
+the rate of change of the value over a step period. This assumes that
+the value is always increasing (the difference between the current and
+the previous value is greater than 0). Traffic counters on a router
+are an ideal candidate for using \s-1COUNTER\s0 as \s-1DST\s0. \s-1DERIVE\s0 is the same as
+\&\s-1COUNTER\s0, but it allows negative values as well. If you want to see the
+rate of \fIchange\fR in free diskspace on your server, then you might
+want to use the \s-1DERIVE\s0 data type. \s-1ABSOLUTE\s0 also saves the rate of
+change, but it assumes that the previous value is set to 0. The
+difference between the current and the previous value is always equal
+to the current value. Thus it just stores the current value divided by
+the step interval (300 seconds in our example). \s-1GAUGE\s0 does not save
+the rate of change. It saves the actual value itself. There are no
+divisions or calculations. Memory consumption in a server is a typical
+example of gauge. The difference between the different types DSTs can be
+explained better with the following example:
+.PP
+.Vb 6
+\& Values       = 300, 600, 900, 1200
+\& Step         = 300 seconds
+\& COUNTER DS   =    1,  1,   1,    1
+\& DERIVE DS    =    1,  1,   1,    1
+\& ABSOLUTE DS  =    1,  2,   3,    4
+\& GAUGE DS     = 300, 600, 900, 1200
+.Ve
+.PP
+The next parameter is \fBheartbeat\fR. In our example, heartbeat is 600
+seconds. If the database does not get a new \s-1PDP\s0 within 300 seconds, it
+will wait for another 300 seconds (total 600 seconds).  If it doesn't
+receive any \s-1PDP\s0 within 600 seconds, it will save an \s-1UNKNOWN\s0 value into
+the database. This \s-1UNKNOWN\s0 value is a special feature of RRDtool \- it
+is much better than to assume a missing value was 0 (zero) or any
+other number which might also be a valid data value.  For example, the
+traffic flow counter on a router keeps increasing. Lets say, a value
+is missed for an interval and 0 is stored instead of \s-1UNKNOWN\s0. Now when
+the next value becomes available, it will calculate the difference
+between the current value and the previous value (0) which is not
+correct. So, inserting the value \s-1UNKNOWN\s0 makes much more sense here.
+.PP
+The next two parameters are the minimum and maximum value,
+respectively. If the variable to be stored has predictable maximum and
+minimum values, this should be specified here. Any update value
+falling out of this range will be stored as \s-1UNKNOWN\s0.
+.PP
+The next line declares a round robin archive (\s-1RRA\s0). The syntax for
+declaring an \s-1RRA\s0 is
+.PP
+.Vb 1
+\& RRA:CF:xff:step:rows
+.Ve
+.PP
+\&\s-1RRA\s0 is the keyword to declare RRAs. The consolidation function (\s-1CF\s0)
+can be \s-1AVERAGE\s0, \s-1MINIMUM\s0, \s-1MAXIMUM\s0, and \s-1LAST\s0. The concept of the
+consolidated data point (\s-1CDP\s0) comes into the picture here. A \s-1CDP\s0 is
+CFed (averaged, maximum/minimum value or last value) from \fIstep\fR
+number of PDPs. This \s-1RRA\s0 will hold \fIrows\fR CDPs.
+.PP
+Lets have a look at the example above. For the first \s-1RRA\s0, 12 (steps)
+PDPs (\s-1DS\s0 variables) are AVERAGEed (\s-1CF\s0) to form one \s-1CDP\s0. 24 (rows) of
+theses CDPs are archived. Each \s-1PDP\s0 occurs at 300 seconds. 12 PDPs
+represent 12 times 300 seconds which is 1 hour. It means 1 \s-1CDP\s0 (which
+is equal to 12 PDPs) represents data worth 1 hour. 24 such CDPs
+represent 1 day (1 hour times 24 CDPs). This means, this \s-1RRA\s0 is an
+archive for one day. After 24 CDPs, \s-1CDP\s0 number 25 will replace the 1st
+\&\s-1CDP\s0. The second \s-1RRA\s0 saves 31 CDPs; each \s-1CPD\s0 represents an \s-1AVERAGE\s0
+value for a day (288 PDPs, each covering 300 seconds = 24
+hours). Therefore this \s-1RRA\s0 is an archive for one month. A single
+database can have many RRAs. If there are multiple DSs, each
+individual \s-1RRA\s0 will save data for all the DSs in the database. For
+example, if a database has 3 DSs and daily, weekly, monthly, and
+yearly RRAs are declared, then each \s-1RRA\s0 will hold data from all 3 data
+sources.
+.Sh "Graphical Magic"
+.IX Subsection "Graphical Magic"
+Another important feature of RRDtool is its ability to create
+graphs. The \*(L"graph\*(R" command uses the \*(L"fetch\*(R" command internally to
+retrieve values from the database. With the retrieved values it draws
+graphs as defined by the parameters supplied on the command line. A
+single graph can show different \s-1DS\s0 (Data Sources) from a database. It
+is also possible to show the values from more than one database in a
+single graph. Often, it is necessary to perform some math on the
+values retrieved from the database before plotting them. For example,
+in \s-1SNMP\s0 replies, memory consumption values are usually specified in
+KBytes and traffic flow on interfaces is specified in Bytes. Graphs
+for these values will be more meaningful if values are represented in
+MBytes and mbps. The RRDtool graph command allows to define such
+conversions. Apart from mathematical calculations, it is also possible
+to perform logical operations such as greater than, less than, and
+if/then/else. If a database contains more than one \s-1RRA\s0 archive, then a
+question may arise \- how does RRDtool decide which \s-1RRA\s0 archive to use
+for retrieving the values? RRDtool looks at several things when making
+its choice. First it makes sure that the \s-1RRA\s0 covers as much of the
+graphing time frame as possible. Second it looks at the resolution of
+the \s-1RRA\s0 compared to the resolution of the graph. It tries to find one
+which has the same or higher better resolution. With the \*(L"\-r\*(R" option
+you can force RRDtool to assume a different resolution than the one
+calculated from the pixel width of the graph.
+.PP
+Values of different variables can be presented in 5 different shapes
+in a graph \- \s-1AREA\s0, \s-1LINE1\s0, \s-1LINE2\s0, \s-1LINE3\s0, and \s-1STACK\s0. \s-1AREA\s0 is represented
+by a solid colored area with values as the boundary of this
+area. \s-1LINE1/2/3\s0 (increasing width) are just plain lines representing
+the values. \s-1STACK\s0 is also an area but it is \*(L"stack\*(R"ed on top \s-1AREA\s0 or
+\&\s-1LINE1/2/3\s0. Another important thing to note is that variables are
+plotted in the order they are defined in the graph command. Therefore
+care must be taken to define \s-1STACK\s0 only after defining \s-1AREA/LINE\s0. It
+is also possible to put formatted comments within the graph.  Detailed
+instructions can be found in the graph manual.
+.Sh "Wrapping RRDtool within Shell/Perl script"
+.IX Subsection "Wrapping RRDtool within Shell/Perl script"
+After understanding RRDtool it is now a time to actually use RRDtool
+in scripts. Tasks involved in network management are data collection,
+data storage, and data retrieval. In the following example, the
+previously created target.rrd database is used. Data collection and
+data storage is done using Shell scripts. Data retrieval and report
+generation is done using Perl scripts. These scripts are shown below:
+.PP
+\fIShell script (collects data, updates database)\fR
+.IX Subsection "Shell script (collects data, updates database)"
+.PP
+.Vb 14
+\& #!/bin/sh
+\& a=0
+\& while [ "$a" == 0 ]; do
+\& snmpwalk \-c public 192.168.1.250 hrSWRunPerfMem > snmp_reply
+\&     total_mem=`awk 'BEGIN {tot_mem=0}
+\&                           { if ($NF == "KBytes")
+\&                             {tot_mem=tot_mem+$(NF\-1)}
+\&                           }
+\&                     END {print tot_mem}' snmp_reply`
+\&     # I can use N as a replacement for the current time
+\&     rrdtool update target.rrd N:$total_mem
+\&     # sleep until the next 300 seconds are full
+\&     perl \-e 'sleep 300 \- time % 300'
+\& done # end of while loop
+.Ve
+.PP
+\fIPerl script (retrieves data from database and generates graphs and statistics)\fR
+.IX Subsection "Perl script (retrieves data from database and generates graphs and statistics)"
+.PP
+.Vb 3
+\& #!/usr/bin/perl \-w
+\& # This script fetches data from target.rrd, creates a graph of memory
+\& # consumption on the target (Dual P3 Processor 1 GHz, 656 MB RAM)
+.Ve
+.PP
+.Vb 6
+\& # call the RRD perl module
+\& use lib qw( /usr/local/rrdtool\-1.0.41/lib/perl ../lib/perl );
+\& use RRDs;
+\& my $cur_time = time();                # set current time
+\& my $end_time = $cur_time \- 86400;     # set end time to 24 hours ago
+\& my $start_time = $end_time \- 2592000; # set start 30 days in the past
+.Ve
+.PP
+.Vb 58
+\& # fetch average values from the RRD database between start and end time
+\& my ($start,$step,$ds_names,$data) =
+\&     RRDs::fetch("target.rrd", "AVERAGE",
+\&                 "\-r", "600", "\-s", "$start_time", "\-e", "$end_time");
+\& # save fetched values in a 2\-dimensional array
+\& my $rows = 0;
+\& my $columns = 0;
+\& my $time_variable = $start;
+\& foreach $line (@$data) {
+\&   $vals[$rows][$columns] = $time_variable;
+\&   $time_variable = $time_variable + $step;
+\&   foreach $val (@$line) {
+\&           $vals[$rows][++$columns] = $val;}
+\&   $rows++;
+\&   $columns = 0;
+\& }
+\& my $tot_time = 0;
+\& my $count = 0;
+\& # save the values from the 2\-dimensional into a 1\-dimensional array
+\& for $i ( 0 .. $#vals ) {
+\&     $tot_mem[$count] = $vals[$i][1];
+\&     $count++;
+\& }
+\& my $tot_mem_sum = 0;
+\& # calculate the total of all values
+\& for $i ( 0 .. ($count\-1) ) {
+\&     $tot_mem_sum = $tot_mem_sum + $tot_mem[$i];
+\& }
+\& # calculate the average of the array
+\& my $tot_mem_ave = $tot_mem_sum/($count);
+\& # create the graph
+\& RRDs::graph ("/images/mem_$count.png",   \e
+\&             "\-\-title= Memory Usage",    \e
+\&             "\-\-vertical\-label=Memory Consumption (MB)", \e
+\&             "\-\-start=$start_time",      \e
+\&             "\-\-end=$end_time",          \e
+\&             "\-\-color=BACK#CCCCCC",      \e
+\&             "\-\-color=CANVAS#CCFFFF",    \e
+\&             "\-\-color=SHADEB#9999CC",    \e
+\&             "\-\-height=125",             \e
+\&             "\-\-upper\-limit=656",        \e
+\&             "\-\-lower\-limit=0",          \e
+\&             "\-\-rigid",                  \e
+\&             "\-\-base=1024",              \e
+\&             "DEF:tot_mem=target.rrd:mem:AVERAGE", \e
+\&             "CDEF:tot_mem_cor=tot_mem,0,671744,LIMIT,UN,0,tot_mem,IF,1024,/",\e
+\&             "CDEF:machine_mem=tot_mem,656,+,tot_mem,\-",\e
+\&             "COMMENT:Memory Consumption between $start_time",\e
+\&             "COMMENT:    and $end_time                     ",\e
+\&             "HRULE:656#000000:Maximum Available Memory \- 656 MB",\e
+\&             "AREA:machine_mem#CCFFFF:Memory Unused",   \e
+\&             "AREA:tot_mem_cor#6699CC:Total memory consumed in MB");
+\& my $err=RRDs::error;
+\& if ($err) {print "problem generating the graph: $err\en";}
+\& # print the output
+\& print "Average memory consumption is ";
+\& printf "%5.2f",$tot_mem_ave/1024;
+\& print " MB. Graphical representation can be found at /images/mem_$count.png.";
+.Ve
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Ketan Patel <k2pattu@yahoo.com>
diff --git a/doc/rrd-beginners.html b/doc/rrd-beginners.html
new file mode 100644 (file)
index 0000000..ca2d0c1
--- /dev/null
@@ -0,0 +1,354 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrd-beginners</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <ul>
+
+               <li><a href="#what_makes_rrdtool_so_special">What makes RRDtool so special?</a></li>
+               <li><a href="#understanding_by_an_example">Understanding by an example</a></li>
+               <li><a href="#graphical_magic">Graphical Magic</a></li>
+               <li><a href="#wrapping_rrdtool_within_shell_perl_script">Wrapping RRDtool within Shell/Perl script</a></li>
+               <ul>
+
+                       <li><a href="#shell_script__collects_data__updates_database_">Shell script (collects data, updates database)</a></li>
+                       <li><a href="#perl_script__retrieves_data_from_database_and_generates_graphs_and_statistics_">Perl script (retrieves data from database and generates graphs and statistics)</a></li>
+               </ul>
+
+       </ul>
+
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrd-beginners - RRDtool Beginners' Guide</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p>Helping new RRDtool users to understand the basics of RRDtool</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>This manual is an attempt to assist beginners in understanding the concepts
+of RRDtool. It sheds a light on differences between RRDtool and other
+databases. With help of an example, it explains the structure of RRDtool
+database. This is followed by an overview of the ``graph'' feature of RRDtool.
+At the end, it has sample scripts that illustrate the
+usage/wrapping of RRDtool within Shell or Perl scripts.</p>
+<p>
+</p>
+<h2><a name="what_makes_rrdtool_so_special">What makes RRDtool so special?</a></h2>
+<p>RRDtool is GNU licensed software developed by Tobias Oetiker, a system
+manager at the Swiss Federal Institute of Technology. Though it is a
+database, there are distinct differences between RRDtool databases and other
+databases as listed below:</p>
+<ul>
+<li>
+<p>RRDtool stores data; that makes it a back-end tool. The RRDtool command set
+allows the creation of graphs; that makes it a front-end tool as well. Other
+databases just store data and can not create graphs.</p>
+</li>
+<li>
+<p>In case of linear databases, new data gets appended at the bottom of
+the database table. Thus its size keeps on increasing, whereas the size of
+an RRDtool database is determined at creation time. Imagine an RRDtool
+database as the perimeter of a circle. Data is added along the
+perimeter. When new data reaches the starting point, it overwrites
+existing data. This way, the size of an RRDtool database always
+remains constant. The name ``Round Robin'' stems from this behavior.</p>
+</li>
+<li>
+<p>Other databases store the values as supplied. RRDtool can be configured to
+calculate the rate of change from the previous to the current value and
+store this information instead.</p>
+</li>
+<li>
+<p>Other databases get updated when values are supplied. The RRDtool database
+is structured in such a way that it needs data at predefined time
+intervals. If it does not get a new value during the interval, it stores an
+UNKNOWN value for that interval. So, when using the RRDtool database, it is
+imperative to use scripts that run at regular intervals to ensure a constant
+data flow to update the RRDtool database.</p>
+</li>
+</ul>
+<p>RRDtool is designed to store time series of data. With every data
+update, an associated time stamp is stored. Time is always expressed
+in seconds passed since epoch (01-01-1970). RRDtool can be installed
+on Unix as well as Windows. It comes with a command set to carry out
+various operations on RRD databases. This command set can be accessed
+from the command line, as well as from Shell or Perl scripts. The
+scripts act as wrappers for accessing data stored in RRDtool
+databases.</p>
+<p>
+</p>
+<h2><a name="understanding_by_an_example">Understanding by an example</a></h2>
+<p>The structure of an RRD database is different than other linear databases.
+Other databases define tables with columns, and many other parameters. These
+definitions sometimes are very complex, especially in large databases.
+RRDtool databases are primarily used for monitoring purposes and
+hence are very simple in structure. The parameters
+that need to be defined are variables that hold values and archives of those
+values. Being time sensitive, a couple of time related parameters are also
+defined. Because of its structure, the definition of an RRDtool database also
+includes a provision to specify specific actions to take in the absence of
+update values. Data Source (DS), heartbeat, Date Source Type (DST), Round
+Robin Archive (RRA), and Consolidation Function (CF) are some of the
+terminologies related to RRDtool databases.</p>
+<p>The structure of a database and the terminology associated with it can be
+best explained with an example.</p>
+<pre>
+ rrdtool create target.rrd \
+         --start 1023654125 \
+         --step 300 \
+         DS:mem:GAUGE:600:0:671744 \
+         RRA:AVERAGE:0.5:12:24 \
+         RRA:AVERAGE:0.5:288:31</pre>
+<p>This example creates a database named <em>target.rrd</em>. Start time
+(1'023'654'125) is specified in total number of seconds since epoch
+(time in seconds since 01-01-1970). While updating the database, the
+update time is also specified.  This update time MUST be large (later)
+then start time and MUST be in seconds since epoch.</p>
+<p>The step of 300 seconds indicates that database expects new values every
+300 seconds. The wrapper script should be scheduled to run every <strong>step</strong>
+seconds so that it updates the database every <strong>step</strong> seconds.</p>
+<p>DS (Data Source) is the actual variable which relates to the parameter on
+the device that is monitored. Its syntax is</p>
+<pre>
+ DS:variable_name:DST:heartbeat:min:max</pre>
+<p><strong>DS</strong> is a key word. <code>variable_name</code> is a name under which the parameter is
+saved in the database. There can be as many DSs in a database as needed. After
+every step interval, a new value of DS is supplied to update the database.
+This value is also called Primary Data Point <strong>(PDP)</strong>. In our example
+mentioned above, a new PDP is generated every 300 seconds.</p>
+<p>Note, that if you do NOT supply new datapoints exactly every 300 seconds,
+this is not a problem, RRDtool will interpolate the data accordingly.</p>
+<p><strong>DST</strong> (Data Source Type) defines the type of the DS. It can be
+COUNTER, DERIVE, ABSOLUTE, GAUGE. A DS declared as COUNTER will save
+the rate of change of the value over a step period. This assumes that
+the value is always increasing (the difference between the current and
+the previous value is greater than 0). Traffic counters on a router
+are an ideal candidate for using COUNTER as DST. DERIVE is the same as
+COUNTER, but it allows negative values as well. If you want to see the
+rate of <em>change</em> in free diskspace on your server, then you might
+want to use the DERIVE data type. ABSOLUTE also saves the rate of
+change, but it assumes that the previous value is set to 0. The
+difference between the current and the previous value is always equal
+to the current value. Thus it just stores the current value divided by
+the step interval (300 seconds in our example). GAUGE does not save
+the rate of change. It saves the actual value itself. There are no
+divisions or calculations. Memory consumption in a server is a typical
+example of gauge. The difference between the different types DSTs can be
+explained better with the following example:</p>
+<pre>
+ Values       = 300, 600, 900, 1200
+ Step         = 300 seconds
+ COUNTER DS   =    1,  1,   1,    1
+ DERIVE DS    =    1,  1,   1,    1
+ ABSOLUTE DS  =    1,  2,   3,    4
+ GAUGE DS     = 300, 600, 900, 1200</pre>
+<p>The next parameter is <strong>heartbeat</strong>. In our example, heartbeat is 600
+seconds. If the database does not get a new PDP within 300 seconds, it
+will wait for another 300 seconds (total 600 seconds).  If it doesn't
+receive any PDP within 600 seconds, it will save an UNKNOWN value into
+the database. This UNKNOWN value is a special feature of RRDtool - it
+is much better than to assume a missing value was 0 (zero) or any
+other number which might also be a valid data value.  For example, the
+traffic flow counter on a router keeps increasing. Lets say, a value
+is missed for an interval and 0 is stored instead of UNKNOWN. Now when
+the next value becomes available, it will calculate the difference
+between the current value and the previous value (0) which is not
+correct. So, inserting the value UNKNOWN makes much more sense here.</p>
+<p>The next two parameters are the minimum and maximum value,
+respectively. If the variable to be stored has predictable maximum and
+minimum values, this should be specified here. Any update value
+falling out of this range will be stored as UNKNOWN.</p>
+<p>The next line declares a round robin archive (RRA). The syntax for
+declaring an RRA is</p>
+<pre>
+ RRA:CF:xff:step:rows</pre>
+<p>RRA is the keyword to declare RRAs. The consolidation function (CF)
+can be AVERAGE, MINIMUM, MAXIMUM, and LAST. The concept of the
+consolidated data point (CDP) comes into the picture here. A CDP is
+CFed (averaged, maximum/minimum value or last value) from <em>step</em>
+number of PDPs. This RRA will hold <em>rows</em> CDPs.</p>
+<p>Lets have a look at the example above. For the first RRA, 12 (steps)
+PDPs (DS variables) are AVERAGEed (CF) to form one CDP. 24 (rows) of
+theses CDPs are archived. Each PDP occurs at 300 seconds. 12 PDPs
+represent 12 times 300 seconds which is 1 hour. It means 1 CDP (which
+is equal to 12 PDPs) represents data worth 1 hour. 24 such CDPs
+represent 1 day (1 hour times 24 CDPs). This means, this RRA is an
+archive for one day. After 24 CDPs, CDP number 25 will replace the 1st
+CDP. The second RRA saves 31 CDPs; each CPD represents an AVERAGE
+value for a day (288 PDPs, each covering 300 seconds = 24
+hours). Therefore this RRA is an archive for one month. A single
+database can have many RRAs. If there are multiple DSs, each
+individual RRA will save data for all the DSs in the database. For
+example, if a database has 3 DSs and daily, weekly, monthly, and
+yearly RRAs are declared, then each RRA will hold data from all 3 data
+sources.</p>
+<p>
+</p>
+<h2><a name="graphical_magic">Graphical Magic</a></h2>
+<p>Another important feature of RRDtool is its ability to create
+graphs. The ``graph'' command uses the ``fetch'' command internally to
+retrieve values from the database. With the retrieved values it draws
+graphs as defined by the parameters supplied on the command line. A
+single graph can show different DS (Data Sources) from a database. It
+is also possible to show the values from more than one database in a
+single graph. Often, it is necessary to perform some math on the
+values retrieved from the database before plotting them. For example,
+in SNMP replies, memory consumption values are usually specified in
+KBytes and traffic flow on interfaces is specified in Bytes. Graphs
+for these values will be more meaningful if values are represented in
+MBytes and mbps. The RRDtool graph command allows to define such
+conversions. Apart from mathematical calculations, it is also possible
+to perform logical operations such as greater than, less than, and
+if/then/else. If a database contains more than one RRA archive, then a
+question may arise - how does RRDtool decide which RRA archive to use
+for retrieving the values? RRDtool looks at several things when making
+its choice. First it makes sure that the RRA covers as much of the
+graphing time frame as possible. Second it looks at the resolution of
+the RRA compared to the resolution of the graph. It tries to find one
+which has the same or higher better resolution. With the ``-r'' option
+you can force RRDtool to assume a different resolution than the one
+calculated from the pixel width of the graph.</p>
+<p>Values of different variables can be presented in 5 different shapes
+in a graph - AREA, LINE1, LINE2, LINE3, and STACK. AREA is represented
+by a solid colored area with values as the boundary of this
+area. LINE1/2/3 (increasing width) are just plain lines representing
+the values. STACK is also an area but it is ``stack''ed on top AREA or
+LINE1/2/3. Another important thing to note is that variables are
+plotted in the order they are defined in the graph command. Therefore
+care must be taken to define STACK only after defining AREA/LINE. It
+is also possible to put formatted comments within the graph.  Detailed
+instructions can be found in the graph manual.</p>
+<p>
+</p>
+<h2><a name="wrapping_rrdtool_within_shell_perl_script">Wrapping RRDtool within Shell/Perl script</a></h2>
+<p>After understanding RRDtool it is now a time to actually use RRDtool
+in scripts. Tasks involved in network management are data collection,
+data storage, and data retrieval. In the following example, the
+previously created target.rrd database is used. Data collection and
+data storage is done using Shell scripts. Data retrieval and report
+generation is done using Perl scripts. These scripts are shown below:</p>
+<p>
+</p>
+<h3><a name="shell_script__collects_data__updates_database_">Shell script (collects data, updates database)</a></h3>
+<pre>
+ #!/bin/sh
+ a=0
+ while [ &quot;$a&quot; == 0 ]; do
+ snmpwalk -c public 192.168.1.250 hrSWRunPerfMem &gt; snmp_reply
+     total_mem=`awk 'BEGIN {tot_mem=0}
+                           { if ($NF == &quot;KBytes&quot;)
+                             {tot_mem=tot_mem+$(NF-1)}
+                           }
+                     END {print tot_mem}' snmp_reply`
+     # I can use N as a replacement for the current time
+     rrdtool update target.rrd N:$total_mem
+     # sleep until the next 300 seconds are full
+     perl -e 'sleep 300 - time % 300'
+ done # end of while loop</pre>
+<p>
+</p>
+<h3><a name="perl_script__retrieves_data_from_database_and_generates_graphs_and_statistics_">Perl script (retrieves data from database and generates graphs and statistics)</a></h3>
+<pre>
+ #!/usr/bin/perl -w
+ # This script fetches data from target.rrd, creates a graph of memory
+ # consumption on the target (Dual P3 Processor 1 GHz, 656 MB RAM)</pre>
+<pre>
+ # call the RRD perl module
+ use lib qw( /usr/local/rrdtool-1.0.41/lib/perl ../lib/perl );
+ use RRDs;
+ my $cur_time = time();                # set current time
+ my $end_time = $cur_time - 86400;     # set end time to 24 hours ago
+ my $start_time = $end_time - 2592000; # set start 30 days in the past</pre>
+<pre>
+ # fetch average values from the RRD database between start and end time
+ my ($start,$step,$ds_names,$data) =
+     RRDs::fetch(&quot;target.rrd&quot;, &quot;AVERAGE&quot;,
+                 &quot;-r&quot;, &quot;600&quot;, &quot;-s&quot;, &quot;$start_time&quot;, &quot;-e&quot;, &quot;$end_time&quot;);
+ # save fetched values in a 2-dimensional array
+ my $rows = 0;
+ my $columns = 0;
+ my $time_variable = $start;
+ foreach $line (@$data) {
+   $vals[$rows][$columns] = $time_variable;
+   $time_variable = $time_variable + $step;
+   foreach $val (@$line) {
+           $vals[$rows][++$columns] = $val;}
+   $rows++;
+   $columns = 0;
+ }
+ my $tot_time = 0;
+ my $count = 0;
+ # save the values from the 2-dimensional into a 1-dimensional array
+ for $i ( 0 .. $#vals ) {
+     $tot_mem[$count] = $vals[$i][1];
+     $count++;
+ }
+ my $tot_mem_sum = 0;
+ # calculate the total of all values
+ for $i ( 0 .. ($count-1) ) {
+     $tot_mem_sum = $tot_mem_sum + $tot_mem[$i];
+ }
+ # calculate the average of the array
+ my $tot_mem_ave = $tot_mem_sum/($count);
+ # create the graph
+ RRDs::graph (&quot;/images/mem_$count.png&quot;,   \
+             &quot;--title= Memory Usage&quot;,    \
+             &quot;--vertical-label=Memory Consumption (MB)&quot;, \
+             &quot;--start=$start_time&quot;,      \
+             &quot;--end=$end_time&quot;,          \
+             &quot;--color=BACK#CCCCCC&quot;,      \
+             &quot;--color=CANVAS#CCFFFF&quot;,    \
+             &quot;--color=SHADEB#9999CC&quot;,    \
+             &quot;--height=125&quot;,             \
+             &quot;--upper-limit=656&quot;,        \
+             &quot;--lower-limit=0&quot;,          \
+             &quot;--rigid&quot;,                  \
+             &quot;--base=1024&quot;,              \
+             &quot;DEF:tot_mem=target.rrd:mem:AVERAGE&quot;, \
+             &quot;CDEF:tot_mem_cor=tot_mem,0,671744,LIMIT,UN,0,tot_mem,IF,1024,/&quot;,\
+             &quot;CDEF:machine_mem=tot_mem,656,+,tot_mem,-&quot;,\
+             &quot;COMMENT:Memory Consumption between $start_time&quot;,\
+             &quot;COMMENT:    and $end_time                     &quot;,\
+             &quot;HRULE:656#000000:Maximum Available Memory - 656 MB&quot;,\
+             &quot;AREA:machine_mem#CCFFFF:Memory Unused&quot;,   \
+             &quot;AREA:tot_mem_cor#6699CC:Total memory consumed in MB&quot;);
+ my $err=RRDs::error;
+ if ($err) {print &quot;problem generating the graph: $err\n&quot;;}
+ # print the output
+ print &quot;Average memory consumption is &quot;;
+ printf &quot;%5.2f&quot;,$tot_mem_ave/1024;
+ print &quot; MB. Graphical representation can be found at /images/mem_$count.png.&quot;;</pre>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Ketan Patel &lt;<a href="mailto:k2pattu@yahoo.com">k2pattu@yahoo.com</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrd-beginners.pod b/doc/rrd-beginners.pod
new file mode 100644 (file)
index 0000000..5ac7997
--- /dev/null
@@ -0,0 +1,326 @@
+=head1 NAME
+
+rrd-beginners - RRDtool Beginners' Guide
+
+=head1 SYNOPSIS
+
+Helping new RRDtool users to understand the basics of RRDtool
+
+=head1 DESCRIPTION
+
+This manual is an attempt to assist beginners in understanding the concepts
+of RRDtool. It sheds a light on differences between RRDtool and other
+databases. With help of an example, it explains the structure of RRDtool
+database. This is followed by an overview of the "graph" feature of RRDtool.
+At the end, it has sample scripts that illustrate the
+usage/wrapping of RRDtool within Shell or Perl scripts.
+
+=head2 What makes RRDtool so special?
+
+RRDtool is GNU licensed software developed by Tobias Oetiker, a system
+manager at the Swiss Federal Institute of Technology. Though it is a
+database, there are distinct differences between RRDtool databases and other
+databases as listed below:
+
+=over
+
+=item *
+
+RRDtool stores data; that makes it a back-end tool. The RRDtool command set
+allows the creation of graphs; that makes it a front-end tool as well. Other
+databases just store data and can not create graphs.
+
+=item *
+
+In case of linear databases, new data gets appended at the bottom of
+the database table. Thus its size keeps on increasing, whereas the size of
+an RRDtool database is determined at creation time. Imagine an RRDtool
+database as the perimeter of a circle. Data is added along the
+perimeter. When new data reaches the starting point, it overwrites
+existing data. This way, the size of an RRDtool database always
+remains constant. The name "Round Robin" stems from this behavior.
+
+=item *
+
+Other databases store the values as supplied. RRDtool can be configured to
+calculate the rate of change from the previous to the current value and
+store this information instead.
+
+=item *
+
+Other databases get updated when values are supplied. The RRDtool database
+is structured in such a way that it needs data at predefined time
+intervals. If it does not get a new value during the interval, it stores an
+UNKNOWN value for that interval. So, when using the RRDtool database, it is
+imperative to use scripts that run at regular intervals to ensure a constant
+data flow to update the RRDtool database.
+
+=back
+
+RRDtool is designed to store time series of data. With every data
+update, an associated time stamp is stored. Time is always expressed
+in seconds passed since epoch (01-01-1970). RRDtool can be installed
+on Unix as well as Windows. It comes with a command set to carry out
+various operations on RRD databases. This command set can be accessed
+from the command line, as well as from Shell or Perl scripts. The
+scripts act as wrappers for accessing data stored in RRDtool
+databases.
+
+=head2 Understanding by an example
+
+The structure of an RRD database is different than other linear databases.
+Other databases define tables with columns, and many other parameters. These
+definitions sometimes are very complex, especially in large databases.
+RRDtool databases are primarily used for monitoring purposes and
+hence are very simple in structure. The parameters
+that need to be defined are variables that hold values and archives of those
+values. Being time sensitive, a couple of time related parameters are also
+defined. Because of its structure, the definition of an RRDtool database also
+includes a provision to specify specific actions to take in the absence of
+update values. Data Source (DS), heartbeat, Date Source Type (DST), Round
+Robin Archive (RRA), and Consolidation Function (CF) are some of the
+terminologies related to RRDtool databases.
+
+The structure of a database and the terminology associated with it can be
+best explained with an example.
+
+ rrdtool create target.rrd \
+         --start 1023654125 \
+         --step 300 \
+         DS:mem:GAUGE:600:0:671744 \
+         RRA:AVERAGE:0.5:12:24 \
+         RRA:AVERAGE:0.5:288:31
+
+This example creates a database named F<target.rrd>. Start time
+(1'023'654'125) is specified in total number of seconds since epoch
+(time in seconds since 01-01-1970). While updating the database, the
+update time is also specified.  This update time MUST be large (later)
+then start time and MUST be in seconds since epoch.
+
+The step of 300 seconds indicates that database expects new values every
+300 seconds. The wrapper script should be scheduled to run every B<step>
+seconds so that it updates the database every B<step> seconds.
+
+DS (Data Source) is the actual variable which relates to the parameter on
+the device that is monitored. Its syntax is
+
+ DS:variable_name:DST:heartbeat:min:max
+
+B<DS> is a key word. C<variable_name> is a name under which the parameter is
+saved in the database. There can be as many DSs in a database as needed. After
+every step interval, a new value of DS is supplied to update the database.
+This value is also called Primary Data Point B<(PDP)>. In our example
+mentioned above, a new PDP is generated every 300 seconds.
+
+Note, that if you do NOT supply new datapoints exactly every 300 seconds,
+this is not a problem, RRDtool will interpolate the data accordingly.
+
+B<DST> (Data Source Type) defines the type of the DS. It can be
+COUNTER, DERIVE, ABSOLUTE, GAUGE. A DS declared as COUNTER will save
+the rate of change of the value over a step period. This assumes that
+the value is always increasing (the difference between the current and
+the previous value is greater than 0). Traffic counters on a router
+are an ideal candidate for using COUNTER as DST. DERIVE is the same as
+COUNTER, but it allows negative values as well. If you want to see the
+rate of I<change> in free diskspace on your server, then you might
+want to use the DERIVE data type. ABSOLUTE also saves the rate of
+change, but it assumes that the previous value is set to 0. The
+difference between the current and the previous value is always equal
+to the current value. Thus it just stores the current value divided by
+the step interval (300 seconds in our example). GAUGE does not save
+the rate of change. It saves the actual value itself. There are no
+divisions or calculations. Memory consumption in a server is a typical
+example of gauge. The difference between the different types DSTs can be
+explained better with the following example:
+
+ Values       = 300, 600, 900, 1200
+ Step         = 300 seconds
+ COUNTER DS   =    1,  1,   1,    1
+ DERIVE DS    =    1,  1,   1,    1
+ ABSOLUTE DS  =    1,  2,   3,    4
+ GAUGE DS     = 300, 600, 900, 1200
+
+The next parameter is B<heartbeat>. In our example, heartbeat is 600
+seconds. If the database does not get a new PDP within 300 seconds, it
+will wait for another 300 seconds (total 600 seconds).  If it doesn't
+receive any PDP within 600 seconds, it will save an UNKNOWN value into
+the database. This UNKNOWN value is a special feature of RRDtool - it
+is much better than to assume a missing value was 0 (zero) or any
+other number which might also be a valid data value.  For example, the
+traffic flow counter on a router keeps increasing. Lets say, a value
+is missed for an interval and 0 is stored instead of UNKNOWN. Now when
+the next value becomes available, it will calculate the difference
+between the current value and the previous value (0) which is not
+correct. So, inserting the value UNKNOWN makes much more sense here.
+
+The next two parameters are the minimum and maximum value,
+respectively. If the variable to be stored has predictable maximum and
+minimum values, this should be specified here. Any update value
+falling out of this range will be stored as UNKNOWN.
+
+The next line declares a round robin archive (RRA). The syntax for
+declaring an RRA is
+
+ RRA:CF:xff:step:rows
+
+RRA is the keyword to declare RRAs. The consolidation function (CF)
+can be AVERAGE, MINIMUM, MAXIMUM, and LAST. The concept of the
+consolidated data point (CDP) comes into the picture here. A CDP is
+CFed (averaged, maximum/minimum value or last value) from I<step>
+number of PDPs. This RRA will hold I<rows> CDPs.
+
+Lets have a look at the example above. For the first RRA, 12 (steps)
+PDPs (DS variables) are AVERAGEed (CF) to form one CDP. 24 (rows) of
+theses CDPs are archived. Each PDP occurs at 300 seconds. 12 PDPs
+represent 12 times 300 seconds which is 1 hour. It means 1 CDP (which
+is equal to 12 PDPs) represents data worth 1 hour. 24 such CDPs
+represent 1 day (1 hour times 24 CDPs). This means, this RRA is an
+archive for one day. After 24 CDPs, CDP number 25 will replace the 1st
+CDP. The second RRA saves 31 CDPs; each CPD represents an AVERAGE
+value for a day (288 PDPs, each covering 300 seconds = 24
+hours). Therefore this RRA is an archive for one month. A single
+database can have many RRAs. If there are multiple DSs, each
+individual RRA will save data for all the DSs in the database. For
+example, if a database has 3 DSs and daily, weekly, monthly, and
+yearly RRAs are declared, then each RRA will hold data from all 3 data
+sources.
+
+=head2 Graphical Magic
+
+Another important feature of RRDtool is its ability to create
+graphs. The "graph" command uses the "fetch" command internally to
+retrieve values from the database. With the retrieved values it draws
+graphs as defined by the parameters supplied on the command line. A
+single graph can show different DS (Data Sources) from a database. It
+is also possible to show the values from more than one database in a
+single graph. Often, it is necessary to perform some math on the
+values retrieved from the database before plotting them. For example,
+in SNMP replies, memory consumption values are usually specified in
+KBytes and traffic flow on interfaces is specified in Bytes. Graphs
+for these values will be more meaningful if values are represented in
+MBytes and mbps. The RRDtool graph command allows to define such
+conversions. Apart from mathematical calculations, it is also possible
+to perform logical operations such as greater than, less than, and
+if/then/else. If a database contains more than one RRA archive, then a
+question may arise - how does RRDtool decide which RRA archive to use
+for retrieving the values? RRDtool looks at several things when making
+its choice. First it makes sure that the RRA covers as much of the
+graphing time frame as possible. Second it looks at the resolution of
+the RRA compared to the resolution of the graph. It tries to find one
+which has the same or higher better resolution. With the "-r" option
+you can force RRDtool to assume a different resolution than the one
+calculated from the pixel width of the graph.
+
+Values of different variables can be presented in 5 different shapes
+in a graph - AREA, LINE1, LINE2, LINE3, and STACK. AREA is represented
+by a solid colored area with values as the boundary of this
+area. LINE1/2/3 (increasing width) are just plain lines representing
+the values. STACK is also an area but it is "stack"ed on top AREA or
+LINE1/2/3. Another important thing to note is that variables are
+plotted in the order they are defined in the graph command. Therefore
+care must be taken to define STACK only after defining AREA/LINE. It
+is also possible to put formatted comments within the graph.  Detailed
+instructions can be found in the graph manual.
+
+=head2 Wrapping RRDtool within Shell/Perl script
+
+After understanding RRDtool it is now a time to actually use RRDtool
+in scripts. Tasks involved in network management are data collection,
+data storage, and data retrieval. In the following example, the
+previously created target.rrd database is used. Data collection and
+data storage is done using Shell scripts. Data retrieval and report
+generation is done using Perl scripts. These scripts are shown below:
+
+=head3 Shell script (collects data, updates database)
+
+ #!/bin/sh
+ a=0
+ while [ "$a" == 0 ]; do
+ snmpwalk -c public 192.168.1.250 hrSWRunPerfMem > snmp_reply
+     total_mem=`awk 'BEGIN {tot_mem=0}
+                           { if ($NF == "KBytes")
+                             {tot_mem=tot_mem+$(NF-1)}
+                           }
+                     END {print tot_mem}' snmp_reply`
+     # I can use N as a replacement for the current time
+     rrdtool update target.rrd N:$total_mem
+     # sleep until the next 300 seconds are full
+     perl -e 'sleep 300 - time % 300'
+ done # end of while loop
+
+=head3 Perl script (retrieves data from database and generates graphs and statistics)
+
+ #!/usr/bin/perl -w
+ # This script fetches data from target.rrd, creates a graph of memory
+ # consumption on the target (Dual P3 Processor 1 GHz, 656 MB RAM)
+
+ # call the RRD perl module
+ use lib qw( /usr/local/rrdtool-1.0.41/lib/perl ../lib/perl );
+ use RRDs;
+ my $cur_time = time();                # set current time
+ my $end_time = $cur_time - 86400;     # set end time to 24 hours ago
+ my $start_time = $end_time - 2592000; # set start 30 days in the past
+
+ # fetch average values from the RRD database between start and end time
+ my ($start,$step,$ds_names,$data) =
+     RRDs::fetch("target.rrd", "AVERAGE",
+                 "-r", "600", "-s", "$start_time", "-e", "$end_time");
+ # save fetched values in a 2-dimensional array
+ my $rows = 0;
+ my $columns = 0;
+ my $time_variable = $start;
+ foreach $line (@$data) {
+   $vals[$rows][$columns] = $time_variable;
+   $time_variable = $time_variable + $step;
+   foreach $val (@$line) {
+           $vals[$rows][++$columns] = $val;}
+   $rows++;
+   $columns = 0;
+ }
+ my $tot_time = 0;
+ my $count = 0;
+ # save the values from the 2-dimensional into a 1-dimensional array
+ for $i ( 0 .. $#vals ) {
+     $tot_mem[$count] = $vals[$i][1];
+     $count++;
+ }
+ my $tot_mem_sum = 0;
+ # calculate the total of all values
+ for $i ( 0 .. ($count-1) ) {
+     $tot_mem_sum = $tot_mem_sum + $tot_mem[$i];
+ }
+ # calculate the average of the array
+ my $tot_mem_ave = $tot_mem_sum/($count);
+ # create the graph
+ RRDs::graph ("/images/mem_$count.png",   \
+             "--title= Memory Usage",    \
+             "--vertical-label=Memory Consumption (MB)", \
+             "--start=$start_time",      \
+             "--end=$end_time",          \
+             "--color=BACK#CCCCCC",      \
+             "--color=CANVAS#CCFFFF",    \
+             "--color=SHADEB#9999CC",    \
+             "--height=125",             \
+             "--upper-limit=656",       \
+             "--lower-limit=0",          \
+             "--rigid",                  \
+             "--base=1024",              \
+             "DEF:tot_mem=target.rrd:mem:AVERAGE", \
+             "CDEF:tot_mem_cor=tot_mem,0,671744,LIMIT,UN,0,tot_mem,IF,1024,/",\
+             "CDEF:machine_mem=tot_mem,656,+,tot_mem,-",\
+             "COMMENT:Memory Consumption between $start_time",\
+             "COMMENT:    and $end_time                     ",\
+             "HRULE:656#000000:Maximum Available Memory - 656 MB",\
+             "AREA:machine_mem#CCFFFF:Memory Unused",   \
+             "AREA:tot_mem_cor#6699CC:Total memory consumed in MB");
+ my $err=RRDs::error;
+ if ($err) {print "problem generating the graph: $err\n";}
+ # print the output
+ print "Average memory consumption is ";
+ printf "%5.2f",$tot_mem_ave/1024;
+ print " MB. Graphical representation can be found at /images/mem_$count.png.";
+
+=head1 AUTHOR
+
+Ketan Patel E<lt>k2pattu@yahoo.comE<gt>
+
diff --git a/doc/rrd-beginners.txt b/doc/rrd-beginners.txt
new file mode 100644 (file)
index 0000000..dad5251
--- /dev/null
@@ -0,0 +1,321 @@
+RRD-BEGINNERS(1)                    rrdtool                   RRD-BEGINNERS(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrd-beginners - RRDtool Beginners' Guide
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       Helping new RRDtool users to understand the basics of RRDtool
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       This manual is an attempt to assist beginners in understanding the con-
+       cepts of RRDtool. It sheds a light on differences between RRDtool and
+       other databases. With help of an example, it explains the structure of
+       RRDtool database. This is followed by an overview of the "graph" fea-
+       ture of RRDtool.  At the end, it has sample scripts that illustrate the
+       usage/wrapping of RRDtool within Shell or Perl scripts.
+
+       W\bWh\bha\bat\bt m\bma\bak\bke\bes\bs R\bRR\bRD\bDt\bto\boo\bol\bl s\bso\bo s\bsp\bpe\bec\bci\bia\bal\bl?\b?
+
+       RRDtool is GNU licensed software developed by Tobias Oetiker, a system
+       manager at the Swiss Federal Institute of Technology. Though it is a
+       database, there are distinct differences between RRDtool databases and
+       other databases as listed below:
+
+       Â·   RRDtool stores data; that makes it a back-end tool. The RRDtool
+           command set allows the creation of graphs; that makes it a front-
+           end tool as well. Other databases just store data and can not cre-
+           ate graphs.
+
+       Â·   In case of linear databases, new data gets appended at the bottom
+           of the database table. Thus its size keeps on increasing, whereas
+           the size of an RRDtool database is determined at creation time.
+           Imagine an RRDtool database as the perimeter of a circle. Data is
+           added along the perimeter. When new data reaches the starting
+           point, it overwrites existing data. This way, the size of an RRD-
+           tool database always remains constant. The name "Round Robin" stems
+           from this behavior.
+
+       Â·   Other databases store the values as supplied. RRDtool can be con-
+           figured to calculate the rate of change from the previous to the
+           current value and store this information instead.
+
+       Â·   Other databases get updated when values are supplied. The RRDtool
+           database is structured in such a way that it needs data at prede-
+           fined time intervals. If it does not get a new value during the
+           interval, it stores an UNKNOWN value for that interval. So, when
+           using the RRDtool database, it is imperative to use scripts that
+           run at regular intervals to ensure a constant data flow to update
+           the RRDtool database.
+
+       RRDtool is designed to store time series of data. With every data
+       update, an associated time stamp is stored. Time is always expressed in
+       seconds passed since epoch (01-01-1970). RRDtool can be installed on
+       Unix as well as Windows. It comes with a command set to carry out vari-
+       ous operations on RRD databases. This command set can be accessed from
+       the command line, as well as from Shell or Perl scripts. The scripts
+       act as wrappers for accessing data stored in RRDtool databases.
+
+       U\bUn\bnd\bde\ber\brs\bst\bta\ban\bnd\bdi\bin\bng\bg b\bby\by a\ban\bn e\bex\bxa\bam\bmp\bpl\ble\be
+
+       The structure of an RRD database is different than other linear
+       databases.  Other databases define tables with columns, and many other
+       parameters. These definitions sometimes are very complex, especially in
+       large databases.  RRDtool databases are primarily used for monitoring
+       purposes and hence are very simple in structure. The parameters that
+       need to be defined are variables that hold values and archives of those
+       values. Being time sensitive, a couple of time related parameters are
+       also defined. Because of its structure, the definition of an RRDtool
+       database also includes a provision to specify specific actions to take
+       in the absence of update values. Data Source (DS), heartbeat, Date
+       Source Type (DST), Round Robin Archive (RRA), and Consolidation Func-
+       tion (CF) are some of the terminologies related to RRDtool databases.
+
+       The structure of a database and the terminology associated with it can
+       be best explained with an example.
+
+        rrdtool create target.rrd \
+                --start 1023654125 \
+                --step 300 \
+                DS:mem:GAUGE:600:0:671744 \
+                RRA:AVERAGE:0.5:12:24 \
+                RRA:AVERAGE:0.5:288:31
+
+       This example creates a database named _\bt_\ba_\br_\bg_\be_\bt_\b._\br_\br_\bd. Start time
+       (1'023'654'125) is specified in total number of seconds since epoch
+       (time in seconds since 01-01-1970). While updating the database, the
+       update time is also specified.  This update time MUST be large (later)
+       then start time and MUST be in seconds since epoch.
+
+       The step of 300 seconds indicates that database expects new values
+       every 300 seconds. The wrapper script should be scheduled to run every
+       s\bst\bte\bep\bp seconds so that it updates the database every s\bst\bte\bep\bp seconds.
+
+       DS (Data Source) is the actual variable which relates to the parameter
+       on the device that is monitored. Its syntax is
+
+        DS:variable_name:DST:heartbeat:min:max
+
+       D\bDS\bS is a key word. "variable_name" is a name under which the parameter
+       is saved in the database. There can be as many DSs in a database as
+       needed. After every step interval, a new value of DS is supplied to
+       update the database.  This value is also called Primary Data Point
+       (\b(P\bPD\bDP\bP)\b). In our example mentioned above, a new PDP is generated every 300
+       seconds.
+
+       Note, that if you do NOT supply new datapoints exactly every 300 sec-
+       onds, this is not a problem, RRDtool will interpolate the data accord-
+       ingly.
+
+       D\bDS\bST\bT (Data Source Type) defines the type of the DS. It can be COUNTER,
+       DERIVE, ABSOLUTE, GAUGE. A DS declared as COUNTER will save the rate of
+       change of the value over a step period. This assumes that the value is
+       always increasing (the difference between the current and the previous
+       value is greater than 0). Traffic counters on a router are an ideal
+       candidate for using COUNTER as DST. DERIVE is the same as COUNTER, but
+       it allows negative values as well. If you want to see the rate of
+       _\bc_\bh_\ba_\bn_\bg_\be in free diskspace on your server, then you might want to use the
+       DERIVE data type. ABSOLUTE also saves the rate of change, but it
+       assumes that the previous value is set to 0. The difference between the
+       current and the previous value is always equal to the current value.
+       Thus it just stores the current value divided by the step interval (300
+       seconds in our example). GAUGE does not save the rate of change. It
+       saves the actual value itself. There are no divisions or calculations.
+       Memory consumption in a server is a typical example of gauge. The dif-
+       ference between the different types DSTs can be explained better with
+       the following example:
+
+        Values       = 300, 600, 900, 1200
+        Step         = 300 seconds
+        COUNTER DS   =    1,  1,   1,    1
+        DERIVE DS    =    1,  1,   1,    1
+        ABSOLUTE DS  =    1,  2,   3,    4
+        GAUGE DS     = 300, 600, 900, 1200
+
+       The next parameter is h\bhe\bea\bar\brt\btb\bbe\bea\bat\bt. In our example, heartbeat is 600 sec-
+       onds. If the database does not get a new PDP within 300 seconds, it
+       will wait for another 300 seconds (total 600 seconds).  If it doesn't
+       receive any PDP within 600 seconds, it will save an UNKNOWN value into
+       the database. This UNKNOWN value is a special feature of RRDtool - it
+       is much better than to assume a missing value was 0 (zero) or any other
+       number which might also be a valid data value.  For example, the traf-
+       fic flow counter on a router keeps increasing. Lets say, a value is
+       missed for an interval and 0 is stored instead of UNKNOWN. Now when the
+       next value becomes available, it will calculate the difference between
+       the current value and the previous value (0) which is not correct. So,
+       inserting the value UNKNOWN makes much more sense here.
+
+       The next two parameters are the minimum and maximum value, respec-
+       tively. If the variable to be stored has predictable maximum and mini-
+       mum values, this should be specified here. Any update value falling out
+       of this range will be stored as UNKNOWN.
+
+       The next line declares a round robin archive (RRA). The syntax for
+       declaring an RRA is
+
+        RRA:CF:xff:step:rows
+
+       RRA is the keyword to declare RRAs. The consolidation function (CF) can
+       be AVERAGE, MINIMUM, MAXIMUM, and LAST. The concept of the consolidated
+       data point (CDP) comes into the picture here. A CDP is CFed (averaged,
+       maximum/minimum value or last value) from _\bs_\bt_\be_\bp number of PDPs. This RRA
+       will hold _\br_\bo_\bw_\bs CDPs.
+
+       Lets have a look at the example above. For the first RRA, 12 (steps)
+       PDPs (DS variables) are AVERAGEed (CF) to form one CDP. 24 (rows) of
+       theses CDPs are archived. Each PDP occurs at 300 seconds. 12 PDPs rep-
+       resent 12 times 300 seconds which is 1 hour. It means 1 CDP (which is
+       equal to 12 PDPs) represents data worth 1 hour. 24 such CDPs represent
+       1 day (1 hour times 24 CDPs). This means, this RRA is an archive for
+       one day. After 24 CDPs, CDP number 25 will replace the 1st CDP. The
+       second RRA saves 31 CDPs; each CPD represents an AVERAGE value for a
+       day (288 PDPs, each covering 300 seconds = 24 hours). Therefore this
+       RRA is an archive for one month. A single database can have many RRAs.
+       If there are multiple DSs, each individual RRA will save data for all
+       the DSs in the database. For example, if a database has 3 DSs and
+       daily, weekly, monthly, and yearly RRAs are declared, then each RRA
+       will hold data from all 3 data sources.
+
+       G\bGr\bra\bap\bph\bhi\bic\bca\bal\bl M\bMa\bag\bgi\bic\bc
+
+       Another important feature of RRDtool is its ability to create graphs.
+       The "graph" command uses the "fetch" command internally to retrieve
+       values from the database. With the retrieved values it draws graphs as
+       defined by the parameters supplied on the command line. A single graph
+       can show different DS (Data Sources) from a database. It is also possi-
+       ble to show the values from more than one database in a single graph.
+       Often, it is necessary to perform some math on the values retrieved
+       from the database before plotting them. For example, in SNMP replies,
+       memory consumption values are usually specified in KBytes and traffic
+       flow on interfaces is specified in Bytes. Graphs for these values will
+       be more meaningful if values are represented in MBytes and mbps. The
+       RRDtool graph command allows to define such conversions. Apart from
+       mathematical calculations, it is also possible to perform logical oper-
+       ations such as greater than, less than, and if/then/else. If a database
+       contains more than one RRA archive, then a question may arise - how
+       does RRDtool decide which RRA archive to use for retrieving the values?
+       RRDtool looks at several things when making its choice. First it makes
+       sure that the RRA covers as much of the graphing time frame as possi-
+       ble. Second it looks at the resolution of the RRA compared to the reso-
+       lution of the graph. It tries to find one which has the same or higher
+       better resolution. With the "-r" option you can force RRDtool to assume
+       a different resolution than the one calculated from the pixel width of
+       the graph.
+
+       Values of different variables can be presented in 5 different shapes in
+       a graph - AREA, LINE1, LINE2, LINE3, and STACK. AREA is represented by
+       a solid colored area with values as the boundary of this area.
+       LINE1/2/3 (increasing width) are just plain lines representing the val-
+       ues. STACK is also an area but it is "stack"ed on top AREA or
+       LINE1/2/3. Another important thing to note is that variables are plot-
+       ted in the order they are defined in the graph command. Therefore care
+       must be taken to define STACK only after defining AREA/LINE. It is also
+       possible to put formatted comments within the graph.  Detailed instruc-
+       tions can be found in the graph manual.
+
+       W\bWr\bra\bap\bpp\bpi\bin\bng\bg R\bRR\bRD\bDt\bto\boo\bol\bl w\bwi\bit\bth\bhi\bin\bn S\bSh\bhe\bel\bll\bl/\b/P\bPe\ber\brl\bl s\bsc\bcr\bri\bip\bpt\bt
+
+       After understanding RRDtool it is now a time to actually use RRDtool in
+       scripts. Tasks involved in network management are data collection, data
+       storage, and data retrieval. In the following example, the previously
+       created target.rrd database is used. Data collection and data storage
+       is done using Shell scripts. Data retrieval and report generation is
+       done using Perl scripts. These scripts are shown below:
+
+       _\bS_\bh_\be_\bl_\bl _\bs_\bc_\br_\bi_\bp_\bt _\b(_\bc_\bo_\bl_\bl_\be_\bc_\bt_\bs _\bd_\ba_\bt_\ba_\b, _\bu_\bp_\bd_\ba_\bt_\be_\bs _\bd_\ba_\bt_\ba_\bb_\ba_\bs_\be_\b)
+
+        #!/bin/sh
+        a=0
+        while [ "$a" == 0 ]; do
+        snmpwalk -c public 192.168.1.250 hrSWRunPerfMem > snmp_reply
+            total_mem=`awk 'BEGIN {tot_mem=0}
+                                  { if ($NF == "KBytes")
+                                    {tot_mem=tot_mem+$(NF-1)}
+                                  }
+                            END {print tot_mem}' snmp_reply`
+            # I can use N as a replacement for the current time
+            rrdtool update target.rrd N:$total_mem
+            # sleep until the next 300 seconds are full
+            perl -e 'sleep 300 - time % 300'
+        done # end of while loop
+
+       _\bP_\be_\br_\bl _\bs_\bc_\br_\bi_\bp_\bt _\b(_\br_\be_\bt_\br_\bi_\be_\bv_\be_\bs _\bd_\ba_\bt_\ba _\bf_\br_\bo_\bm _\bd_\ba_\bt_\ba_\bb_\ba_\bs_\be _\ba_\bn_\bd _\bg_\be_\bn_\be_\br_\ba_\bt_\be_\bs _\bg_\br_\ba_\bp_\bh_\bs _\ba_\bn_\bd
+       _\bs_\bt_\ba_\bt_\bi_\bs_\bt_\bi_\bc_\bs_\b)
+
+        #!/usr/bin/perl -w
+        # This script fetches data from target.rrd, creates a graph of memory
+        # consumption on the target (Dual P3 Processor 1 GHz, 656 MB RAM)
+
+        # call the RRD perl module
+        use lib qw( /usr/local/rrdtool-1.0.41/lib/perl ../lib/perl );
+        use RRDs;
+        my $cur_time = time();                # set current time
+        my $end_time = $cur_time - 86400;     # set end time to 24 hours ago
+        my $start_time = $end_time - 2592000; # set start 30 days in the past
+
+        # fetch average values from the RRD database between start and end time
+        my ($start,$step,$ds_names,$data) =
+            RRDs::fetch("target.rrd", "AVERAGE",
+                        "-r", "600", "-s", "$start_time", "-e", "$end_time");
+        # save fetched values in a 2-dimensional array
+        my $rows = 0;
+        my $columns = 0;
+        my $time_variable = $start;
+        foreach $line (@$data) {
+          $vals[$rows][$columns] = $time_variable;
+          $time_variable = $time_variable + $step;
+          foreach $val (@$line) {
+                  $vals[$rows][++$columns] = $val;}
+          $rows++;
+          $columns = 0;
+        }
+        my $tot_time = 0;
+        my $count = 0;
+        # save the values from the 2-dimensional into a 1-dimensional array
+        for $i ( 0 .. $#vals ) {
+            $tot_mem[$count] = $vals[$i][1];
+            $count++;
+        }
+        my $tot_mem_sum = 0;
+        # calculate the total of all values
+        for $i ( 0 .. ($count-1) ) {
+            $tot_mem_sum = $tot_mem_sum + $tot_mem[$i];
+        }
+        # calculate the average of the array
+        my $tot_mem_ave = $tot_mem_sum/($count);
+        # create the graph
+        RRDs::graph ("/images/mem_$count.png",   \
+                    "--title= Memory Usage",    \
+                    "--vertical-label=Memory Consumption (MB)", \
+                    "--start=$start_time",      \
+                    "--end=$end_time",          \
+                    "--color=BACK#CCCCCC",      \
+                    "--color=CANVAS#CCFFFF",    \
+                    "--color=SHADEB#9999CC",    \
+                    "--height=125",             \
+                    "--upper-limit=656",        \
+                    "--lower-limit=0",          \
+                    "--rigid",                  \
+                    "--base=1024",              \
+                    "DEF:tot_mem=target.rrd:mem:AVERAGE", \
+                    "CDEF:tot_mem_cor=tot_mem,0,671744,LIMIT,UN,0,tot_mem,IF,1024,/",\
+                    "CDEF:machine_mem=tot_mem,656,+,tot_mem,-",\
+                    "COMMENT:Memory Consumption between $start_time",\
+                    "COMMENT:    and $end_time                     ",\
+                    "HRULE:656#000000:Maximum Available Memory - 656 MB",\
+                    "AREA:machine_mem#CCFFFF:Memory Unused",   \
+                    "AREA:tot_mem_cor#6699CC:Total memory consumed in MB");
+        my $err=RRDs::error;
+        if ($err) {print "problem generating the graph: $err\n";}
+        # print the output
+        print "Average memory consumption is ";
+        printf "%5.2f",$tot_mem_ave/1024;
+        print " MB. Graphical representation can be found at /images/mem_$count.png.";
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Ketan Patel <k2pattu@yahoo.com>
+
+
+
+1.2.26                            2007-11-20                  RRD-BEGINNERS(1)
diff --git a/doc/rrdbuild.1 b/doc/rrdbuild.1
new file mode 100644 (file)
index 0000000..964629a
--- /dev/null
@@ -0,0 +1,341 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDBUILD 1"
+.TH RRDBUILD 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdbuild \- Instructions for building RRDtool
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+.Sh "Overview"
+.IX Subsection "Overview"
+If you downloaded the source of rrdtool you have to compile it. This
+document will give some information on how this is done.
+.PP
+RRDtool relies on services of thrid part libraries. Some of these libraries
+may already be installed on your system. You have to compile copies of the other
+ones before you can build RRDtool.
+.PP
+This document will tell you about all the necessary steps to get going.
+.Sh "Building"
+.IX Subsection "Building"
+Before you start to build RRDtool, you have to decide two things:
+.IP "1." 4
+In which directory you want to build the software.
+.IP "2." 4
+Where you want to install the software.
+.PP
+Once you have decided. Save the two locations into environment variables.
+Depending on the shell you are using, you can do either (bash,zsh):
+.PP
+.Vb 2
+\& BUILD_DIR=/tmp/rrdbuild
+\& INSTALL_DIR=/usr/local/rrdtool\-1.2.26
+.Ve
+.PP
+Or if you run tcsh:
+.PP
+.Vb 2
+\& set BUILD_DIR=/tmp/rrdbuild
+\& set INSTALL_DIR=/usr/local/rrdtool\-1.2.26
+.Ve
+.PP
+If your \fI/tmp\fR is mounted with the option noexec (\s-1RHEL\s0 seems todo that) you have to choose
+a different directory!
+.PP
+Now make sure the \s-1BUILD_DIR\s0 exists and go there:
+.PP
+.Vb 2
+\& mkdir \-p $BUILD_DIR
+\& cd $BUILD_DIR
+.Ve
+.PP
+Lets first assume you already have all the necessary libraries
+pre\-installed. Note that these instructions assume that your copies of
+\&\fBtar\fR and \fBmake\fR are actually \fB\s-1GNU\s0 tar\fR and \fB\s-1GNU\s0 make\fR respectively. It
+could be that they are installed as \fBgtar\fR and \fBgmake\fR on your system.
+.PP
+.Vb 4
+\& wget http://oss.oetiker.ch/rrdtool/pub/rrdtool\-1.2.26.tar.gz
+\& tar zxf rrdtool\-1.2.26.tar.gz
+\& cd rrdtool\-1.2.26
+\& ./configure \-\-prefix=$INSTALL_DIR && make && make install
+.Ve
+.PP
+Ok, this was very optimistic. This try will probably have ended with
+\&\fBconfigure\fR complaining about several missing libraries. If you are on a
+Linux or *bsd system you may want to just install the missing bits from your
+software repository. When you do that, make sure you also get the \fB\-dev\fR
+package for each library you install. Once you have the missing bits on
+board, just re-run the last line of the instructions above.
+.PP
+But again this may have been too optimistic, and you actually have to
+compile your own copies of the required libraries.
+.PP
+\fIBuild Tipps for \s-1AIX\s0\fR
+.IX Subsection "Build Tipps for AIX"
+.PP
+If you are woking with \s-1AIX\s0, you may find the the \fB\-\-disable\-shared\fR option
+will cause things to break for you. In that case you may have to install the
+shared libraries into the rrdtool \s-1PREFIX\s0 and work with \fB\-\-disable\-static\fR
+instead.
+.PP
+Another hint to get rrdtool working on \s-1AIX\s0 is to use the \s-1IBM\s0 \s-1XL\s0 C Compiler:
+.PP
+.Vb 2
+\& export CC=/usr/vac/bin/cc
+\& export PERLCC=$CC
+.Ve
+.PP
+(Better instructions for \s-1AIX\s0 welcome!)
+.Sh "Building Libraries"
+.IX Subsection "Building Libraries"
+In order to build the libraries you need a compiler on your system.
+Unfortunately compilers are not all alike. This has an effect on the \s-1CFLAGS\s0
+you want to set. The examples below are for the popular \s-1GCC\s0 compiler suite.
+If you have an other compile you have to use the following settings:
+.IP "Sun Forte" 4
+.IX Item "Sun Forte"
+.Vb 1
+\& CFLAGS="\-xO3 \-kPIC"
+.Ve
+.IP "Building zlib" 4
+.IX Item "Building zlib"
+.Vb 7
+\& cd $BUILD_DIR
+\& wget http://oss.oetiker.ch/rrdtool/pub/libs/zlib\-1.2.3.tar.gz
+\& tar  zxf zlib\-1.2.3.tar.gz
+\& cd zlib\-1.2.3
+\& env CFLAGS="\-O3 \-fPIC" ./configure \-\-prefix=$BUILD_DIR/lb
+\& make
+\& make install
+.Ve
+.IP "Building libpng" 4
+.IX Item "Building libpng"
+Libpng itself requires zlib to build, so we need to help a bit. If you
+already have a copy of zlib on your system (which is very likley) you can
+drop the settings of \s-1LDFLAGS\s0 and \s-1CPPFLAGS\s0. Note that the backslash (\e) at
+the end of line 4 means that line 4 and line 5 are on one line.
+.Sp
+.Vb 8
+\& cd $BUILD_DIR
+\& wget http://oss.oetiker.ch/rrdtool/pub/libs/libpng\-1.2.10.tar.gz
+\& tar zxvf libpng\-1.2.10.tar.gz
+\& cd libpng\-1.2.10
+\& env CPPFLAGS="\-I$BUILD_DIR/lb/include" LDFLAGS="\-L$BUILD_DIR/lb/lib" CFLAGS="\-O3 \-fPIC" \e
+\&     ./configure \-\-disable\-shared \-\-prefix=$BUILD_DIR/lb
+\& make
+\& make install
+.Ve
+.IP "Building freetype" 4
+.IX Item "Building freetype"
+.Vb 8
+\& cd $BUILD_DIR
+\& wget http://oss.oetiker.ch/rrdtool/pub/libs/freetype\-2.1.10.tar.bz2
+\& tar jxvf freetype\-2.1.10.tar.bz2
+\& cd freetype\-2.1.10
+\& env CPPFLAGS="\-I$BUILD_DIR/lb/include" LDFLAGS="\-L$BUILD_DIR/lb/lib" CFLAGS="\-O3 \-fPIC" \e
+\&     ./configure \-\-disable\-shared \-\-prefix=$BUILD_DIR/lb
+\& make
+\& make install
+.Ve
+.Sp
+If you run into problems building freetype on Solaris, you may want to try to
+add the following at the end of the configure line:
+.Sp
+.Vb 1
+\& GNUMAKE=gmake EGREP=egrep
+.Ve
+.IP "Building libart_lgpl" 4
+.IX Item "Building libart_lgpl"
+.Vb 7
+\& cd $BUILD_DIR
+\& wget http://oss.oetiker.ch/rrdtool/pub/libs/libart_lgpl\-2.3.17.tar.gz
+\& tar zxvf libart_lgpl\-2.3.17.tar.gz
+\& cd libart_lgpl\-2.3.17
+\& env CFLAGS="\-O3 \-fPIC" ./configure \-\-disable\-shared \-\-prefix=$BUILD_DIR/lb
+\& make
+\& make install
+.Ve
+.PP
+Now all the dependent libraries are built and you can try again. Since these
+are static libraries, you may have to use \fIranlib\fR to make them accessible.
+Especially \s-1BSD\s0 systems like Mac \s-1OS\s0 X may require this, Linux and Solaris
+will do just fine without since their \fIar\fR command does ranlibs job as well.
+.PP
+.Vb 1
+\& ranlib $BUILD_DIR/lb/lib/*.a
+.Ve
+.PP
+This time you tell configure where it should be looking for libraries and
+include files. This is done via environment variables. Depending on the
+shell you are running, the syntax for setting environment variables is
+different. Under csh/tcsh you use:
+.PP
+.Vb 4
+\& set IR=\-I$BUILD_DIR/lb/include
+\& setenv CPPFLAGS "$IR $IR/libart\-2.0 $IR/freetype2 $IR/libpng"
+\& setenv LDFLAGS  \-L$BUILD_DIR/lb/lib
+\& setenv CFLAGS \-O3
+.Ve
+.PP
+If you are running bash/sh/ash/ksh/zsh use this:
+.PP
+.Vb 5
+\& IR=\-I$BUILD_DIR/lb/include
+\& CPPFLAGS="$IR $IR/libart\-2.0 $IR/freetype2 $IR/libpng"
+\& LDFLAGS="\-L$BUILD_DIR/lb/lib"
+\& CFLAGS=\-O3
+\& export CPPFLAGS LDFLAGS CFLAGS
+.Ve
+.PP
+And finally try building again. We disable the python and tcl bindings
+because it seems that a fair number of people have ill configured python and
+tcl setups that would prevent rrdtool from building if they are included in
+their current state.
+.PP
+.Vb 5
+\& cd $BUILD_DIR/rrdtool\-1.2.26
+\& ./configure \-\-prefix=$INSTALL_DIR \-\-disable\-python \-\-disable\-tcl
+\& make clean
+\& make
+\& make install
+.Ve
+.PP
+\&\s-1SOLARIS\s0 \s-1HINT:\s0 if you want to build  the perl module for the native perl (the
+one shipping with solaris) you will need the sun forte compiler
+installed on your box or you have to hand-tune bindings/perl\-shared/Makefile
+while building!
+.PP
+Now go to \fI$INSTALL_DIR\fR\fB/share/rrdtool/examples/\fR and run them to see if your
+build has been successful.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Tobias Oetiker <tobi@oetiker.ch>
diff --git a/doc/rrdbuild.html b/doc/rrdbuild.html
new file mode 100644 (file)
index 0000000..2202ec7
--- /dev/null
@@ -0,0 +1,238 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdbuild</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <ul>
+
+               <li><a href="#overview">Overview</a></li>
+               <li><a href="#building">Building</a></li>
+               <ul>
+
+                       <li><a href="#build_tipps_for_aix">Build Tipps for AIX</a></li>
+               </ul>
+
+               <li><a href="#building_libraries">Building Libraries</a></li>
+       </ul>
+
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdbuild - Instructions for building RRDtool</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>
+</p>
+<h2><a name="overview">Overview</a></h2>
+<p>If you downloaded the source of rrdtool you have to compile it. This
+document will give some information on how this is done.</p>
+<p>RRDtool relies on services of thrid part libraries. Some of these libraries
+may already be installed on your system. You have to compile copies of the other
+ones before you can build RRDtool.</p>
+<p>This document will tell you about all the necessary steps to get going.</p>
+<p>
+</p>
+<h2><a name="building">Building</a></h2>
+<p>Before you start to build RRDtool, you have to decide two things:</p>
+<ol>
+<li>
+<p>In which directory you want to build the software.</p>
+</li>
+<li>
+<p>Where you want to install the software.</p>
+</li>
+</ol>
+<p>Once you have decided. Save the two locations into environment variables.
+Depending on the shell you are using, you can do either (bash,zsh):</p>
+<pre>
+ BUILD_DIR=/tmp/rrdbuild
+ INSTALL_DIR=/usr/local/rrdtool-1.2.26</pre>
+<p>Or if you run tcsh:</p>
+<pre>
+ set BUILD_DIR=/tmp/rrdbuild
+ set INSTALL_DIR=/usr/local/rrdtool-1.2.26</pre>
+<p>If your <em>/tmp</em> is mounted with the option noexec (RHEL seems todo that) you have to choose
+a different directory!</p>
+<p>Now make sure the BUILD_DIR exists and go there:</p>
+<pre>
+ mkdir -p $BUILD_DIR
+ cd $BUILD_DIR</pre>
+<p>Lets first assume you already have all the necessary libraries
+pre-installed. Note that these instructions assume that your copies of
+<strong>tar</strong> and <strong>make</strong> are actually <strong>GNU tar</strong> and <strong>GNU make</strong> respectively. It
+could be that they are installed as <strong>gtar</strong> and <strong>gmake</strong> on your system.</p>
+<pre>
+ wget <a href="http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.26.tar.gz">http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.26.tar.gz</a>
+ tar zxf rrdtool-1.2.26.tar.gz
+ cd rrdtool-1.2.26
+ ./configure --prefix=$INSTALL_DIR &amp;&amp; make &amp;&amp; make install</pre>
+<p>Ok, this was very optimistic. This try will probably have ended with
+<strong>configure</strong> complaining about several missing libraries. If you are on a
+Linux or *bsd system you may want to just install the missing bits from your
+software repository. When you do that, make sure you also get the <strong>-dev</strong>
+package for each library you install. Once you have the missing bits on
+board, just re-run the last line of the instructions above.</p>
+<p>But again this may have been too optimistic, and you actually have to
+compile your own copies of the required libraries.</p>
+<p>
+</p>
+<h3><a name="build_tipps_for_aix">Build Tipps for AIX</a></h3>
+<p>If you are woking with AIX, you may find the the <strong>--disable-shared</strong> option
+will cause things to break for you. In that case you may have to install the
+shared libraries into the rrdtool PREFIX and work with <strong>--disable-static</strong>
+instead.</p>
+<p>Another hint to get rrdtool working on AIX is to use the IBM XL C Compiler:</p>
+<pre>
+ export CC=/usr/vac/bin/cc
+ export PERLCC=$CC</pre>
+<p>(Better instructions for AIX welcome!)</p>
+<p>
+</p>
+<h2><a name="building_libraries">Building Libraries</a></h2>
+<p>In order to build the libraries you need a compiler on your system.
+Unfortunately compilers are not all alike. This has an effect on the CFLAGS
+you want to set. The examples below are for the popular GCC compiler suite.
+If you have an other compile you have to use the following settings:</p>
+<dl>
+<dt><strong><a name="item_sun_forte">Sun Forte</a></strong>
+
+<dd>
+<pre>
+ CFLAGS=&quot;-xO3 -kPIC&quot;</pre>
+</dd>
+</dl>
+<dl>
+<dt><strong><a name="item_building_zlib">Building zlib</a></strong>
+
+<dd>
+<pre>
+ cd $BUILD_DIR
+ wget <a href="http://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz">http://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz</a>
+ tar  zxf zlib-1.2.3.tar.gz
+ cd zlib-1.2.3
+ env CFLAGS=&quot;-O3 -fPIC&quot; ./configure --prefix=$BUILD_DIR/lb
+ make
+ make install</pre>
+</dd>
+<dt><strong><a name="item_building_libpng">Building libpng</a></strong>
+
+<dd>
+<p>Libpng itself requires zlib to build, so we need to help a bit. If you
+already have a copy of zlib on your system (which is very likley) you can
+drop the settings of LDFLAGS and CPPFLAGS. Note that the backslash (\) at
+the end of line 4 means that line 4 and line 5 are on one line.</p>
+</dd>
+<dd>
+<pre>
+ cd $BUILD_DIR
+ wget <a href="http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.10.tar.gz">http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.10.tar.gz</a>
+ tar zxvf libpng-1.2.10.tar.gz
+ cd libpng-1.2.10
+ env CPPFLAGS=&quot;-I$BUILD_DIR/lb/include&quot; LDFLAGS=&quot;-L$BUILD_DIR/lb/lib&quot; CFLAGS=&quot;-O3 -fPIC&quot; \
+     ./configure --disable-shared --prefix=$BUILD_DIR/lb
+ make
+ make install</pre>
+</dd>
+</li>
+<dt><strong><a name="item_building_freetype">Building freetype</a></strong>
+
+<dd>
+<pre>
+ cd $BUILD_DIR
+ wget <a href="http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.1.10.tar.bz2">http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.1.10.tar.bz2</a>
+ tar jxvf freetype-2.1.10.tar.bz2
+ cd freetype-2.1.10
+ env CPPFLAGS=&quot;-I$BUILD_DIR/lb/include&quot; LDFLAGS=&quot;-L$BUILD_DIR/lb/lib&quot; CFLAGS=&quot;-O3 -fPIC&quot; \
+     ./configure --disable-shared --prefix=$BUILD_DIR/lb
+ make
+ make install</pre>
+</dd>
+<dd>
+<p>If you run into problems building freetype on Solaris, you may want to try to
+add the following at the end of the configure line:</p>
+</dd>
+<dd>
+<pre>
+ GNUMAKE=gmake EGREP=egrep</pre>
+</dd>
+<dt><strong><a name="item_building_libart_lgpl">Building libart_lgpl</a></strong>
+
+<dd>
+<pre>
+ cd $BUILD_DIR
+ wget <a href="http://oss.oetiker.ch/rrdtool/pub/libs/libart_lgpl-2.3.17.tar.gz">http://oss.oetiker.ch/rrdtool/pub/libs/libart_lgpl-2.3.17.tar.gz</a>
+ tar zxvf libart_lgpl-2.3.17.tar.gz
+ cd libart_lgpl-2.3.17
+ env CFLAGS=&quot;-O3 -fPIC&quot; ./configure --disable-shared --prefix=$BUILD_DIR/lb
+ make
+ make install</pre>
+</dd>
+</dl>
+<p>Now all the dependent libraries are built and you can try again. Since these
+are static libraries, you may have to use <em>ranlib</em> to make them accessible.
+Especially BSD systems like Mac OS X may require this, Linux and Solaris
+will do just fine without since their <em>ar</em> command does ranlibs job as well.</p>
+<pre>
+ ranlib $BUILD_DIR/lb/lib/*.a</pre>
+<p>This time you tell configure where it should be looking for libraries and
+include files. This is done via environment variables. Depending on the
+shell you are running, the syntax for setting environment variables is
+different. Under csh/tcsh you use:</p>
+<pre>
+ set IR=-I$BUILD_DIR/lb/include
+ setenv CPPFLAGS &quot;$IR $IR/libart-2.0 $IR/freetype2 $IR/libpng&quot;
+ setenv LDFLAGS  -L$BUILD_DIR/lb/lib
+ setenv CFLAGS -O3</pre>
+<p>If you are running bash/sh/ash/ksh/zsh use this:</p>
+<pre>
+ IR=-I$BUILD_DIR/lb/include
+ CPPFLAGS=&quot;$IR $IR/libart-2.0 $IR/freetype2 $IR/libpng&quot;
+ LDFLAGS=&quot;-L$BUILD_DIR/lb/lib&quot;
+ CFLAGS=-O3
+ export CPPFLAGS LDFLAGS CFLAGS</pre>
+<p>And finally try building again. We disable the python and tcl bindings
+because it seems that a fair number of people have ill configured python and
+tcl setups that would prevent rrdtool from building if they are included in
+their current state.</p>
+<pre>
+ cd $BUILD_DIR/rrdtool-1.2.26
+ ./configure --prefix=$INSTALL_DIR --disable-python --disable-tcl
+ make clean
+ make
+ make install</pre>
+<p>SOLARIS HINT: if you want to build  the perl module for the native perl (the
+one shipping with solaris) you will need the sun forte compiler
+installed on your box or you have to hand-tune bindings/perl-shared/Makefile
+while building!</p>
+<p>Now go to <em>$INSTALL_DIR</em><strong>/share/rrdtool/examples/</strong> and run them to see if your
+build has been successful.</p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdbuild.pod b/doc/rrdbuild.pod
new file mode 100644 (file)
index 0000000..07ac7eb
--- /dev/null
@@ -0,0 +1,205 @@
+=head1 NAME
+
+rrdbuild - Instructions for building RRDtool
+
+=head1 DESCRIPTION
+
+=head2 Overview
+
+If you downloaded the source of rrdtool you have to compile it. This
+document will give some information on how this is done.
+
+RRDtool relies on services of thrid part libraries. Some of these libraries
+may already be installed on your system. You have to compile copies of the other
+ones before you can build RRDtool.
+
+This document will tell you about all the necessary steps to get going.
+
+=head2 Building
+
+Before you start to build RRDtool, you have to decide two things:
+
+=over
+
+=item 1.
+
+In which directory you want to build the software.
+
+=item 2.
+
+Where you want to install the software.
+
+=back
+
+Once you have decided. Save the two locations into environment variables.
+Depending on the shell you are using, you can do either (bash,zsh):
+
+ BUILD_DIR=/tmp/rrdbuild
+ INSTALL_DIR=/usr/local/rrdtool-1.2.26
+
+Or if you run tcsh:
+
+ set BUILD_DIR=/tmp/rrdbuild
+ set INSTALL_DIR=/usr/local/rrdtool-1.2.26
+
+If your F</tmp> is mounted with the option noexec (RHEL seems todo that) you have to choose
+a different directory!
+
+Now make sure the BUILD_DIR exists and go there:
+
+ mkdir -p $BUILD_DIR
+ cd $BUILD_DIR
+
+Lets first assume you already have all the necessary libraries
+pre-installed. Note that these instructions assume that your copies of
+B<tar> and B<make> are actually B<GNU tar> and B<GNU make> respectively. It
+could be that they are installed as B<gtar> and B<gmake> on your system.
+
+ wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.26.tar.gz
+ tar zxf rrdtool-1.2.26.tar.gz
+ cd rrdtool-1.2.26
+ ./configure --prefix=$INSTALL_DIR && make && make install
+
+Ok, this was very optimistic. This try will probably have ended with
+B<configure> complaining about several missing libraries. If you are on a
+Linux or *bsd system you may want to just install the missing bits from your
+software repository. When you do that, make sure you also get the B<-dev>
+package for each library you install. Once you have the missing bits on
+board, just re-run the last line of the instructions above.
+
+But again this may have been too optimistic, and you actually have to
+compile your own copies of the required libraries.
+
+=head3 Build Tipps for AIX
+
+If you are woking with AIX, you may find the the B<--disable-shared> option
+will cause things to break for you. In that case you may have to install the
+shared libraries into the rrdtool PREFIX and work with B<--disable-static>
+instead.
+
+Another hint to get rrdtool working on AIX is to use the IBM XL C Compiler:
+
+ export CC=/usr/vac/bin/cc
+ export PERLCC=$CC
+
+(Better instructions for AIX welcome!)
+
+=head2 Building Libraries
+
+In order to build the libraries you need a compiler on your system.
+Unfortunately compilers are not all alike. This has an effect on the CFLAGS
+you want to set. The examples below are for the popular GCC compiler suite.
+If you have an other compile you have to use the following settings:
+
+=over
+
+=item Sun Forte
+
+ CFLAGS="-xO3 -kPIC"
+
+=back
+
+=over 
+
+=item Building zlib
+
+ cd $BUILD_DIR
+ wget http://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz
+ tar  zxf zlib-1.2.3.tar.gz
+ cd zlib-1.2.3
+ env CFLAGS="-O3 -fPIC" ./configure --prefix=$BUILD_DIR/lb
+ make
+ make install
+
+=item Building libpng
+
+Libpng itself requires zlib to build, so we need to help a bit. If you
+already have a copy of zlib on your system (which is very likley) you can
+drop the settings of LDFLAGS and CPPFLAGS. Note that the backslash (\) at
+the end of line 4 means that line 4 and line 5 are on one line.
+
+ cd $BUILD_DIR
+ wget http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.10.tar.gz
+ tar zxvf libpng-1.2.10.tar.gz
+ cd libpng-1.2.10
+ env CPPFLAGS="-I$BUILD_DIR/lb/include" LDFLAGS="-L$BUILD_DIR/lb/lib" CFLAGS="-O3 -fPIC" \
+     ./configure --disable-shared --prefix=$BUILD_DIR/lb
+ make
+ make install
+
+=item Building freetype
+
+ cd $BUILD_DIR
+ wget http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.1.10.tar.bz2
+ tar jxvf freetype-2.1.10.tar.bz2
+ cd freetype-2.1.10
+ env CPPFLAGS="-I$BUILD_DIR/lb/include" LDFLAGS="-L$BUILD_DIR/lb/lib" CFLAGS="-O3 -fPIC" \
+     ./configure --disable-shared --prefix=$BUILD_DIR/lb
+ make
+ make install
+
+If you run into problems building freetype on Solaris, you may want to try to
+add the following at the end of the configure line:
+
+ GNUMAKE=gmake EGREP=egrep
+
+=item Building libart_lgpl
+
+ cd $BUILD_DIR
+ wget http://oss.oetiker.ch/rrdtool/pub/libs/libart_lgpl-2.3.17.tar.gz
+ tar zxvf libart_lgpl-2.3.17.tar.gz
+ cd libart_lgpl-2.3.17
+ env CFLAGS="-O3 -fPIC" ./configure --disable-shared --prefix=$BUILD_DIR/lb
+ make
+ make install
+
+=back
+
+Now all the dependent libraries are built and you can try again. Since these
+are static libraries, you may have to use F<ranlib> to make them accessible.
+Especially BSD systems like Mac OS X may require this, Linux and Solaris
+will do just fine without since their F<ar> command does ranlibs job as well.
+
+ ranlib $BUILD_DIR/lb/lib/*.a
+
+This time you tell configure where it should be looking for libraries and
+include files. This is done via environment variables. Depending on the
+shell you are running, the syntax for setting environment variables is
+different. Under csh/tcsh you use:
+
+ set IR=-I$BUILD_DIR/lb/include
+ setenv CPPFLAGS "$IR $IR/libart-2.0 $IR/freetype2 $IR/libpng"
+ setenv LDFLAGS  -L$BUILD_DIR/lb/lib
+ setenv CFLAGS -O3
+
+If you are running bash/sh/ash/ksh/zsh use this:
+
+ IR=-I$BUILD_DIR/lb/include
+ CPPFLAGS="$IR $IR/libart-2.0 $IR/freetype2 $IR/libpng"
+ LDFLAGS="-L$BUILD_DIR/lb/lib"
+ CFLAGS=-O3
+ export CPPFLAGS LDFLAGS CFLAGS
+
+And finally try building again. We disable the python and tcl bindings
+because it seems that a fair number of people have ill configured python and
+tcl setups that would prevent rrdtool from building if they are included in
+their current state.
+
+ cd $BUILD_DIR/rrdtool-1.2.26
+ ./configure --prefix=$INSTALL_DIR --disable-python --disable-tcl
+ make clean
+ make
+ make install
+
+SOLARIS HINT: if you want to build  the perl module for the native perl (the
+one shipping with solaris) you will need the sun forte compiler
+installed on your box or you have to hand-tune bindings/perl-shared/Makefile
+while building!
+
+Now go to I<$INSTALL_DIR>B</share/rrdtool/examples/> and run them to see if your
+build has been successful.
+
+=head1 AUTHOR
+
+Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
+
diff --git a/doc/rrdbuild.txt b/doc/rrdbuild.txt
new file mode 100644 (file)
index 0000000..7749d99
--- /dev/null
@@ -0,0 +1,193 @@
+RRDBUILD(1)                         rrdtool                        RRDBUILD(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdbuild - Instructions for building RRDtool
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       O\bOv\bve\ber\brv\bvi\bie\bew\bw
+
+       If you downloaded the source of rrdtool you have to compile it. This
+       document will give some information on how this is done.
+
+       RRDtool relies on services of thrid part libraries. Some of these
+       libraries may already be installed on your system. You have to compile
+       copies of the other ones before you can build RRDtool.
+
+       This document will tell you about all the necessary steps to get going.
+
+       B\bBu\bui\bil\bld\bdi\bin\bng\bg
+
+       Before you start to build RRDtool, you have to decide two things:
+
+       1.  In which directory you want to build the software.
+
+       2.  Where you want to install the software.
+
+       Once you have decided. Save the two locations into environment vari-
+       ables.  Depending on the shell you are using, you can do either
+       (bash,zsh):
+
+        BUILD_DIR=/tmp/rrdbuild
+        INSTALL_DIR=/usr/local/rrdtool-1.2.26
+
+       Or if you run tcsh:
+
+        set BUILD_DIR=/tmp/rrdbuild
+        set INSTALL_DIR=/usr/local/rrdtool-1.2.26
+
+       If your _\b/_\bt_\bm_\bp is mounted with the option noexec (RHEL seems todo that)
+       you have to choose a different directory!
+
+       Now make sure the BUILD_DIR exists and go there:
+
+        mkdir -p $BUILD_DIR
+        cd $BUILD_DIR
+
+       Lets first assume you already have all the necessary libraries
+       pre-installed. Note that these instructions assume that your copies of
+       t\bta\bar\br and m\bma\bak\bke\be are actually G\bGN\bNU\bU t\bta\bar\br and G\bGN\bNU\bU m\bma\bak\bke\be respectively. It could
+       be that they are installed as g\bgt\bta\bar\br and g\bgm\bma\bak\bke\be on your system.
+
+        wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.26.tar.gz
+        tar zxf rrdtool-1.2.26.tar.gz
+        cd rrdtool-1.2.26
+        ./configure --prefix=$INSTALL_DIR && make && make install
+
+       Ok, this was very optimistic. This try will probably have ended with
+       c\bco\bon\bnf\bfi\big\bgu\bur\bre\be complaining about several missing libraries. If you are on a
+       Linux or *bsd system you may want to just install the missing bits from
+       your software repository. When you do that, make sure you also get the
+       -\b-d\bde\bev\bv package for each library you install. Once you have the missing
+       bits on board, just re-run the last line of the instructions above.
+
+       But again this may have been too optimistic, and you actually have to
+       compile your own copies of the required libraries.
+
+       _\bB_\bu_\bi_\bl_\bd _\bT_\bi_\bp_\bp_\bs _\bf_\bo_\br _\bA_\bI_\bX
+
+       If you are woking with AIX, you may find the the -\b--\b-d\bdi\bis\bsa\bab\bbl\ble\be-\b-s\bsh\bha\bar\bre\bed\bd
+       option will cause things to break for you. In that case you may have to
+       install the shared libraries into the rrdtool PREFIX and work with
+       -\b--\b-d\bdi\bis\bsa\bab\bbl\ble\be-\b-s\bst\bta\bat\bti\bic\bc instead.
+
+       Another hint to get rrdtool working on AIX is to use the IBM XL C Com-
+       piler:
+
+        export CC=/usr/vac/bin/cc
+        export PERLCC=$CC
+
+       (Better instructions for AIX welcome!)
+
+       B\bBu\bui\bil\bld\bdi\bin\bng\bg L\bLi\bib\bbr\bra\bar\bri\bie\bes\bs
+
+       In order to build the libraries you need a compiler on your system.
+       Unfortunately compilers are not all alike. This has an effect on the
+       CFLAGS you want to set. The examples below are for the popular GCC com-
+       piler suite.  If you have an other compile you have to use the follow-
+       ing settings:
+
+       Sun Forte
+            CFLAGS="-xO3 -kPIC"
+
+       Building zlib
+            cd $BUILD_DIR
+            wget http://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz
+            tar  zxf zlib-1.2.3.tar.gz
+            cd zlib-1.2.3
+            env CFLAGS="-O3 -fPIC" ./configure --prefix=$BUILD_DIR/lb
+            make
+            make install
+
+       Building libpng
+           Libpng itself requires zlib to build, so we need to help a bit. If
+           you already have a copy of zlib on your system (which is very lik-
+           ley) you can drop the settings of LDFLAGS and CPPFLAGS. Note that
+           the backslash (\) at the end of line 4 means that line 4 and line 5
+           are on one line.
+
+            cd $BUILD_DIR
+            wget http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.10.tar.gz
+            tar zxvf libpng-1.2.10.tar.gz
+            cd libpng-1.2.10
+            env CPPFLAGS="-I$BUILD_DIR/lb/include" LDFLAGS="-L$BUILD_DIR/lb/lib" CFLAGS="-O3 -fPIC" \
+                ./configure --disable-shared --prefix=$BUILD_DIR/lb
+            make
+            make install
+
+       Building freetype
+            cd $BUILD_DIR
+            wget http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.1.10.tar.bz2
+            tar jxvf freetype-2.1.10.tar.bz2
+            cd freetype-2.1.10
+            env CPPFLAGS="-I$BUILD_DIR/lb/include" LDFLAGS="-L$BUILD_DIR/lb/lib" CFLAGS="-O3 -fPIC" \
+                ./configure --disable-shared --prefix=$BUILD_DIR/lb
+            make
+            make install
+
+           If you run into problems building freetype on Solaris, you may want
+           to try to add the following at the end of the configure line:
+
+            GNUMAKE=gmake EGREP=egrep
+
+       Building libart_lgpl
+            cd $BUILD_DIR
+            wget http://oss.oetiker.ch/rrdtool/pub/libs/libart_lgpl-2.3.17.tar.gz
+            tar zxvf libart_lgpl-2.3.17.tar.gz
+            cd libart_lgpl-2.3.17
+            env CFLAGS="-O3 -fPIC" ./configure --disable-shared --prefix=$BUILD_DIR/lb
+            make
+            make install
+
+       Now all the dependent libraries are built and you can try again. Since
+       these are static libraries, you may have to use _\br_\ba_\bn_\bl_\bi_\bb to make them
+       accessible.  Especially BSD systems like Mac OS X may require this,
+       Linux and Solaris will do just fine without since their _\ba_\br command does
+       ranlibs job as well.
+
+        ranlib $BUILD_DIR/lb/lib/*.a
+
+       This time you tell configure where it should be looking for libraries
+       and include files. This is done via environment variables. Depending on
+       the shell you are running, the syntax for setting environment variables
+       is different. Under csh/tcsh you use:
+
+        set IR=-I$BUILD_DIR/lb/include
+        setenv CPPFLAGS "$IR $IR/libart-2.0 $IR/freetype2 $IR/libpng"
+        setenv LDFLAGS  -L$BUILD_DIR/lb/lib
+        setenv CFLAGS -O3
+
+       If you are running bash/sh/ash/ksh/zsh use this:
+
+        IR=-I$BUILD_DIR/lb/include
+        CPPFLAGS="$IR $IR/libart-2.0 $IR/freetype2 $IR/libpng"
+        LDFLAGS="-L$BUILD_DIR/lb/lib"
+        CFLAGS=-O3
+        export CPPFLAGS LDFLAGS CFLAGS
+
+       And finally try building again. We disable the python and tcl bindings
+       because it seems that a fair number of people have ill configured
+       python and tcl setups that would prevent rrdtool from building if they
+       are included in their current state.
+
+        cd $BUILD_DIR/rrdtool-1.2.26
+        ./configure --prefix=$INSTALL_DIR --disable-python --disable-tcl
+        make clean
+        make
+        make install
+
+       SOLARIS HINT: if you want to build  the perl module for the native perl
+       (the one shipping with solaris) you will need the sun forte compiler
+       installed on your box or you have to hand-tune bind-
+       ings/perl-shared/Makefile while building!
+
+       Now go to _\b$_\bI_\bN_\bS_\bT_\bA_\bL_\bL_\b__\bD_\bI_\bR/\b/s\bsh\bha\bar\bre\be/\b/r\brr\brd\bdt\bto\boo\bol\bl/\b/e\bex\bxa\bam\bmp\bpl\ble\bes\bs/\b/ and run them to see if
+       your build has been successful.
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Tobias Oetiker <tobi@oetiker.ch>
+
+
+
+1.2.26                            2007-11-20                       RRDBUILD(1)
diff --git a/doc/rrdcgi.1 b/doc/rrdcgi.1
new file mode 100644 (file)
index 0000000..5be0d12
--- /dev/null
@@ -0,0 +1,336 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDCGI 1"
+.TH RRDCGI 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdcgi \- Create web pages containing RRD graphs based on templates
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\f(CW\*(C`#!/path/to/\*(C'\fR\fBrrdcgi\fR [\fB\-\-filter\fR]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fBrrdcgi\fR is a sort of very limited script interpreter. Its purpose
+is to run as a cgi-program and parse a web page template containing special
+<\s-1RRD::\s0 tags. \fBrrdcgi\fR will interpret and act according to these tags.
+In the end it will printout a web page including the necessary \s-1CGI\s0 headers.
+.PP
+\&\fBrrdcgi\fR parses the contents of the template in 3 steps. In each step it looks
+only for a subset of tags. This allows nesting of tags.
+.PP
+The argument parser uses the same semantics as you are used from your C\-shell.
+.IP "\fB\-\-filter\fR" 8
+.IX Item "--filter"
+Assume that rrdcgi is run as a filter and not as a cgi.
+.Sh "Keywords"
+.IX Subsection "Keywords"
+.IP "\s-1RRD::CV\s0 \fIname\fR" 8
+.IX Item "RRD::CV name"
+Inserts the \s-1CGI\s0 variable of the given name.
+.IP "\s-1RRD::CV::QUOTE\s0 \fIname\fR" 8
+.IX Item "RRD::CV::QUOTE name"
+Inserts the \s-1CGI\s0 variable of the given name but quotes it, ready for
+use as an argument in another \s-1RRD::\s0 tag. So even when there are spaces in the
+value of the \s-1CGI\s0 variable it will still be considered to be one argument.
+.IP "\s-1RRD::CV::PATH\s0 \fIname\fR" 8
+.IX Item "RRD::CV::PATH name"
+Inserts the \s-1CGI\s0 variable of the given name, quotes it and makes sure
+it starts neither with a '/' nor contains '..'. This is to make
+sure that no problematic pathnames can be introduced through the
+\&\s-1CGI\s0 interface.
+.IP "\s-1RRD::GETENV\s0 \fIvariable\fR" 8
+.IX Item "RRD::GETENV variable"
+Get the value of an environment variable.
+.Sp
+.Vb 1
+\& <RRD::GETENV REMOTE_USER>
+.Ve
+.Sp
+might give you the name of the remote user given you are using
+some sort of access control on the directory.
+.IP "\s-1RRD::GOODFOR\s0 \fIseconds\fR" 8
+.IX Item "RRD::GOODFOR seconds"
+Specify the number of seconds this page should remain valid. This will prompt
+the rrdcgi to output a Last\-Modified, an Expire and if the number of
+seconds is \fInegative\fR a Refresh header.
+.IP "\s-1RRD::INCLUDE\s0 \fIfilename\fR" 8
+.IX Item "RRD::INCLUDE filename"
+Include the contents of the specified file into the page returned from the cgi.
+.IP "\s-1RRD::SETENV\s0 \fIvariable\fR \fIvalue\fR" 8
+.IX Item "RRD::SETENV variable value"
+If you want to present your graphs in another time zone than your own, you
+could use
+.Sp
+.Vb 1
+\& <RRD::SETENV TZ UTC>
+.Ve
+.Sp
+to make sure everything is presented in Universal Time. Note that the
+values permitted to \s-1TZ\s0 depend on your \s-1OS\s0.
+.IP "\s-1RRD::SETVAR\s0 \fIvariable\fR \fIvalue\fR" 8
+.IX Item "RRD::SETVAR variable value"
+Analog to \s-1SETENV\s0 but for local variables.
+.IP "\s-1RRD::GETVAR\s0 \fIvariable\fR" 8
+.IX Item "RRD::GETVAR variable"
+Analog to \s-1GETENV\s0 but for local variables.
+.IP "\s-1RRD::TIME::LAST\s0 \fIrrd-file\fR \fIstrftime-format\fR" 8
+.IX Item "RRD::TIME::LAST rrd-file strftime-format"
+This gets replaced by the last modification time of the selected \s-1RRD\s0. The
+time is \fIstrftime\fR\-formatted with the string specified in the second argument.
+.IP "\s-1RRD::TIME::NOW\s0 \fIstrftime-format\fR" 8
+.IX Item "RRD::TIME::NOW strftime-format"
+This gets replaced by the current time of day. The time is
+\&\fIstrftime\fR\-formatted with the string specified in the argument.
+.Sp
+Note that if you return : (colons) from your strftime format you may
+have to escape them using \e if the time is to be used as an argument
+to a \s-1GRAPH\s0 command.
+.IP "\s-1RRD::TIME::STRFTIME\s0 \fISTART|END\fR \fIstart-spec\fR \fIend-spec\fR \fIstrftime-format\fR" 8
+.IX Item "RRD::TIME::STRFTIME START|END start-spec end-spec strftime-format"
+This gets replaced by a strftime-formatted time using the format
+\&\fIstrftime-format\fR on either \fIstart-spec\fR or \fIend-spec\fR depending on
+whether \fI\s-1START\s0\fR or \fI\s-1END\s0\fR is specified.  Both \fIstart-spec\fR and \fIend-spec\fR
+must be supplied as either could be relative to the other.  This is intended
+to allow pretty titles on graphs with times that are easier for non RRDtool
+folks to figure out than \*(L"\-2weeks\*(R".
+.Sp
+Note that again, if you return : (colon) from your strftime format,
+you may have to escape them using \e if the time is to be used as an
+argument to a \s-1GRAPH\s0 command.
+.IP "\s-1RRD::GRAPH\s0 \fIrrdgraph arguments\fR" 8
+.IX Item "RRD::GRAPH rrdgraph arguments"
+This tag creates the \s-1RRD\s0 graph defined by its argument and then is
+replaced by an appropriate <\s-1IMG\s0 ... > tag referring to the graph.
+The \fB\-\-lazy\fR option in \s-1RRD\s0 graph can be used to make sure that graphs
+are only regenerated when they are out of date. The arguments
+to the \fB\s-1RRD::GRAPH\s0\fR tag work as described in the \fBrrdgraph\fR manual page.
+.Sp
+Use the \fB\-\-lazy\fR option in your \s-1RRD::GRAPH\s0 tags, to reduce the load
+on your server. This option makes sure that graphs are only regenerated when
+the old ones are out of date.
+.Sp
+If you do not specify your own \fB\-\-imginfo\fR format, the following will
+be used:
+.Sp
+.Vb 1
+\& <IMG SRC="%s" WIDTH="%lu" HEIGHT="%lu">
+.Ve
+.Sp
+Note that \f(CW%s\fR stands for the filename part of the graph generated, all
+directories given in the \s-1PNG\s0 file argument will get dropped.
+.IP "\s-1RRD::PRINT\s0 \fInumber\fR" 8
+.IX Item "RRD::PRINT number"
+If the preceding  \fB\s-1RRD::GRAPH\s0\fR tag contained and \fB\s-1PRINT\s0\fR arguments,
+then you can access their output with this tag. The \fInumber\fR argument refers to the
+number of the \fB\s-1PRINT\s0\fR argument. This first \fB\s-1PRINT\s0\fR has \fInumber\fR 0.
+.IP "\s-1RRD::INTERNAL\s0 <var>" 8
+.IX Item "RRD::INTERNAL <var>"
+This tag gets replaced by an internal var. Currently these vars are known:
+\&\s-1VERSION\s0, \s-1COMPILETIME\s0.
+These vars represent the compiled-in values. 
+.SH "EXAMPLE 1"
+.IX Header "EXAMPLE 1"
+The example below creates a web pages with a single \s-1RRD\s0 graph.
+.PP
+.Vb 9
+\& #!/usr/local/bin/rrdcgi
+\& <HTML>
+\& <HEAD><TITLE>RRDCGI Demo</TITLE></HEAD>
+\& <BODY>
+\& <H1>RRDCGI Example Page</H1>
+\& <P>
+\& <RRD::GRAPH demo.png \-\-lazy \-\-title="Temperatures"
+\&          DEF:cel=demo.rrd:exhaust:AVERAGE
+\&          LINE2:cel#00a000:"D. Celsius">
+.Ve
+.PP
+.Vb 3
+\& </P>
+\& </BODY>
+\& </HTML>
+.Ve
+.SH "EXAMPLE 2"
+.IX Header "EXAMPLE 2"
+This script is slightly more elaborate, it allows you to run it from
+a form which sets \s-1RRD_NAME\s0. \s-1RRD_NAME\s0 is then used to select which \s-1RRD\s0
+you want to use as source for your graph.
+.PP
+.Vb 15
+\& #!/usr/local/bin/rrdcgi
+\& <HTML>
+\& <HEAD><TITLE>RRDCGI Demo</TITLE></HEAD>
+\& <BODY>
+\& <H1>RRDCGI Example Page for <RRD::CV RRD_NAME></H1>
+\& <H2>Selection</H2>
+\& <FORM><INPUT NAME=RRD_NAME TYPE=RADIO VALUE=roomA> Room A,
+\&       <INPUT NAME=RRD_NAME TYPE=RADIO VALUE=roomB> Room B.
+\&       <INPUT TYPE=SUBMIT></FORM>
+\& <H2>Graph</H2>
+\& <P>
+\& <RRD::GRAPH <RRD::CV::PATH RRD_NAME>.png \-\-lazy
+\&          \-\-title "Temperatures for "<RRD::CV::QUOTE RRD_NAME>
+\&          DEF:cel=<RRD::CV::PATH RRD_NAME>.rrd:exhaust:AVERAGE
+\&          LINE2:cel#00a000:"D. Celsius">
+.Ve
+.PP
+.Vb 3
+\& </P>
+\& </BODY>
+\& </HTML>
+.Ve
+.SH "EXAMPLE 3"
+.IX Header "EXAMPLE 3"
+This example shows how to handle the case where the \s-1RRD\s0, graphs and
+cgi-bins are seperate directories
+.PP
+.Vb 14
+\& #!/.../bin/rrdcgi
+\& <HTML>
+\& <HEAD><TITLE>RRDCGI Demo</TITLE></HEAD>
+\& <BODY>
+\& <H1>RRDCGI test Page</H1>
+\& <RRD::GRAPH
+\&  /.../web/pngs/testhvt.png
+\&  \-\-imginfo '<IMG SRC=/.../pngs/%s WIDTH=%lu HEIGHT=%lu >'
+\&  \-\-lazy \-\-start \-1d \-\-end now
+\&  DEF:http_src=/.../rrds/test.rrd:http_src:AVERAGE
+\&  AREA:http_src#00ff00:http_src
+\& >
+\& </BODY>
+\& </HTML>
+.Ve
+.PP
+Note 1: Replace /.../ with the relevant directories
+.PP
+Note 2: The SRC=/.../pngs should be paths from the view of the
+webserver/browser
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Tobias Oetiker <tobi@oetiker.ch>
diff --git a/doc/rrdcgi.html b/doc/rrdcgi.html
new file mode 100644 (file)
index 0000000..f062d93
--- /dev/null
@@ -0,0 +1,301 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdcgi</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <ul>
+
+               <li><a href="#keywords">Keywords</a></li>
+       </ul>
+
+       <li><a href="#example_1">EXAMPLE 1</a></li>
+       <li><a href="#example_2">EXAMPLE 2</a></li>
+       <li><a href="#example_3">EXAMPLE 3</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdcgi - Create web pages containing RRD graphs based on templates</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p><code>#!/path/to/</code><strong>rrdcgi</strong> [<strong>--filter</strong>]</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p><strong>rrdcgi</strong> is a sort of very limited script interpreter. Its purpose
+is to run as a cgi-program and parse a web page template containing special
+&lt;RRD:: tags. <strong>rrdcgi</strong> will interpret and act according to these tags.
+In the end it will printout a web page including the necessary CGI headers.</p>
+<p><strong>rrdcgi</strong> parses the contents of the template in 3 steps. In each step it looks
+only for a subset of tags. This allows nesting of tags.</p>
+<p>The argument parser uses the same semantics as you are used from your C-shell.</p>
+<dl>
+<dt><strong><a name="item__2d_2dfilter"><strong>--filter</strong></a></strong>
+
+<dd>
+<p>Assume that rrdcgi is run as a filter and not as a cgi.</p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<h2><a name="keywords">Keywords</a></h2>
+<dl>
+<dt><strong><a name="item_rrd_3a_3acv_name">RRD::CV <em>name</em></a></strong>
+
+<dd>
+<p>Inserts the CGI variable of the given name.</p>
+</dd>
+</li>
+<dt><strong><a name="item_rrd_3a_3acv_3a_3aquote_name">RRD::CV::QUOTE <em>name</em></a></strong>
+
+<dd>
+<p>Inserts the CGI variable of the given name but quotes it, ready for
+use as an argument in another RRD:: tag. So even when there are spaces in the
+value of the CGI variable it will still be considered to be one argument.</p>
+</dd>
+</li>
+<dt><strong><a name="item_rrd_3a_3acv_3a_3apath_name">RRD::CV::PATH <em>name</em></a></strong>
+
+<dd>
+<p>Inserts the CGI variable of the given name, quotes it and makes sure
+it starts neither with a '/' nor contains '..'. This is to make
+sure that no problematic pathnames can be introduced through the
+CGI interface.</p>
+</dd>
+</li>
+<dt><strong><a name="item_rrd_3a_3agetenv_variable">RRD::GETENV <em>variable</em></a></strong>
+
+<dd>
+<p>Get the value of an environment variable.</p>
+</dd>
+<dd>
+<pre>
+ &lt;RRD::GETENV REMOTE_USER&gt;</pre>
+</dd>
+<dd>
+<p>might give you the name of the remote user given you are using
+some sort of access control on the directory.</p>
+</dd>
+</li>
+<dt><strong><a name="item_rrd_3a_3agoodfor_seconds">RRD::GOODFOR <em>seconds</em></a></strong>
+
+<dd>
+<p>Specify the number of seconds this page should remain valid. This will prompt
+the rrdcgi to output a Last-Modified, an Expire and if the number of
+seconds is <em>negative</em> a Refresh header.</p>
+</dd>
+</li>
+<dt><strong><a name="item_rrd_3a_3ainclude_filename">RRD::INCLUDE <em>filename</em></a></strong>
+
+<dd>
+<p>Include the contents of the specified file into the page returned from the cgi.</p>
+</dd>
+</li>
+<dt><strong><a name="item_rrd_3a_3asetenv_variable_value">RRD::SETENV <em>variable</em> <em>value</em></a></strong>
+
+<dd>
+<p>If you want to present your graphs in another time zone than your own, you
+could use</p>
+</dd>
+<dd>
+<pre>
+ &lt;RRD::SETENV TZ UTC&gt;</pre>
+</dd>
+<dd>
+<p>to make sure everything is presented in Universal Time. Note that the
+values permitted to TZ depend on your OS.</p>
+</dd>
+</li>
+<dt><strong><a name="item_rrd_3a_3asetvar_variable_value">RRD::SETVAR <em>variable</em> <em>value</em></a></strong>
+
+<dd>
+<p>Analog to SETENV but for local variables.</p>
+</dd>
+</li>
+<dt><strong><a name="item_rrd_3a_3agetvar_variable">RRD::GETVAR <em>variable</em></a></strong>
+
+<dd>
+<p>Analog to GETENV but for local variables.</p>
+</dd>
+</li>
+<dt><strong><a name="item_rrd_3a_3atime_3a_3alast_rrd_2dfile_strftime_2dform">RRD::TIME::LAST <em>rrd-file</em> <em>strftime-format</em></a></strong>
+
+<dd>
+<p>This gets replaced by the last modification time of the selected RRD. The
+time is <em>strftime</em>-formatted with the string specified in the second argument.</p>
+</dd>
+</li>
+<dt><strong><a name="item_rrd_3a_3atime_3a_3anow_strftime_2dformat">RRD::TIME::NOW <em>strftime-format</em></a></strong>
+
+<dd>
+<p>This gets replaced by the current time of day. The time is
+<em>strftime</em>-formatted with the string specified in the argument.</p>
+</dd>
+<dd>
+<p>Note that if you return : (colons) from your strftime format you may
+have to escape them using \ if the time is to be used as an argument
+to a GRAPH command.</p>
+</dd>
+</li>
+<dt><strong><a name="item_rrd_3a_3atime_3a_3astrftime_start_7cend_start_2dsp">RRD::TIME::STRFTIME <em>START|END</em> <em>start-spec</em> <em>end-spec</em> <em>strftime-format</em></a></strong>
+
+<dd>
+<p>This gets replaced by a strftime-formatted time using the format
+<em>strftime-format</em> on either <em>start-spec</em> or <em>end-spec</em> depending on
+whether <em>START</em> or <em>END</em> is specified.  Both <em>start-spec</em> and <em>end-spec</em>
+must be supplied as either could be relative to the other.  This is intended
+to allow pretty titles on graphs with times that are easier for non RRDtool
+folks to figure out than ``-2weeks''.</p>
+</dd>
+<dd>
+<p>Note that again, if you return : (colon) from your strftime format,
+you may have to escape them using \ if the time is to be used as an
+argument to a GRAPH command.</p>
+</dd>
+</li>
+<dt><strong><a name="item_rrd_3a_3agraph_rrdgraph_arguments">RRD::GRAPH <em>rrdgraph arguments</em></a></strong>
+
+<dd>
+<p>This tag creates the RRD graph defined by its argument and then is
+replaced by an appropriate &lt;IMG ... &gt; tag referring to the graph.
+The <strong>--lazy</strong> option in RRD graph can be used to make sure that graphs
+are only regenerated when they are out of date. The arguments
+to the <strong>RRD::GRAPH</strong> tag work as described in the <strong>rrdgraph</strong> manual page.</p>
+</dd>
+<dd>
+<p>Use the <strong>--lazy</strong> option in your RRD::GRAPH tags, to reduce the load
+on your server. This option makes sure that graphs are only regenerated when
+the old ones are out of date.</p>
+</dd>
+<dd>
+<p>If you do not specify your own <strong>--imginfo</strong> format, the following will
+be used:</p>
+</dd>
+<dd>
+<pre>
+ &lt;IMG SRC=&quot;%s&quot; WIDTH=&quot;%lu&quot; HEIGHT=&quot;%lu&quot;&gt;</pre>
+</dd>
+<dd>
+<p>Note that %s stands for the filename part of the graph generated, all
+directories given in the PNG file argument will get dropped.</p>
+</dd>
+</li>
+<dt><strong><a name="item_rrd_3a_3aprint_number">RRD::PRINT <em>number</em></a></strong>
+
+<dd>
+<p>If the preceding  <strong>RRD::GRAPH</strong> tag contained and <strong>PRINT</strong> arguments,
+then you can access their output with this tag. The <em>number</em> argument refers to the
+number of the <strong>PRINT</strong> argument. This first <strong>PRINT</strong> has <em>number</em> 0.</p>
+</dd>
+</li>
+<dt><strong><a name="item_rrd_3a_3ainternal__3cvar_3e">RRD::INTERNAL &lt;var&gt;</a></strong>
+
+<dd>
+<p>This tag gets replaced by an internal var. Currently these vars are known:
+VERSION, COMPILETIME.
+These vars represent the compiled-in values.</p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<hr />
+<h1><a name="example_1">EXAMPLE 1</a></h1>
+<p>The example below creates a web pages with a single RRD graph.</p>
+<pre>
+ #!/usr/local/bin/rrdcgi
+ &lt;HTML&gt;
+ &lt;HEAD&gt;&lt;TITLE&gt;RRDCGI Demo&lt;/TITLE&gt;&lt;/HEAD&gt;
+ &lt;BODY&gt;
+ &lt;H1&gt;RRDCGI Example Page&lt;/H1&gt;
+ &lt;P&gt;
+ &lt;RRD::GRAPH demo.png --lazy --title=&quot;Temperatures&quot;
+          DEF:cel=demo.rrd:exhaust:AVERAGE
+          LINE2:cel#00a000:&quot;D. Celsius&quot;&gt;</pre>
+<pre>
+ &lt;/P&gt;
+ &lt;/BODY&gt;
+ &lt;/HTML&gt;</pre>
+<p>
+</p>
+<hr />
+<h1><a name="example_2">EXAMPLE 2</a></h1>
+<p>This script is slightly more elaborate, it allows you to run it from
+a form which sets RRD_NAME. RRD_NAME is then used to select which RRD
+you want to use as source for your graph.</p>
+<pre>
+ #!/usr/local/bin/rrdcgi
+ &lt;HTML&gt;
+ &lt;HEAD&gt;&lt;TITLE&gt;RRDCGI Demo&lt;/TITLE&gt;&lt;/HEAD&gt;
+ &lt;BODY&gt;
+ &lt;H1&gt;RRDCGI Example Page for &lt;RRD::CV RRD_NAME&gt;&lt;/H1&gt;
+ &lt;H2&gt;Selection&lt;/H2&gt;
+ &lt;FORM&gt;&lt;INPUT NAME=RRD_NAME TYPE=RADIO VALUE=roomA&gt; Room A,
+       &lt;INPUT NAME=RRD_NAME TYPE=RADIO VALUE=roomB&gt; Room B.
+       &lt;INPUT TYPE=SUBMIT&gt;&lt;/FORM&gt;
+ &lt;H2&gt;Graph&lt;/H2&gt;
+ &lt;P&gt;
+ &lt;RRD::GRAPH &lt;RRD::CV::PATH RRD_NAME&gt;.png --lazy
+          --title &quot;Temperatures for &quot;&lt;RRD::CV::QUOTE RRD_NAME&gt;
+          DEF:cel=&lt;RRD::CV::PATH RRD_NAME&gt;.rrd:exhaust:AVERAGE
+          LINE2:cel#00a000:&quot;D. Celsius&quot;&gt;</pre>
+<pre>
+ &lt;/P&gt;
+ &lt;/BODY&gt;
+ &lt;/HTML&gt;</pre>
+<p>
+</p>
+<hr />
+<h1><a name="example_3">EXAMPLE 3</a></h1>
+<p>This example shows how to handle the case where the RRD, graphs and
+cgi-bins are seperate directories</p>
+<pre>
+ #!/.../bin/rrdcgi
+ &lt;HTML&gt;
+ &lt;HEAD&gt;&lt;TITLE&gt;RRDCGI Demo&lt;/TITLE&gt;&lt;/HEAD&gt;
+ &lt;BODY&gt;
+ &lt;H1&gt;RRDCGI test Page&lt;/H1&gt;
+ &lt;RRD::GRAPH
+  /.../web/pngs/testhvt.png
+  --imginfo '&lt;IMG SRC=/.../pngs/%s WIDTH=%lu HEIGHT=%lu &gt;'
+  --lazy --start -1d --end now
+  DEF:http_src=/.../rrds/test.rrd:http_src:AVERAGE
+  AREA:http_src#00ff00:http_src
+ &gt;
+ &lt;/BODY&gt;
+ &lt;/HTML&gt;</pre>
+<p>Note 1: Replace /.../ with the relevant directories</p>
+<p>Note 2: The SRC=/.../pngs should be paths from the view of the
+webserver/browser</p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdcgi.pod b/doc/rrdcgi.pod
new file mode 100644 (file)
index 0000000..4c81e01
--- /dev/null
@@ -0,0 +1,225 @@
+=head1 NAME
+
+rrdcgi - Create web pages containing RRD graphs based on templates
+
+=head1 SYNOPSIS
+
+C<#!/path/to/>B<rrdcgi> S<[B<--filter>]>
+
+=head1 DESCRIPTION
+
+B<rrdcgi> is a sort of very limited script interpreter. Its purpose
+is to run as a cgi-program and parse a web page template containing special
+E<lt>RRD:: tags. B<rrdcgi> will interpret and act according to these tags.
+In the end it will printout a web page including the necessary CGI headers.
+
+B<rrdcgi> parses the contents of the template in 3 steps. In each step it looks
+only for a subset of tags. This allows nesting of tags.
+
+The argument parser uses the same semantics as you are used from your C-shell.
+
+=over 8
+
+=item B<--filter>
+
+Assume that rrdcgi is run as a filter and not as a cgi.
+
+=back
+
+=head2 Keywords
+
+=over 8
+
+=item RRD::CV I<name>
+
+Inserts the CGI variable of the given name.
+
+=item RRD::CV::QUOTE I<name>
+
+Inserts the CGI variable of the given name but quotes it, ready for
+use as an argument in another RRD:: tag. So even when there are spaces in the
+value of the CGI variable it will still be considered to be one argument.
+
+=item RRD::CV::PATH I<name>
+
+Inserts the CGI variable of the given name, quotes it and makes sure
+it starts neither with a '/' nor contains '..'. This is to make
+sure that no problematic pathnames can be introduced through the
+CGI interface.
+
+=item RRD::GETENV I<variable>
+
+Get the value of an environment variable.
+
+ <RRD::GETENV REMOTE_USER>
+
+might give you the name of the remote user given you are using
+some sort of access control on the directory.
+
+
+=item RRD::GOODFOR I<seconds>
+
+Specify the number of seconds this page should remain valid. This will prompt
+the rrdcgi to output a Last-Modified, an Expire and if the number of
+seconds is I<negative> a Refresh header.
+
+=item RRD::INCLUDE I<filename>
+
+Include the contents of the specified file into the page returned from the cgi.
+
+=item RRD::SETENV I<variable> I<value>
+
+If you want to present your graphs in another time zone than your own, you
+could use
+
+ <RRD::SETENV TZ UTC>
+
+to make sure everything is presented in Universal Time. Note that the
+values permitted to TZ depend on your OS.
+
+=item RRD::SETVAR I<variable> I<value>
+
+Analog to SETENV but for local variables.
+
+=item RRD::GETVAR I<variable>
+
+Analog to GETENV but for local variables.
+
+=item RRD::TIME::LAST I<rrd-file> I<strftime-format>
+
+This gets replaced by the last modification time of the selected RRD. The
+time is I<strftime>-formatted with the string specified in the second argument.
+
+=item RRD::TIME::NOW I<strftime-format>
+
+This gets replaced by the current time of day. The time is
+I<strftime>-formatted with the string specified in the argument.
+
+Note that if you return : (colons) from your strftime format you may
+have to escape them using \ if the time is to be used as an argument
+to a GRAPH command.
+
+=item RRD::TIME::STRFTIME I<START|END> I<start-spec> I<end-spec> I<strftime-format>
+
+This gets replaced by a strftime-formatted time using the format
+I<strftime-format> on either I<start-spec> or I<end-spec> depending on
+whether I<START> or I<END> is specified.  Both I<start-spec> and I<end-spec>
+must be supplied as either could be relative to the other.  This is intended
+to allow pretty titles on graphs with times that are easier for non RRDtool
+folks to figure out than "-2weeks".
+
+Note that again, if you return : (colon) from your strftime format,
+you may have to escape them using \ if the time is to be used as an
+argument to a GRAPH command.
+
+=item RRD::GRAPH I<rrdgraph arguments>
+
+This tag creates the RRD graph defined by its argument and then is
+replaced by an appropriate E<lt>IMG ... E<gt> tag referring to the graph.
+The B<--lazy> option in RRD graph can be used to make sure that graphs
+are only regenerated when they are out of date. The arguments
+to the B<RRD::GRAPH> tag work as described in the B<rrdgraph> manual page.
+
+Use the B<--lazy> option in your RRD::GRAPH tags, to reduce the load
+on your server. This option makes sure that graphs are only regenerated when
+the old ones are out of date.
+
+If you do not specify your own B<--imginfo> format, the following will
+be used:
+
+ <IMG SRC="%s" WIDTH="%lu" HEIGHT="%lu">
+
+Note that %s stands for the filename part of the graph generated, all
+directories given in the PNG file argument will get dropped.
+
+=item RRD::PRINT I<number>
+
+If the preceding  B<RRD::GRAPH> tag contained and B<PRINT> arguments,
+then you can access their output with this tag. The I<number> argument refers to the
+number of the B<PRINT> argument. This first B<PRINT> has I<number> 0.
+
+=item RRD::INTERNAL <var>
+
+This tag gets replaced by an internal var. Currently these vars are known:
+VERSION, COMPILETIME.
+These vars represent the compiled-in values. 
+
+=back
+
+=head1 EXAMPLE 1
+
+The example below creates a web pages with a single RRD graph.
+
+ #!/usr/local/bin/rrdcgi
+ <HTML>
+ <HEAD><TITLE>RRDCGI Demo</TITLE></HEAD>
+ <BODY>
+ <H1>RRDCGI Example Page</H1>
+ <P>
+ <RRD::GRAPH demo.png --lazy --title="Temperatures"
+          DEF:cel=demo.rrd:exhaust:AVERAGE
+          LINE2:cel#00a000:"D. Celsius">
+
+ </P>
+ </BODY>
+ </HTML>
+
+=head1 EXAMPLE 2
+
+This script is slightly more elaborate, it allows you to run it from
+a form which sets RRD_NAME. RRD_NAME is then used to select which RRD
+you want to use as source for your graph.
+
+ #!/usr/local/bin/rrdcgi
+ <HTML>
+ <HEAD><TITLE>RRDCGI Demo</TITLE></HEAD>
+ <BODY>
+ <H1>RRDCGI Example Page for <RRD::CV RRD_NAME></H1>
+ <H2>Selection</H2>
+ <FORM><INPUT NAME=RRD_NAME TYPE=RADIO VALUE=roomA> Room A,
+       <INPUT NAME=RRD_NAME TYPE=RADIO VALUE=roomB> Room B.
+       <INPUT TYPE=SUBMIT></FORM>
+ <H2>Graph</H2>
+ <P>
+ <RRD::GRAPH <RRD::CV::PATH RRD_NAME>.png --lazy
+          --title "Temperatures for "<RRD::CV::QUOTE RRD_NAME>
+          DEF:cel=<RRD::CV::PATH RRD_NAME>.rrd:exhaust:AVERAGE
+          LINE2:cel#00a000:"D. Celsius">
+
+ </P>
+ </BODY>
+ </HTML>
+
+=head1 EXAMPLE 3
+
+This example shows how to handle the case where the RRD, graphs and
+cgi-bins are seperate directories
+
+ #!/.../bin/rrdcgi
+ <HTML>
+ <HEAD><TITLE>RRDCGI Demo</TITLE></HEAD>
+ <BODY>
+ <H1>RRDCGI test Page</H1>
+ <RRD::GRAPH
+  /.../web/pngs/testhvt.png
+  --imginfo '<IMG SRC=/.../pngs/%s WIDTH=%lu HEIGHT=%lu >'
+  --lazy --start -1d --end now
+  DEF:http_src=/.../rrds/test.rrd:http_src:AVERAGE
+  AREA:http_src#00ff00:http_src
+ >
+ </BODY>
+ </HTML>
+
+Note 1: Replace /.../ with the relevant directories
+
+Note 2: The SRC=/.../pngs should be paths from the view of the
+webserver/browser
+
+=head1 AUTHOR
+
+Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
+
+
+
+
+
diff --git a/doc/rrdcgi.txt b/doc/rrdcgi.txt
new file mode 100644 (file)
index 0000000..949a8ef
--- /dev/null
@@ -0,0 +1,207 @@
+RRDCGI(1)                           rrdtool                          RRDCGI(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdcgi - Create web pages containing RRD graphs based on templates
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       "#!/path/to/"r\brr\brd\bdc\bcg\bgi\bi [-\b--\b-f\bfi\bil\blt\bte\ber\br]
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       r\brr\brd\bdc\bcg\bgi\bi is a sort of very limited script interpreter. Its purpose is to
+       run as a cgi-program and parse a web page template containing special
+       <RRD:: tags. r\brr\brd\bdc\bcg\bgi\bi will interpret and act according to these tags.  In
+       the end it will printout a web page including the necessary CGI head-
+       ers.
+
+       r\brr\brd\bdc\bcg\bgi\bi parses the contents of the template in 3 steps. In each step it
+       looks only for a subset of tags. This allows nesting of tags.
+
+       The argument parser uses the same semantics as you are used from your
+       C-shell.
+
+       -\b--\b-f\bfi\bil\blt\bte\ber\br
+               Assume that rrdcgi is run as a filter and not as a cgi.
+
+       K\bKe\bey\byw\bwo\bor\brd\bds\bs
+
+
+       RRD::CV _\bn_\ba_\bm_\be
+               Inserts the CGI variable of the given name.
+
+       RRD::CV::QUOTE _\bn_\ba_\bm_\be
+               Inserts the CGI variable of the given name but quotes it, ready
+               for use as an argument in another RRD:: tag. So even when there
+               are spaces in the value of the CGI variable it will still be
+               considered to be one argument.
+
+       RRD::CV::PATH _\bn_\ba_\bm_\be
+               Inserts the CGI variable of the given name, quotes it and makes
+               sure it starts neither with a '/' nor contains '..'. This is to
+               make sure that no problematic pathnames can be introduced
+               through the CGI interface.
+
+       RRD::GETENV _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be
+               Get the value of an environment variable.
+
+                <RRD::GETENV REMOTE_USER>
+
+               might give you the name of the remote user given you are using
+               some sort of access control on the directory.
+
+       RRD::GOODFOR _\bs_\be_\bc_\bo_\bn_\bd_\bs
+               Specify the number of seconds this page should remain valid.
+               This will prompt the rrdcgi to output a Last-Modified, an
+               Expire and if the number of seconds is _\bn_\be_\bg_\ba_\bt_\bi_\bv_\be a Refresh
+               header.
+
+       RRD::INCLUDE _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
+               Include the contents of the specified file into the page
+               returned from the cgi.
+
+       RRD::SETENV _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be _\bv_\ba_\bl_\bu_\be
+               If you want to present your graphs in another time zone than
+               your own, you could use
+
+                <RRD::SETENV TZ UTC>
+
+               to make sure everything is presented in Universal Time. Note
+               that the values permitted to TZ depend on your OS.
+
+       RRD::SETVAR _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be _\bv_\ba_\bl_\bu_\be
+               Analog to SETENV but for local variables.
+
+       RRD::GETVAR _\bv_\ba_\br_\bi_\ba_\bb_\bl_\be
+               Analog to GETENV but for local variables.
+
+       RRD::TIME::LAST _\br_\br_\bd_\b-_\bf_\bi_\bl_\be _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be_\b-_\bf_\bo_\br_\bm_\ba_\bt
+               This gets replaced by the last modification time of the
+               selected RRD. The time is _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be-formatted with the string
+               specified in the second argument.
+
+       RRD::TIME::NOW _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be_\b-_\bf_\bo_\br_\bm_\ba_\bt
+               This gets replaced by the current time of day. The time is
+               _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be-formatted with the string specified in the argument.
+
+               Note that if you return : (colons) from your strftime format
+               you may have to escape them using \ if the time is to be used
+               as an argument to a GRAPH command.
+
+       RRD::TIME::STRFTIME _\bS_\bT_\bA_\bR_\bT_\b|_\bE_\bN_\bD _\bs_\bt_\ba_\br_\bt_\b-_\bs_\bp_\be_\bc _\be_\bn_\bd_\b-_\bs_\bp_\be_\bc _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be_\b-_\bf_\bo_\br_\bm_\ba_\bt
+               This gets replaced by a strftime-formatted time using the for-
+               mat _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be_\b-_\bf_\bo_\br_\bm_\ba_\bt on either _\bs_\bt_\ba_\br_\bt_\b-_\bs_\bp_\be_\bc or _\be_\bn_\bd_\b-_\bs_\bp_\be_\bc depending
+               on whether _\bS_\bT_\bA_\bR_\bT or _\bE_\bN_\bD is specified.  Both _\bs_\bt_\ba_\br_\bt_\b-_\bs_\bp_\be_\bc and _\be_\bn_\bd_\b-
+               _\bs_\bp_\be_\bc must be supplied as either could be relative to the other.
+               This is intended to allow pretty titles on graphs with times
+               that are easier for non RRDtool folks to figure out than
+               "-2weeks".
+
+               Note that again, if you return : (colon) from your strftime
+               format, you may have to escape them using \ if the time is to
+               be used as an argument to a GRAPH command.
+
+       RRD::GRAPH _\br_\br_\bd_\bg_\br_\ba_\bp_\bh _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs
+               This tag creates the RRD graph defined by its argument and then
+               is replaced by an appropriate <IMG ... > tag referring to the
+               graph.  The -\b--\b-l\bla\baz\bzy\by option in RRD graph can be used to make sure
+               that graphs are only regenerated when they are out of date. The
+               arguments to the R\bRR\bRD\bD:\b::\b:G\bGR\bRA\bAP\bPH\bH tag work as described in the r\brr\brd\bd-\b-
+               g\bgr\bra\bap\bph\bh manual page.
+
+               Use the -\b--\b-l\bla\baz\bzy\by option in your RRD::GRAPH tags, to reduce the
+               load on your server. This option makes sure that graphs are
+               only regenerated when the old ones are out of date.
+
+               If you do not specify your own -\b--\b-i\bim\bmg\bgi\bin\bnf\bfo\bo format, the following
+               will be used:
+
+                <IMG SRC="%s" WIDTH="%lu" HEIGHT="%lu">
+
+               Note that %s stands for the filename part of the graph gener-
+               ated, all directories given in the PNG file argument will get
+               dropped.
+
+       RRD::PRINT _\bn_\bu_\bm_\bb_\be_\br
+               If the preceding  R\bRR\bRD\bD:\b::\b:G\bGR\bRA\bAP\bPH\bH tag contained and P\bPR\bRI\bIN\bNT\bT arguments,
+               then you can access their output with this tag. The _\bn_\bu_\bm_\bb_\be_\br
+               argument refers to the number of the P\bPR\bRI\bIN\bNT\bT argument. This first
+               P\bPR\bRI\bIN\bNT\bT has _\bn_\bu_\bm_\bb_\be_\br 0.
+
+       RRD::INTERNAL <var>
+               This tag gets replaced by an internal var. Currently these vars
+               are known: VERSION, COMPILETIME.  These vars represent the
+               compiled-in values.
+
+E\bEX\bXA\bAM\bMP\bPL\bLE\bE 1\b1
+       The example below creates a web pages with a single RRD graph.
+
+        #!/usr/local/bin/rrdcgi
+        <HTML>
+        <HEAD><TITLE>RRDCGI Demo</TITLE></HEAD>
+        <BODY>
+        <H1>RRDCGI Example Page</H1>
+        <P>
+        <RRD::GRAPH demo.png --lazy --title="Temperatures"
+                 DEF:cel=demo.rrd:exhaust:AVERAGE
+                 LINE2:cel#00a000:"D. Celsius">
+
+        </P>
+        </BODY>
+        </HTML>
+
+E\bEX\bXA\bAM\bMP\bPL\bLE\bE 2\b2
+       This script is slightly more elaborate, it allows you to run it from a
+       form which sets RRD_NAME. RRD_NAME is then used to select which RRD you
+       want to use as source for your graph.
+
+        #!/usr/local/bin/rrdcgi
+        <HTML>
+        <HEAD><TITLE>RRDCGI Demo</TITLE></HEAD>
+        <BODY>
+        <H1>RRDCGI Example Page for <RRD::CV RRD_NAME></H1>
+        <H2>Selection</H2>
+        <FORM><INPUT NAME=RRD_NAME TYPE=RADIO VALUE=roomA> Room A,
+              <INPUT NAME=RRD_NAME TYPE=RADIO VALUE=roomB> Room B.
+              <INPUT TYPE=SUBMIT></FORM>
+        <H2>Graph</H2>
+        <P>
+        <RRD::GRAPH <RRD::CV::PATH RRD_NAME>.png --lazy
+                 --title "Temperatures for "<RRD::CV::QUOTE RRD_NAME>
+                 DEF:cel=<RRD::CV::PATH RRD_NAME>.rrd:exhaust:AVERAGE
+                 LINE2:cel#00a000:"D. Celsius">
+
+        </P>
+        </BODY>
+        </HTML>
+
+E\bEX\bXA\bAM\bMP\bPL\bLE\bE 3\b3
+       This example shows how to handle the case where the RRD, graphs and
+       cgi-bins are seperate directories
+
+        #!/.../bin/rrdcgi
+        <HTML>
+        <HEAD><TITLE>RRDCGI Demo</TITLE></HEAD>
+        <BODY>
+        <H1>RRDCGI test Page</H1>
+        <RRD::GRAPH
+         /.../web/pngs/testhvt.png
+         --imginfo '<IMG SRC=/.../pngs/%s WIDTH=%lu HEIGHT=%lu >'
+         --lazy --start -1d --end now
+         DEF:http_src=/.../rrds/test.rrd:http_src:AVERAGE
+         AREA:http_src#00ff00:http_src
+        >
+        </BODY>
+        </HTML>
+
+       Note 1: Replace /.../ with the relevant directories
+
+       Note 2: The SRC=/.../pngs should be paths from the view of the web-
+       server/browser
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Tobias Oetiker <tobi@oetiker.ch>
+
+
+
+1.2.26                            2007-11-20                         RRDCGI(1)
diff --git a/doc/rrdcreate.1 b/doc/rrdcreate.1
new file mode 100644 (file)
index 0000000..b18228f
--- /dev/null
@@ -0,0 +1,630 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDCREATE 1"
+.TH RRDCREATE 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdcreate \- Set up a new Round Robin Database
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBrrdtool\fR \fBcreate\fR \fIfilename\fR
+[\fB\-\-start\fR|\fB\-b\fR\ \fIstart\ time\fR]
+[\fB\-\-step\fR|\fB\-s\fR\ \fIstep\fR]
+[\fB\s-1DS:\s0\fR\fIds-name\fR\fB:\fR\fI\s-1DST\s0\fR\fB:\fR\fIdst\ arguments\fR]
+[\fB\s-1RRA:\s0\fR\fI\s-1CF\s0\fR\fB:\fR\fIcf\ arguments\fR]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The create function of RRDtool lets you set up new Round Robin
+Database (\fB\s-1RRD\s0\fR) files.  The file is created at its final, full size
+and filled with \fI*UNKNOWN*\fR data.
+.IP "\fIfilename\fR" 8
+.IX Item "filename"
+The name of the \fB\s-1RRD\s0\fR you want to create. \fB\s-1RRD\s0\fR files should end
+with the extension \fI.rrd\fR. However, \fBRRDtool\fR will accept any
+filename.
+.IP "\fB\-\-start\fR|\fB\-b\fR \fIstart time\fR (default: now \- 10s)" 8
+.IX Item "--start|-b start time (default: now - 10s)"
+Specifies the time in seconds since 1970\-01\-01 \s-1UTC\s0 when the first
+value should be added to the \fB\s-1RRD\s0\fR. \fBRRDtool\fR will not accept
+any data timed before or at the time specified.
+.Sp
+See also AT-STYLE \s-1TIME\s0 \s-1SPECIFICATION\s0 section in the
+\&\fIrrdfetch\fR documentation for other ways to specify time.
+.IP "\fB\-\-step\fR|\fB\-s\fR \fIstep\fR (default: 300 seconds)" 8
+.IX Item "--step|-s step (default: 300 seconds)"
+Specifies the base interval in seconds with which data will be fed
+into the \fB\s-1RRD\s0\fR.
+.IP "\fB\s-1DS:\s0\fR\fIds-name\fR\fB:\fR\fI\s-1DST\s0\fR\fB:\fR\fIdst arguments\fR" 8
+.IX Item "DS:ds-name:DST:dst arguments"
+A single \fB\s-1RRD\s0\fR can accept input from several data sources (\fB\s-1DS\s0\fR),
+for example incoming and outgoing traffic on a specific communication
+line. With the \fB\s-1DS\s0\fR configuration option you must define some basic
+properties of each data source you want to store in the \fB\s-1RRD\s0\fR.
+.Sp
+\&\fIds-name\fR is the name you will use to reference this particular data
+source from an \fB\s-1RRD\s0\fR. A \fIds-name\fR must be 1 to 19 characters long in
+the characters [a\-zA\-Z0\-9_].
+.Sp
+\&\fI\s-1DST\s0\fR defines the Data Source Type. The remaining arguments of a
+data source entry depend on the data source type. For \s-1GAUGE\s0, \s-1COUNTER\s0,
+\&\s-1DERIVE\s0, and \s-1ABSOLUTE\s0 the format for a data source entry is:
+.Sp
+\&\fB\s-1DS:\s0\fR\fIds-name\fR\fB:\fR\fI\s-1GAUGE\s0 | \s-1COUNTER\s0 | \s-1DERIVE\s0 | \s-1ABSOLUTE\s0\fR\fB:\fR\fIheartbeat\fR\fB:\fR\fImin\fR\fB:\fR\fImax\fR
+.Sp
+For \s-1COMPUTE\s0 data sources, the format is:
+.Sp
+\&\fB\s-1DS:\s0\fR\fIds-name\fR\fB:\fR\fI\s-1COMPUTE\s0\fR\fB:\fR\fIrpn-expression\fR
+.Sp
+In order to decide which data source type to use, review the
+definitions that follow. Also consult the section on \*(L"\s-1HOW\s0 \s-1TO\s0 \s-1MEASURE\s0\*(R"
+for further insight.
+.RS 8
+.IP "\fB\s-1GAUGE\s0\fR" 4
+.IX Item "GAUGE"
+is for things like temperatures or number of people in a room or the
+value of a RedHat share.
+.IP "\fB\s-1COUNTER\s0\fR" 4
+.IX Item "COUNTER"
+is for continuous incrementing counters like the ifInOctets counter in
+a router. The \fB\s-1COUNTER\s0\fR data source assumes that the counter never
+decreases, except when a counter overflows.  The update function takes
+the overflow into account.  The counter is stored as a per-second
+rate. When the counter overflows, RRDtool checks if the overflow
+happened at the 32bit or 64bit border and acts accordingly by adding
+an appropriate value to the result.
+.IP "\fB\s-1DERIVE\s0\fR" 4
+.IX Item "DERIVE"
+will store the derivative of the line going from the last to the
+current value of the data source. This can be useful for gauges, for
+example, to measure the rate of people entering or leaving a
+room. Internally, derive works exactly like \s-1COUNTER\s0 but without
+overflow checks. So if your counter does not reset at 32 or 64 bit you
+might want to use \s-1DERIVE\s0 and combine it with a \s-1MIN\s0 value of 0.
+.RS 4
+.IP "\s-1NOTE\s0 on \s-1COUNTER\s0 vs \s-1DERIVE\s0" 4
+.IX Item "NOTE on COUNTER vs DERIVE"
+by Don Baarda <don.baarda@baesystems.com>
+.Sp
+If you cannot tolerate ever mistaking the occasional counter reset for a
+legitimate counter wrap, and would prefer \*(L"Unknowns\*(R" for all legitimate
+counter wraps and resets, always use \s-1DERIVE\s0 with min=0. Otherwise, using
+\&\s-1COUNTER\s0 with a suitable max will return correct values for all legitimate
+counter wraps, mark some counter resets as \*(L"Unknown\*(R", but can mistake some
+counter resets for a legitimate counter wrap.
+.Sp
+For a 5 minute step and 32\-bit counter, the probability of mistaking a
+counter reset for a legitimate wrap is arguably about 0.8% per 1Mbps of
+maximum bandwidth. Note that this equates to 80% for 100Mbps interfaces, so
+for high bandwidth interfaces and a 32bit counter, \s-1DERIVE\s0 with min=0 is
+probably preferable. If you are using a 64bit counter, just about any max
+setting will eliminate the possibility of mistaking a reset for a counter
+wrap.
+.RE
+.RS 4
+.RE
+.IP "\fB\s-1ABSOLUTE\s0\fR" 4
+.IX Item "ABSOLUTE"
+is for counters which get reset upon reading. This is used for fast counters
+which tend to overflow. So instead of reading them normally you reset them
+after every read to make sure you have a maximum time available before the
+next overflow. Another usage is for things you count like number of messages
+since the last update.
+.IP "\fB\s-1COMPUTE\s0\fR" 4
+.IX Item "COMPUTE"
+is for storing the result of a formula applied to other data sources
+in the \fB\s-1RRD\s0\fR. This data source is not supplied a value on update, but
+rather its Primary Data Points (PDPs) are computed from the PDPs of
+the data sources according to the rpn-expression that defines the
+formula. Consolidation functions are then applied normally to the PDPs
+of the \s-1COMPUTE\s0 data source (that is the rpn-expression is only applied
+to generate PDPs). In database software, such data sets are referred
+to as \*(L"virtual\*(R" or \*(L"computed\*(R" columns.
+.RE
+.RS 8
+.Sp
+\&\fIheartbeat\fR defines the maximum number of seconds that may pass
+between two updates of this data source before the value of the
+data source is assumed to be \fI*UNKNOWN*\fR.
+.Sp
+\&\fImin\fR and \fImax\fR define the expected range values for data supplied by a
+data source. If \fImin\fR and/or \fImax\fR any value outside the defined range
+will be regarded as \fI*UNKNOWN*\fR. If you do not know or care about min and
+max, set them to U for unknown. Note that min and max always refer to the
+processed values of the \s-1DS\s0. For a traffic\-\fB\s-1COUNTER\s0\fR type \s-1DS\s0 this would be
+the maximum and minimum data-rate expected from the device.
+.Sp
+\&\fIIf information on minimal/maximal expected values is available,
+always set the min and/or max properties. This will help RRDtool in
+doing a simple sanity check on the data supplied when running update.\fR
+.Sp
+\&\fIrpn-expression\fR defines the formula used to compute the PDPs of a
+\&\s-1COMPUTE\s0 data source from other data sources in the same <\s-1RRD\s0>. It is
+similar to defining a \fB\s-1CDEF\s0\fR argument for the graph command. Please
+refer to that manual page for a list and description of \s-1RPN\s0 operations
+supported. For \s-1COMPUTE\s0 data sources, the following \s-1RPN\s0 operations are
+not supported: \s-1COUNT\s0, \s-1PREV\s0, \s-1TIME\s0, and \s-1LTIME\s0. In addition, in defining
+the \s-1RPN\s0 expression, the \s-1COMPUTE\s0 data source may only refer to the
+names of data source listed previously in the create command. This is
+similar to the restriction that \fB\s-1CDEF\s0\fRs must refer only to \fB\s-1DEF\s0\fRs
+and \fB\s-1CDEF\s0\fRs previously defined in the same graph command.
+.RE
+.IP "\fB\s-1RRA:\s0\fR\fI\s-1CF\s0\fR\fB:\fR\fIcf arguments\fR" 8
+.IX Item "RRA:CF:cf arguments"
+The purpose of an \fB\s-1RRD\s0\fR is to store data in the round robin archives
+(\fB\s-1RRA\s0\fR). An archive consists of a number of data values or statistics for
+each of the defined data-sources (\fB\s-1DS\s0\fR) and is defined with an \fB\s-1RRA\s0\fR line.
+.Sp
+When data is entered into an \fB\s-1RRD\s0\fR, it is first fit into time slots
+of the length defined with the \fB\-s\fR option, thus becoming a \fIprimary
+data point\fR.
+.Sp
+The data is also processed with the consolidation function (\fI\s-1CF\s0\fR) of
+the archive. There are several consolidation functions that
+consolidate primary data points via an aggregate function: \fB\s-1AVERAGE\s0\fR,
+\&\fB\s-1MIN\s0\fR, \fB\s-1MAX\s0\fR, \fB\s-1LAST\s0\fR. The format of \fB\s-1RRA\s0\fR line for these
+consolidation functions is:
+.Sp
+\&\fB\s-1RRA:\s0\fR\fI\s-1AVERAGE\s0 | \s-1MIN\s0 | \s-1MAX\s0 | \s-1LAST\s0\fR\fB:\fR\fIxff\fR\fB:\fR\fIsteps\fR\fB:\fR\fIrows\fR
+.Sp
+\&\fIxff\fR The xfiles factor defines what part of a consolidation interval may
+be made up from \fI*UNKNOWN*\fR data while the consolidated value is still
+regarded as known. It is given as the ratio of allowed \fI*UNKNOWN*\fR PDPs
+to the number of PDPs in the interval. Thus, it ranges from 0 to 1 (exclusive).
+.Sp
+\&\fIsteps\fR defines how many of these \fIprimary data points\fR are used to build
+a \fIconsolidated data point\fR which then goes into the archive.
+.Sp
+\&\fIrows\fR defines how many generations of data values are kept in an \fB\s-1RRA\s0\fR.
+.SH "Aberrant Behavior Detection with Holt-Winters Forecasting"
+.IX Header "Aberrant Behavior Detection with Holt-Winters Forecasting"
+In addition to the aggregate functions, there are a set of specialized
+functions that enable \fBRRDtool\fR to provide data smoothing (via the
+Holt-Winters forecasting algorithm), confidence bands, and the
+flagging aberrant behavior in the data source time series:
+.IP "\(bu" 4
+\&\fB\s-1RRA:\s0\fR\fI\s-1HWPREDICT\s0\fR\fB:\fR\fIrows\fR\fB:\fR\fIalpha\fR\fB:\fR\fIbeta\fR\fB:\fR\fIseasonal period\fR[\fB:\fR\fIrra-num\fR]
+.IP "\(bu" 4
+\&\fB\s-1RRA:\s0\fR\fI\s-1SEASONAL\s0\fR\fB:\fR\fIseasonal period\fR\fB:\fR\fIgamma\fR\fB:\fR\fIrra-num\fR
+.IP "\(bu" 4
+\&\fB\s-1RRA:\s0\fR\fI\s-1DEVSEASONAL\s0\fR\fB:\fR\fIseasonal period\fR\fB:\fR\fIgamma\fR\fB:\fR\fIrra-num\fR
+.IP "\(bu" 4
+\&\fB\s-1RRA:\s0\fR\fI\s-1DEVPREDICT\s0\fR\fB:\fR\fIrows\fR\fB:\fR\fIrra-num\fR
+.IP "\(bu" 4
+\&\fB\s-1RRA:\s0\fR\fI\s-1FAILURES\s0\fR\fB:\fR\fIrows\fR\fB:\fR\fIthreshold\fR\fB:\fR\fIwindow length\fR\fB:\fR\fIrra-num\fR
+.PP
+These \fBRRAs\fR differ from the true consolidation functions in several ways.
+First, each of the \fB\s-1RRA\s0\fRs is updated once for every primary data point.
+Second, these \fBRRAs\fR are interdependent. To generate real-time confidence
+bounds, a matched set of \s-1HWPREDICT\s0, \s-1SEASONAL\s0, \s-1DEVSEASONAL\s0, and
+\&\s-1DEVPREDICT\s0 must exist. Generating smoothed values of the primary data points
+requires both a \s-1HWPREDICT\s0 \fB\s-1RRA\s0\fR and \s-1SEASONAL\s0 \fB\s-1RRA\s0\fR. Aberrant behavior
+detection requires \s-1FAILURES\s0, \s-1HWPREDICT\s0, \s-1DEVSEASONAL\s0, and \s-1SEASONAL\s0.
+.PP
+The actual predicted, or smoothed, values are stored in the \s-1HWPREDICT\s0
+\&\fB\s-1RRA\s0\fR. The predicted deviations are stored in \s-1DEVPREDICT\s0 (think a standard
+deviation which can be scaled to yield a confidence band). The \s-1FAILURES\s0
+\&\fB\s-1RRA\s0\fR stores binary indicators. A 1 marks the indexed observation as
+failure; that is, the number of confidence bounds violations in the
+preceding window of observations met or exceeded a specified threshold. An
+example of using these \fBRRAs\fR to graph confidence bounds and failures
+appears in rrdgraph.
+.PP
+The \s-1SEASONAL\s0 and \s-1DEVSEASONAL\s0 \fBRRAs\fR store the seasonal coefficients for the
+Holt-Winters forecasting algorithm and the seasonal deviations, respectively.
+There is one entry per observation time point in the seasonal cycle. For
+example, if primary data points are generated every five minutes and the
+seasonal cycle is 1 day, both \s-1SEASONAL\s0 and \s-1DEVSEASONAL\s0 will have 288 rows.
+.PP
+In order to simplify the creation for the novice user, in addition to
+supporting explicit creation of the \s-1HWPREDICT\s0, \s-1SEASONAL\s0, \s-1DEVPREDICT\s0,
+\&\s-1DEVSEASONAL\s0, and \s-1FAILURES\s0 \fBRRAs\fR, the \fBRRDtool\fR create command supports
+implicit creation of the other four when \s-1HWPREDICT\s0 is specified alone and
+the final argument \fIrra-num\fR is omitted.
+.PP
+\&\fIrows\fR specifies the length of the \fB\s-1RRA\s0\fR prior to wrap around. Remember
+that there is a one-to-one correspondence between primary data points and
+entries in these RRAs. For the \s-1HWPREDICT\s0 \s-1CF\s0, \fIrows\fR should be larger than
+the \fIseasonal period\fR. If the \s-1DEVPREDICT\s0 \fB\s-1RRA\s0\fR is implicitly created, the
+default number of rows is the same as the \s-1HWPREDICT\s0 \fIrows\fR argument. If the
+\&\s-1FAILURES\s0 \fB\s-1RRA\s0\fR is implicitly created, \fIrows\fR will be set to the \fIseasonal
+period\fR argument of the \s-1HWPREDICT\s0 \fB\s-1RRA\s0\fR. Of course, the \fBRRDtool\fR
+\&\fIresize\fR command is available if these defaults are not sufficient and the
+creator wishes to avoid explicit creations of the other specialized function
+\&\fBRRAs\fR.
+.PP
+\&\fIseasonal period\fR specifies the number of primary data points in a seasonal
+cycle. If \s-1SEASONAL\s0 and \s-1DEVSEASONAL\s0 are implicitly created, this argument for
+those \fBRRAs\fR is set automatically to the value specified by \s-1HWPREDICT\s0. If
+they are explicitly created, the creator should verify that all three
+\&\fIseasonal period\fR arguments agree.
+.PP
+\&\fIalpha\fR is the adaption parameter of the intercept (or baseline)
+coefficient in the Holt-Winters forecasting algorithm. See rrdtool for a
+description of this algorithm. \fIalpha\fR must lie between 0 and 1. A value
+closer to 1 means that more recent observations carry greater weight in
+predicting the baseline component of the forecast. A value closer to 0 means
+that past history carries greater weight in predicting the baseline
+component.
+.PP
+\&\fIbeta\fR is the adaption parameter of the slope (or linear trend) coefficient
+in the Holt-Winters forecasting algorithm. \fIbeta\fR must lie between 0 and 1
+and plays the same role as \fIalpha\fR with respect to the predicted linear
+trend.
+.PP
+\&\fIgamma\fR is the adaption parameter of the seasonal coefficients in the
+Holt-Winters forecasting algorithm (\s-1HWPREDICT\s0) or the adaption parameter in
+the exponential smoothing update of the seasonal deviations. It must lie
+between 0 and 1. If the \s-1SEASONAL\s0 and \s-1DEVSEASONAL\s0 \fBRRAs\fR are created
+implicitly, they will both have the same value for \fIgamma\fR: the value
+specified for the \s-1HWPREDICT\s0 \fIalpha\fR argument. Note that because there is
+one seasonal coefficient (or deviation) for each time point during the
+seasonal cycle, the adaptation rate is much slower than the baseline. Each
+seasonal coefficient is only updated (or adapts) when the observed value
+occurs at the offset in the seasonal cycle corresponding to that
+coefficient.
+.PP
+If \s-1SEASONAL\s0 and \s-1DEVSEASONAL\s0 \fBRRAs\fR are created explicitly, \fIgamma\fR need not
+be the same for both. Note that \fIgamma\fR can also be changed via the
+\&\fBRRDtool\fR \fItune\fR command.
+.PP
+\&\fIrra-num\fR provides the links between related \fBRRAs\fR. If \s-1HWPREDICT\s0 is
+specified alone and the other \fBRRAs\fR are created implicitly, then
+there is no need to worry about this argument. If \fBRRAs\fR are created
+explicitly, then carefully pay attention to this argument. For each
+\&\fB\s-1RRA\s0\fR which includes this argument, there is a dependency between
+that \fB\s-1RRA\s0\fR and another \fB\s-1RRA\s0\fR. The \fIrra-num\fR argument is the 1\-based
+index in the order of \fB\s-1RRA\s0\fR creation (that is, the order they appear
+in the \fIcreate\fR command). The dependent \fB\s-1RRA\s0\fR for each \fB\s-1RRA\s0\fR
+requiring the \fIrra-num\fR argument is listed here:
+.IP "\(bu" 4
+\&\s-1HWPREDICT\s0 \fIrra-num\fR is the index of the \s-1SEASONAL\s0 \fB\s-1RRA\s0\fR.
+.IP "\(bu" 4
+\&\s-1SEASONAL\s0 \fIrra-num\fR is the index of the \s-1HWPREDICT\s0 \fB\s-1RRA\s0\fR.
+.IP "\(bu" 4
+\&\s-1DEVPREDICT\s0 \fIrra-num\fR is the index of the \s-1DEVSEASONAL\s0 \fB\s-1RRA\s0\fR.
+.IP "\(bu" 4
+\&\s-1DEVSEASONAL\s0 \fIrra-num\fR is the index of the \s-1HWPREDICT\s0 \fB\s-1RRA\s0\fR.
+.IP "\(bu" 4
+\&\s-1FAILURES\s0 \fIrra-num\fR is the index of the \s-1DEVSEASONAL\s0 \fB\s-1RRA\s0\fR.
+.PP
+\&\fIthreshold\fR is the minimum number of violations (observed values outside
+the confidence bounds) within a window that constitutes a failure. If the
+\&\s-1FAILURES\s0 \fB\s-1RRA\s0\fR is implicitly created, the default value is 7.
+.PP
+\&\fIwindow length\fR is the number of time points in the window. Specify an
+integer greater than or equal to the threshold and less than or equal to 28.
+The time interval this window represents depends on the interval between
+primary data points. If the \s-1FAILURES\s0 \fB\s-1RRA\s0\fR is implicitly created, the
+default value is 9.
+.SH "The HEARTBEAT and the STEP"
+.IX Header "The HEARTBEAT and the STEP"
+Here is an explanation by Don Baarda on the inner workings of RRDtool.
+It may help you to sort out why all this *UNKNOWN* data is popping
+up in your databases:
+.PP
+RRDtool gets fed samples at arbitrary times. From these it builds Primary
+Data Points (PDPs) at exact times on every \*(L"step\*(R" interval. The PDPs are
+then accumulated into RRAs.
+.PP
+The \*(L"heartbeat\*(R" defines the maximum acceptable interval between
+samples. If the interval between samples is less than \*(L"heartbeat\*(R",
+then an average rate is calculated and applied for that interval. If
+the interval between samples is longer than \*(L"heartbeat\*(R", then that
+entire interval is considered \*(L"unknown\*(R". Note that there are other
+things that can make a sample interval \*(L"unknown\*(R", such as the rate
+exceeding limits, or even an \*(L"unknown\*(R" input sample.
+.PP
+The known rates during a \s-1PDP\s0's \*(L"step\*(R" interval are used to calculate
+an average rate for that \s-1PDP\s0. Also, if the total \*(L"unknown\*(R" time during
+the \*(L"step\*(R" interval exceeds the \*(L"heartbeat\*(R", the entire \s-1PDP\s0 is marked
+as \*(L"unknown\*(R". This means that a mixture of known and \*(L"unknown\*(R" sample
+times in a single \s-1PDP\s0 \*(L"step\*(R" may or may not add up to enough \*(L"unknown\*(R"
+time to exceed \*(L"heartbeat\*(R" and hence mark the whole \s-1PDP\s0 \*(L"unknown\*(R". So
+\&\*(L"heartbeat\*(R" is not only the maximum acceptable interval between
+samples, but also the maximum acceptable amount of \*(L"unknown\*(R" time per
+\&\s-1PDP\s0 (obviously this is only significant if you have \*(L"heartbeat\*(R" less
+than \*(L"step\*(R").
+.PP
+The \*(L"heartbeat\*(R" can be short (unusual) or long (typical) relative to
+the \*(L"step\*(R" interval between PDPs. A short \*(L"heartbeat\*(R" means you
+require multiple samples per \s-1PDP\s0, and if you don't get them mark the
+\&\s-1PDP\s0 unknown. A long heartbeat can span multiple \*(L"steps\*(R", which means
+it is acceptable to have multiple PDPs calculated from a single
+sample. An extreme example of this might be a \*(L"step\*(R" of 5 minutes and a
+\&\*(L"heartbeat\*(R" of one day, in which case a single sample every day will
+result in all the PDPs for that entire day period being set to the
+same average rate. \fI\-\- Don Baarda <don.baarda@baesystems.com>\fR
+.PP
+.Vb 35
+\&       time|
+\&       axis|
+\& begin__|00|
+\&        |01|
+\&       u|02|\-\-\-\-* sample1, restart "hb"\-timer
+\&       u|03|   /
+\&       u|04|  /
+\&       u|05| /
+\&       u|06|/     "hbt" expired
+\&       u|07|
+\&        |08|\-\-\-\-* sample2, restart "hb" 
+\&        |09|   / 
+\&        |10|  /
+\&       u|11|\-\-\-\-* sample3, restart "hb"
+\&       u|12|   /
+\&       u|13|  /
+\& step1_u|14| /
+\&       u|15|/     "swt" expired
+\&       u|16|
+\&        |17|\-\-\-\-* sample4, restart "hb", create "pdp" for step1 = 
+\&        |18|   /  = unknown due to 10 "u" labled secs > "hb"
+\&        |19|  /
+\&        |20| /
+\&        |21|\-\-\-\-* sample5, restart "hb"
+\&        |22|   /
+\&        |23|  /
+\&        |24|\-\-\-\-* sample6, restart "hb"
+\&        |25|   /
+\&        |26|  /
+\&        |27|\-\-\-\-* sample7, restart "hb"
+\& step2__|28|   /
+\&        |22|  /
+\&        |23|\-\-\-\-* sample8, restart "hb", create "pdp" for step1, create "cdp" 
+\&        |24|   /
+\&        |25|  /
+.Ve
+.PP
+graphics by \fIvladimir.lavrov@desy.de\fR.
+.SH "HOW TO MEASURE"
+.IX Header "HOW TO MEASURE"
+Here are a few hints on how to measure:
+.IP "Temperature" 4
+.IX Item "Temperature"
+Usually you have some type of meter you can read to get the temperature.
+The temperature is not really connected with a time. The only connection is
+that the temperature reading happened at a certain time. You can use the
+\&\fB\s-1GAUGE\s0\fR data source type for this. RRDtool will then record your reading
+together with the time.
+.IP "Mail Messages" 4
+.IX Item "Mail Messages"
+Assume you have a method to count the number of messages transported by
+your mailserver in a certain amount of time, giving you data like '5
+messages in the last 65 seconds'. If you look at the count of 5 like an
+\&\fB\s-1ABSOLUTE\s0\fR data type you can simply update the \s-1RRD\s0 with the number 5 and the
+end time of your monitoring period. RRDtool will then record the number of
+messages per second. If at some later stage you want to know the number of
+messages transported in a day, you can get the average messages per second
+from RRDtool for the day in question and multiply this number with the
+number of seconds in a day. Because all math is run with Doubles, the
+precision should be acceptable.
+.IP "It's always a Rate" 4
+.IX Item "It's always a Rate"
+RRDtool stores rates in amount/second for \s-1COUNTER\s0, \s-1DERIVE\s0 and \s-1ABSOLUTE\s0
+data.  When you plot the data, you will get on the y axis
+amount/second which you might be tempted to convert to an absolute
+amount by multiplying by the delta-time between the points. RRDtool
+plots continuous data, and as such is not appropriate for plotting
+absolute amounts as for example \*(L"total bytes\*(R" sent and received in a
+router. What you probably want is plot rates that you can scale to
+bytes/hour, for example, or plot absolute amounts with another tool
+that draws bar\-plots, where the delta-time is clear on the plot for
+each point (such that when you read the graph you see for example \s-1GB\s0
+on the y axis, days on the x axis and one bar for each day).
+.SH "EXAMPLE"
+.IX Header "EXAMPLE"
+.Vb 6
+\& rrdtool create temperature.rrd \-\-step 300 \e
+\&  DS:temp:GAUGE:600:\-273:5000 \e
+\&  RRA:AVERAGE:0.5:1:1200 \e
+\&  RRA:MIN:0.5:12:2400 \e
+\&  RRA:MAX:0.5:12:2400 \e
+\&  RRA:AVERAGE:0.5:12:2400
+.Ve
+.PP
+This sets up an \fB\s-1RRD\s0\fR called \fItemperature.rrd\fR which accepts one
+temperature value every 300 seconds. If no new data is supplied for
+more than 600 seconds, the temperature becomes \fI*UNKNOWN*\fR.  The
+minimum acceptable value is \-273 and the maximum is 5'000.
+.PP
+A few archive areas are also defined. The first stores the
+temperatures supplied for 100 hours (1'200 * 300 seconds = 100
+hours). The second \s-1RRA\s0 stores the minimum temperature recorded over
+every hour (12 * 300 seconds = 1 hour), for 100 days (2'400 hours). The
+third and the fourth \s-1RRA\s0's do the same for the maximum and
+average temperature, respectively.
+.SH "EXAMPLE 2"
+.IX Header "EXAMPLE 2"
+.Vb 4
+\& rrdtool create monitor.rrd \-\-step 300        \e
+\&   DS:ifOutOctets:COUNTER:1800:0:4294967295   \e
+\&   RRA:AVERAGE:0.5:1:2016                     \e
+\&   RRA:HWPREDICT:1440:0.1:0.0035:288
+.Ve
+.PP
+This example is a monitor of a router interface. The first \fB\s-1RRA\s0\fR tracks the
+traffic flow in octets; the second \fB\s-1RRA\s0\fR generates the specialized
+functions \fBRRAs\fR for aberrant behavior detection. Note that the \fIrra-num\fR
+argument of \s-1HWPREDICT\s0 is missing, so the other \fBRRAs\fR will implicitly be
+created with default parameter values. In this example, the forecasting
+algorithm baseline adapts quickly; in fact the most recent one hour of
+observations (each at 5 minute intervals) accounts for 75% of the baseline
+prediction. The linear trend forecast adapts much more slowly. Observations
+made during the last day (at 288 observations per day) account for only
+65% of the predicted linear trend. Note: these computations rely on an
+exponential smoothing formula described in the \s-1LISA\s0 2000 paper.
+.PP
+The seasonal cycle is one day (288 data points at 300 second intervals), and
+the seasonal adaption parameter will be set to 0.1. The \s-1RRD\s0 file will store 5
+days (1'440 data points) of forecasts and deviation predictions before wrap
+around. The file will store 1 day (a seasonal cycle) of 0\-1 indicators in
+the \s-1FAILURES\s0 \fB\s-1RRA\s0\fR.
+.PP
+The same \s-1RRD\s0 file and \fBRRAs\fR are created with the following command,
+which explicitly creates all specialized function \fBRRAs\fR.
+.PP
+.Vb 8
+\& rrdtool create monitor.rrd \-\-step 300 \e
+\&   DS:ifOutOctets:COUNTER:1800:0:4294967295 \e
+\&   RRA:AVERAGE:0.5:1:2016 \e
+\&   RRA:HWPREDICT:1440:0.1:0.0035:288:3 \e
+\&   RRA:SEASONAL:288:0.1:2 \e
+\&   RRA:DEVPREDICT:1440:5 \e
+\&   RRA:DEVSEASONAL:288:0.1:2 \e
+\&   RRA:FAILURES:288:7:9:5
+.Ve
+.PP
+Of course, explicit creation need not replicate implicit create, a
+number of arguments could be changed.
+.SH "EXAMPLE 3"
+.IX Header "EXAMPLE 3"
+.Vb 5
+\& rrdtool create proxy.rrd \-\-step 300 \e
+\&   DS:Total:DERIVE:1800:0:U  \e
+\&   DS:Duration:DERIVE:1800:0:U  \e
+\&   DS:AvgReqDur:COMPUTE:Duration,Requests,0,EQ,1,Requests,IF,/ \e
+\&   RRA:AVERAGE:0.5:1:2016
+.Ve
+.PP
+This example is monitoring the average request duration during each 300 sec
+interval for requests processed by a web proxy during the interval.
+In this case, the proxy exposes two counters, the number of requests
+processed since boot and the total cumulative duration of all processed
+requests. Clearly these counters both have some rollover point, but using the
+\&\s-1DERIVE\s0 data source also handles the reset that occurs when the web proxy is
+stopped and restarted.
+.PP
+In the \fB\s-1RRD\s0\fR, the first data source stores the requests per second rate
+during the interval. The second data source stores the total duration of all
+requests processed during the interval divided by 300. The \s-1COMPUTE\s0 data source
+divides each \s-1PDP\s0 of the AccumDuration by the corresponding \s-1PDP\s0 of
+TotalRequests and stores the average request duration. The remainder of the
+\&\s-1RPN\s0 expression handles the divide by zero case.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Tobias Oetiker <tobi@oetiker.ch>
diff --git a/doc/rrdcreate.html b/doc/rrdcreate.html
new file mode 100644 (file)
index 0000000..8b4d326
--- /dev/null
@@ -0,0 +1,585 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdcreate</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#aberrant_behavior_detection_with_holtwinters_forecasting">Aberrant Behavior Detection with Holt-Winters Forecasting</a></li>
+       <li><a href="#the_heartbeat_and_the_step">The HEARTBEAT and the STEP</a></li>
+       <li><a href="#how_to_measure">HOW TO MEASURE</a></li>
+       <li><a href="#example">EXAMPLE</a></li>
+       <li><a href="#example_2">EXAMPLE 2</a></li>
+       <li><a href="#example_3">EXAMPLE 3</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdcreate - Set up a new Round Robin Database</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p><strong>rrdtool</strong> <strong>create</strong> <em>filename</em>
+[<strong>--start</strong>|<strong>-b</strong>&nbsp;<em>start&nbsp;time</em>]
+[<strong>--step</strong>|<strong>-s</strong>&nbsp;<em>step</em>]
+[<strong>DS:</strong><em>ds-name</em><strong>:</strong><em>DST</em><strong>:</strong><em>dst&nbsp;arguments</em>]
+[<strong>RRA:</strong><em>CF</em><strong>:</strong><em>cf&nbsp;arguments</em>]</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>The create function of RRDtool lets you set up new Round Robin
+Database (<strong>RRD</strong>) files.  The file is created at its final, full size
+and filled with <em>*UNKNOWN*</em> data.</p>
+<dl>
+<dt><strong><a name="item_filename"><em>filename</em></a></strong>
+
+<dd>
+<p>The name of the <strong>RRD</strong> you want to create. <strong>RRD</strong> files should end
+with the extension <em>.rrd</em>. However, <strong>RRDtool</strong> will accept any
+filename.</p>
+</dd>
+</li>
+<dt><strong><a name="item_time"><strong>--start</strong>|<strong>-b</strong> <em>start time</em> (default: now - 10s)</a></strong>
+
+<dd>
+<p>Specifies the time in seconds since 1970-01-01 UTC when the first
+value should be added to the <strong>RRD</strong>. <strong>RRDtool</strong> will not accept
+any data timed before or at the time specified.</p>
+</dd>
+<dd>
+<p>See also AT-STYLE TIME SPECIFICATION section in the
+<em>rrdfetch</em> documentation for other ways to specify time.</p>
+</dd>
+</li>
+<dt><strong><a name="item_step"><strong>--step</strong>|<strong>-s</strong> <em>step</em> (default: 300 seconds)</a></strong>
+
+<dd>
+<p>Specifies the base interval in seconds with which data will be fed
+into the <strong>RRD</strong>.</p>
+</dd>
+</li>
+<dt><strong><a name="item_ds_3ads_2dname_3adst_3adst_arguments"><strong>DS:</strong><em>ds-name</em><strong>:</strong><em>DST</em><strong>:</strong><em>dst arguments</em></a></strong>
+
+<dd>
+<p>A single <strong>RRD</strong> can accept input from several data sources (<strong>DS</strong>),
+for example incoming and outgoing traffic on a specific communication
+line. With the <strong>DS</strong> configuration option you must define some basic
+properties of each data source you want to store in the <strong>RRD</strong>.</p>
+</dd>
+<dd>
+<p><em>ds-name</em> is the name you will use to reference this particular data
+source from an <strong>RRD</strong>. A <em>ds-name</em> must be 1 to 19 characters long in
+the characters [a-zA-Z0-9_].</p>
+</dd>
+<dd>
+<p><em>DST</em> defines the Data Source Type. The remaining arguments of a
+data source entry depend on the data source type. For GAUGE, COUNTER,
+DERIVE, and ABSOLUTE the format for a data source entry is:</p>
+</dd>
+<dd>
+<p><strong>DS:</strong><em>ds-name</em><strong>:</strong><em>GAUGE | COUNTER | DERIVE | ABSOLUTE</em><strong>:</strong><em>heartbeat</em><strong>:</strong><em>min</em><strong>:</strong><em>max</em></p>
+</dd>
+<dd>
+<p>For COMPUTE data sources, the format is:</p>
+</dd>
+<dd>
+<p><strong>DS:</strong><em>ds-name</em><strong>:</strong><em>COMPUTE</em><strong>:</strong><em>rpn-expression</em></p>
+</dd>
+<dd>
+<p>In order to decide which data source type to use, review the
+definitions that follow. Also consult the section on ``HOW TO MEASURE''
+for further insight.</p>
+</dd>
+<dl>
+<dt><strong><a name="item_gauge"><strong>GAUGE</strong></a></strong>
+
+<dd>
+<p>is for things like temperatures or number of people in a room or the
+value of a RedHat share.</p>
+</dd>
+</li>
+<dt><strong><a name="item_counter"><strong>COUNTER</strong></a></strong>
+
+<dd>
+<p>is for continuous incrementing counters like the ifInOctets counter in
+a router. The <strong>COUNTER</strong> data source assumes that the counter never
+decreases, except when a counter overflows.  The update function takes
+the overflow into account.  The counter is stored as a per-second
+rate. When the counter overflows, RRDtool checks if the overflow
+happened at the 32bit or 64bit border and acts accordingly by adding
+an appropriate value to the result.</p>
+</dd>
+</li>
+<dt><strong><a name="item_derive"><strong>DERIVE</strong></a></strong>
+
+<dd>
+<p>will store the derivative of the line going from the last to the
+current value of the data source. This can be useful for gauges, for
+example, to measure the rate of people entering or leaving a
+room. Internally, derive works exactly like COUNTER but without
+overflow checks. So if your counter does not reset at 32 or 64 bit you
+might want to use DERIVE and combine it with a MIN value of 0.</p>
+</dd>
+<dl>
+<dt><strong><a name="item_note_on_counter_vs_derive">NOTE on COUNTER vs DERIVE</a></strong>
+
+<dd>
+<p>by Don Baarda &lt;<a href="mailto:don.baarda@baesystems.com">don.baarda@baesystems.com</a>&gt;</p>
+</dd>
+<dd>
+<p>If you cannot tolerate ever mistaking the occasional counter reset for a
+legitimate counter wrap, and would prefer ``Unknowns'' for all legitimate
+counter wraps and resets, always use DERIVE with min=0. Otherwise, using
+COUNTER with a suitable max will return correct values for all legitimate
+counter wraps, mark some counter resets as ``Unknown'', but can mistake some
+counter resets for a legitimate counter wrap.</p>
+</dd>
+<dd>
+<p>For a 5 minute step and 32-bit counter, the probability of mistaking a
+counter reset for a legitimate wrap is arguably about 0.8% per 1Mbps of
+maximum bandwidth. Note that this equates to 80% for 100Mbps interfaces, so
+for high bandwidth interfaces and a 32bit counter, DERIVE with min=0 is
+probably preferable. If you are using a 64bit counter, just about any max
+setting will eliminate the possibility of mistaking a reset for a counter
+wrap.</p>
+</dd>
+</li>
+</dl>
+<dt><strong><a name="item_absolute"><strong>ABSOLUTE</strong></a></strong>
+
+<dd>
+<p>is for counters which get reset upon reading. This is used for fast counters
+which tend to overflow. So instead of reading them normally you reset them
+after every read to make sure you have a maximum time available before the
+next overflow. Another usage is for things you count like number of messages
+since the last update.</p>
+</dd>
+</li>
+<dt><strong><a name="item_compute"><strong>COMPUTE</strong></a></strong>
+
+<dd>
+<p>is for storing the result of a formula applied to other data sources
+in the <strong>RRD</strong>. This data source is not supplied a value on update, but
+rather its Primary Data Points (PDPs) are computed from the PDPs of
+the data sources according to the rpn-expression that defines the
+formula. Consolidation functions are then applied normally to the PDPs
+of the COMPUTE data source (that is the rpn-expression is only applied
+to generate PDPs). In database software, such data sets are referred
+to as ``virtual'' or ``computed'' columns.</p>
+</dd>
+</li>
+</dl>
+<p><em>heartbeat</em> defines the maximum number of seconds that may pass
+between two updates of this data source before the value of the
+data source is assumed to be <em>*UNKNOWN*</em>.</p>
+<p><em>min</em> and <em>max</em> define the expected range values for data supplied by a
+data source. If <em>min</em> and/or <em>max</em> any value outside the defined range
+will be regarded as <em>*UNKNOWN*</em>. If you do not know or care about min and
+max, set them to U for unknown. Note that min and max always refer to the
+processed values of the DS. For a traffic-<strong>COUNTER</strong> type DS this would be
+the maximum and minimum data-rate expected from the device.</p>
+<p><em>If information on minimal/maximal expected values is available,
+always set the min and/or max properties. This will help RRDtool in
+doing a simple sanity check on the data supplied when running update.</em></p>
+<p><em>rpn-expression</em> defines the formula used to compute the PDPs of a
+COMPUTE data source from other data sources in the same &lt;RRD&gt;. It is
+similar to defining a <strong>CDEF</strong> argument for the graph command. Please
+refer to that manual page for a list and description of RPN operations
+supported. For COMPUTE data sources, the following RPN operations are
+not supported: COUNT, PREV, TIME, and LTIME. In addition, in defining
+the RPN expression, the COMPUTE data source may only refer to the
+names of data source listed previously in the create command. This is
+similar to the restriction that <strong>CDEF</strong>s must refer only to <strong>DEF</strong>s
+and <strong>CDEF</strong>s previously defined in the same graph command.</p>
+<dt><strong><a name="item_rra_3acf_3acf_arguments"><strong>RRA:</strong><em>CF</em><strong>:</strong><em>cf arguments</em></a></strong>
+
+<dd>
+<p>The purpose of an <strong>RRD</strong> is to store data in the round robin archives
+(<strong>RRA</strong>). An archive consists of a number of data values or statistics for
+each of the defined data-sources (<strong>DS</strong>) and is defined with an <strong>RRA</strong> line.</p>
+</dd>
+<dd>
+<p>When data is entered into an <strong>RRD</strong>, it is first fit into time slots
+of the length defined with the <strong>-s</strong> option, thus becoming a <em>primary
+data point</em>.</p>
+</dd>
+<dd>
+<p>The data is also processed with the consolidation function (<em>CF</em>) of
+the archive. There are several consolidation functions that
+consolidate primary data points via an aggregate function: <strong>AVERAGE</strong>,
+<strong>MIN</strong>, <strong>MAX</strong>, <strong>LAST</strong>. The format of <strong>RRA</strong> line for these
+consolidation functions is:</p>
+</dd>
+<dd>
+<p><strong>RRA:</strong><em>AVERAGE | MIN | MAX | LAST</em><strong>:</strong><em>xff</em><strong>:</strong><em>steps</em><strong>:</strong><em>rows</em></p>
+</dd>
+<dd>
+<p><em>xff</em> The xfiles factor defines what part of a consolidation interval may
+be made up from <em>*UNKNOWN*</em> data while the consolidated value is still
+regarded as known. It is given as the ratio of allowed <em>*UNKNOWN*</em> PDPs
+to the number of PDPs in the interval. Thus, it ranges from 0 to 1 (exclusive).</p>
+</dd>
+<dd>
+<p><em>steps</em> defines how many of these <em>primary data points</em> are used to build
+a <em>consolidated data point</em> which then goes into the archive.</p>
+</dd>
+<dd>
+<p><em>rows</em> defines how many generations of data values are kept in an <strong>RRA</strong>.</p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<hr />
+<h1><a name="aberrant_behavior_detection_with_holtwinters_forecasting">Aberrant Behavior Detection with Holt-Winters Forecasting</a></h1>
+<p>In addition to the aggregate functions, there are a set of specialized
+functions that enable <strong>RRDtool</strong> to provide data smoothing (via the
+Holt-Winters forecasting algorithm), confidence bands, and the
+flagging aberrant behavior in the data source time series:</p>
+<ul>
+<li>
+<p><strong>RRA:</strong><em>HWPREDICT</em><strong>:</strong><em>rows</em><strong>:</strong><em>alpha</em><strong>:</strong><em>beta</em><strong>:</strong><em>seasonal period</em>[<strong>:</strong><em>rra-num</em>]</p>
+</li>
+<li>
+<p><strong>RRA:</strong><em>SEASONAL</em><strong>:</strong><em>seasonal period</em><strong>:</strong><em>gamma</em><strong>:</strong><em>rra-num</em></p>
+</li>
+<li>
+<p><strong>RRA:</strong><em>DEVSEASONAL</em><strong>:</strong><em>seasonal period</em><strong>:</strong><em>gamma</em><strong>:</strong><em>rra-num</em></p>
+</li>
+<li>
+<p><strong>RRA:</strong><em>DEVPREDICT</em><strong>:</strong><em>rows</em><strong>:</strong><em>rra-num</em></p>
+</li>
+<li>
+<p><strong>RRA:</strong><em>FAILURES</em><strong>:</strong><em>rows</em><strong>:</strong><em>threshold</em><strong>:</strong><em>window length</em><strong>:</strong><em>rra-num</em></p>
+</li>
+</ul>
+<p>These <strong>RRAs</strong> differ from the true consolidation functions in several ways.
+First, each of the <strong>RRA</strong>s is updated once for every primary data point.
+Second, these <strong>RRAs</strong> are interdependent. To generate real-time confidence
+bounds, a matched set of HWPREDICT, SEASONAL, DEVSEASONAL, and
+DEVPREDICT must exist. Generating smoothed values of the primary data points
+requires both a HWPREDICT <strong>RRA</strong> and SEASONAL <strong>RRA</strong>. Aberrant behavior
+detection requires FAILURES, HWPREDICT, DEVSEASONAL, and SEASONAL.</p>
+<p>The actual predicted, or smoothed, values are stored in the HWPREDICT
+<strong>RRA</strong>. The predicted deviations are stored in DEVPREDICT (think a standard
+deviation which can be scaled to yield a confidence band). The FAILURES
+<strong>RRA</strong> stores binary indicators. A 1 marks the indexed observation as
+failure; that is, the number of confidence bounds violations in the
+preceding window of observations met or exceeded a specified threshold. An
+example of using these <strong>RRAs</strong> to graph confidence bounds and failures
+appears in <a href="././rrdgraph.html">the rrdgraph manpage</a>.</p>
+<p>The SEASONAL and DEVSEASONAL <strong>RRAs</strong> store the seasonal coefficients for the
+Holt-Winters forecasting algorithm and the seasonal deviations, respectively.
+There is one entry per observation time point in the seasonal cycle. For
+example, if primary data points are generated every five minutes and the
+seasonal cycle is 1 day, both SEASONAL and DEVSEASONAL will have 288 rows.</p>
+<p>In order to simplify the creation for the novice user, in addition to
+supporting explicit creation of the HWPREDICT, SEASONAL, DEVPREDICT,
+DEVSEASONAL, and FAILURES <strong>RRAs</strong>, the <strong>RRDtool</strong> create command supports
+implicit creation of the other four when HWPREDICT is specified alone and
+the final argument <em>rra-num</em> is omitted.</p>
+<p><em>rows</em> specifies the length of the <strong>RRA</strong> prior to wrap around. Remember
+that there is a one-to-one correspondence between primary data points and
+entries in these RRAs. For the HWPREDICT CF, <em>rows</em> should be larger than
+the <em>seasonal period</em>. If the DEVPREDICT <strong>RRA</strong> is implicitly created, the
+default number of rows is the same as the HWPREDICT <em>rows</em> argument. If the
+FAILURES <strong>RRA</strong> is implicitly created, <em>rows</em> will be set to the <em>seasonal
+period</em> argument of the HWPREDICT <strong>RRA</strong>. Of course, the <strong>RRDtool</strong>
+<em>resize</em> command is available if these defaults are not sufficient and the
+creator wishes to avoid explicit creations of the other specialized function
+<strong>RRAs</strong>.</p>
+<p><em>seasonal period</em> specifies the number of primary data points in a seasonal
+cycle. If SEASONAL and DEVSEASONAL are implicitly created, this argument for
+those <strong>RRAs</strong> is set automatically to the value specified by HWPREDICT. If
+they are explicitly created, the creator should verify that all three
+<em>seasonal period</em> arguments agree.</p>
+<p><em>alpha</em> is the adaption parameter of the intercept (or baseline)
+coefficient in the Holt-Winters forecasting algorithm. See <a href="././rrdtool.html">the rrdtool manpage</a> for a
+description of this algorithm. <em>alpha</em> must lie between 0 and 1. A value
+closer to 1 means that more recent observations carry greater weight in
+predicting the baseline component of the forecast. A value closer to 0 means
+that past history carries greater weight in predicting the baseline
+component.</p>
+<p><em>beta</em> is the adaption parameter of the slope (or linear trend) coefficient
+in the Holt-Winters forecasting algorithm. <em>beta</em> must lie between 0 and 1
+and plays the same role as <em>alpha</em> with respect to the predicted linear
+trend.</p>
+<p><em>gamma</em> is the adaption parameter of the seasonal coefficients in the
+Holt-Winters forecasting algorithm (HWPREDICT) or the adaption parameter in
+the exponential smoothing update of the seasonal deviations. It must lie
+between 0 and 1. If the SEASONAL and DEVSEASONAL <strong>RRAs</strong> are created
+implicitly, they will both have the same value for <em>gamma</em>: the value
+specified for the HWPREDICT <em>alpha</em> argument. Note that because there is
+one seasonal coefficient (or deviation) for each time point during the
+seasonal cycle, the adaptation rate is much slower than the baseline. Each
+seasonal coefficient is only updated (or adapts) when the observed value
+occurs at the offset in the seasonal cycle corresponding to that
+coefficient.</p>
+<p>If SEASONAL and DEVSEASONAL <strong>RRAs</strong> are created explicitly, <em>gamma</em> need not
+be the same for both. Note that <em>gamma</em> can also be changed via the
+<strong>RRDtool</strong> <em>tune</em> command.</p>
+<p><em>rra-num</em> provides the links between related <strong>RRAs</strong>. If HWPREDICT is
+specified alone and the other <strong>RRAs</strong> are created implicitly, then
+there is no need to worry about this argument. If <strong>RRAs</strong> are created
+explicitly, then carefully pay attention to this argument. For each
+<strong>RRA</strong> which includes this argument, there is a dependency between
+that <strong>RRA</strong> and another <strong>RRA</strong>. The <em>rra-num</em> argument is the 1-based
+index in the order of <strong>RRA</strong> creation (that is, the order they appear
+in the <em>create</em> command). The dependent <strong>RRA</strong> for each <strong>RRA</strong>
+requiring the <em>rra-num</em> argument is listed here:</p>
+<ul>
+<li>
+<p>HWPREDICT <em>rra-num</em> is the index of the SEASONAL <strong>RRA</strong>.</p>
+</li>
+<li>
+<p>SEASONAL <em>rra-num</em> is the index of the HWPREDICT <strong>RRA</strong>.</p>
+</li>
+<li>
+<p>DEVPREDICT <em>rra-num</em> is the index of the DEVSEASONAL <strong>RRA</strong>.</p>
+</li>
+<li>
+<p>DEVSEASONAL <em>rra-num</em> is the index of the HWPREDICT <strong>RRA</strong>.</p>
+</li>
+<li>
+<p>FAILURES <em>rra-num</em> is the index of the DEVSEASONAL <strong>RRA</strong>.</p>
+</li>
+</ul>
+<p><em>threshold</em> is the minimum number of violations (observed values outside
+the confidence bounds) within a window that constitutes a failure. If the
+FAILURES <strong>RRA</strong> is implicitly created, the default value is 7.</p>
+<p><em>window length</em> is the number of time points in the window. Specify an
+integer greater than or equal to the threshold and less than or equal to 28.
+The time interval this window represents depends on the interval between
+primary data points. If the FAILURES <strong>RRA</strong> is implicitly created, the
+default value is 9.</p>
+<p>
+</p>
+<hr />
+<h1><a name="the_heartbeat_and_the_step">The HEARTBEAT and the STEP</a></h1>
+<p>Here is an explanation by Don Baarda on the inner workings of RRDtool.
+It may help you to sort out why all this *UNKNOWN* data is popping
+up in your databases:</p>
+<p>RRDtool gets fed samples at arbitrary times. From these it builds Primary
+Data Points (PDPs) at exact times on every ``step'' interval. The PDPs are
+then accumulated into RRAs.</p>
+<p>The ``heartbeat'' defines the maximum acceptable interval between
+samples. If the interval between samples is less than ``heartbeat'',
+then an average rate is calculated and applied for that interval. If
+the interval between samples is longer than ``heartbeat'', then that
+entire interval is considered ``unknown''. Note that there are other
+things that can make a sample interval ``unknown'', such as the rate
+exceeding limits, or even an ``unknown'' input sample.</p>
+<p>The known rates during a PDP's ``step'' interval are used to calculate
+an average rate for that PDP. Also, if the total ``unknown'' time during
+the ``step'' interval exceeds the ``heartbeat'', the entire PDP is marked
+as ``unknown''. This means that a mixture of known and ``unknown'' sample
+times in a single PDP ``step'' may or may not add up to enough ``unknown''
+time to exceed ``heartbeat'' and hence mark the whole PDP ``unknown''. So
+``heartbeat'' is not only the maximum acceptable interval between
+samples, but also the maximum acceptable amount of ``unknown'' time per
+PDP (obviously this is only significant if you have ``heartbeat'' less
+than ``step'').</p>
+<p>The ``heartbeat'' can be short (unusual) or long (typical) relative to
+the ``step'' interval between PDPs. A short ``heartbeat'' means you
+require multiple samples per PDP, and if you don't get them mark the
+PDP unknown. A long heartbeat can span multiple ``steps'', which means
+it is acceptable to have multiple PDPs calculated from a single
+sample. An extreme example of this might be a ``step'' of 5 minutes and a
+``heartbeat'' of one day, in which case a single sample every day will
+result in all the PDPs for that entire day period being set to the
+same average rate. <em>-- Don Baarda &lt;<a href="mailto:don.baarda@baesystems.com">don.baarda@baesystems.com</a>&gt;</em></p>
+<pre>
+       time|
+       axis|
+ begin__|00|
+        |01|
+       u|02|----* sample1, restart &quot;hb&quot;-timer
+       u|03|   /
+       u|04|  /
+       u|05| /
+       u|06|/     &quot;hbt&quot; expired
+       u|07|
+        |08|----* sample2, restart &quot;hb&quot; 
+        |09|   / 
+        |10|  /
+       u|11|----* sample3, restart &quot;hb&quot;
+       u|12|   /
+       u|13|  /
+ step1_u|14| /
+       u|15|/     &quot;swt&quot; expired
+       u|16|
+        |17|----* sample4, restart &quot;hb&quot;, create &quot;pdp&quot; for step1 = 
+        |18|   /  = unknown due to 10 &quot;u&quot; labled secs &gt; &quot;hb&quot;
+        |19|  /
+        |20| /
+        |21|----* sample5, restart &quot;hb&quot;
+        |22|   /
+        |23|  /
+        |24|----* sample6, restart &quot;hb&quot;
+        |25|   /
+        |26|  /
+        |27|----* sample7, restart &quot;hb&quot;
+ step2__|28|   /
+        |22|  /
+        |23|----* sample8, restart &quot;hb&quot;, create &quot;pdp&quot; for step1, create &quot;cdp&quot; 
+        |24|   /
+        |25|  /</pre>
+<p>graphics by <em><a href="mailto:vladimir.lavrov@desy.de">vladimir.lavrov@desy.de</a></em>.</p>
+<p>
+</p>
+<hr />
+<h1><a name="how_to_measure">HOW TO MEASURE</a></h1>
+<p>Here are a few hints on how to measure:</p>
+<dl>
+<dt><strong><a name="item_temperature">Temperature</a></strong>
+
+<dd>
+<p>Usually you have some type of meter you can read to get the temperature.
+The temperature is not really connected with a time. The only connection is
+that the temperature reading happened at a certain time. You can use the
+<strong>GAUGE</strong> data source type for this. RRDtool will then record your reading
+together with the time.</p>
+</dd>
+</li>
+<dt><strong><a name="item_mail_messages">Mail Messages</a></strong>
+
+<dd>
+<p>Assume you have a method to count the number of messages transported by
+your mailserver in a certain amount of time, giving you data like '5
+messages in the last 65 seconds'. If you look at the count of 5 like an
+<strong>ABSOLUTE</strong> data type you can simply update the RRD with the number 5 and the
+end time of your monitoring period. RRDtool will then record the number of
+messages per second. If at some later stage you want to know the number of
+messages transported in a day, you can get the average messages per second
+from RRDtool for the day in question and multiply this number with the
+number of seconds in a day. Because all math is run with Doubles, the
+precision should be acceptable.</p>
+</dd>
+</li>
+<dt><strong><a name="item_it_27s_always_a_rate">It's always a Rate</a></strong>
+
+<dd>
+<p>RRDtool stores rates in amount/second for COUNTER, DERIVE and ABSOLUTE
+data.  When you plot the data, you will get on the y axis
+amount/second which you might be tempted to convert to an absolute
+amount by multiplying by the delta-time between the points. RRDtool
+plots continuous data, and as such is not appropriate for plotting
+absolute amounts as for example ``total bytes'' sent and received in a
+router. What you probably want is plot rates that you can scale to
+bytes/hour, for example, or plot absolute amounts with another tool
+that draws bar-plots, where the delta-time is clear on the plot for
+each point (such that when you read the graph you see for example GB
+on the y axis, days on the x axis and one bar for each day).</p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<hr />
+<h1><a name="example">EXAMPLE</a></h1>
+<pre>
+ rrdtool create temperature.rrd --step 300 \
+  DS:temp:GAUGE:600:-273:5000 \
+  RRA:AVERAGE:0.5:1:1200 \
+  RRA:MIN:0.5:12:2400 \
+  RRA:MAX:0.5:12:2400 \
+  RRA:AVERAGE:0.5:12:2400</pre>
+<p>This sets up an <strong>RRD</strong> called <em>temperature.rrd</em> which accepts one
+temperature value every 300 seconds. If no new data is supplied for
+more than 600 seconds, the temperature becomes <em>*UNKNOWN*</em>.  The
+minimum acceptable value is -273 and the maximum is 5'000.</p>
+<p>A few archive areas are also defined. The first stores the
+temperatures supplied for 100 hours (1'200 * 300 seconds = 100
+hours). The second RRA stores the minimum temperature recorded over
+every hour (12 * 300 seconds = 1 hour), for 100 days (2'400 hours). The
+third and the fourth RRA's do the same for the maximum and
+average temperature, respectively.</p>
+<p>
+</p>
+<hr />
+<h1><a name="example_2">EXAMPLE 2</a></h1>
+<pre>
+ rrdtool create monitor.rrd --step 300        \
+   DS:ifOutOctets:COUNTER:1800:0:4294967295   \
+   RRA:AVERAGE:0.5:1:2016                     \
+   RRA:HWPREDICT:1440:0.1:0.0035:288</pre>
+<p>This example is a monitor of a router interface. The first <strong>RRA</strong> tracks the
+traffic flow in octets; the second <strong>RRA</strong> generates the specialized
+functions <strong>RRAs</strong> for aberrant behavior detection. Note that the <em>rra-num</em>
+argument of HWPREDICT is missing, so the other <strong>RRAs</strong> will implicitly be
+created with default parameter values. In this example, the forecasting
+algorithm baseline adapts quickly; in fact the most recent one hour of
+observations (each at 5 minute intervals) accounts for 75% of the baseline
+prediction. The linear trend forecast adapts much more slowly. Observations
+made during the last day (at 288 observations per day) account for only
+65% of the predicted linear trend. Note: these computations rely on an
+exponential smoothing formula described in the LISA 2000 paper.</p>
+<p>The seasonal cycle is one day (288 data points at 300 second intervals), and
+the seasonal adaption parameter will be set to 0.1. The RRD file will store 5
+days (1'440 data points) of forecasts and deviation predictions before wrap
+around. The file will store 1 day (a seasonal cycle) of 0-1 indicators in
+the FAILURES <strong>RRA</strong>.</p>
+<p>The same RRD file and <strong>RRAs</strong> are created with the following command,
+which explicitly creates all specialized function <strong>RRAs</strong>.</p>
+<pre>
+ rrdtool create monitor.rrd --step 300 \
+   DS:ifOutOctets:COUNTER:1800:0:4294967295 \
+   RRA:AVERAGE:0.5:1:2016 \
+   RRA:HWPREDICT:1440:0.1:0.0035:288:3 \
+   RRA:SEASONAL:288:0.1:2 \
+   RRA:DEVPREDICT:1440:5 \
+   RRA:DEVSEASONAL:288:0.1:2 \
+   RRA:FAILURES:288:7:9:5</pre>
+<p>Of course, explicit creation need not replicate implicit create, a
+number of arguments could be changed.</p>
+<p>
+</p>
+<hr />
+<h1><a name="example_3">EXAMPLE 3</a></h1>
+<pre>
+ rrdtool create proxy.rrd --step 300 \
+   DS:Total:DERIVE:1800:0:U  \
+   DS:Duration:DERIVE:1800:0:U  \
+   DS:AvgReqDur:COMPUTE:Duration,Requests,0,EQ,1,Requests,IF,/ \
+   RRA:AVERAGE:0.5:1:2016</pre>
+<p>This example is monitoring the average request duration during each 300 sec
+interval for requests processed by a web proxy during the interval.
+In this case, the proxy exposes two counters, the number of requests
+processed since boot and the total cumulative duration of all processed
+requests. Clearly these counters both have some rollover point, but using the
+DERIVE data source also handles the reset that occurs when the web proxy is
+stopped and restarted.</p>
+<p>In the <strong>RRD</strong>, the first data source stores the requests per second rate
+during the interval. The second data source stores the total duration of all
+requests processed during the interval divided by 300. The COMPUTE data source
+divides each PDP of the AccumDuration by the corresponding PDP of
+TotalRequests and stores the average request duration. The remainder of the
+RPN expression handles the divide by zero case.</p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdcreate.pod b/doc/rrdcreate.pod
new file mode 100644 (file)
index 0000000..27ef702
--- /dev/null
@@ -0,0 +1,553 @@
+=head1 NAME
+
+rrdcreate - Set up a new Round Robin Database
+
+=head1 SYNOPSIS
+
+B<rrdtool> B<create> I<filename>
+S<[B<--start>|B<-b> I<start time>]>
+S<[B<--step>|B<-s> I<step>]>
+S<[B<DS:>I<ds-name>B<:>I<DST>B<:>I<dst arguments>]>
+S<[B<RRA:>I<CF>B<:>I<cf arguments>]>
+
+=head1 DESCRIPTION
+
+The create function of RRDtool lets you set up new Round Robin
+Database (B<RRD>) files.  The file is created at its final, full size
+and filled with I<*UNKNOWN*> data.
+
+=over 8
+
+=item I<filename>
+
+The name of the B<RRD> you want to create. B<RRD> files should end
+with the extension F<.rrd>. However, B<RRDtool> will accept any
+filename.
+
+=item B<--start>|B<-b> I<start time> (default: now - 10s)
+
+Specifies the time in seconds since 1970-01-01 UTC when the first
+value should be added to the B<RRD>. B<RRDtool> will not accept
+any data timed before or at the time specified.
+
+See also AT-STYLE TIME SPECIFICATION section in the
+I<rrdfetch> documentation for other ways to specify time.
+
+=item B<--step>|B<-s> I<step> (default: 300 seconds)
+
+Specifies the base interval in seconds with which data will be fed
+into the B<RRD>.
+
+=item B<DS:>I<ds-name>B<:>I<DST>B<:>I<dst arguments>
+
+A single B<RRD> can accept input from several data sources (B<DS>),
+for example incoming and outgoing traffic on a specific communication
+line. With the B<DS> configuration option you must define some basic
+properties of each data source you want to store in the B<RRD>.
+
+I<ds-name> is the name you will use to reference this particular data
+source from an B<RRD>. A I<ds-name> must be 1 to 19 characters long in
+the characters [a-zA-Z0-9_].
+
+I<DST> defines the Data Source Type. The remaining arguments of a
+data source entry depend on the data source type. For GAUGE, COUNTER,
+DERIVE, and ABSOLUTE the format for a data source entry is:
+
+B<DS:>I<ds-name>B<:>I<GAUGE | COUNTER | DERIVE | ABSOLUTE>B<:>I<heartbeat>B<:>I<min>B<:>I<max>
+
+For COMPUTE data sources, the format is:
+
+B<DS:>I<ds-name>B<:>I<COMPUTE>B<:>I<rpn-expression>
+
+In order to decide which data source type to use, review the
+definitions that follow. Also consult the section on "HOW TO MEASURE"
+for further insight.
+
+=over 4
+
+=item B<GAUGE>
+
+is for things like temperatures or number of people in a room or the
+value of a RedHat share.
+
+=item B<COUNTER>
+
+is for continuous incrementing counters like the ifInOctets counter in
+a router. The B<COUNTER> data source assumes that the counter never
+decreases, except when a counter overflows.  The update function takes
+the overflow into account.  The counter is stored as a per-second
+rate. When the counter overflows, RRDtool checks if the overflow
+happened at the 32bit or 64bit border and acts accordingly by adding
+an appropriate value to the result.
+
+=item B<DERIVE>
+
+will store the derivative of the line going from the last to the
+current value of the data source. This can be useful for gauges, for
+example, to measure the rate of people entering or leaving a
+room. Internally, derive works exactly like COUNTER but without
+overflow checks. So if your counter does not reset at 32 or 64 bit you
+might want to use DERIVE and combine it with a MIN value of 0.
+
+=over
+
+=item NOTE on COUNTER vs DERIVE
+
+by Don Baarda E<lt>don.baarda@baesystems.comE<gt>
+
+If you cannot tolerate ever mistaking the occasional counter reset for a
+legitimate counter wrap, and would prefer "Unknowns" for all legitimate
+counter wraps and resets, always use DERIVE with min=0. Otherwise, using
+COUNTER with a suitable max will return correct values for all legitimate
+counter wraps, mark some counter resets as "Unknown", but can mistake some
+counter resets for a legitimate counter wrap.
+
+For a 5 minute step and 32-bit counter, the probability of mistaking a
+counter reset for a legitimate wrap is arguably about 0.8% per 1Mbps of
+maximum bandwidth. Note that this equates to 80% for 100Mbps interfaces, so
+for high bandwidth interfaces and a 32bit counter, DERIVE with min=0 is
+probably preferable. If you are using a 64bit counter, just about any max
+setting will eliminate the possibility of mistaking a reset for a counter
+wrap.
+
+=back
+
+=item B<ABSOLUTE>
+
+is for counters which get reset upon reading. This is used for fast counters
+which tend to overflow. So instead of reading them normally you reset them
+after every read to make sure you have a maximum time available before the
+next overflow. Another usage is for things you count like number of messages
+since the last update.
+
+=item B<COMPUTE>
+
+is for storing the result of a formula applied to other data sources
+in the B<RRD>. This data source is not supplied a value on update, but
+rather its Primary Data Points (PDPs) are computed from the PDPs of
+the data sources according to the rpn-expression that defines the
+formula. Consolidation functions are then applied normally to the PDPs
+of the COMPUTE data source (that is the rpn-expression is only applied
+to generate PDPs). In database software, such data sets are referred
+to as "virtual" or "computed" columns.
+
+=back
+
+I<heartbeat> defines the maximum number of seconds that may pass
+between two updates of this data source before the value of the
+data source is assumed to be I<*UNKNOWN*>.
+
+I<min> and I<max> define the expected range values for data supplied by a
+data source. If I<min> and/or I<max> any value outside the defined range
+will be regarded as I<*UNKNOWN*>. If you do not know or care about min and
+max, set them to U for unknown. Note that min and max always refer to the
+processed values of the DS. For a traffic-B<COUNTER> type DS this would be
+the maximum and minimum data-rate expected from the device.
+
+I<If information on minimal/maximal expected values is available,
+always set the min and/or max properties. This will help RRDtool in
+doing a simple sanity check on the data supplied when running update.>
+
+I<rpn-expression> defines the formula used to compute the PDPs of a
+COMPUTE data source from other data sources in the same <RRD>. It is
+similar to defining a B<CDEF> argument for the graph command. Please
+refer to that manual page for a list and description of RPN operations
+supported. For COMPUTE data sources, the following RPN operations are
+not supported: COUNT, PREV, TIME, and LTIME. In addition, in defining
+the RPN expression, the COMPUTE data source may only refer to the
+names of data source listed previously in the create command. This is
+similar to the restriction that B<CDEF>s must refer only to B<DEF>s
+and B<CDEF>s previously defined in the same graph command.
+
+=item B<RRA:>I<CF>B<:>I<cf arguments>
+
+
+The purpose of an B<RRD> is to store data in the round robin archives
+(B<RRA>). An archive consists of a number of data values or statistics for
+each of the defined data-sources (B<DS>) and is defined with an B<RRA> line.
+
+When data is entered into an B<RRD>, it is first fit into time slots
+of the length defined with the B<-s> option, thus becoming a I<primary
+data point>.
+
+The data is also processed with the consolidation function (I<CF>) of
+the archive. There are several consolidation functions that
+consolidate primary data points via an aggregate function: B<AVERAGE>,
+B<MIN>, B<MAX>, B<LAST>. The format of B<RRA> line for these
+consolidation functions is:
+
+B<RRA:>I<AVERAGE | MIN | MAX | LAST>B<:>I<xff>B<:>I<steps>B<:>I<rows>
+
+I<xff> The xfiles factor defines what part of a consolidation interval may
+be made up from I<*UNKNOWN*> data while the consolidated value is still
+regarded as known. It is given as the ratio of allowed I<*UNKNOWN*> PDPs
+to the number of PDPs in the interval. Thus, it ranges from 0 to 1 (exclusive).
+
+
+I<steps> defines how many of these I<primary data points> are used to build
+a I<consolidated data point> which then goes into the archive.
+
+I<rows> defines how many generations of data values are kept in an B<RRA>.
+
+=back
+
+=head1 Aberrant Behavior Detection with Holt-Winters Forecasting
+
+In addition to the aggregate functions, there are a set of specialized
+functions that enable B<RRDtool> to provide data smoothing (via the
+Holt-Winters forecasting algorithm), confidence bands, and the
+flagging aberrant behavior in the data source time series:
+
+=over
+
+=item *
+
+B<RRA:>I<HWPREDICT>B<:>I<rows>B<:>I<alpha>B<:>I<beta>B<:>I<seasonal period>[B<:>I<rra-num>]
+
+=item *
+
+B<RRA:>I<SEASONAL>B<:>I<seasonal period>B<:>I<gamma>B<:>I<rra-num>
+
+=item *
+
+B<RRA:>I<DEVSEASONAL>B<:>I<seasonal period>B<:>I<gamma>B<:>I<rra-num>
+
+=item *
+
+B<RRA:>I<DEVPREDICT>B<:>I<rows>B<:>I<rra-num>
+
+=item *
+
+B<RRA:>I<FAILURES>B<:>I<rows>B<:>I<threshold>B<:>I<window length>B<:>I<rra-num>
+
+=back
+
+These B<RRAs> differ from the true consolidation functions in several ways.
+First, each of the B<RRA>s is updated once for every primary data point.
+Second, these B<RRAs> are interdependent. To generate real-time confidence
+bounds, a matched set of HWPREDICT, SEASONAL, DEVSEASONAL, and
+DEVPREDICT must exist. Generating smoothed values of the primary data points
+requires both a HWPREDICT B<RRA> and SEASONAL B<RRA>. Aberrant behavior
+detection requires FAILURES, HWPREDICT, DEVSEASONAL, and SEASONAL.
+
+The actual predicted, or smoothed, values are stored in the HWPREDICT
+B<RRA>. The predicted deviations are stored in DEVPREDICT (think a standard
+deviation which can be scaled to yield a confidence band). The FAILURES
+B<RRA> stores binary indicators. A 1 marks the indexed observation as
+failure; that is, the number of confidence bounds violations in the
+preceding window of observations met or exceeded a specified threshold. An
+example of using these B<RRAs> to graph confidence bounds and failures
+appears in L<rrdgraph>.
+
+The SEASONAL and DEVSEASONAL B<RRAs> store the seasonal coefficients for the
+Holt-Winters forecasting algorithm and the seasonal deviations, respectively.
+There is one entry per observation time point in the seasonal cycle. For
+example, if primary data points are generated every five minutes and the
+seasonal cycle is 1 day, both SEASONAL and DEVSEASONAL will have 288 rows.
+
+In order to simplify the creation for the novice user, in addition to
+supporting explicit creation of the HWPREDICT, SEASONAL, DEVPREDICT,
+DEVSEASONAL, and FAILURES B<RRAs>, the B<RRDtool> create command supports
+implicit creation of the other four when HWPREDICT is specified alone and
+the final argument I<rra-num> is omitted.
+
+I<rows> specifies the length of the B<RRA> prior to wrap around. Remember
+that there is a one-to-one correspondence between primary data points and
+entries in these RRAs. For the HWPREDICT CF, I<rows> should be larger than
+the I<seasonal period>. If the DEVPREDICT B<RRA> is implicitly created, the
+default number of rows is the same as the HWPREDICT I<rows> argument. If the
+FAILURES B<RRA> is implicitly created, I<rows> will be set to the I<seasonal
+period> argument of the HWPREDICT B<RRA>. Of course, the B<RRDtool>
+I<resize> command is available if these defaults are not sufficient and the
+creator wishes to avoid explicit creations of the other specialized function
+B<RRAs>.
+
+I<seasonal period> specifies the number of primary data points in a seasonal
+cycle. If SEASONAL and DEVSEASONAL are implicitly created, this argument for
+those B<RRAs> is set automatically to the value specified by HWPREDICT. If
+they are explicitly created, the creator should verify that all three
+I<seasonal period> arguments agree.
+
+I<alpha> is the adaption parameter of the intercept (or baseline)
+coefficient in the Holt-Winters forecasting algorithm. See L<rrdtool> for a
+description of this algorithm. I<alpha> must lie between 0 and 1. A value
+closer to 1 means that more recent observations carry greater weight in
+predicting the baseline component of the forecast. A value closer to 0 means
+that past history carries greater weight in predicting the baseline
+component.
+
+I<beta> is the adaption parameter of the slope (or linear trend) coefficient
+in the Holt-Winters forecasting algorithm. I<beta> must lie between 0 and 1
+and plays the same role as I<alpha> with respect to the predicted linear
+trend.
+
+I<gamma> is the adaption parameter of the seasonal coefficients in the
+Holt-Winters forecasting algorithm (HWPREDICT) or the adaption parameter in
+the exponential smoothing update of the seasonal deviations. It must lie
+between 0 and 1. If the SEASONAL and DEVSEASONAL B<RRAs> are created
+implicitly, they will both have the same value for I<gamma>: the value
+specified for the HWPREDICT I<alpha> argument. Note that because there is
+one seasonal coefficient (or deviation) for each time point during the
+seasonal cycle, the adaptation rate is much slower than the baseline. Each
+seasonal coefficient is only updated (or adapts) when the observed value
+occurs at the offset in the seasonal cycle corresponding to that
+coefficient.
+
+If SEASONAL and DEVSEASONAL B<RRAs> are created explicitly, I<gamma> need not
+be the same for both. Note that I<gamma> can also be changed via the
+B<RRDtool> I<tune> command.
+
+I<rra-num> provides the links between related B<RRAs>. If HWPREDICT is
+specified alone and the other B<RRAs> are created implicitly, then
+there is no need to worry about this argument. If B<RRAs> are created
+explicitly, then carefully pay attention to this argument. For each
+B<RRA> which includes this argument, there is a dependency between
+that B<RRA> and another B<RRA>. The I<rra-num> argument is the 1-based
+index in the order of B<RRA> creation (that is, the order they appear
+in the I<create> command). The dependent B<RRA> for each B<RRA>
+requiring the I<rra-num> argument is listed here:
+
+=over
+
+=item *
+
+HWPREDICT I<rra-num> is the index of the SEASONAL B<RRA>.
+
+=item *
+
+SEASONAL I<rra-num> is the index of the HWPREDICT B<RRA>.
+
+=item *
+
+DEVPREDICT I<rra-num> is the index of the DEVSEASONAL B<RRA>.
+
+=item *
+
+DEVSEASONAL I<rra-num> is the index of the HWPREDICT B<RRA>.
+
+=item *
+
+FAILURES I<rra-num> is the index of the DEVSEASONAL B<RRA>.
+
+=back
+
+I<threshold> is the minimum number of violations (observed values outside
+the confidence bounds) within a window that constitutes a failure. If the
+FAILURES B<RRA> is implicitly created, the default value is 7.
+
+I<window length> is the number of time points in the window. Specify an
+integer greater than or equal to the threshold and less than or equal to 28.
+The time interval this window represents depends on the interval between
+primary data points. If the FAILURES B<RRA> is implicitly created, the
+default value is 9.
+
+=head1 The HEARTBEAT and the STEP
+
+Here is an explanation by Don Baarda on the inner workings of RRDtool.
+It may help you to sort out why all this *UNKNOWN* data is popping
+up in your databases:
+
+RRDtool gets fed samples at arbitrary times. From these it builds Primary
+Data Points (PDPs) at exact times on every "step" interval. The PDPs are
+then accumulated into RRAs.
+
+The "heartbeat" defines the maximum acceptable interval between
+samples. If the interval between samples is less than "heartbeat",
+then an average rate is calculated and applied for that interval. If
+the interval between samples is longer than "heartbeat", then that
+entire interval is considered "unknown". Note that there are other
+things that can make a sample interval "unknown", such as the rate
+exceeding limits, or even an "unknown" input sample.
+
+The known rates during a PDP's "step" interval are used to calculate
+an average rate for that PDP. Also, if the total "unknown" time during
+the "step" interval exceeds the "heartbeat", the entire PDP is marked
+as "unknown". This means that a mixture of known and "unknown" sample
+times in a single PDP "step" may or may not add up to enough "unknown"
+time to exceed "heartbeat" and hence mark the whole PDP "unknown". So
+"heartbeat" is not only the maximum acceptable interval between
+samples, but also the maximum acceptable amount of "unknown" time per
+PDP (obviously this is only significant if you have "heartbeat" less
+than "step").
+
+The "heartbeat" can be short (unusual) or long (typical) relative to
+the "step" interval between PDPs. A short "heartbeat" means you
+require multiple samples per PDP, and if you don't get them mark the
+PDP unknown. A long heartbeat can span multiple "steps", which means
+it is acceptable to have multiple PDPs calculated from a single
+sample. An extreme example of this might be a "step" of 5 minutes and a
+"heartbeat" of one day, in which case a single sample every day will
+result in all the PDPs for that entire day period being set to the
+same average rate. I<-- Don Baarda E<lt>don.baarda@baesystems.comE<gt>>
+
+       time|
+       axis|
+ begin__|00|
+        |01|
+       u|02|----* sample1, restart "hb"-timer
+       u|03|   /
+       u|04|  /
+       u|05| /
+       u|06|/     "hbt" expired
+       u|07|
+        |08|----* sample2, restart "hb" 
+        |09|   / 
+        |10|  /
+       u|11|----* sample3, restart "hb"
+       u|12|   /
+       u|13|  /
+ step1_u|14| /
+       u|15|/     "swt" expired
+       u|16|
+        |17|----* sample4, restart "hb", create "pdp" for step1 = 
+        |18|   /  = unknown due to 10 "u" labled secs > "hb"
+        |19|  /
+        |20| /
+        |21|----* sample5, restart "hb"
+        |22|   /
+        |23|  /
+        |24|----* sample6, restart "hb"
+        |25|   /
+        |26|  /
+        |27|----* sample7, restart "hb"
+ step2__|28|   /
+        |22|  /
+        |23|----* sample8, restart "hb", create "pdp" for step1, create "cdp" 
+        |24|   /
+        |25|  /
+
+graphics by I<vladimir.lavrov@desy.de>.
+
+
+=head1 HOW TO MEASURE
+
+Here are a few hints on how to measure:
+
+=over
+
+
+=item Temperature
+
+Usually you have some type of meter you can read to get the temperature.
+The temperature is not really connected with a time. The only connection is
+that the temperature reading happened at a certain time. You can use the
+B<GAUGE> data source type for this. RRDtool will then record your reading
+together with the time.
+
+=item Mail Messages
+
+Assume you have a method to count the number of messages transported by
+your mailserver in a certain amount of time, giving you data like '5
+messages in the last 65 seconds'. If you look at the count of 5 like an
+B<ABSOLUTE> data type you can simply update the RRD with the number 5 and the
+end time of your monitoring period. RRDtool will then record the number of
+messages per second. If at some later stage you want to know the number of
+messages transported in a day, you can get the average messages per second
+from RRDtool for the day in question and multiply this number with the
+number of seconds in a day. Because all math is run with Doubles, the
+precision should be acceptable.
+
+=item It's always a Rate
+
+RRDtool stores rates in amount/second for COUNTER, DERIVE and ABSOLUTE
+data.  When you plot the data, you will get on the y axis
+amount/second which you might be tempted to convert to an absolute
+amount by multiplying by the delta-time between the points. RRDtool
+plots continuous data, and as such is not appropriate for plotting
+absolute amounts as for example "total bytes" sent and received in a
+router. What you probably want is plot rates that you can scale to
+bytes/hour, for example, or plot absolute amounts with another tool
+that draws bar-plots, where the delta-time is clear on the plot for
+each point (such that when you read the graph you see for example GB
+on the y axis, days on the x axis and one bar for each day).
+
+=back
+
+
+=head1 EXAMPLE
+
+ rrdtool create temperature.rrd --step 300 \
+  DS:temp:GAUGE:600:-273:5000 \
+  RRA:AVERAGE:0.5:1:1200 \
+  RRA:MIN:0.5:12:2400 \
+  RRA:MAX:0.5:12:2400 \
+  RRA:AVERAGE:0.5:12:2400
+
+This sets up an B<RRD> called F<temperature.rrd> which accepts one
+temperature value every 300 seconds. If no new data is supplied for
+more than 600 seconds, the temperature becomes I<*UNKNOWN*>.  The
+minimum acceptable value is -273 and the maximum is 5'000.
+
+A few archive areas are also defined. The first stores the
+temperatures supplied for 100 hours (1'200 * 300 seconds = 100
+hours). The second RRA stores the minimum temperature recorded over
+every hour (12 * 300 seconds = 1 hour), for 100 days (2'400 hours). The
+third and the fourth RRA's do the same for the maximum and
+average temperature, respectively.
+
+=head1 EXAMPLE 2
+
+ rrdtool create monitor.rrd --step 300        \
+   DS:ifOutOctets:COUNTER:1800:0:4294967295   \
+   RRA:AVERAGE:0.5:1:2016                     \
+   RRA:HWPREDICT:1440:0.1:0.0035:288
+
+This example is a monitor of a router interface. The first B<RRA> tracks the
+traffic flow in octets; the second B<RRA> generates the specialized
+functions B<RRAs> for aberrant behavior detection. Note that the I<rra-num>
+argument of HWPREDICT is missing, so the other B<RRAs> will implicitly be
+created with default parameter values. In this example, the forecasting
+algorithm baseline adapts quickly; in fact the most recent one hour of
+observations (each at 5 minute intervals) accounts for 75% of the baseline
+prediction. The linear trend forecast adapts much more slowly. Observations
+made during the last day (at 288 observations per day) account for only
+65% of the predicted linear trend. Note: these computations rely on an
+exponential smoothing formula described in the LISA 2000 paper.
+
+The seasonal cycle is one day (288 data points at 300 second intervals), and
+the seasonal adaption parameter will be set to 0.1. The RRD file will store 5
+days (1'440 data points) of forecasts and deviation predictions before wrap
+around. The file will store 1 day (a seasonal cycle) of 0-1 indicators in
+the FAILURES B<RRA>.
+
+The same RRD file and B<RRAs> are created with the following command,
+which explicitly creates all specialized function B<RRAs>.
+
+ rrdtool create monitor.rrd --step 300 \
+   DS:ifOutOctets:COUNTER:1800:0:4294967295 \
+   RRA:AVERAGE:0.5:1:2016 \
+   RRA:HWPREDICT:1440:0.1:0.0035:288:3 \
+   RRA:SEASONAL:288:0.1:2 \
+   RRA:DEVPREDICT:1440:5 \
+   RRA:DEVSEASONAL:288:0.1:2 \
+   RRA:FAILURES:288:7:9:5
+
+Of course, explicit creation need not replicate implicit create, a
+number of arguments could be changed.
+
+=head1 EXAMPLE 3
+
+ rrdtool create proxy.rrd --step 300 \
+   DS:Total:DERIVE:1800:0:U  \
+   DS:Duration:DERIVE:1800:0:U  \
+   DS:AvgReqDur:COMPUTE:Duration,Requests,0,EQ,1,Requests,IF,/ \
+   RRA:AVERAGE:0.5:1:2016
+
+This example is monitoring the average request duration during each 300 sec
+interval for requests processed by a web proxy during the interval.
+In this case, the proxy exposes two counters, the number of requests
+processed since boot and the total cumulative duration of all processed
+requests. Clearly these counters both have some rollover point, but using the
+DERIVE data source also handles the reset that occurs when the web proxy is
+stopped and restarted.
+
+In the B<RRD>, the first data source stores the requests per second rate
+during the interval. The second data source stores the total duration of all
+requests processed during the interval divided by 300. The COMPUTE data source
+divides each PDP of the AccumDuration by the corresponding PDP of
+TotalRequests and stores the average request duration. The remainder of the
+RPN expression handles the divide by zero case.
+
+=head1 AUTHOR
+
+Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
diff --git a/doc/rrdcreate.txt b/doc/rrdcreate.txt
new file mode 100644 (file)
index 0000000..3d2560c
--- /dev/null
@@ -0,0 +1,507 @@
+RRDCREATE(1)                        rrdtool                       RRDCREATE(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdcreate - Set up a new Round Robin Database
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       r\brr\brd\bdt\bto\boo\bol\bl c\bcr\bre\bea\bat\bte\be _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be [-\b--\b-s\bst\bta\bar\brt\bt|-\b-b\bb _\bs_\bt_\ba_\br_\bt _\bt_\bi_\bm_\be] [-\b--\b-s\bst\bte\bep\bp|-\b-s\bs _\bs_\bt_\be_\bp]
+       [D\bDS\bS:\b:_\bd_\bs_\b-_\bn_\ba_\bm_\be:\b:_\bD_\bS_\bT:\b:_\bd_\bs_\bt _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs] [R\bRR\bRA\bA:\b:_\bC_\bF:\b:_\bc_\bf _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs]
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       The create function of RRDtool lets you set up new Round Robin Database
+       (R\bRR\bRD\bD) files.  The file is created at its final, full size and filled
+       with _\b*_\bU_\bN_\bK_\bN_\bO_\bW_\bN_\b* data.
+
+       _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
+               The name of the R\bRR\bRD\bD you want to create. R\bRR\bRD\bD files should end
+               with the extension _\b._\br_\br_\bd. However, R\bRR\bRD\bDt\bto\boo\bol\bl will accept any file-
+               name.
+
+       -\b--\b-s\bst\bta\bar\brt\bt|-\b-b\bb _\bs_\bt_\ba_\br_\bt _\bt_\bi_\bm_\be (default: now - 10s)
+               Specifies the time in seconds since 1970-01-01 UTC when the
+               first value should be added to the R\bRR\bRD\bD. R\bRR\bRD\bDt\bto\boo\bol\bl will not accept
+               any data timed before or at the time specified.
+
+               See also AT-STYLE TIME SPECIFICATION section in the _\br_\br_\bd_\bf_\be_\bt_\bc_\bh
+               documentation for other ways to specify time.
+
+       -\b--\b-s\bst\bte\bep\bp|-\b-s\bs _\bs_\bt_\be_\bp (default: 300 seconds)
+               Specifies the base interval in seconds with which data will be
+               fed into the R\bRR\bRD\bD.
+
+       D\bDS\bS:\b:_\bd_\bs_\b-_\bn_\ba_\bm_\be:\b:_\bD_\bS_\bT:\b:_\bd_\bs_\bt _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs
+               A single R\bRR\bRD\bD can accept input from several data sources (D\bDS\bS),
+               for example incoming and outgoing traffic on a specific commu-
+               nication line. With the D\bDS\bS configuration option you must define
+               some basic properties of each data source you want to store in
+               the R\bRR\bRD\bD.
+
+               _\bd_\bs_\b-_\bn_\ba_\bm_\be is the name you will use to reference this particular
+               data source from an R\bRR\bRD\bD. A _\bd_\bs_\b-_\bn_\ba_\bm_\be must be 1 to 19 characters
+               long in the characters [a-zA-Z0-9_].
+
+               _\bD_\bS_\bT defines the Data Source Type. The remaining arguments of a
+               data source entry depend on the data source type. For GAUGE,
+               COUNTER, DERIVE, and ABSOLUTE the format for a data source
+               entry is:
+
+               D\bDS\bS:\b:_\bd_\bs_\b-_\bn_\ba_\bm_\be:\b:_\bG_\bA_\bU_\bG_\bE _\b| _\bC_\bO_\bU_\bN_\bT_\bE_\bR _\b| _\bD_\bE_\bR_\bI_\bV_\bE _\b| _\bA_\bB_\bS_\bO_\bL_\bU_\bT_\bE:\b:_\bh_\be_\ba_\br_\bt_\b-
+               _\bb_\be_\ba_\bt:\b:_\bm_\bi_\bn:\b:_\bm_\ba_\bx
+
+               For COMPUTE data sources, the format is:
+
+               D\bDS\bS:\b:_\bd_\bs_\b-_\bn_\ba_\bm_\be:\b:_\bC_\bO_\bM_\bP_\bU_\bT_\bE:\b:_\br_\bp_\bn_\b-_\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn
+
+               In order to decide which data source type to use, review the
+               definitions that follow. Also consult the section on "HOW TO
+               MEASURE" for further insight.
+
+               G\bGA\bAU\bUG\bGE\bE
+                   is for things like temperatures or number of people in a
+                   room or the value of a RedHat share.
+
+               C\bCO\bOU\bUN\bNT\bTE\bER\bR
+                   is for continuous incrementing counters like the ifInOctets
+                   counter in a router. The C\bCO\bOU\bUN\bNT\bTE\bER\bR data source assumes that
+                   the counter never decreases, except when a counter over-
+                   flows.  The update function takes the overflow into
+                   account.  The counter is stored as a per-second rate. When
+                   the counter overflows, RRDtool checks if the overflow hap-
+                   pened at the 32bit or 64bit border and acts accordingly by
+                   adding an appropriate value to the result.
+
+               D\bDE\bER\bRI\bIV\bVE\bE
+                   will store the derivative of the line going from the last
+                   to the current value of the data source. This can be useful
+                   for gauges, for example, to measure the rate of people
+                   entering or leaving a room. Internally, derive works
+                   exactly like COUNTER but without overflow checks. So if
+                   your counter does not reset at 32 or 64 bit you might want
+                   to use DERIVE and combine it with a MIN value of 0.
+
+                   NOTE on COUNTER vs DERIVE
+                       by Don Baarda <don.baarda@baesystems.com>
+
+                       If you cannot tolerate ever mistaking the occasional
+                       counter reset for a legitimate counter wrap, and would
+                       prefer "Unknowns" for all legitimate counter wraps and
+                       resets, always use DERIVE with min=0. Otherwise, using
+                       COUNTER with a suitable max will return correct values
+                       for all legitimate counter wraps, mark some counter
+                       resets as "Unknown", but can mistake some counter
+                       resets for a legitimate counter wrap.
+
+                       For a 5 minute step and 32-bit counter, the probability
+                       of mistaking a counter reset for a legitimate wrap is
+                       arguably about 0.8% per 1Mbps of maximum bandwidth.
+                       Note that this equates to 80% for 100Mbps interfaces,
+                       so for high bandwidth interfaces and a 32bit counter,
+                       DERIVE with min=0 is probably preferable. If you are
+                       using a 64bit counter, just about any max setting will
+                       eliminate the possibility of mistaking a reset for a
+                       counter wrap.
+
+               A\bAB\bBS\bSO\bOL\bLU\bUT\bTE\bE
+                   is for counters which get reset upon reading. This is used
+                   for fast counters which tend to overflow. So instead of
+                   reading them normally you reset them after every read to
+                   make sure you have a maximum time available before the next
+                   overflow. Another usage is for things you count like number
+                   of messages since the last update.
+
+               C\bCO\bOM\bMP\bPU\bUT\bTE\bE
+                   is for storing the result of a formula applied to other
+                   data sources in the R\bRR\bRD\bD. This data source is not supplied a
+                   value on update, but rather its Primary Data Points (PDPs)
+                   are computed from the PDPs of the data sources according to
+                   the rpn-expression that defines the formula. Consolidation
+                   functions are then applied normally to the PDPs of the COM-
+                   PUTE data source (that is the rpn-expression is only
+                   applied to generate PDPs). In database software, such data
+                   sets are referred to as "virtual" or "computed" columns.
+
+               _\bh_\be_\ba_\br_\bt_\bb_\be_\ba_\bt defines the maximum number of seconds that may pass
+               between two updates of this data source before the value of the
+               data source is assumed to be _\b*_\bU_\bN_\bK_\bN_\bO_\bW_\bN_\b*.
+
+               _\bm_\bi_\bn and _\bm_\ba_\bx define the expected range values for data supplied
+               by a data source. If _\bm_\bi_\bn and/or _\bm_\ba_\bx any value outside the
+               defined range will be regarded as _\b*_\bU_\bN_\bK_\bN_\bO_\bW_\bN_\b*. If you do not know
+               or care about min and max, set them to U for unknown. Note that
+               min and max always refer to the processed values of the DS. For
+               a traffic-C\bCO\bOU\bUN\bNT\bTE\bER\bR type DS this would be the maximum and minimum
+               data-rate expected from the device.
+
+               _\bI_\bf _\bi_\bn_\bf_\bo_\br_\bm_\ba_\bt_\bi_\bo_\bn _\bo_\bn _\bm_\bi_\bn_\bi_\bm_\ba_\bl_\b/_\bm_\ba_\bx_\bi_\bm_\ba_\bl _\be_\bx_\bp_\be_\bc_\bt_\be_\bd _\bv_\ba_\bl_\bu_\be_\bs _\bi_\bs _\ba_\bv_\ba_\bi_\bl_\ba_\bb_\bl_\be_\b,
+               _\ba_\bl_\bw_\ba_\by_\bs _\bs_\be_\bt _\bt_\bh_\be _\bm_\bi_\bn _\ba_\bn_\bd_\b/_\bo_\br _\bm_\ba_\bx _\bp_\br_\bo_\bp_\be_\br_\bt_\bi_\be_\bs_\b. _\bT_\bh_\bi_\bs _\bw_\bi_\bl_\bl _\bh_\be_\bl_\bp _\bR_\bR_\bD_\b-
+               _\bt_\bo_\bo_\bl _\bi_\bn _\bd_\bo_\bi_\bn_\bg _\ba _\bs_\bi_\bm_\bp_\bl_\be _\bs_\ba_\bn_\bi_\bt_\by _\bc_\bh_\be_\bc_\bk _\bo_\bn _\bt_\bh_\be _\bd_\ba_\bt_\ba _\bs_\bu_\bp_\bp_\bl_\bi_\be_\bd _\bw_\bh_\be_\bn
+               _\br_\bu_\bn_\bn_\bi_\bn_\bg _\bu_\bp_\bd_\ba_\bt_\be_\b.
+
+               _\br_\bp_\bn_\b-_\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn defines the formula used to compute the PDPs of
+               a COMPUTE data source from other data sources in the same
+               <RRD>. It is similar to defining a C\bCD\bDE\bEF\bF argument for the graph
+               command. Please refer to that manual page for a list and
+               description of RPN operations supported. For COMPUTE data
+               sources, the following RPN operations are not supported: COUNT,
+               PREV, TIME, and LTIME. In addition, in defining the RPN expres-
+               sion, the COMPUTE data source may only refer to the names of
+               data source listed previously in the create command. This is
+               similar to the restriction that C\bCD\bDE\bEF\bFs must refer only to D\bDE\bEF\bFs
+               and C\bCD\bDE\bEF\bFs previously defined in the same graph command.
+
+       R\bRR\bRA\bA:\b:_\bC_\bF:\b:_\bc_\bf _\ba_\br_\bg_\bu_\bm_\be_\bn_\bt_\bs
+               The purpose of an R\bRR\bRD\bD is to store data in the round robin
+               archives (R\bRR\bRA\bA). An archive consists of a number of data values
+               or statistics for each of the defined data-sources (D\bDS\bS) and is
+               defined with an R\bRR\bRA\bA line.
+
+               When data is entered into an R\bRR\bRD\bD, it is first fit into time
+               slots of the length defined with the -\b-s\bs option, thus becoming a
+               _\bp_\br_\bi_\bm_\ba_\br_\by _\bd_\ba_\bt_\ba _\bp_\bo_\bi_\bn_\bt.
+
+               The data is also processed with the consolidation function (_\bC_\bF)
+               of the archive. There are several consolidation functions that
+               consolidate primary data points via an aggregate function:
+               A\bAV\bVE\bER\bRA\bAG\bGE\bE, M\bMI\bIN\bN, M\bMA\bAX\bX, L\bLA\bAS\bST\bT. The format of R\bRR\bRA\bA line for these con-
+               solidation functions is:
+
+               R\bRR\bRA\bA:\b:_\bA_\bV_\bE_\bR_\bA_\bG_\bE _\b| _\bM_\bI_\bN _\b| _\bM_\bA_\bX _\b| _\bL_\bA_\bS_\bT:\b:_\bx_\bf_\bf:\b:_\bs_\bt_\be_\bp_\bs:\b:_\br_\bo_\bw_\bs
+
+               _\bx_\bf_\bf The xfiles factor defines what part of a consolidation
+               interval may be made up from _\b*_\bU_\bN_\bK_\bN_\bO_\bW_\bN_\b* data while the consoli-
+               dated value is still regarded as known. It is given as the
+               ratio of allowed _\b*_\bU_\bN_\bK_\bN_\bO_\bW_\bN_\b* PDPs to the number of PDPs in the
+               interval. Thus, it ranges from 0 to 1 (exclusive).
+
+               _\bs_\bt_\be_\bp_\bs defines how many of these _\bp_\br_\bi_\bm_\ba_\br_\by _\bd_\ba_\bt_\ba _\bp_\bo_\bi_\bn_\bt_\bs are used to
+               build a _\bc_\bo_\bn_\bs_\bo_\bl_\bi_\bd_\ba_\bt_\be_\bd _\bd_\ba_\bt_\ba _\bp_\bo_\bi_\bn_\bt which then goes into the
+               archive.
+
+               _\br_\bo_\bw_\bs defines how many generations of data values are kept in an
+               R\bRR\bRA\bA.
+
+A\bAb\bbe\ber\brr\bra\ban\bnt\bt B\bBe\beh\bha\bav\bvi\bio\bor\br D\bDe\bet\bte\bec\bct\bti\bio\bon\bn w\bwi\bit\bth\bh H\bHo\bol\blt\bt-\b-W\bWi\bin\bnt\bte\ber\brs\bs F\bFo\bor\bre\bec\bca\bas\bst\bti\bin\bng\bg
+       In addition to the aggregate functions, there are a set of specialized
+       functions that enable R\bRR\bRD\bDt\bto\boo\bol\bl to provide data smoothing (via the Holt-
+       Winters forecasting algorithm), confidence bands, and the flagging
+       aberrant behavior in the data source time series:
+
+       Â·   R\bRR\bRA\bA:\b:_\bH_\bW_\bP_\bR_\bE_\bD_\bI_\bC_\bT:\b:_\br_\bo_\bw_\bs:\b:_\ba_\bl_\bp_\bh_\ba:\b:_\bb_\be_\bt_\ba:\b:_\bs_\be_\ba_\bs_\bo_\bn_\ba_\bl _\bp_\be_\br_\bi_\bo_\bd[:\b:_\br_\br_\ba_\b-_\bn_\bu_\bm]
+
+       Â·   R\bRR\bRA\bA:\b:_\bS_\bE_\bA_\bS_\bO_\bN_\bA_\bL:\b:_\bs_\be_\ba_\bs_\bo_\bn_\ba_\bl _\bp_\be_\br_\bi_\bo_\bd:\b:_\bg_\ba_\bm_\bm_\ba:\b:_\br_\br_\ba_\b-_\bn_\bu_\bm
+
+       Â·   R\bRR\bRA\bA:\b:_\bD_\bE_\bV_\bS_\bE_\bA_\bS_\bO_\bN_\bA_\bL:\b:_\bs_\be_\ba_\bs_\bo_\bn_\ba_\bl _\bp_\be_\br_\bi_\bo_\bd:\b:_\bg_\ba_\bm_\bm_\ba:\b:_\br_\br_\ba_\b-_\bn_\bu_\bm
+
+       Â·   R\bRR\bRA\bA:\b:_\bD_\bE_\bV_\bP_\bR_\bE_\bD_\bI_\bC_\bT:\b:_\br_\bo_\bw_\bs:\b:_\br_\br_\ba_\b-_\bn_\bu_\bm
+
+       Â·   R\bRR\bRA\bA:\b:_\bF_\bA_\bI_\bL_\bU_\bR_\bE_\bS:\b:_\br_\bo_\bw_\bs:\b:_\bt_\bh_\br_\be_\bs_\bh_\bo_\bl_\bd:\b:_\bw_\bi_\bn_\bd_\bo_\bw _\bl_\be_\bn_\bg_\bt_\bh:\b:_\br_\br_\ba_\b-_\bn_\bu_\bm
+
+       These R\bRR\bRA\bAs\bs differ from the true consolidation functions in several
+       ways.  First, each of the R\bRR\bRA\bAs is updated once for every primary data
+       point.  Second, these R\bRR\bRA\bAs\bs are interdependent. To generate real-time
+       confidence bounds, a matched set of HWPREDICT, SEASONAL, DEVSEASONAL,
+       and DEVPREDICT must exist. Generating smoothed values of the primary
+       data points requires both a HWPREDICT R\bRR\bRA\bA and SEASONAL R\bRR\bRA\bA. Aberrant
+       behavior detection requires FAILURES, HWPREDICT, DEVSEASONAL, and SEA-
+       SONAL.
+
+       The actual predicted, or smoothed, values are stored in the HWPREDICT
+       R\bRR\bRA\bA. The predicted deviations are stored in DEVPREDICT (think a stan-
+       dard deviation which can be scaled to yield a confidence band). The
+       FAILURES R\bRR\bRA\bA stores binary indicators. A 1 marks the indexed observa-
+       tion as failure; that is, the number of confidence bounds violations in
+       the preceding window of observations met or exceeded a specified
+       threshold. An example of using these R\bRR\bRA\bAs\bs to graph confidence bounds
+       and failures appears in rrdgraph.
+
+       The SEASONAL and DEVSEASONAL R\bRR\bRA\bAs\bs store the seasonal coefficients for
+       the Holt-Winters forecasting algorithm and the seasonal deviations,
+       respectively.  There is one entry per observation time point in the
+       seasonal cycle. For example, if primary data points are generated every
+       five minutes and the seasonal cycle is 1 day, both SEASONAL and DEVSEA-
+       SONAL will have 288 rows.
+
+       In order to simplify the creation for the novice user, in addition to
+       supporting explicit creation of the HWPREDICT, SEASONAL, DEVPREDICT,
+       DEVSEASONAL, and FAILURES R\bRR\bRA\bAs\bs, the R\bRR\bRD\bDt\bto\boo\bol\bl create command supports
+       implicit creation of the other four when HWPREDICT is specified alone
+       and the final argument _\br_\br_\ba_\b-_\bn_\bu_\bm is omitted.
+
+       _\br_\bo_\bw_\bs specifies the length of the R\bRR\bRA\bA prior to wrap around. Remember
+       that there is a one-to-one correspondence between primary data points
+       and entries in these RRAs. For the HWPREDICT CF, _\br_\bo_\bw_\bs should be larger
+       than the _\bs_\be_\ba_\bs_\bo_\bn_\ba_\bl _\bp_\be_\br_\bi_\bo_\bd. If the DEVPREDICT R\bRR\bRA\bA is implicitly created,
+       the default number of rows is the same as the HWPREDICT _\br_\bo_\bw_\bs argument.
+       If the FAILURES R\bRR\bRA\bA is implicitly created, _\br_\bo_\bw_\bs will be set to the _\bs_\be_\ba_\b-
+       _\bs_\bo_\bn_\ba_\bl _\bp_\be_\br_\bi_\bo_\bd argument of the HWPREDICT R\bRR\bRA\bA. Of course, the R\bRR\bRD\bDt\bto\boo\bol\bl
+       _\br_\be_\bs_\bi_\bz_\be command is available if these defaults are not sufficient and
+       the creator wishes to avoid explicit creations of the other specialized
+       function R\bRR\bRA\bAs\bs.
+
+       _\bs_\be_\ba_\bs_\bo_\bn_\ba_\bl _\bp_\be_\br_\bi_\bo_\bd specifies the number of primary data points in a sea-
+       sonal cycle. If SEASONAL and DEVSEASONAL are implicitly created, this
+       argument for those R\bRR\bRA\bAs\bs is set automatically to the value specified by
+       HWPREDICT. If they are explicitly created, the creator should verify
+       that all three _\bs_\be_\ba_\bs_\bo_\bn_\ba_\bl _\bp_\be_\br_\bi_\bo_\bd arguments agree.
+
+       _\ba_\bl_\bp_\bh_\ba is the adaption parameter of the intercept (or baseline) coeffi-
+       cient in the Holt-Winters forecasting algorithm. See rrdtool for a
+       description of this algorithm. _\ba_\bl_\bp_\bh_\ba must lie between 0 and 1. A value
+       closer to 1 means that more recent observations carry greater weight in
+       predicting the baseline component of the forecast. A value closer to 0
+       means that past history carries greater weight in predicting the base-
+       line component.
+
+       _\bb_\be_\bt_\ba is the adaption parameter of the slope (or linear trend) coeffi-
+       cient in the Holt-Winters forecasting algorithm. _\bb_\be_\bt_\ba must lie between
+       0 and 1 and plays the same role as _\ba_\bl_\bp_\bh_\ba with respect to the predicted
+       linear trend.
+
+       _\bg_\ba_\bm_\bm_\ba is the adaption parameter of the seasonal coefficients in the
+       Holt-Winters forecasting algorithm (HWPREDICT) or the adaption parame-
+       ter in the exponential smoothing update of the seasonal deviations. It
+       must lie between 0 and 1. If the SEASONAL and DEVSEASONAL R\bRR\bRA\bAs\bs are cre-
+       ated implicitly, they will both have the same value for _\bg_\ba_\bm_\bm_\ba: the
+       value specified for the HWPREDICT _\ba_\bl_\bp_\bh_\ba argument. Note that because
+       there is one seasonal coefficient (or deviation) for each time point
+       during the seasonal cycle, the adaptation rate is much slower than the
+       baseline. Each seasonal coefficient is only updated (or adapts) when
+       the observed value occurs at the offset in the seasonal cycle corre-
+       sponding to that coefficient.
+
+       If SEASONAL and DEVSEASONAL R\bRR\bRA\bAs\bs are created explicitly, _\bg_\ba_\bm_\bm_\ba need not
+       be the same for both. Note that _\bg_\ba_\bm_\bm_\ba can also be changed via the R\bRR\bRD\bD-\b-
+       t\bto\boo\bol\bl _\bt_\bu_\bn_\be command.
+
+       _\br_\br_\ba_\b-_\bn_\bu_\bm provides the links between related R\bRR\bRA\bAs\bs. If HWPREDICT is speci-
+       fied alone and the other R\bRR\bRA\bAs\bs are created implicitly, then there is no
+       need to worry about this argument. If R\bRR\bRA\bAs\bs are created explicitly, then
+       carefully pay attention to this argument. For each R\bRR\bRA\bA which includes
+       this argument, there is a dependency between that R\bRR\bRA\bA and another R\bRR\bRA\bA.
+       The _\br_\br_\ba_\b-_\bn_\bu_\bm argument is the 1-based index in the order of R\bRR\bRA\bA creation
+       (that is, the order they appear in the _\bc_\br_\be_\ba_\bt_\be command). The dependent
+       R\bRR\bRA\bA for each R\bRR\bRA\bA requiring the _\br_\br_\ba_\b-_\bn_\bu_\bm argument is listed here:
+
+       Â·   HWPREDICT _\br_\br_\ba_\b-_\bn_\bu_\bm is the index of the SEASONAL R\bRR\bRA\bA.
+
+       Â·   SEASONAL _\br_\br_\ba_\b-_\bn_\bu_\bm is the index of the HWPREDICT R\bRR\bRA\bA.
+
+       Â·   DEVPREDICT _\br_\br_\ba_\b-_\bn_\bu_\bm is the index of the DEVSEASONAL R\bRR\bRA\bA.
+
+       Â·   DEVSEASONAL _\br_\br_\ba_\b-_\bn_\bu_\bm is the index of the HWPREDICT R\bRR\bRA\bA.
+
+       Â·   FAILURES _\br_\br_\ba_\b-_\bn_\bu_\bm is the index of the DEVSEASONAL R\bRR\bRA\bA.
+
+       _\bt_\bh_\br_\be_\bs_\bh_\bo_\bl_\bd is the minimum number of violations (observed values outside
+       the confidence bounds) within a window that constitutes a failure. If
+       the FAILURES R\bRR\bRA\bA is implicitly created, the default value is 7.
+
+       _\bw_\bi_\bn_\bd_\bo_\bw _\bl_\be_\bn_\bg_\bt_\bh is the number of time points in the window. Specify an
+       integer greater than or equal to the threshold and less than or equal
+       to 28.  The time interval this window represents depends on the inter-
+       val between primary data points. If the FAILURES R\bRR\bRA\bA is implicitly cre-
+       ated, the default value is 9.
+
+T\bTh\bhe\be H\bHE\bEA\bAR\bRT\bTB\bBE\bEA\bAT\bT a\ban\bnd\bd t\bth\bhe\be S\bST\bTE\bEP\bP
+       Here is an explanation by Don Baarda on the inner workings of RRDtool.
+       It may help you to sort out why all this *UNKNOWN* data is popping up
+       in your databases:
+
+       RRDtool gets fed samples at arbitrary times. From these it builds Pri-
+       mary Data Points (PDPs) at exact times on every "step" interval. The
+       PDPs are then accumulated into RRAs.
+
+       The "heartbeat" defines the maximum acceptable interval between sam-
+       ples. If the interval between samples is less than "heartbeat", then an
+       average rate is calculated and applied for that interval. If the inter-
+       val between samples is longer than "heartbeat", then that entire inter-
+       val is considered "unknown". Note that there are other things that can
+       make a sample interval "unknown", such as the rate exceeding limits, or
+       even an "unknown" input sample.
+
+       The known rates during a PDP's "step" interval are used to calculate an
+       average rate for that PDP. Also, if the total "unknown" time during the
+       "step" interval exceeds the "heartbeat", the entire PDP is marked as
+       "unknown". This means that a mixture of known and "unknown" sample
+       times in a single PDP "step" may or may not add up to enough "unknown"
+       time to exceed "heartbeat" and hence mark the whole PDP "unknown". So
+       "heartbeat" is not only the maximum acceptable interval between sam-
+       ples, but also the maximum acceptable amount of "unknown" time per PDP
+       (obviously this is only significant if you have "heartbeat" less than
+       "step").
+
+       The "heartbeat" can be short (unusual) or long (typical) relative to
+       the "step" interval between PDPs. A short "heartbeat" means you require
+       multiple samples per PDP, and if you don't get them mark the PDP
+       unknown. A long heartbeat can span multiple "steps", which means it is
+       acceptable to have multiple PDPs calculated from a single sample. An
+       extreme example of this might be a "step" of 5 minutes and a "heart-
+       beat" of one day, in which case a single sample every day will result
+       in all the PDPs for that entire day period being set to the same aver-
+       age rate. _\b-_\b- _\bD_\bo_\bn _\bB_\ba_\ba_\br_\bd_\ba _\b<_\bd_\bo_\bn_\b._\bb_\ba_\ba_\br_\bd_\ba_\b@_\bb_\ba_\be_\bs_\by_\bs_\bt_\be_\bm_\bs_\b._\bc_\bo_\bm_\b>
+
+              time|
+              axis|
+        begin__|00|
+               |01|
+              u|02|----* sample1, restart "hb"-timer
+              u|03|   /
+              u|04|  /
+              u|05| /
+              u|06|/     "hbt" expired
+              u|07|
+               |08|----* sample2, restart "hb"
+               |09|   /
+               |10|  /
+              u|11|----* sample3, restart "hb"
+              u|12|   /
+              u|13|  /
+        step1_u|14| /
+              u|15|/     "swt" expired
+              u|16|
+               |17|----* sample4, restart "hb", create "pdp" for step1 =
+               |18|   /  = unknown due to 10 "u" labled secs > "hb"
+               |19|  /
+               |20| /
+               |21|----* sample5, restart "hb"
+               |22|   /
+               |23|  /
+               |24|----* sample6, restart "hb"
+               |25|   /
+               |26|  /
+               |27|----* sample7, restart "hb"
+        step2__|28|   /
+               |22|  /
+               |23|----* sample8, restart "hb", create "pdp" for step1, create "cdp"
+               |24|   /
+               |25|  /
+
+       graphics by _\bv_\bl_\ba_\bd_\bi_\bm_\bi_\br_\b._\bl_\ba_\bv_\br_\bo_\bv_\b@_\bd_\be_\bs_\by_\b._\bd_\be.
+
+H\bHO\bOW\bW T\bTO\bO M\bME\bEA\bAS\bSU\bUR\bRE\bE
+       Here are a few hints on how to measure:
+
+       Temperature
+           Usually you have some type of meter you can read to get the temper-
+           ature.  The temperature is not really connected with a time. The
+           only connection is that the temperature reading happened at a cer-
+           tain time. You can use the G\bGA\bAU\bUG\bGE\bE data source type for this. RRDtool
+           will then record your reading together with the time.
+
+       Mail Messages
+           Assume you have a method to count the number of messages trans-
+           ported by your mailserver in a certain amount of time, giving you
+           data like '5 messages in the last 65 seconds'. If you look at the
+           count of 5 like an A\bAB\bBS\bSO\bOL\bLU\bUT\bTE\bE data type you can simply update the RRD
+           with the number 5 and the end time of your monitoring period. RRD-
+           tool will then record the number of messages per second. If at some
+           later stage you want to know the number of messages transported in
+           a day, you can get the average messages per second from RRDtool for
+           the day in question and multiply this number with the number of
+           seconds in a day. Because all math is run with Doubles, the preci-
+           sion should be acceptable.
+
+       It's always a Rate
+           RRDtool stores rates in amount/second for COUNTER, DERIVE and ABSO-
+           LUTE data.  When you plot the data, you will get on the y axis
+           amount/second which you might be tempted to convert to an absolute
+           amount by multiplying by the delta-time between the points. RRDtool
+           plots continuous data, and as such is not appropriate for plotting
+           absolute amounts as for example "total bytes" sent and received in
+           a router. What you probably want is plot rates that you can scale
+           to bytes/hour, for example, or plot absolute amounts with another
+           tool that draws bar-plots, where the delta-time is clear on the
+           plot for each point (such that when you read the graph you see for
+           example GB on the y axis, days on the x axis and one bar for each
+           day).
+
+E\bEX\bXA\bAM\bMP\bPL\bLE\bE
+        rrdtool create temperature.rrd --step 300 \
+         DS:temp:GAUGE:600:-273:5000 \
+         RRA:AVERAGE:0.5:1:1200 \
+         RRA:MIN:0.5:12:2400 \
+         RRA:MAX:0.5:12:2400 \
+         RRA:AVERAGE:0.5:12:2400
+
+       This sets up an R\bRR\bRD\bD called _\bt_\be_\bm_\bp_\be_\br_\ba_\bt_\bu_\br_\be_\b._\br_\br_\bd which accepts one tempera-
+       ture value every 300 seconds. If no new data is supplied for more than
+       600 seconds, the temperature becomes _\b*_\bU_\bN_\bK_\bN_\bO_\bW_\bN_\b*.  The minimum acceptable
+       value is -273 and the maximum is 5'000.
+
+       A few archive areas are also defined. The first stores the temperatures
+       supplied for 100 hours (1'200 * 300 seconds = 100 hours). The second
+       RRA stores the minimum temperature recorded over every hour (12 * 300
+       seconds = 1 hour), for 100 days (2'400 hours). The third and the fourth
+       RRA's do the same for the maximum and average temperature, respec-
+       tively.
+
+E\bEX\bXA\bAM\bMP\bPL\bLE\bE 2\b2
+        rrdtool create monitor.rrd --step 300        \
+          DS:ifOutOctets:COUNTER:1800:0:4294967295   \
+          RRA:AVERAGE:0.5:1:2016                     \
+          RRA:HWPREDICT:1440:0.1:0.0035:288
+
+       This example is a monitor of a router interface. The first R\bRR\bRA\bA tracks
+       the traffic flow in octets; the second R\bRR\bRA\bA generates the specialized
+       functions R\bRR\bRA\bAs\bs for aberrant behavior detection. Note that the _\br_\br_\ba_\b-_\bn_\bu_\bm
+       argument of HWPREDICT is missing, so the other R\bRR\bRA\bAs\bs will implicitly be
+       created with default parameter values. In this example, the forecasting
+       algorithm baseline adapts quickly; in fact the most recent one hour of
+       observations (each at 5 minute intervals) accounts for 75% of the base-
+       line prediction. The linear trend forecast adapts much more slowly.
+       Observations made during the last day (at 288 observations per day)
+       account for only 65% of the predicted linear trend. Note: these compu-
+       tations rely on an exponential smoothing formula described in the LISA
+       2000 paper.
+
+       The seasonal cycle is one day (288 data points at 300 second inter-
+       vals), and the seasonal adaption parameter will be set to 0.1. The RRD
+       file will store 5 days (1'440 data points) of forecasts and deviation
+       predictions before wrap around. The file will store 1 day (a seasonal
+       cycle) of 0-1 indicators in the FAILURES R\bRR\bRA\bA.
+
+       The same RRD file and R\bRR\bRA\bAs\bs are created with the following command,
+       which explicitly creates all specialized function R\bRR\bRA\bAs\bs.
+
+        rrdtool create monitor.rrd --step 300 \
+          DS:ifOutOctets:COUNTER:1800:0:4294967295 \
+          RRA:AVERAGE:0.5:1:2016 \
+          RRA:HWPREDICT:1440:0.1:0.0035:288:3 \
+          RRA:SEASONAL:288:0.1:2 \
+          RRA:DEVPREDICT:1440:5 \
+          RRA:DEVSEASONAL:288:0.1:2 \
+          RRA:FAILURES:288:7:9:5
+
+       Of course, explicit creation need not replicate implicit create, a num-
+       ber of arguments could be changed.
+
+E\bEX\bXA\bAM\bMP\bPL\bLE\bE 3\b3
+        rrdtool create proxy.rrd --step 300 \
+          DS:Total:DERIVE:1800:0:U  \
+          DS:Duration:DERIVE:1800:0:U  \
+          DS:AvgReqDur:COMPUTE:Duration,Requests,0,EQ,1,Requests,IF,/ \
+          RRA:AVERAGE:0.5:1:2016
+
+       This example is monitoring the average request duration during each 300
+       sec interval for requests processed by a web proxy during the interval.
+       In this case, the proxy exposes two counters, the number of requests
+       processed since boot and the total cumulative duration of all processed
+       requests. Clearly these counters both have some rollover point, but
+       using the DERIVE data source also handles the reset that occurs when
+       the web proxy is stopped and restarted.
+
+       In the R\bRR\bRD\bD, the first data source stores the requests per second rate
+       during the interval. The second data source stores the total duration
+       of all requests processed during the interval divided by 300. The COM-
+       PUTE data source divides each PDP of the AccumDuration by the corre-
+       sponding PDP of TotalRequests and stores the average request duration.
+       The remainder of the RPN expression handles the divide by zero case.
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Tobias Oetiker <tobi@oetiker.ch>
+
+
+
+1.2.26                            2007-11-20                      RRDCREATE(1)
diff --git a/doc/rrddump.1 b/doc/rrddump.1
new file mode 100644 (file)
index 0000000..d559ec0
--- /dev/null
@@ -0,0 +1,170 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDDUMP 1"
+.TH RRDDUMP 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrddump \- dump the contents of an RRD to XML format
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBrrdtool\fR \fBdump\fR \fIfilename.rrd\fR > \fIfilename.xml\fR
+.PP
+or 
+.PP
+\&\fBrrdtool\fR \fBdump\fR \fIfilename.rrd\fR \fIfilename.xml\fR
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fBdump\fR function writes the contents of an \fB\s-1RRD\s0\fR in human
+readable (?) \s-1XML\s0 format to a file or to stdout. This format can
+be read by rrdrestore. Together they allow you to transfer your
+files from one computer architecture to another as well to
+manipulate the contents of an \fB\s-1RRD\s0\fR file in a somewhat more
+convenient manner.
+.IP "\fIfilename.rrd\fR" 8
+.IX Item "filename.rrd"
+The name of the \fB\s-1RRD\s0\fR you want to dump.
+.IP "\fIfilename.xml\fR" 8
+.IX Item "filename.xml"
+The (optional) filename that you want to write the \s-1XML\s0 output to.
+If not specified, the \s-1XML\s0 will be printed to stdout.
+.SH "EXAMPLES"
+.IX Header "EXAMPLES"
+To transfer an \s-1RRD\s0 between architectures, follow these steps:
+.IP "1." 4
+On the same system where the \s-1RRD\s0 was created, use \fBrrdtool\fR \fBdump\fR
+to export the data to \s-1XML\s0 format.
+.IP "2." 4
+Transfer the \s-1XML\s0 dump to the target system.
+.IP "3." 4
+Run \fBrrdtool\fR \fBrestore\fR to create a new \s-1RRD\s0 from the \s-1XML\s0 dump. See
+\&\fBrrdrestore\fR for details.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Tobias Oetiker <tobi@oetiker.ch>
diff --git a/doc/rrddump.html b/doc/rrddump.html
new file mode 100644 (file)
index 0000000..2283122
--- /dev/null
@@ -0,0 +1,89 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrddump</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#examples">EXAMPLES</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrddump - dump the contents of an RRD to XML format</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p><strong>rrdtool</strong> <strong>dump</strong> <em>filename.rrd</em> &gt; <em>filename.xml</em></p>
+<p>or</p>
+<p><strong>rrdtool</strong> <strong>dump</strong> <em>filename.rrd</em> <em>filename.xml</em></p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>The <strong>dump</strong> function writes the contents of an <strong>RRD</strong> in human
+readable (?) XML format to a file or to stdout. This format can
+be read by rrdrestore. Together they allow you to transfer your
+files from one computer architecture to another as well to
+manipulate the contents of an <strong>RRD</strong> file in a somewhat more
+convenient manner.</p>
+<dl>
+<dt><strong><a name="item_filename_2errd"><em>filename.rrd</em></a></strong>
+
+<dd>
+<p>The name of the <strong>RRD</strong> you want to dump.</p>
+</dd>
+</li>
+<dt><strong><a name="item_filename_2exml"><em>filename.xml</em></a></strong>
+
+<dd>
+<p>The (optional) filename that you want to write the XML output to.
+If not specified, the XML will be printed to stdout.</p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<hr />
+<h1><a name="examples">EXAMPLES</a></h1>
+<p>To transfer an RRD between architectures, follow these steps:</p>
+<ol>
+<li>
+<p>On the same system where the RRD was created, use <strong>rrdtool</strong> <strong>dump</strong>
+to export the data to XML format.</p>
+</li>
+<li>
+<p>Transfer the XML dump to the target system.</p>
+</li>
+<li>
+<p>Run <strong>rrdtool</strong> <strong>restore</strong> to create a new RRD from the XML dump. See
+<strong>rrdrestore</strong> for details.</p>
+</li>
+</ol>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrddump.pod b/doc/rrddump.pod
new file mode 100644 (file)
index 0000000..2e4cd4b
--- /dev/null
@@ -0,0 +1,62 @@
+=head1 NAME
+
+rrddump - dump the contents of an RRD to XML format
+
+=head1 SYNOPSIS
+
+B<rrdtool> B<dump> I<filename.rrd> E<gt> I<filename.xml>
+
+or 
+
+B<rrdtool> B<dump> I<filename.rrd> I<filename.xml>
+
+=head1 DESCRIPTION
+
+The B<dump> function writes the contents of an B<RRD> in human
+readable (?) XML format to a file or to stdout. This format can
+be read by rrdrestore. Together they allow you to transfer your
+files from one computer architecture to another as well to
+manipulate the contents of an B<RRD> file in a somewhat more
+convenient manner.
+
+
+
+=over 8
+
+=item I<filename.rrd>
+
+The name of the B<RRD> you want to dump.
+
+=item I<filename.xml>
+
+The (optional) filename that you want to write the XML output to.
+If not specified, the XML will be printed to stdout.
+
+=back
+
+=head1 EXAMPLES
+
+To transfer an RRD between architectures, follow these steps:
+
+=over 4
+
+=item 1.
+
+On the same system where the RRD was created, use B<rrdtool> B<dump>
+to export the data to XML format.
+
+=item 2.
+
+Transfer the XML dump to the target system.
+
+=item 3.
+
+Run B<rrdtool> B<restore> to create a new RRD from the XML dump. See
+B<rrdrestore> for details.
+
+=back
+
+=head1 AUTHOR
+
+Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
+
diff --git a/doc/rrddump.txt b/doc/rrddump.txt
new file mode 100644 (file)
index 0000000..226a7b8
--- /dev/null
@@ -0,0 +1,45 @@
+RRDDUMP(1)                          rrdtool                         RRDDUMP(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrddump - dump the contents of an RRD to XML format
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       r\brr\brd\bdt\bto\boo\bol\bl d\bdu\bum\bmp\bp _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be_\b._\br_\br_\bd > _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be_\b._\bx_\bm_\bl
+
+       or
+
+       r\brr\brd\bdt\bto\boo\bol\bl d\bdu\bum\bmp\bp _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be_\b._\br_\br_\bd _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be_\b._\bx_\bm_\bl
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       The d\bdu\bum\bmp\bp function writes the contents of an R\bRR\bRD\bD in human readable (?)
+       XML format to a file or to stdout. This format can be read by
+       rrdrestore. Together they allow you to transfer your files from one
+       computer architecture to another as well to manipulate the contents of
+       an R\bRR\bRD\bD file in a somewhat more convenient manner.
+
+       _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be_\b._\br_\br_\bd
+               The name of the R\bRR\bRD\bD you want to dump.
+
+       _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be_\b._\bx_\bm_\bl
+               The (optional) filename that you want to write the XML output
+               to.  If not specified, the XML will be printed to stdout.
+
+E\bEX\bXA\bAM\bMP\bPL\bLE\bES\bS
+       To transfer an RRD between architectures, follow these steps:
+
+       1.  On the same system where the RRD was created, use r\brr\brd\bdt\bto\boo\bol\bl d\bdu\bum\bmp\bp to
+           export the data to XML format.
+
+       2.  Transfer the XML dump to the target system.
+
+       3.  Run r\brr\brd\bdt\bto\boo\bol\bl r\bre\bes\bst\bto\bor\bre\be to create a new RRD from the XML dump. See
+           r\brr\brd\bdr\bre\bes\bst\bto\bor\bre\be for details.
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Tobias Oetiker <tobi@oetiker.ch>
+
+
+
+1.2.26                            2007-11-20                        RRDDUMP(1)
diff --git a/doc/rrdfetch.1 b/doc/rrdfetch.1
new file mode 100644 (file)
index 0000000..e218ff8
--- /dev/null
@@ -0,0 +1,369 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDFETCH 1"
+.TH RRDFETCH 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdfetch \- Fetch data from an RRD.
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBrrdtool\fR \fBfetch\fR \fIfilename\fR \fI\s-1CF\s0\fR
+[\fB\-\-resolution\fR|\fB\-r\fR\ \fIresolution\fR]
+[\fB\-\-start\fR|\fB\-s\fR\ \fIstart\fR]
+[\fB\-\-end\fR|\fB\-e\fR\ \fIend\fR]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fBfetch\fR function is normally used internally by the graph
+function to get data from \fB\s-1RRD\s0\fRs. \fBfetch\fR will analyze the \fB\s-1RRD\s0\fR
+and try to retrieve the data in the resolution requested.
+The data fetched is printed to stdout. \fI*UNKNOWN*\fR data is often
+represented by the string \*(L"NaN\*(R" depending on your \s-1OS\s0's printf
+function.
+.IP "\fIfilename\fR" 8
+.IX Item "filename"
+the name of the \fB\s-1RRD\s0\fR you want to fetch the data from.
+.IP "\fI\s-1CF\s0\fR" 8
+.IX Item "CF"
+the consolidation function that is applied to the data you
+want to fetch (\s-1AVERAGE\s0,MIN,MAX,LAST)
+.IP "\fB\-\-resolution\fR|\fB\-r\fR \fIresolution\fR (default is the highest resolution)" 8
+.IX Item "--resolution|-r resolution (default is the highest resolution)"
+the interval you want the values to have (seconds per
+value). \fBrrdfetch\fR will try to match your request, but it will return
+data even if no absolute match is possible. \fB\s-1NB\s0.\fR See note below.
+.IP "\fB\-\-start\fR|\fB\-s\fR \fIstart\fR (default end\-1day)" 8
+.IX Item "--start|-s start (default end-1day)"
+start of the time series. A time in seconds since epoch (1970\-01\-01)
+is required. Negative numbers are relative to the current time. By default,
+one day worth of data will be fetched. See also AT-STYLE \s-1TIME\s0 \s-1SPECIFICATION\s0
+section for a detailed explanation on  ways to specify the start time.
+.IP "\fB\-\-end\fR|\fB\-e\fR \fIend\fR (default now)" 8
+.IX Item "--end|-e end (default now)"
+the end of the time series in seconds since epoch. See also AT-STYLE
+\&\s-1TIME\s0 \s-1SPECIFICATION\s0 section for a detailed explanation of how to
+specify the end time.
+.Sh "\s-1RESOLUTION\s0 \s-1INTERVAL\s0"
+.IX Subsection "RESOLUTION INTERVAL"
+In order to get RRDtool to fetch anything other than the finest resolution \s-1RRA\s0
+\&\fBboth\fR the start and end time must be specified on boundaries that are
+multiples of the desired resolution. Consider the following example:
+.PP
+.Vb 7
+\& rrdtool create subdata.rrd \-s 10 DS:ds0:GAUGE:300:0:U \e
+\&  RRA:AVERAGE:0.5:30:3600 \e
+\&  RRA:AVERAGE:0.5:90:1200 \e
+\&  RRA:AVERAGE:0.5:360:1200 \e
+\&  RRA:MAX:0.5:360:1200 \e
+\&  RRA:AVERAGE:0.5:8640:600 \e
+\&  RRA:MAX:0.5:8640:600
+.Ve
+.PP
+This \s-1RRD\s0 collects data every 10 seconds and stores its averages over 5
+minutes, 15 minutes, 1 hour, and 1 day, as well as the maxima for 1 hour
+and 1 day.
+.PP
+Consider now that you want to fetch the 15 minute average data for the
+last hour.  You might try
+.PP
+.Vb 1
+\& rrdtool fetch subdata.rrd AVERAGE \-r 900 \-s \-1h
+.Ve
+.PP
+However, this will almost always result in a time series that is
+\&\fB\s-1NOT\s0\fR in the 15 minute \s-1RRA\s0. Therefore, the highest resolution \s-1RRA\s0,
+i.e. 5 minute averages, will be chosen which in this case is not
+what you want.
+.PP
+Hence, make sure that
+.IP "1." 3
+both start and end time are a multiple of 900
+.IP "2." 3
+both start and end time are within the desired \s-1RRA\s0
+.PP
+So, if time now is called \*(L"t\*(R", do
+.PP
+.Vb 3
+\& end time == int(t/900)*900,
+\& start time == end time \- 1hour,
+\& resolution == 900.
+.Ve
+.PP
+Using the bash shell, this could look be:
+.PP
+.Vb 4
+\& TIME=$(date +%s)
+\& RRDRES=900
+\& rrdtool fetch subdata.rrd AVERAGE \-r $RRDRES \e
+\&    \-e $(($TIME/$RRDRES*$RRDRES)) \-s e\-1h
+.Ve
+.PP
+Or in Perl:
+.PP
+.Vb 3
+\& perl \-e '$ctime = time; $rrdres = 900; \e
+\&          system "rrdtool fetch subdata.rrd AVERAGE \e
+\&                  \-r $rrdres \-e @{[int($ctime/$rrdres)*$rrdres]} \-s e\-1h"'
+.Ve
+.Sh "AT-STYLE \s-1TIME\s0 \s-1SPECIFICATION\s0"
+.IX Subsection "AT-STYLE TIME SPECIFICATION"
+Apart from the traditional \fISeconds since epoch\fR, RRDtool does also
+understand at-style time specification. The specification is called
+\&\*(L"at\-style\*(R" after the Unix command \fIat\fR\|(1) that has moderately complex
+ways to specify time to run your job at a certain date and time. The
+at-style specification consists of two parts: the \fB\s-1TIME\s0 \s-1REFERENCE\s0\fR
+specification and the \fB\s-1TIME\s0 \s-1OFFSET\s0\fR specification.
+.Sh "\s-1TIME\s0 \s-1REFERENCE\s0 \s-1SPECIFICATION\s0"
+.IX Subsection "TIME REFERENCE SPECIFICATION"
+The time reference specification is used, well, to establish a reference
+moment in time (to which the time offset is then applied to). When present,
+it should come first, when omitted, it defaults to \fBnow\fR. On its own part,
+time reference consists of a \fItime-of-day\fR reference (which should come
+first, if present) and a \fIday\fR reference.
+.PP
+The \fItime-of-day\fR can be specified as \fB\s-1HH:MM\s0\fR, \fB\s-1HH\s0.MM\fR,
+or just \fB\s-1HH\s0\fR. You can suffix it with \fBam\fR or \fBpm\fR or use
+24\-hours clock. Some special times of day are understood as well,
+including \fBmidnight\fR (00:00), \fBnoon\fR (12:00) and British
+\&\fBteatime\fR (16:00).
+.PP
+The \fIday\fR can be specified as \fImonth-name\fR \fIday-of-the-month\fR and
+optional a 2\- or 4\-digit \fIyear\fR number (e.g. March 8 1999). Alternatively,
+you can use \fIday-of-week-name\fR (e.g. Monday), or one of the words:
+\&\fByesterday\fR, \fBtoday\fR, \fBtomorrow\fR. You can also specify the \fIday\fR as a
+full date in several numerical formats, including \fBMM/DD/[\s-1YY\s0]YY\fR,
+\&\fB\s-1DD\s0.MM.[\s-1YY\s0]YY\fR, or \fB\s-1YYYYMMDD\s0\fR.
+.PP
+\&\fI\s-1NOTE1\s0\fR: this is different from the original \fIat\fR\|(1) behavior, where a
+single-number date is interpreted as MMDD[\s-1YY\s0]YY.
+.PP
+\&\fI\s-1NOTE2\s0\fR: if you specify the \fIday\fR in this way, the \fItime-of-day\fR is
+\&\s-1REQUIRED\s0 as well.
+.PP
+Finally, you can use the words \fBnow\fR, \fBstart\fR, or \fBend\fR as your time
+reference. \fBNow\fR refers to the current moment (and is also the default
+time reference). \fBStart\fR (\fBend\fR) can be used to specify a time
+relative to the start (end) time for those tools that use these
+categories (\fBrrdfetch\fR, rrdgraph).
+.PP
+Month and day of the week names can be used in their naturally
+abbreviated form (e.g., Dec for December, Sun for Sunday, etc.). The
+words \fBnow\fR, \fBstart\fR, \fBend\fR can be abbreviated as \fBn\fR, \fBs\fR, \fBe\fR.
+.Sh "\s-1TIME\s0 \s-1OFFSET\s0 \s-1SPECIFICATION\s0"
+.IX Subsection "TIME OFFSET SPECIFICATION"
+The time offset specification is used to add/subtract certain time
+intervals to/from the time reference moment. It consists of a \fIsign\fR
+(\fB+\fR\ or\ \fB\-\fR) and an \fIamount\fR. The following time units can be
+used to specify the \fIamount\fR: \fByears\fR, \fBmonths\fR, \fBweeks\fR, \fBdays\fR,
+\&\fBhours\fR, \fBminutes\fR, or \fBseconds\fR. These units can be used in
+singular or plural form, and abbreviated naturally or to a single
+letter (e.g. +3days, \-1wk, \-3y). Several time units can be combined
+(e.g., \-5mon1w2d) or concatenated (e.g., \-5h45min = \-5h\-45min =
+\&\-6h+15min = \-7h+1h30m\-15min, etc.)
+.PP
+\&\fI\s-1NOTE3\s0\fR: If you specify time offset in days, weeks, months, or years,
+you will end with the time offset that may vary depending on your time
+reference, because all those time units have no single well defined
+time interval value (1\ year contains either 365 or 366 days, 1\ month
+is 28 to 31 days long, and even 1\ day may be not equal to 24 hours
+twice a year, when DST-related clock adjustments take place).
+To cope with this, when you use days, weeks, months, or years
+as your time offset units your time reference date is adjusted
+accordingly without too much further effort to ensure anything
+about it (in the hope that \fImktime\fR\|(3) will take care of this later).
+This may lead to some surprising (or even invalid!) results,
+e.g. 'May\ 31\ \-1month' = 'Apr\ 31' (meaningless) = 'May\ 1'
+(after \fImktime\fR\|(3) normalization); in the \s-1EET\s0 timezone
+\&'3:30am Mar 29 1999 \-1 day' yields '3:30am Mar 28 1999' (Sunday)
+which is an invalid time/date combination (because of 3am \-> 4am \s-1DST\s0
+forward clock adjustment, see the below example).
+.PP
+In contrast, hours, minutes, and seconds are well defined time
+intervals, and these are guaranteed to always produce time offsets
+exactly as specified (e.g. for \s-1EET\s0 timezone, '8:00\ Mar\ 27\ 1999\ +2\ days' = '8:00\ Mar\ 29\ 1999', but since there is 1\-hour \s-1DST\s0 forward
+clock adjustment that occurs around 3:00\ Mar\ 28\ 1999, the actual
+time interval between 8:00\ Mar\ 27\ 1999 and 8:00\ Mar\ 29\ 1999
+equals 47 hours; on the other hand, '8:00\ Mar\ 27\ 1999\ +48\ hours' =
+\&'9:00\ Mar\ 29\ 1999', as expected)
+.PP
+\&\fI\s-1NOTE4\s0\fR: The single-letter abbreviation for both \fBmonths\fR and \fBminutes\fR
+is \fBm\fR. To disambiguate them, the parser tries to read your mind\ :)
+by applying the following two heuristics:
+.IP "1" 3
+.IX Item "1"
+If \fBm\fR is used in context of (i.e. right after the) years,
+months, weeks, or days it is assumed to mean \fBmonths\fR, while
+in the context of hours, minutes, and seconds it means minutes.
+(e.g., in \-1y6m or +3w1m \fBm\fR is interpreted as \fBmonths\fR, while in
+\&\-3h20m or +5s2m \fBm\fR the parser decides for \fBminutes\fR).
+.IP "2" 3
+.IX Item "2"
+Out of context (i.e. right after the \fB+\fR or \fB\-\fR sign) the
+meaning of \fBm\fR is guessed from the number it directly follows.
+Currently, if the number's absolute value is below 25 it is assumed
+that \fBm\fR means \fBmonths\fR, otherwise it is treated as \fBminutes\fR.
+(e.g., \-25m == \-25 minutes, while +24m == +24 months)
+.PP
+\&\fIFinal \s-1NOTES\s0\fR: Time specification is case\-insensitive.
+Whitespace can be inserted freely or omitted altogether.
+There are, however, cases when whitespace is required
+(e.g., 'midnight\ Thu'). In this case you should either quote the
+whole phrase to prevent it from being taken apart by your shell or use
+\&'_' (underscore) or ',' (comma) which also count as whitespace
+(e.g., midnight_Thu or midnight,Thu).
+.Sh "\s-1TIME\s0 \s-1SPECIFICATION\s0 \s-1EXAMPLES\s0"
+.IX Subsection "TIME SPECIFICATION EXAMPLES"
+\&\fIOct 12\fR \*(-- October 12 this year
+.PP
+\&\fI\-1month\fR or \fI\-1m\fR \*(-- current time of day, only a month before
+(may yield surprises, see \s-1NOTE3\s0 above).
+.PP
+\&\fInoon yesterday \-3hours\fR \*(-- yesterday morning; can also be specified
+as \fI9am\-1day\fR.
+.PP
+\&\fI23:59 31.12.1999\fR \*(-- 1 minute to the year 2000.
+.PP
+\&\fI12/31/99 11:59pm\fR \*(-- 1 minute to the year 2000 for imperialists.
+.PP
+\&\fI12am 01/01/01\fR \*(-- start of the new millennium
+.PP
+\&\fIend\-3weeks\fR or \fIe\-3w\fR \*(-- 3 weeks before end time
+(may be used as start time specification).
+.PP
+\&\fIstart+6hours\fR or \fIs+6h\fR \*(-- 6 hours after start time
+(may be used as end time specification).
+.PP
+\&\fI931225537\fR \*(-- 18:45  July 5th, 1999
+(yes, seconds since 1970 are valid as well).
+.PP
+\&\fI19970703 12:45\fR \*(-- 12:45  July 3th, 1997
+(my favorite, and its even got an \s-1ISO\s0 number (8601)).
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Tobias Oetiker <tobi@oetiker.ch>
diff --git a/doc/rrdfetch.html b/doc/rrdfetch.html
new file mode 100644 (file)
index 0000000..9e4e41c
--- /dev/null
@@ -0,0 +1,276 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdfetch</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <ul>
+
+               <li><a href="#resolution_interval">RESOLUTION INTERVAL</a></li>
+               <li><a href="#atstyle_time_specification">AT-STYLE TIME SPECIFICATION</a></li>
+               <li><a href="#time_reference_specification">TIME REFERENCE SPECIFICATION</a></li>
+               <li><a href="#time_offset_specification">TIME OFFSET SPECIFICATION</a></li>
+               <li><a href="#time_specification_examples">TIME SPECIFICATION EXAMPLES</a></li>
+       </ul>
+
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdfetch - Fetch data from an RRD.</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p><strong>rrdtool</strong> <strong>fetch</strong> <em>filename</em> <em>CF</em>
+[<strong>--resolution</strong>|<strong>-r</strong>&nbsp;<em>resolution</em>]
+[<strong>--start</strong>|<strong>-s</strong>&nbsp;<em>start</em>]
+[<strong>--end</strong>|<strong>-e</strong>&nbsp;<em>end</em>]</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>The <strong>fetch</strong> function is normally used internally by the graph
+function to get data from <strong>RRD</strong>s. <strong>fetch</strong> will analyze the <strong>RRD</strong>
+and try to retrieve the data in the resolution requested.
+The data fetched is printed to stdout. <em>*UNKNOWN*</em> data is often
+represented by the string ``NaN'' depending on your OS's printf
+function.</p>
+<dl>
+<dt><strong><a name="item_filename"><em>filename</em></a></strong>
+
+<dd>
+<p>the name of the <strong>RRD</strong> you want to fetch the data from.</p>
+</dd>
+</li>
+<dt><strong><a name="item_cf"><em>CF</em></a></strong>
+
+<dd>
+<p>the consolidation function that is applied to the data you
+want to fetch (AVERAGE,MIN,MAX,LAST)</p>
+</dd>
+</li>
+<dt><strong><a name="item_resolution"><strong>--resolution</strong>|<strong>-r</strong> <em>resolution</em> (default is the highest resolution)</a></strong>
+
+<dd>
+<p>the interval you want the values to have (seconds per
+value). <strong>rrdfetch</strong> will try to match your request, but it will return
+data even if no absolute match is possible. <strong>NB.</strong> See note below.</p>
+</dd>
+</li>
+<dt><strong><a name="item_start"><strong>--start</strong>|<strong>-s</strong> <em>start</em> (default end-1day)</a></strong>
+
+<dd>
+<p>start of the time series. A time in seconds since epoch (1970-01-01)
+is required. Negative numbers are relative to the current time. By default,
+one day worth of data will be fetched. See also AT-STYLE TIME SPECIFICATION
+section for a detailed explanation on  ways to specify the start time.</p>
+</dd>
+</li>
+<dt><strong><a name="item_end"><strong>--end</strong>|<strong>-e</strong> <em>end</em> (default now)</a></strong>
+
+<dd>
+<p>the end of the time series in seconds since epoch. See also AT-STYLE
+TIME SPECIFICATION section for a detailed explanation of how to
+specify the end time.</p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<h2><a name="resolution_interval">RESOLUTION INTERVAL</a></h2>
+<p>In order to get RRDtool to fetch anything other than the finest resolution RRA
+<strong>both</strong> the start and end time must be specified on boundaries that are
+multiples of the desired resolution. Consider the following example:</p>
+<pre>
+ rrdtool create subdata.rrd -s 10 DS:ds0:GAUGE:300:0:U \
+  RRA:AVERAGE:0.5:30:3600 \
+  RRA:AVERAGE:0.5:90:1200 \
+  RRA:AVERAGE:0.5:360:1200 \
+  RRA:MAX:0.5:360:1200 \
+  RRA:AVERAGE:0.5:8640:600 \
+  RRA:MAX:0.5:8640:600</pre>
+<p>This RRD collects data every 10 seconds and stores its averages over 5
+minutes, 15 minutes, 1 hour, and 1 day, as well as the maxima for 1 hour
+and 1 day.</p>
+<p>Consider now that you want to fetch the 15 minute average data for the
+last hour.  You might try</p>
+<pre>
+ rrdtool fetch subdata.rrd AVERAGE -r 900 -s -1h</pre>
+<p>However, this will almost always result in a time series that is
+<strong>NOT</strong> in the 15 minute RRA. Therefore, the highest resolution RRA,
+i.e. 5 minute averages, will be chosen which in this case is not
+what you want.</p>
+<p>Hence, make sure that</p>
+<ol>
+<li>
+<p>both start and end time are a multiple of 900</p>
+</li>
+<li>
+<p>both start and end time are within the desired RRA</p>
+</li>
+</ol>
+<p>So, if time now is called ``t'', do</p>
+<pre>
+ end time == int(t/900)*900,
+ start time == end time - 1hour,
+ resolution == 900.</pre>
+<p>Using the bash shell, this could look be:</p>
+<pre>
+ TIME=$(date +%s)
+ RRDRES=900
+ rrdtool fetch subdata.rrd AVERAGE -r $RRDRES \
+    -e $(($TIME/$RRDRES*$RRDRES)) -s e-1h</pre>
+<p>Or in Perl:</p>
+<pre>
+ perl -e '$ctime = time; $rrdres = 900; \
+          system &quot;rrdtool fetch subdata.rrd AVERAGE \
+                  -r $rrdres -e @{[int($ctime/$rrdres)*$rrdres]} -s e-1h&quot;'</pre>
+<p>
+</p>
+<h2><a name="atstyle_time_specification">AT-STYLE TIME SPECIFICATION</a></h2>
+<p>Apart from the traditional <em>Seconds since epoch</em>, RRDtool does also
+understand at-style time specification. The specification is called
+``at-style'' after the Unix command <code>at(1)</code> that has moderately complex
+ways to specify time to run your job at a certain date and time. The
+at-style specification consists of two parts: the <strong>TIME REFERENCE</strong>
+specification and the <strong>TIME OFFSET</strong> specification.</p>
+<p>
+</p>
+<h2><a name="time_reference_specification">TIME REFERENCE SPECIFICATION</a></h2>
+<p>The time reference specification is used, well, to establish a reference
+moment in time (to which the time offset is then applied to). When present,
+it should come first, when omitted, it defaults to <strong>now</strong>. On its own part,
+time reference consists of a <em>time-of-day</em> reference (which should come
+first, if present) and a <em>day</em> reference.</p>
+<p>The <em>time-of-day</em> can be specified as <strong>HH:MM</strong>, <strong>HH.MM</strong>,
+or just <strong>HH</strong>. You can suffix it with <strong>am</strong> or <strong>pm</strong> or use
+24-hours clock. Some special times of day are understood as well,
+including <strong>midnight</strong> (00:00), <strong>noon</strong> (12:00) and British
+<strong>teatime</strong> (16:00).</p>
+<p>The <em>day</em> can be specified as <em>month-name</em> <em>day-of-the-month</em> and
+optional a 2- or 4-digit <em>year</em> number (e.g. March 8 1999). Alternatively,
+you can use <em>day-of-week-name</em> (e.g. Monday), or one of the words:
+<strong>yesterday</strong>, <strong>today</strong>, <strong>tomorrow</strong>. You can also specify the <em>day</em> as a
+full date in several numerical formats, including <strong>MM/DD/[YY]YY</strong>,
+<strong>DD.MM.[YY]YY</strong>, or <strong>YYYYMMDD</strong>.</p>
+<p><em>NOTE1</em>: this is different from the original <code>at(1)</code> behavior, where a
+single-number date is interpreted as MMDD[YY]YY.</p>
+<p><em>NOTE2</em>: if you specify the <em>day</em> in this way, the <em>time-of-day</em> is
+REQUIRED as well.</p>
+<p>Finally, you can use the words <strong>now</strong>, <strong>start</strong>, or <strong>end</strong> as your time
+reference. <strong>Now</strong> refers to the current moment (and is also the default
+time reference). <strong>Start</strong> (<strong>end</strong>) can be used to specify a time
+relative to the start (end) time for those tools that use these
+categories (<strong>rrdfetch</strong>, <a href="././rrdgraph.html">the rrdgraph manpage</a>).</p>
+<p>Month and day of the week names can be used in their naturally
+abbreviated form (e.g., Dec for December, Sun for Sunday, etc.). The
+words <strong>now</strong>, <strong>start</strong>, <strong>end</strong> can be abbreviated as <strong>n</strong>, <strong>s</strong>, <strong>e</strong>.</p>
+<p>
+</p>
+<h2><a name="time_offset_specification">TIME OFFSET SPECIFICATION</a></h2>
+<p>The time offset specification is used to add/subtract certain time
+intervals to/from the time reference moment. It consists of a <em>sign</em>
+(<strong>+</strong>&nbsp;or&nbsp;<strong>-</strong>) and an <em>amount</em>. The following time units can be
+used to specify the <em>amount</em>: <strong>years</strong>, <strong>months</strong>, <strong>weeks</strong>, <strong>days</strong>,
+<strong>hours</strong>, <strong>minutes</strong>, or <strong>seconds</strong>. These units can be used in
+singular or plural form, and abbreviated naturally or to a single
+letter (e.g. +3days, -1wk, -3y). Several time units can be combined
+(e.g., -5mon1w2d) or concatenated (e.g., -5h45min = -5h-45min =
+-6h+15min = -7h+1h30m-15min, etc.)</p>
+<p><em>NOTE3</em>: If you specify time offset in days, weeks, months, or years,
+you will end with the time offset that may vary depending on your time
+reference, because all those time units have no single well defined
+time interval value (1&nbsp;year contains either 365 or 366 days, 1&nbsp;month
+is 28 to 31 days long, and even 1&nbsp;day may be not equal to 24 hours
+twice a year, when DST-related clock adjustments take place).
+To cope with this, when you use days, weeks, months, or years
+as your time offset units your time reference date is adjusted
+accordingly without too much further effort to ensure anything
+about it (in the hope that <code>mktime(3)</code> will take care of this later).
+This may lead to some surprising (or even invalid!) results,
+e.g. 'May&nbsp;31&nbsp;-1month' = 'Apr&nbsp;31' (meaningless) = 'May&nbsp;1'
+(after <code>mktime(3)</code> normalization); in the EET timezone
+'3:30am Mar 29 1999 -1 day' yields '3:30am Mar 28 1999' (Sunday)
+which is an invalid time/date combination (because of 3am -&gt; 4am DST
+forward clock adjustment, see the below example).</p>
+<p>In contrast, hours, minutes, and seconds are well defined time
+intervals, and these are guaranteed to always produce time offsets
+exactly as specified (e.g. for EET timezone, '8:00&nbsp;Mar&nbsp;27&nbsp;1999&nbsp;+2
+days' = '8:00&nbsp;Mar&nbsp;29&nbsp;1999', but since there is 1-hour DST forward
+clock adjustment that occurs around 3:00&nbsp;Mar&nbsp;28&nbsp;1999, the actual
+time interval between 8:00&nbsp;Mar&nbsp;27&nbsp;1999 and 8:00&nbsp;Mar&nbsp;29&nbsp;1999
+equals 47 hours; on the other hand, '8:00&nbsp;Mar&nbsp;27&nbsp;1999&nbsp;+48&nbsp;hours' =
+'9:00&nbsp;Mar&nbsp;29&nbsp;1999', as expected)</p>
+<p><em>NOTE4</em>: The single-letter abbreviation for both <strong>months</strong> and <strong>minutes</strong>
+is <strong>m</strong>. To disambiguate them, the parser tries to read your mind&nbsp;:)
+by applying the following two heuristics:</p>
+<ol>
+<li>
+<p>If <strong>m</strong> is used in context of (i.e. right after the) years,
+months, weeks, or days it is assumed to mean <strong>months</strong>, while
+in the context of hours, minutes, and seconds it means minutes.
+(e.g., in -1y6m or +3w1m <strong>m</strong> is interpreted as <strong>months</strong>, while in
+-3h20m or +5s2m <strong>m</strong> the parser decides for <strong>minutes</strong>).</p>
+</li>
+<li>
+<p>Out of context (i.e. right after the <strong>+</strong> or <strong>-</strong> sign) the
+meaning of <strong>m</strong> is guessed from the number it directly follows.
+Currently, if the number's absolute value is below 25 it is assumed
+that <strong>m</strong> means <strong>months</strong>, otherwise it is treated as <strong>minutes</strong>.
+(e.g., -25m == -25 minutes, while +24m == +24 months)</p>
+</li>
+</ol>
+<p><em>Final NOTES</em>: Time specification is case-insensitive.
+Whitespace can be inserted freely or omitted altogether.
+There are, however, cases when whitespace is required
+(e.g., 'midnight&nbsp;Thu'). In this case you should either quote the
+whole phrase to prevent it from being taken apart by your shell or use
+'_' (underscore) or ',' (comma) which also count as whitespace
+(e.g., midnight_Thu or midnight,Thu).</p>
+<p>
+</p>
+<h2><a name="time_specification_examples">TIME SPECIFICATION EXAMPLES</a></h2>
+<p><em>Oct 12</em> -- October 12 this year</p>
+<p><em>-1month</em> or <em>-1m</em> -- current time of day, only a month before
+(may yield surprises, see NOTE3 above).</p>
+<p><em>noon yesterday -3hours</em> -- yesterday morning; can also be specified
+as <em>9am-1day</em>.</p>
+<p><em>23:59 31.12.1999</em> -- 1 minute to the year 2000.</p>
+<p><em>12/31/99 11:59pm</em> -- 1 minute to the year 2000 for imperialists.</p>
+<p><em>12am 01/01/01</em> -- start of the new millennium</p>
+<p><em>end-3weeks</em> or <em>e-3w</em> -- 3 weeks before end time
+(may be used as start time specification).</p>
+<p><em>start+6hours</em> or <em>s+6h</em> -- 6 hours after start time
+(may be used as end time specification).</p>
+<p><em>931225537</em> -- 18:45  July 5th, 1999
+(yes, seconds since 1970 are valid as well).</p>
+<p><em>19970703 12:45</em> -- 12:45  July 3th, 1997
+(my favorite, and its even got an ISO number (8601)).</p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdfetch.pod b/doc/rrdfetch.pod
new file mode 100644 (file)
index 0000000..51b5ccd
--- /dev/null
@@ -0,0 +1,262 @@
+=head1 NAME
+
+rrdfetch - Fetch data from an RRD.
+
+=head1 SYNOPSIS
+
+B<rrdtool> B<fetch> I<filename> I<CF>
+S<[B<--resolution>|B<-r> I<resolution>]>
+S<[B<--start>|B<-s> I<start>]>
+S<[B<--end>|B<-e> I<end>]>
+
+=head1 DESCRIPTION
+
+The B<fetch> function is normally used internally by the graph
+function to get data from B<RRD>s. B<fetch> will analyze the B<RRD>
+and try to retrieve the data in the resolution requested.
+The data fetched is printed to stdout. I<*UNKNOWN*> data is often
+represented by the string "NaN" depending on your OS's printf
+function.
+
+=over 8
+
+=item I<filename>
+
+the name of the B<RRD> you want to fetch the data from.
+
+=item I<CF>
+
+the consolidation function that is applied to the data you
+want to fetch (AVERAGE,MIN,MAX,LAST)
+
+=item B<--resolution>|B<-r> I<resolution> (default is the highest resolution)
+
+the interval you want the values to have (seconds per
+value). B<rrdfetch> will try to match your request, but it will return
+data even if no absolute match is possible. B<NB.> See note below.
+
+=item B<--start>|B<-s> I<start> (default end-1day)
+
+start of the time series. A time in seconds since epoch (1970-01-01)
+is required. Negative numbers are relative to the current time. By default,
+one day worth of data will be fetched. See also AT-STYLE TIME SPECIFICATION
+section for a detailed explanation on  ways to specify the start time.
+
+=item B<--end>|B<-e> I<end> (default now)
+
+the end of the time series in seconds since epoch. See also AT-STYLE
+TIME SPECIFICATION section for a detailed explanation of how to
+specify the end time.
+
+=back
+
+=head2 RESOLUTION INTERVAL
+
+In order to get RRDtool to fetch anything other than the finest resolution RRA
+B<both> the start and end time must be specified on boundaries that are
+multiples of the desired resolution. Consider the following example:
+
+ rrdtool create subdata.rrd -s 10 DS:ds0:GAUGE:300:0:U \
+  RRA:AVERAGE:0.5:30:3600 \
+  RRA:AVERAGE:0.5:90:1200 \
+  RRA:AVERAGE:0.5:360:1200 \
+  RRA:MAX:0.5:360:1200 \
+  RRA:AVERAGE:0.5:8640:600 \
+  RRA:MAX:0.5:8640:600
+
+This RRD collects data every 10 seconds and stores its averages over 5
+minutes, 15 minutes, 1 hour, and 1 day, as well as the maxima for 1 hour
+and 1 day.
+
+Consider now that you want to fetch the 15 minute average data for the
+last hour.  You might try
+
+ rrdtool fetch subdata.rrd AVERAGE -r 900 -s -1h
+
+However, this will almost always result in a time series that is
+B<NOT> in the 15 minute RRA. Therefore, the highest resolution RRA,
+i.e. 5 minute averages, will be chosen which in this case is not
+what you want.
+
+Hence, make sure that
+
+=over 3
+
+=item 1.
+
+both start and end time are a multiple of 900
+
+=item 2.
+
+both start and end time are within the desired RRA
+
+=back
+
+So, if time now is called "t", do
+
+ end time == int(t/900)*900,
+ start time == end time - 1hour,
+ resolution == 900.
+
+Using the bash shell, this could look be:
+
+ TIME=$(date +%s)
+ RRDRES=900
+ rrdtool fetch subdata.rrd AVERAGE -r $RRDRES \
+    -e $(($TIME/$RRDRES*$RRDRES)) -s e-1h
+
+Or in Perl:
+
+ perl -e '$ctime = time; $rrdres = 900; \
+          system "rrdtool fetch subdata.rrd AVERAGE \
+                  -r $rrdres -e @{[int($ctime/$rrdres)*$rrdres]} -s e-1h"'
+
+
+=head2 AT-STYLE TIME SPECIFICATION
+
+Apart from the traditional I<Seconds since epoch>, RRDtool does also
+understand at-style time specification. The specification is called
+"at-style" after the Unix command at(1) that has moderately complex
+ways to specify time to run your job at a certain date and time. The
+at-style specification consists of two parts: the B<TIME REFERENCE>
+specification and the B<TIME OFFSET> specification.
+
+=head2 TIME REFERENCE SPECIFICATION
+
+The time reference specification is used, well, to establish a reference
+moment in time (to which the time offset is then applied to). When present,
+it should come first, when omitted, it defaults to B<now>. On its own part,
+time reference consists of a I<time-of-day> reference (which should come
+first, if present) and a I<day> reference.
+
+The I<time-of-day> can be specified as B<HH:MM>, B<HH.MM>,
+or just B<HH>. You can suffix it with B<am> or B<pm> or use
+24-hours clock. Some special times of day are understood as well,
+including B<midnight> (00:00), B<noon> (12:00) and British
+B<teatime> (16:00).
+
+The I<day> can be specified as I<month-name> I<day-of-the-month> and
+optional a 2- or 4-digit I<year> number (e.g. March 8 1999). Alternatively,
+you can use I<day-of-week-name> (e.g. Monday), or one of the words:
+B<yesterday>, B<today>, B<tomorrow>. You can also specify the I<day> as a
+full date in several numerical formats, including B<MM/DD/[YY]YY>,
+B<DD.MM.[YY]YY>, or B<YYYYMMDD>.
+
+I<NOTE1>: this is different from the original at(1) behavior, where a
+single-number date is interpreted as MMDD[YY]YY.
+
+I<NOTE2>: if you specify the I<day> in this way, the I<time-of-day> is
+REQUIRED as well.
+
+Finally, you can use the words B<now>, B<start>, or B<end> as your time
+reference. B<Now> refers to the current moment (and is also the default
+time reference). B<Start> (B<end>) can be used to specify a time
+relative to the start (end) time for those tools that use these
+categories (B<rrdfetch>, L<rrdgraph>).
+
+Month and day of the week names can be used in their naturally
+abbreviated form (e.g., Dec for December, Sun for Sunday, etc.). The
+words B<now>, B<start>, B<end> can be abbreviated as B<n>, B<s>, B<e>.
+
+=head2 TIME OFFSET SPECIFICATION
+
+The time offset specification is used to add/subtract certain time
+intervals to/from the time reference moment. It consists of a I<sign>
+(S<B<+> or B<->>) and an I<amount>. The following time units can be
+used to specify the I<amount>: B<years>, B<months>, B<weeks>, B<days>,
+B<hours>, B<minutes>, or B<seconds>. These units can be used in
+singular or plural form, and abbreviated naturally or to a single
+letter (e.g. +3days, -1wk, -3y). Several time units can be combined
+(e.g., -5mon1w2d) or concatenated (e.g., -5h45min = -5h-45min =
+-6h+15min = -7h+1h30m-15min, etc.)
+
+I<NOTE3>: If you specify time offset in days, weeks, months, or years,
+you will end with the time offset that may vary depending on your time
+reference, because all those time units have no single well defined
+time interval value (S<1 year> contains either 365 or 366 days, S<1 month>
+is 28 to 31 days long, and even S<1 day> may be not equal to 24 hours
+twice a year, when DST-related clock adjustments take place).
+To cope with this, when you use days, weeks, months, or years
+as your time offset units your time reference date is adjusted
+accordingly without too much further effort to ensure anything
+about it (in the hope that mktime(3) will take care of this later).
+This may lead to some surprising (or even invalid!) results,
+e.g. S<'May 31 -1month'> = S<'Apr 31'> (meaningless) = S<'May 1'>
+(after mktime(3) normalization); in the EET timezone
+'3:30am Mar 29 1999 -1 day' yields '3:30am Mar 28 1999' (Sunday)
+which is an invalid time/date combination (because of 3am -> 4am DST
+forward clock adjustment, see the below example).
+
+In contrast, hours, minutes, and seconds are well defined time
+intervals, and these are guaranteed to always produce time offsets
+exactly as specified (e.g. for EET timezone, S<'8:00 Mar 27 1999 +2
+days'> = S<'8:00 Mar 29 1999'>, but since there is 1-hour DST forward
+clock adjustment that occurs around S<3:00 Mar 28 1999>, the actual
+time interval between S<8:00 Mar 27 1999> and S<8:00 Mar 29 1999>
+equals 47 hours; on the other hand, S<'8:00 Mar 27 1999 +48 hours'> =
+S<'9:00 Mar 29 1999'>, as expected)
+
+I<NOTE4>: The single-letter abbreviation for both B<months> and B<minutes>
+is B<m>. To disambiguate them, the parser tries to read your S<mind :)>
+by applying the following two heuristics:
+
+=over 3
+
+=item 1
+
+If B<m> is used in context of (i.e. right after the) years,
+months, weeks, or days it is assumed to mean B<months>, while
+in the context of hours, minutes, and seconds it means minutes.
+(e.g., in -1y6m or +3w1m B<m> is interpreted as B<months>, while in
+-3h20m or +5s2m B<m> the parser decides for B<minutes>).
+
+=item 2
+
+Out of context (i.e. right after the B<+> or B<-> sign) the
+meaning of B<m> is guessed from the number it directly follows.
+Currently, if the number's absolute value is below 25 it is assumed
+that B<m> means B<months>, otherwise it is treated as B<minutes>.
+(e.g., -25m == -25 minutes, while +24m == +24 months)
+
+=back
+
+I<Final NOTES>: Time specification is case-insensitive.
+Whitespace can be inserted freely or omitted altogether.
+There are, however, cases when whitespace is required
+(e.g., S<'midnight Thu'>). In this case you should either quote the
+whole phrase to prevent it from being taken apart by your shell or use
+'_' (underscore) or ',' (comma) which also count as whitespace
+(e.g., midnight_Thu or midnight,Thu).
+
+
+=head2 TIME SPECIFICATION EXAMPLES
+
+I<Oct 12> -- October 12 this year
+
+I<-1month> or I<-1m> -- current time of day, only a month before
+(may yield surprises, see NOTE3 above).
+
+I<noon yesterday -3hours> -- yesterday morning; can also be specified
+as I<9am-1day>.
+
+I<23:59 31.12.1999> -- 1 minute to the year 2000.
+
+I<12/31/99 11:59pm> -- 1 minute to the year 2000 for imperialists.
+
+I<12am 01/01/01> -- start of the new millennium
+
+I<end-3weeks> or I<e-3w> -- 3 weeks before end time
+(may be used as start time specification).
+
+I<start+6hours> or I<s+6h> -- 6 hours after start time
+(may be used as end time specification).
+
+I<931225537> -- 18:45  July 5th, 1999
+(yes, seconds since 1970 are valid as well).
+
+I<19970703 12:45> -- 12:45  July 3th, 1997
+(my favorite, and its even got an ISO number (8601)).
+
+=head1 AUTHOR
+
+Tobias Oetiker <tobi@oetiker.ch>
diff --git a/doc/rrdfetch.txt b/doc/rrdfetch.txt
new file mode 100644 (file)
index 0000000..10057c2
--- /dev/null
@@ -0,0 +1,231 @@
+RRDFETCH(1)                         rrdtool                        RRDFETCH(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdfetch - Fetch data from an RRD.
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       r\brr\brd\bdt\bto\boo\bol\bl f\bfe\bet\btc\bch\bh _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be _\bC_\bF [-\b--\b-r\bre\bes\bso\bol\blu\but\bti\bio\bon\bn|-\b-r\br _\br_\be_\bs_\bo_\bl_\bu_\bt_\bi_\bo_\bn]
+       [-\b--\b-s\bst\bta\bar\brt\bt|-\b-s\bs _\bs_\bt_\ba_\br_\bt] [-\b--\b-e\ben\bnd\bd|-\b-e\be _\be_\bn_\bd]
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       The f\bfe\bet\btc\bch\bh function is normally used internally by the graph function to
+       get data from R\bRR\bRD\bDs. f\bfe\bet\btc\bch\bh will analyze the R\bRR\bRD\bD and try to retrieve the
+       data in the resolution requested.  The data fetched is printed to std-
+       out. _\b*_\bU_\bN_\bK_\bN_\bO_\bW_\bN_\b* data is often represented by the string "NaN" depending
+       on your OS's printf function.
+
+       _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
+               the name of the R\bRR\bRD\bD you want to fetch the data from.
+
+       _\bC_\bF      the consolidation function that is applied to the data you want
+               to fetch (AVERAGE,MIN,MAX,LAST)
+
+       -\b--\b-r\bre\bes\bso\bol\blu\but\bti\bio\bon\bn|-\b-r\br _\br_\be_\bs_\bo_\bl_\bu_\bt_\bi_\bo_\bn (default is the highest resolution)
+               the interval you want the values to have (seconds per value).
+               r\brr\brd\bdf\bfe\bet\btc\bch\bh will try to match your request, but it will return
+               data even if no absolute match is possible. N\bNB\bB.\b. See note below.
+
+       -\b--\b-s\bst\bta\bar\brt\bt|-\b-s\bs _\bs_\bt_\ba_\br_\bt (default end-1day)
+               start of the time series. A time in seconds since epoch
+               (1970-01-01) is required. Negative numbers are relative to the
+               current time. By default, one day worth of data will be
+               fetched. See also AT-STYLE TIME SPECIFICATION section for a
+               detailed explanation on  ways to specify the start time.
+
+       -\b--\b-e\ben\bnd\bd|-\b-e\be _\be_\bn_\bd (default now)
+               the end of the time series in seconds since epoch. See also AT-
+               STYLE TIME SPECIFICATION section for a detailed explanation of
+               how to specify the end time.
+
+       R\bRE\bES\bSO\bOL\bLU\bUT\bTI\bIO\bON\bN I\bIN\bNT\bTE\bER\bRV\bVA\bAL\bL
+
+       In order to get RRDtool to fetch anything other than the finest resolu-
+       tion RRA b\bbo\bot\bth\bh the start and end time must be specified on boundaries
+       that are multiples of the desired resolution. Consider the following
+       example:
+
+        rrdtool create subdata.rrd -s 10 DS:ds0:GAUGE:300:0:U \
+         RRA:AVERAGE:0.5:30:3600 \
+         RRA:AVERAGE:0.5:90:1200 \
+         RRA:AVERAGE:0.5:360:1200 \
+         RRA:MAX:0.5:360:1200 \
+         RRA:AVERAGE:0.5:8640:600 \
+         RRA:MAX:0.5:8640:600
+
+       This RRD collects data every 10 seconds and stores its averages over 5
+       minutes, 15 minutes, 1 hour, and 1 day, as well as the maxima for 1
+       hour and 1 day.
+
+       Consider now that you want to fetch the 15 minute average data for the
+       last hour.  You might try
+
+        rrdtool fetch subdata.rrd AVERAGE -r 900 -s -1h
+
+       However, this will almost always result in a time series that is N\bNO\bOT\bT in
+       the 15 minute RRA. Therefore, the highest resolution RRA, i.e. 5 minute
+       averages, will be chosen which in this case is not what you want.
+
+       Hence, make sure that
+
+       1. both start and end time are a multiple of 900
+
+       2. both start and end time are within the desired RRA
+
+       So, if time now is called "t", do
+
+        end time == int(t/900)*900,
+        start time == end time - 1hour,
+        resolution == 900.
+
+       Using the bash shell, this could look be:
+
+        TIME=$(date +%s)
+        RRDRES=900
+        rrdtool fetch subdata.rrd AVERAGE -r $RRDRES \
+           -e $(($TIME/$RRDRES*$RRDRES)) -s e-1h
+
+       Or in Perl:
+
+        perl -e '$ctime = time; $rrdres = 900; \
+                 system "rrdtool fetch subdata.rrd AVERAGE \
+                         -r $rrdres -e @{[int($ctime/$rrdres)*$rrdres]} -s e-1h"'
+
+       A\bAT\bT-\b-S\bST\bTY\bYL\bLE\bE T\bTI\bIM\bME\bE S\bSP\bPE\bEC\bCI\bIF\bFI\bIC\bCA\bAT\bTI\bIO\bON\bN
+
+       Apart from the traditional _\bS_\be_\bc_\bo_\bn_\bd_\bs _\bs_\bi_\bn_\bc_\be _\be_\bp_\bo_\bc_\bh, RRDtool does also
+       understand at-style time specification. The specification is called
+       "at-style" after the Unix command _\ba_\bt(1) that has moderately complex
+       ways to specify time to run your job at a certain date and time. The
+       at-style specification consists of two parts: the T\bTI\bIM\bME\bE R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bE speci-
+       fication and the T\bTI\bIM\bME\bE O\bOF\bFF\bFS\bSE\bET\bT specification.
+
+       T\bTI\bIM\bME\bE R\bRE\bEF\bFE\bER\bRE\bEN\bNC\bCE\bE S\bSP\bPE\bEC\bCI\bIF\bFI\bIC\bCA\bAT\bTI\bIO\bON\bN
+
+       The time reference specification is used, well, to establish a refer-
+       ence moment in time (to which the time offset is then applied to). When
+       present, it should come first, when omitted, it defaults to n\bno\bow\bw. On its
+       own part, time reference consists of a _\bt_\bi_\bm_\be_\b-_\bo_\bf_\b-_\bd_\ba_\by reference (which
+       should come first, if present) and a _\bd_\ba_\by reference.
+
+       The _\bt_\bi_\bm_\be_\b-_\bo_\bf_\b-_\bd_\ba_\by can be specified as H\bHH\bH:\b:M\bMM\bM, H\bHH\bH.\b.M\bMM\bM, or just H\bHH\bH. You can
+       suffix it with a\bam\bm or p\bpm\bm or use 24-hours clock. Some special times of
+       day are understood as well, including m\bmi\bid\bdn\bni\big\bgh\bht\bt (00:00), n\bno\boo\bon\bn (12:00)
+       and British t\bte\bea\bat\bti\bim\bme\be (16:00).
+
+       The _\bd_\ba_\by can be specified as _\bm_\bo_\bn_\bt_\bh_\b-_\bn_\ba_\bm_\be _\bd_\ba_\by_\b-_\bo_\bf_\b-_\bt_\bh_\be_\b-_\bm_\bo_\bn_\bt_\bh and optional a
+       2- or 4-digit _\by_\be_\ba_\br number (e.g. March 8 1999). Alternatively, you can
+       use _\bd_\ba_\by_\b-_\bo_\bf_\b-_\bw_\be_\be_\bk_\b-_\bn_\ba_\bm_\be (e.g. Monday), or one of the words: y\bye\bes\bst\bte\ber\brd\bda\bay\by,
+       t\bto\bod\bda\bay\by, t\bto\bom\bmo\bor\brr\bro\bow\bw. You can also specify the _\bd_\ba_\by as a full date in several
+       numerical formats, including M\bMM\bM/\b/D\bDD\bD/\b/[\b[Y\bYY\bY]\b]Y\bYY\bY, D\bDD\bD.\b.M\bMM\bM.\b.[\b[Y\bYY\bY]\b]Y\bYY\bY, or Y\bYY\bYY\bYY\bYM\bMM\bMD\bDD\bD.
+
+       _\bN_\bO_\bT_\bE_\b1: this is different from the original _\ba_\bt(1) behavior, where a sin-
+       gle-number date is interpreted as MMDD[YY]YY.
+
+       _\bN_\bO_\bT_\bE_\b2: if you specify the _\bd_\ba_\by in this way, the _\bt_\bi_\bm_\be_\b-_\bo_\bf_\b-_\bd_\ba_\by is REQUIRED
+       as well.
+
+       Finally, you can use the words n\bno\bow\bw, s\bst\bta\bar\brt\bt, or e\ben\bnd\bd as your time refer-
+       ence. N\bNo\bow\bw refers to the current moment (and is also the default time
+       reference). S\bSt\bta\bar\brt\bt (e\ben\bnd\bd) can be used to specify a time relative to the
+       start (end) time for those tools that use these categories (r\brr\brd\bdf\bfe\bet\btc\bch\bh,
+       rrdgraph).
+
+       Month and day of the week names can be used in their naturally abbrevi-
+       ated form (e.g., Dec for December, Sun for Sunday, etc.). The words
+       n\bno\bow\bw, s\bst\bta\bar\brt\bt, e\ben\bnd\bd can be abbreviated as n\bn, s\bs, e\be.
+
+       T\bTI\bIM\bME\bE O\bOF\bFF\bFS\bSE\bET\bT S\bSP\bPE\bEC\bCI\bIF\bFI\bIC\bCA\bAT\bTI\bIO\bON\bN
+
+       The time offset specification is used to add/subtract certain time
+       intervals to/from the time reference moment. It consists of a _\bs_\bi_\bg_\bn
+       (+\b+ or -\b-) and an _\ba_\bm_\bo_\bu_\bn_\bt. The following time units can be used to specify
+       the _\ba_\bm_\bo_\bu_\bn_\bt: y\bye\bea\bar\brs\bs, m\bmo\bon\bnt\bth\bhs\bs, w\bwe\bee\bek\bks\bs, d\bda\bay\bys\bs, h\bho\bou\bur\brs\bs, m\bmi\bin\bnu\but\bte\bes\bs, or s\bse\bec\bco\bon\bnd\bds\bs.
+       These units can be used in singular or plural form, and abbreviated
+       naturally or to a single letter (e.g. +3days, -1wk, -3y). Several time
+       units can be combined (e.g., -5mon1w2d) or concatenated (e.g., -5h45min
+       = -5h-45min = -6h+15min = -7h+1h30m-15min, etc.)
+
+       _\bN_\bO_\bT_\bE_\b3: If you specify time offset in days, weeks, months, or years, you
+       will end with the time offset that may vary depending on your time ref-
+       erence, because all those time units have no single well defined time
+       interval value (1 year contains either 365 or 366 days, 1 month is 28
+       to 31 days long, and even 1 day may be not equal to 24 hours twice a
+       year, when DST-related clock adjustments take place).  To cope with
+       this, when you use days, weeks, months, or years as your time offset
+       units your time reference date is adjusted accordingly without too much
+       further effort to ensure anything about it (in the hope that _\bm_\bk_\bt_\bi_\bm_\be(3)
+       will take care of this later).  This may lead to some surprising (or
+       even invalid!) results, e.g. 'May 31 -1month' = 'Apr 31' (meaningless)
+       = 'May 1' (after _\bm_\bk_\bt_\bi_\bm_\be(3) normalization); in the EET timezone '3:30am
+       Mar 29 1999 -1 day' yields '3:30am Mar 28 1999' (Sunday) which is an
+       invalid time/date combination (because of 3am -> 4am DST forward clock
+       adjustment, see the below example).
+
+       In contrast, hours, minutes, and seconds are well defined time inter-
+       vals, and these are guaranteed to always produce time offsets exactly
+       as specified (e.g. for EET timezone, '8:00 Mar 27 1999 +2 days' =
+       '8:00 Mar 29 1999', but since there is 1-hour DST forward clock adjust-
+       ment that occurs around 3:00 Mar 28 1999, the actual time interval
+       between 8:00 Mar 27 1999 and 8:00 Mar 29 1999 equals 47 hours; on the
+       other hand, '8:00 Mar 27 1999 +48 hours' = '9:00 Mar 29 1999', as
+       expected)
+
+       _\bN_\bO_\bT_\bE_\b4: The single-letter abbreviation for both m\bmo\bon\bnt\bth\bhs\bs and m\bmi\bin\bnu\but\bte\bes\bs is m\bm.
+       To disambiguate them, the parser tries to read your mind :) by applying
+       the following two heuristics:
+
+       1  If m\bm is used in context of (i.e. right after the) years, months,
+          weeks, or days it is assumed to mean m\bmo\bon\bnt\bth\bhs\bs, while in the context of
+          hours, minutes, and seconds it means minutes.  (e.g., in -1y6m or
+          +3w1m m\bm is interpreted as m\bmo\bon\bnt\bth\bhs\bs, while in -3h20m or +5s2m m\bm the
+          parser decides for m\bmi\bin\bnu\but\bte\bes\bs).
+
+       2  Out of context (i.e. right after the +\b+ or -\b- sign) the meaning of m\bm
+          is guessed from the number it directly follows.  Currently, if the
+          number's absolute value is below 25 it is assumed that m\bm means
+          m\bmo\bon\bnt\bth\bhs\bs, otherwise it is treated as m\bmi\bin\bnu\but\bte\bes\bs.  (e.g., -25m == -25 min-
+          utes, while +24m == +24 months)
+
+       _\bF_\bi_\bn_\ba_\bl _\bN_\bO_\bT_\bE_\bS: Time specification is case-insensitive.  Whitespace can be
+       inserted freely or omitted altogether.  There are, however, cases when
+       whitespace is required (e.g., 'midnight Thu'). In this case you should
+       either quote the whole phrase to prevent it from being taken apart by
+       your shell or use '_' (underscore) or ',' (comma) which also count as
+       whitespace (e.g., midnight_Thu or midnight,Thu).
+
+       T\bTI\bIM\bME\bE S\bSP\bPE\bEC\bCI\bIF\bFI\bIC\bCA\bAT\bTI\bIO\bON\bN E\bEX\bXA\bAM\bMP\bPL\bLE\bES\bS
+
+       _\bO_\bc_\bt _\b1_\b2 -- October 12 this year
+
+       _\b-_\b1_\bm_\bo_\bn_\bt_\bh or _\b-_\b1_\bm -- current time of day, only a month before (may yield
+       surprises, see NOTE3 above).
+
+       _\bn_\bo_\bo_\bn _\by_\be_\bs_\bt_\be_\br_\bd_\ba_\by _\b-_\b3_\bh_\bo_\bu_\br_\bs -- yesterday morning; can also be specified as
+       _\b9_\ba_\bm_\b-_\b1_\bd_\ba_\by.
+
+       _\b2_\b3_\b:_\b5_\b9 _\b3_\b1_\b._\b1_\b2_\b._\b1_\b9_\b9_\b9 -- 1 minute to the year 2000.
+
+       _\b1_\b2_\b/_\b3_\b1_\b/_\b9_\b9 _\b1_\b1_\b:_\b5_\b9_\bp_\bm -- 1 minute to the year 2000 for imperialists.
+
+       _\b1_\b2_\ba_\bm _\b0_\b1_\b/_\b0_\b1_\b/_\b0_\b1 -- start of the new millennium
+
+       _\be_\bn_\bd_\b-_\b3_\bw_\be_\be_\bk_\bs or _\be_\b-_\b3_\bw -- 3 weeks before end time (may be used as start
+       time specification).
+
+       _\bs_\bt_\ba_\br_\bt_\b+_\b6_\bh_\bo_\bu_\br_\bs or _\bs_\b+_\b6_\bh -- 6 hours after start time (may be used as end
+       time specification).
+
+       _\b9_\b3_\b1_\b2_\b2_\b5_\b5_\b3_\b7 -- 18:45  July 5th, 1999 (yes, seconds since 1970 are valid
+       as well).
+
+       _\b1_\b9_\b9_\b7_\b0_\b7_\b0_\b3 _\b1_\b2_\b:_\b4_\b5 -- 12:45  July 3th, 1997 (my favorite, and its even got
+       an ISO number (8601)).
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Tobias Oetiker <tobi@oetiker.ch>
+
+
+
+1.2.26                            2007-11-20                       RRDFETCH(1)
diff --git a/doc/rrdfirst.1 b/doc/rrdfirst.1
new file mode 100644 (file)
index 0000000..7834052
--- /dev/null
@@ -0,0 +1,152 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDFIRST 1"
+.TH RRDFIRST 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdfirst \- Return the date of the first data sample in an RRA within an RRD
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBrrdtool\fR \fBfirst\fR \fIfilename\fR [\fI\-\-rraindex number\fR]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fBfirst\fR function returns the \s-1UNIX\s0 timestamp of the first data
+sample entered into the specified \s-1RRA\s0 of the \s-1RRD\s0 file.
+.IP "\fIfilename\fR" 8
+.IX Item "filename"
+The name of the \fB\s-1RRD\s0\fR that contains the data.
+.IP "\fI\-\-rraindex number\fR" 8
+.IX Item "--rraindex number"
+The index number of the \fB\s-1RRA\s0\fR that is to be examined. If not specified, the
+index defaults to zero. \fB\s-1RRA\s0\fR index numbers can be determined through
+\&\fBrrdtool info\fR.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Burton Strauss <Burton@ntopSupport.com>
diff --git a/doc/rrdfirst.html b/doc/rrdfirst.html
new file mode 100644 (file)
index 0000000..819171a
--- /dev/null
@@ -0,0 +1,65 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdfirst</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdfirst - Return the date of the first data sample in an RRA within an RRD</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p><strong>rrdtool</strong> <strong>first</strong> <em>filename</em> [<em>--rraindex number</em>]</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>The <strong>first</strong> function returns the UNIX timestamp of the first data
+sample entered into the specified RRA of the RRD file.</p>
+<dl>
+<dt><strong><a name="item_filename"><em>filename</em></a></strong>
+
+<dd>
+<p>The name of the <strong>RRD</strong> that contains the data.</p>
+</dd>
+</li>
+<dt><strong><a name="item__2d_2drraindex_number"><em>--rraindex number</em></a></strong>
+
+<dd>
+<p>The index number of the <strong>RRA</strong> that is to be examined. If not specified, the
+index defaults to zero. <strong>RRA</strong> index numbers can be determined through
+<strong>rrdtool info</strong>.</p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Burton Strauss &lt;<a href="mailto:Burton@ntopSupport.com">Burton@ntopSupport.com</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdfirst.pod b/doc/rrdfirst.pod
new file mode 100644 (file)
index 0000000..9a3c690
--- /dev/null
@@ -0,0 +1,32 @@
+=head1 NAME
+
+rrdfirst - Return the date of the first data sample in an RRA within an RRD
+
+=head1 SYNOPSIS
+
+B<rrdtool> B<first> I<filename> [I<--rraindex number>]
+
+=head1 DESCRIPTION
+
+The B<first> function returns the UNIX timestamp of the first data
+sample entered into the specified RRA of the RRD file.
+
+=over 8
+
+=item I<filename>
+
+The name of the B<RRD> that contains the data.
+
+=item I<--rraindex number>
+
+The index number of the B<RRA> that is to be examined. If not specified, the
+index defaults to zero. B<RRA> index numbers can be determined through
+B<rrdtool info>.
+
+=back
+
+=head1 AUTHOR
+
+Burton Strauss <Burton@ntopSupport.com>
+
+
diff --git a/doc/rrdfirst.txt b/doc/rrdfirst.txt
new file mode 100644 (file)
index 0000000..7a3559e
--- /dev/null
@@ -0,0 +1,29 @@
+RRDFIRST(1)                         rrdtool                        RRDFIRST(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdfirst - Return the date of the first data sample in an RRA within an
+       RRD
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       r\brr\brd\bdt\bto\boo\bol\bl f\bfi\bir\brs\bst\bt _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be [_\b-_\b-_\br_\br_\ba_\bi_\bn_\bd_\be_\bx _\bn_\bu_\bm_\bb_\be_\br]
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       The f\bfi\bir\brs\bst\bt function returns the UNIX timestamp of the first data sample
+       entered into the specified RRA of the RRD file.
+
+       _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
+               The name of the R\bRR\bRD\bD that contains the data.
+
+       _\b-_\b-_\br_\br_\ba_\bi_\bn_\bd_\be_\bx _\bn_\bu_\bm_\bb_\be_\br
+               The index number of the R\bRR\bRA\bA that is to be examined. If not
+               specified, the index defaults to zero. R\bRR\bRA\bA index numbers can be
+               determined through r\brr\brd\bdt\bto\boo\bol\bl i\bin\bnf\bfo\bo.
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Burton Strauss <Burton@ntopSupport.com>
+
+
+
+1.2.26                            2007-11-20                       RRDFIRST(1)
diff --git a/doc/rrdgraph.1 b/doc/rrdgraph.1
new file mode 100644 (file)
index 0000000..2020b9e
--- /dev/null
@@ -0,0 +1,516 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDGRAPH 1"
+.TH RRDGRAPH 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdgraph \- Round Robin Database tool grapher functions
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBrrdtool graph\fR \fIfilename\fR
+[\fIoption\fR ...]
+[\fIdata definition\fR ...]
+[\fIdata calculation\fR ...]
+[\fIvariable definition\fR ...]
+[\fIgraph element\fR ...]
+[\fIprint element\fR ...]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fBgraph\fR function of \fBRRDtool\fR is used to present the
+data from an \fB\s-1RRD\s0\fR to a human viewer.  Its main purpose is to
+create a nice graphical representation, but it can also generate
+a numerical report.
+.SH "OVERVIEW"
+.IX Header "OVERVIEW"
+\&\fBrrdtool graph\fR needs data to work with, so you must use one or more
+\&\fBdata definition\fR statements to collect this
+data.  You are not limited to one database, it's perfectly legal to
+collect data from two or more databases (one per statement, though).
+.PP
+If you want to display averages, maxima, percentiles, etcetera
+it is best to collect them now using the
+\&\fBvariable definition\fR statement.
+Currently this makes no difference, but in a future version
+of rrdtool you may want to collect these values before consolidation.
+.PP
+The data fetched from the \fB\s-1RRA\s0\fR is then \fBconsolidated\fR so that
+there is exactly one datapoint per pixel in the graph. If you do
+not take care yourself, \fBRRDtool\fR will expand the range slightly
+if necessary. Note, in that case the first and/or last pixel may very
+well become unknown!
+.PP
+Sometimes data is not exactly in the format you would like to display
+it. For instance, you might be collecting \fBbytes\fR per second, but
+want to display \fBbits\fR per second. This is what the \fBdata calculation\fR command is designed for. After
+\&\fBconsolidating\fR the data, a copy is made and this copy is modified
+using a rather powerful \fB\s-1RPN\s0\fR command set.
+.PP
+When you are done fetching and processing the data, it is time to
+graph it (or print it).  This ends the \fBrrdtool graph\fR sequence.
+.SH "OPTIONS"
+.IX Header "OPTIONS"
+.IP "filename" 4
+.IX Item "filename"
+The name and path of the graph to generate. It is recommended to
+end this in \f(CW\*(C`.png\*(C'\fR, \f(CW\*(C`.svg\*(C'\fR or \f(CW\*(C`.eps\*(C'\fR, but \fBRRDtool\fR does not enforce this.
+.Sp
+\&\fIfilename\fR can be '\f(CW\*(C`\-\*(C'\fR' to send the image to \f(CW\*(C`stdout\*(C'\fR. In
+this case, no other output is generated.
+.IP "Time range" 4
+.IX Item "Time range"
+[\fB\-s\fR|\fB\-\-start\fR \fItime\fR]
+[\fB\-e\fR|\fB\-\-end\fR \fItime\fR]
+[\fB\-S\fR|\fB\-\-step\fR \fIseconds\fR]
+.Sp
+The start and end of the time series you would like to display, and which
+\&\fB\s-1RRA\s0\fR the data should come from.  Defaults are: 1 day ago until
+now, with the best possible resolution. \fBStart\fR and \fBend\fR can
+be specified in several formats, see
+AT-STYLE \s-1TIME\s0 \s-1SPECIFICATION\s0 and rrdgraph_examples.
+By default, \fBrrdtool graph\fR calculates the width of one pixel in
+the time domain and tries to get data from an \fB\s-1RRA\s0\fR with that
+resolution.  With the \fBstep\fR option you can alter this behaviour.
+If you want \fBrrdtool graph\fR to get data at a one-hour resolution
+from the \fB\s-1RRD\s0\fR, set \fBstep\fR to 3'600. Note: a step smaller than
+one pixel will silently be ignored.
+.IP "Labels" 4
+.IX Item "Labels"
+[\fB\-t\fR|\fB\-\-title\fR \fIstring\fR]
+[\fB\-v\fR|\fB\-\-vertical\-label\fR \fIstring\fR]
+.Sp
+A horizontal string at the top of the graph and/or a vertically
+placed string at the left hand side of the graph.
+.IP "Size" 4
+.IX Item "Size"
+[\fB\-w\fR|\fB\-\-width\fR \fIpixels\fR]
+[\fB\-h\fR|\fB\-\-height\fR \fIpixels\fR]
+[\fB\-j\fR|\fB\-\-only\-graph\fR]
+.Sp
+The width and height of the \fBcanvas\fR (the part of the graph with
+the actual data and such). This defaults to 400 pixels by 100 pixels.
+.Sp
+If you specify the \fB\-\-only\-graph\fR option and set the height < 32
+pixels you will get a tiny graph image (thumbnail) to use as an icon
+for use in an overview, for example. All labeling will be stripped off
+the graph.
+.IP "Limits" 4
+.IX Item "Limits"
+[\fB\-u\fR|\fB\-\-upper\-limit\fR \fIvalue\fR]
+[\fB\-l\fR|\fB\-\-lower\-limit\fR \fIvalue\fR]
+[\fB\-r\fR|\fB\-\-rigid\fR]
+.Sp
+By default the graph will be autoscaling so that it will adjust the
+y\-axis to the range of the data. You can change this behaviour by
+explicitly setting the limits. The displayed y\-axis will then range at
+least from \fBlower-limit\fR to \fBupper-limit\fR. Autoscaling will still
+permit those boundaries to be stretched unless the \fBrigid\fR option is
+set.
+.Sp
+[\fB\-A\fR|\fB\-\-alt\-autoscale\fR]
+.Sp
+Sometimes the default algorithm for selecting the y\-axis scale is not
+satisfactory. Normally the scale is selected from a predefined
+set of ranges and this fails miserably when you need to graph something
+like \f(CW\*(C`260 + 0.001 * sin(x)\*(C'\fR. This option calculates the minimum and
+maximum y\-axis from the actual minimum and maximum data values. Our example
+would display slightly less than \f(CW\*(C`260\-0.001\*(C'\fR to slightly more than
+\&\f(CW\*(C`260+0.001\*(C'\fR (this feature was contributed by Sasha Mikheev).
+.Sp
+[\fB\-J\fR|\fB\-\-alt\-autoscale\-min\fR]
+.Sp
+Where \f(CW\*(C`\-\-alt\-autoscale\*(C'\fR will modify both the absolute maximum \s-1AND\s0 minimum
+values, this option will only affect the minimum value. The maximum
+value, if not defined on the command line, will be 0. This option can
+be useful when graphing router traffic when the \s-1WAN\s0 line uses compression,
+and thus the throughput may be higher than the \s-1WAN\s0 line speed.
+.Sp
+[\fB\-M\fR|\fB\-\-alt\-autoscale\-max\fR]
+.Sp
+Where \f(CW\*(C`\-\-alt\-autoscale\*(C'\fR will modify both the absolute maximum \s-1AND\s0 minimum
+values, this option will only affect the maximum value. The minimum
+value, if not defined on the command line, will be 0. This option can
+be useful when graphing router traffic when the \s-1WAN\s0 line uses compression,
+and thus the throughput may be higher than the \s-1WAN\s0 line speed.
+.Sp
+[\fB\-N\fR|\fB\-\-no\-gridfit\fR]
+.Sp
+In order to avoid anti-aliasing effects gridlines are placed on
+integer pixel values. This is by default done by extending
+the scale so that gridlines happens to be spaced using an
+integer number of pixels and also start on an integer pixel value.
+This might extend the scale too much for some logarithmic scales
+and for linear scales where \fB\-\-alt\-autoscale\fR is needed.
+Using \fB\-\-no\-gridfit\fR disables modification of the scale.
+.IP "Grid" 4
+.IX Item "Grid"
+.RS 4
+.PD 0
+.IP "X\-Axis" 4
+.IX Item "X-Axis"
+.PD
+[\fB\-x\fR|\fB\-\-x\-grid\fR \fI\s-1GTM\s0\fR\fB:\fR\fI\s-1GST\s0\fR\fB:\fR\fI\s-1MTM\s0\fR\fB:\fR\fI\s-1MST\s0\fR\fB:\fR\fI\s-1LTM\s0\fR\fB:\fR\fI\s-1LST\s0\fR\fB:\fR\fI\s-1LPR\s0\fR\fB:\fR\fI\s-1LFM\s0\fR]
+.Sp
+[\fB\-x\fR|\fB\-\-x\-grid\fR \fBnone\fR]
+.Sp
+The x\-axis label is quite complex to configure. If you don't have
+very special needs it is probably best to rely on the autoconfiguration
+to get this right. You can specify the string \f(CW\*(C`none\*(C'\fR to suppress the grid
+and labels altogether.
+.Sp
+The grid is defined by specifying a certain amount of time in the \fI?TM\fR
+positions. You can choose from \f(CW\*(C`SECOND\*(C'\fR, \f(CW\*(C`MINUTE\*(C'\fR, \f(CW\*(C`HOUR\*(C'\fR, \f(CW\*(C`DAY\*(C'\fR,
+\&\f(CW\*(C`WEEK\*(C'\fR, \f(CW\*(C`MONTH\*(C'\fR or \f(CW\*(C`YEAR\*(C'\fR. Then you define how many of these should
+pass between each line or label.  This pair (\fI?TM:?ST\fR) needs to be
+specified for the base grid (\fIG??\fR), the major grid (\fIM??\fR) and the
+labels (\fIL??\fR). For the labels you also must define a precision
+in \fI\s-1LPR\s0\fR and a \fIstrftime\fR format string in \fI\s-1LFM\s0\fR.  \fI\s-1LPR\s0\fR defines
+where each label will be placed. If it is zero, the label will be
+placed right under the corresponding line (useful for hours, dates
+etcetera).  If you specify a number of seconds here the label is
+centered on this interval (useful for Monday, January etcetera).
+.Sp
+.Vb 1
+\& \-\-x\-grid MINUTE:10:HOUR:1:HOUR:4:0:%X
+.Ve
+.Sp
+This places grid lines every 10 minutes, major grid lines every hour,
+and labels every 4 hours. The labels are placed under the major grid
+lines as they specify exactly that time.
+.Sp
+.Vb 1
+\& \-\-x\-grid HOUR:8:DAY:1:DAY:1:0:%A
+.Ve
+.Sp
+This places grid lines every 8 hours, major grid lines and labels
+each day. The labels are placed exactly between two major grid lines
+as they specify the complete day and not just midnight.
+.IP "Y\-Axis" 4
+.IX Item "Y-Axis"
+[\fB\-y\fR|\fB\-\-y\-grid\fR \fIgrid step\fR\fB:\fR\fIlabel factor\fR]
+.Sp
+[\fB\-y\fR|\fB\-\-y\-grid\fR \fBnone\fR]
+.Sp
+Y\-axis grid lines appear at each \fIgrid step\fR interval.  Labels are
+placed every \fIlabel factor\fR lines.  You can specify \f(CW\*(C`\-y none\*(C'\fR to
+suppress the grid and labels altogether.  The default for this option is
+to automatically select sensible values.
+.Sp
+If you have set \-\-y\-grid to 'none' not only the labels get supressed, also
+the space reserved for the labels is removed. You can still add space
+manually if you use the \-\-units\-length command to explicitly reserve space.
+.Sp
+[\fB\-Y\fR|\fB\-\-alt\-y\-grid\fR]
+.Sp
+Place the Y grid dynamically based on the graph's Y range. The algorithm
+ensures that you always have a grid, that there are enough but not too many
+grid lines, and that the grid is metric. That is the grid lines are placed
+every 1, 2, 5 or 10 units. This parameter will also ensure that you get
+enough decimals displayed even if your graph goes from 69.998 to 70.001. 
+(contributed by Sasha Mikheev).
+.Sp
+[\fB\-o\fR|\fB\-\-logarithmic\fR]
+.Sp
+Logarithmic y\-axis scaling.
+.Sp
+[\fB\-X\fR|\fB\-\-units\-exponent\fR \fIvalue\fR]
+.Sp
+This sets the 10**exponent scaling of the y\-axis values. Normally,
+values will be scaled to the appropriate units (k, M, etc.).  However,
+you may wish to display units always in k (Kilo, 10e3) even if the data
+is in the M (Mega, 10e6) range, for instance. Value should be an
+integer which is a multiple of 3 between \-18 and 18 inclusively.  It is
+the exponent on the units you wish to use. For example, use 3 to
+display the y\-axis values in k (Kilo, 10e3, thousands), use \-6 to
+display the y\-axis values in u (Micro, 10e\-6, millionths).  Use a value
+of 0 to prevent any scaling of the y\-axis values.
+.Sp
+This option is very effective at confusing the heck out of the default
+rrdtool autoscaler and grid painter. If rrdtool detects that it is not
+successful in labeling the graph under the given circumstances, it will switch
+to the more robust \fB\-\-alt\-y\-grid\fR mode.
+.Sp
+[\fB\-L\fR|\fB\-\-units\-length\fR \fIvalue\fR]
+.Sp
+How many digits should rrdtool assume the y\-axis labels to be? You
+may have to use this option to make enough space once you start
+fideling with the y\-axis labeling.
+.Sp
+[\fB\-\-units=si\fR]
+.Sp
+With this option y\-axis values on logarithmic graphs will be scaled to 
+the appropriate units (k, M, etc.) instead of using exponential notation.
+Note that for linear graphs, \s-1SI\s0 notation is used by default.
+.RE
+.RS 4
+.RE
+.IP "Miscellaneous" 4
+.IX Item "Miscellaneous"
+[\fB\-z\fR|\fB\-\-lazy\fR]
+.Sp
+Only generate the graph if the current graph is out of date or not
+existent.
+.Sp
+[\fB\-f\fR|\fB\-\-imginfo\fR \fIprintfstr\fR]
+.Sp
+After the image has been created, the graph function uses printf
+together with this format string to create output similar to the \s-1PRINT\s0
+function, only that the printf function is supplied with the parameters
+\&\fIfilename\fR, \fIxsize\fR and \fIysize\fR. In order to generate an \fB\s-1IMG\s0\fR tag
+suitable for including the graph into a web page, the command line
+would look like this:
+.Sp
+.Vb 1
+\& \-\-imginfo '<IMG SRC="/img/%s" WIDTH="%lu" HEIGHT="%lu" ALT="Demo">'
+.Ve
+.Sp
+[\fB\-c\fR|\fB\-\-color\fR \fI\s-1COLORTAG\s0\fR#\fIrrggbb\fR[\fIaa\fR]]
+.Sp
+Override the default colors for the standard elements of the graph. The
+\&\fI\s-1COLORTAG\s0\fR is one of \f(CW\*(C`BACK\*(C'\fR background, \f(CW\*(C`CANVAS\*(C'\fR for the background of
+the actual graph, \f(CW\*(C`SHADEA\*(C'\fR for the left and top border, \f(CW\*(C`SHADEB\*(C'\fR for the
+right and bottom border, \f(CW\*(C`GRID\*(C'\fR, \f(CW\*(C`MGRID\*(C'\fR for the major grid, \f(CW\*(C`FONT\*(C'\fR for
+the color of the font, \f(CW\*(C`AXIS\*(C'\fR for the axis of the graph, \f(CW\*(C`FRAME\*(C'\fR for the
+line around the color spots and finally \f(CW\*(C`ARROW\*(C'\fR for the arrow head pointing
+up and forward. Each color is composed out of three hexadecimal numbers
+specifying its rgb color component (00 is off, \s-1FF\s0 is maximum) of red, green
+and blue. Optionally you may add another hexadecimal number specifying the
+transparency (\s-1FF\s0 is solid). You may set this option several times to alter
+multiple defaults.
+.Sp
+A green arrow is made by: \f(CW\*(C`\-\-color ARROW#00FF00\*(C'\fR
+.Sp
+[\fB\-\-zoom\fR \fIfactor\fR]
+.Sp
+Zoom the graphics by the given amount. The factor must be > 0
+.Sp
+[\fB\-n\fR|\fB\-\-font\fR \fI\s-1FONTTAG\s0\fR\fB:\fR\fIsize\fR\fB:\fR[\fIfont\fR]]
+.Sp
+This lets you customize which font to use for the various text
+elements on the \s-1RRD\s0 graphs. \f(CW\*(C`DEFAULT\*(C'\fR sets the default value for all
+elements, \f(CW\*(C`TITLE\*(C'\fR for the title, \f(CW\*(C`AXIS\*(C'\fR for the axis labels, \f(CW\*(C`UNIT\*(C'\fR
+for the vertical unit label, \f(CW\*(C`LEGEND\*(C'\fR for the graph legend.
+.Sp
+Use Times for the title: \f(CW\*(C`\-\-font TITLE:13:/usr/lib/fonts/times.ttf\*(C'\fR
+.Sp
+If you do not give a font string you can modify just the sice of the default font:
+\&\f(CW\*(C`\-\-font TITLE:13:\*(C'\fR.
+.Sp
+If you specify the size 0 then you can modify just the font without touching
+the size. This is especially usefull for altering the default font without
+resetting the default fontsizes: \f(CW\*(C`\-\-font DEFAULT:0:/usr/lib/fonts/times.ttf\*(C'\fR.
+.Sp
+RRDtool comes with a preset default font. You can set the environment
+variable \f(CW\*(C`RRD_DEFAULT_FONT\*(C'\fR if you want to change this.
+.Sp
+Truetype fonts are only supported for \s-1PNG\s0 output. See below.
+.Sp
+[\fB\-R\fR|\fB\-\-font\-render\-mode\fR {\fInormal\fR,\fIlight\fR,\fImono\fR}]
+.Sp
+This lets you customize the strength of the font smoothing,
+or disable it entirely using \fImono\fR. By default, \fInormal\fR
+font smoothing is used.
+.Sp
+[\fB\-B\fR|\fB\-\-font\-smoothing\-threshold\fR \fIsize\fR]
+.Sp
+This specifies the largest font size which will be rendered
+bitmapped, that is, without any font smoothing. By default,
+no text is rendered bitmapped.
+.Sp
+[\fB\-E\fR|\fB\-\-slope\-mode\fR]
+.Sp
+RRDtool graphs are composed of stair case curves by default. This is in line with
+the way RRDtool calculates its data. Some people favor a more 'organic' look
+for their graphs even though it is not all that true.
+.Sp
+[\fB\-a\fR|\fB\-\-imgformat\fR \fB\s-1PNG\s0\fR|\fB\s-1SVG\s0\fR|\fB\s-1EPS\s0\fR|\fB\s-1PDF\s0\fR]
+.Sp
+Image format for the generated graph. For the vector formats you can
+choose among the standard Postscript fonts Courier\-Bold,
+Courier\-BoldOblique, Courier\-Oblique, Courier, Helvetica\-Bold,
+Helvetica\-BoldOblique, Helvetica\-Oblique, Helvetica, Symbol,
+Times\-Bold, Times\-BoldItalic, Times\-Italic, Times\-Roman, and ZapfDingbats.
+.Sp
+[\fB\-i\fR|\fB\-\-interlaced\fR]
+.Sp
+If images are interlaced they become visible on browsers more quickly.
+.Sp
+[\fB\-g\fR|\fB\-\-no\-legend\fR]
+.Sp
+Suppress generation of the legend; only render the graph.
+.Sp
+[\fB\-F\fR|\fB\-\-force\-rules\-legend\fR]
+.Sp
+Force the generation of \s-1HRULE\s0 and \s-1VRULE\s0 legends even if those \s-1HRULE\s0 or
+\&\s-1VRULE\s0 will not be drawn because out of graph boundaries (mimics
+behaviour of pre 1.0.42 versions).
+.Sp
+[\fB\-T\fR|\fB\-\-tabwidth\fR \fIvalue\fR]
+.Sp
+By default the tab-width is 40 pixels, use this option to change it.
+.Sp
+[\fB\-b\fR|\fB\-\-base\fR \fIvalue\fR]
+.Sp
+If you are graphing memory (and \s-1NOT\s0 network traffic) this switch
+should be set to 1024 so that one Kb is 1024 byte. For traffic
+measurement, 1 kb/s is 1000 b/s.
+.Sp
+[\fB\-W\fR|\fB\-\-watermark\fR \fIstring\fR]
+.Sp
+Adds the given string as a watermark, horizontally centred, at the bottom 
+of the graph.
+.IP "Data and variables" 4
+.IX Item "Data and variables"
+\&\fB\s-1DEF:\s0\fR\fIvname\fR\fB=\fR\fIrrdfile\fR\fB:\fR\fIds-name\fR\fB:\fR\fI\s-1CF\s0\fR[\fB:step=\fR\fIstep\fR][\fB:start=\fR\fItime\fR][\fB:end=\fR\fItime\fR]
+.Sp
+\&\fB\s-1CDEF:\s0\fR\fIvname\fR\fB=\fR\fI\s-1RPN\s0 expression\fR
+.Sp
+\&\fB\s-1VDEF:\s0\fR\fIvname\fR\fB=\fR\fI\s-1RPN\s0 expression\fR
+.Sp
+You need at least one \fB\s-1DEF\s0\fR statement to generate anything. The
+other statements are useful but optional.
+See rrdgraph_data and rrdgraph_rpn for the exact format.
+.IP "Graph and print elements" 4
+.IX Item "Graph and print elements"
+You need at least one graph element to generate an image and/or
+at least one print statement to generate a report.
+See rrdgraph_graph for the exact format.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+rrdgraph gives an overview of how \fBrrdtool graph\fR works.
+rrdgraph_data describes \fB\s-1DEF\s0\fR,\fB\s-1CDEF\s0\fR and \fB\s-1VDEF\s0\fR in detail.
+rrdgraph_rpn describes the \fB\s-1RPN\s0\fR language used in the \fB?DEF\fR statements.
+rrdgraph_graph page describes all of the graph and print functions.
+.PP
+Make sure to read rrdgraph_examples for tips&tricks.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Program by Tobias Oetiker <tobi@oetiker.ch>
+.PP
+This manual page by Alex van den Bogaerdt <alex@ergens.op.het.net>
diff --git a/doc/rrdgraph.html b/doc/rrdgraph.html
new file mode 100644 (file)
index 0000000..dd767de
--- /dev/null
@@ -0,0 +1,523 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdgraph</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#overview">OVERVIEW</a></li>
+       <li><a href="#options">OPTIONS</a></li>
+       <li><a href="#see_also">SEE ALSO</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdgraph - Round Robin Database tool grapher functions</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p><strong>rrdtool graph</strong> <em>filename</em>
+[<em><a href="././rrdgraph.html#options">option</a></em> ...]
+[<em><a href="././rrdgraph_data.html#def">data definition</a></em> ...]
+[<em><a href="././rrdgraph_data.html#cdef">data calculation</a></em> ...]
+[<em><a href="././rrdgraph_data.html#vdef">variable definition</a></em> ...]
+[<em><a href="././rrdgraph_graph.html#graph">graph element</a></em> ...]
+[<em><a href="././rrdgraph_graph.html#print">print element</a></em> ...]</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>The <strong>graph</strong> function of <strong>RRDtool</strong> is used to present the
+data from an <strong>RRD</strong> to a human viewer.  Its main purpose is to
+create a nice graphical representation, but it can also generate
+a numerical report.</p>
+<p>
+</p>
+<hr />
+<h1><a name="overview">OVERVIEW</a></h1>
+<p><strong>rrdtool graph</strong> needs data to work with, so you must use one or more
+<strong><a href="././rrdgraph_data.html#def">data definition</a></strong> statements to collect this
+data.  You are not limited to one database, it's perfectly legal to
+collect data from two or more databases (one per statement, though).</p>
+<p>If you want to display averages, maxima, percentiles, etcetera
+it is best to collect them now using the
+<strong><a href="././rrdgraph_data.html#vdef">variable definition</a></strong> statement.
+Currently this makes no difference, but in a future version
+of rrdtool you may want to collect these values before consolidation.</p>
+<p>The data fetched from the <strong>RRA</strong> is then <strong>consolidated</strong> so that
+there is exactly one datapoint per pixel in the graph. If you do
+not take care yourself, <strong>RRDtool</strong> will expand the range slightly
+if necessary. Note, in that case the first and/or last pixel may very
+well become unknown!</p>
+<p>Sometimes data is not exactly in the format you would like to display
+it. For instance, you might be collecting <strong>bytes</strong> per second, but
+want to display <strong>bits</strong> per second. This is what the <strong><a href="././rrdgraph_data.html#cdef">data calculation</a></strong> command is designed for. After
+<strong>consolidating</strong> the data, a copy is made and this copy is modified
+using a rather powerful <strong><a href="././rrdgraph_rpn.html">RPN</a></strong> command set.</p>
+<p>When you are done fetching and processing the data, it is time to
+graph it (or print it).  This ends the <strong>rrdtool graph</strong> sequence.</p>
+<p>
+</p>
+<hr />
+<h1><a name="options">OPTIONS</a></h1>
+<dl>
+<dt><strong><a name="item_filename">filename</a></strong>
+
+<dd>
+<p>The name and path of the graph to generate. It is recommended to
+end this in <code>.png</code>, <code>.svg</code> or <code>.eps</code>, but <strong>RRDtool</strong> does not enforce this.</p>
+</dd>
+<dd>
+<p><em>filename</em> can be '<code>-</code>' to send the image to <code>stdout</code>. In
+this case, no other output is generated.</p>
+</dd>
+</li>
+<dt><strong><a name="item_time_range">Time range</a></strong>
+
+<dd>
+<p>[<strong>-s</strong>|<strong>--start</strong> <em>time</em>]
+[<strong>-e</strong>|<strong>--end</strong> <em>time</em>]
+[<strong>-S</strong>|<strong>--step</strong> <em>seconds</em>]</p>
+</dd>
+<dd>
+<p>The start and end of the time series you would like to display, and which
+<strong>RRA</strong> the data should come from.  Defaults are: 1 day ago until
+now, with the best possible resolution. <strong>Start</strong> and <strong>end</strong> can
+be specified in several formats, see
+<a href="././rrdfetch.html">AT-STYLE TIME SPECIFICATION</a> and <a href="././rrdgraph_examples.html">the rrdgraph_examples manpage</a>.
+By default, <strong>rrdtool graph</strong> calculates the width of one pixel in
+the time domain and tries to get data from an <strong>RRA</strong> with that
+resolution.  With the <strong>step</strong> option you can alter this behaviour.
+If you want <strong>rrdtool graph</strong> to get data at a one-hour resolution
+from the <strong>RRD</strong>, set <strong>step</strong> to 3'600. Note: a step smaller than
+one pixel will silently be ignored.</p>
+</dd>
+</li>
+<dt><strong><a name="item_labels">Labels</a></strong>
+
+<dd>
+<p>[<strong>-t</strong>|<strong>--title</strong> <em>string</em>]
+[<strong>-v</strong>|<strong>--vertical-label</strong> <em>string</em>]</p>
+</dd>
+<dd>
+<p>A horizontal string at the top of the graph and/or a vertically
+placed string at the left hand side of the graph.</p>
+</dd>
+</li>
+<dt><strong><a name="item_size">Size</a></strong>
+
+<dd>
+<p>[<strong>-w</strong>|<strong>--width</strong> <em>pixels</em>]
+[<strong>-h</strong>|<strong>--height</strong> <em>pixels</em>]
+[<strong>-j</strong>|<strong>--only-graph</strong>]</p>
+</dd>
+<dd>
+<p>The width and height of the <strong>canvas</strong> (the part of the graph with
+the actual data and such). This defaults to 400 pixels by 100 pixels.</p>
+</dd>
+<dd>
+<p>If you specify the <strong>--only-graph</strong> option and set the height &lt; 32
+pixels you will get a tiny graph image (thumbnail) to use as an icon
+for use in an overview, for example. All labeling will be stripped off
+the graph.</p>
+</dd>
+</li>
+<dt><strong><a name="item_limits">Limits</a></strong>
+
+<dd>
+<p>[<strong>-u</strong>|<strong>--upper-limit</strong> <em>value</em>]
+[<strong>-l</strong>|<strong>--lower-limit</strong> <em>value</em>]
+[<strong>-r</strong>|<strong>--rigid</strong>]</p>
+</dd>
+<dd>
+<p>By default the graph will be autoscaling so that it will adjust the
+y-axis to the range of the data. You can change this behaviour by
+explicitly setting the limits. The displayed y-axis will then range at
+least from <strong>lower-limit</strong> to <strong>upper-limit</strong>. Autoscaling will still
+permit those boundaries to be stretched unless the <strong>rigid</strong> option is
+set.</p>
+</dd>
+<dd>
+<p>[<strong>-A</strong>|<strong>--alt-autoscale</strong>]</p>
+</dd>
+<dd>
+<p>Sometimes the default algorithm for selecting the y-axis scale is not
+satisfactory. Normally the scale is selected from a predefined
+set of ranges and this fails miserably when you need to graph something
+like <code>260 + 0.001 * sin(x)</code>. This option calculates the minimum and
+maximum y-axis from the actual minimum and maximum data values. Our example
+would display slightly less than <code>260-0.001</code> to slightly more than
+<code>260+0.001</code> (this feature was contributed by Sasha Mikheev).</p>
+</dd>
+<dd>
+<p>[<strong>-J</strong>|<strong>--alt-autoscale-min</strong>]</p>
+</dd>
+<dd>
+<p>Where <code>--alt-autoscale</code> will modify both the absolute maximum AND minimum
+values, this option will only affect the minimum value. The maximum
+value, if not defined on the command line, will be 0. This option can
+be useful when graphing router traffic when the WAN line uses compression,
+and thus the throughput may be higher than the WAN line speed.</p>
+</dd>
+<dd>
+<p>[<strong>-M</strong>|<strong>--alt-autoscale-max</strong>]</p>
+</dd>
+<dd>
+<p>Where <code>--alt-autoscale</code> will modify both the absolute maximum AND minimum
+values, this option will only affect the maximum value. The minimum
+value, if not defined on the command line, will be 0. This option can
+be useful when graphing router traffic when the WAN line uses compression,
+and thus the throughput may be higher than the WAN line speed.</p>
+</dd>
+<dd>
+<p>[<strong>-N</strong>|<strong>--no-gridfit</strong>]</p>
+</dd>
+<dd>
+<p>In order to avoid anti-aliasing effects gridlines are placed on
+integer pixel values. This is by default done by extending
+the scale so that gridlines happens to be spaced using an
+integer number of pixels and also start on an integer pixel value.
+This might extend the scale too much for some logarithmic scales
+and for linear scales where <strong>--alt-autoscale</strong> is needed.
+Using <strong>--no-gridfit</strong> disables modification of the scale.</p>
+</dd>
+</li>
+<dt><strong><a name="item_grid">Grid</a></strong>
+
+<dl>
+<dt><strong><a name="item_x_2daxis">X-Axis</a></strong>
+
+<dd>
+<p>[<strong>-x</strong>|<strong>--x-grid</strong> <em>GTM</em><strong>:</strong><em>GST</em><strong>:</strong><em>MTM</em><strong>:</strong><em>MST</em><strong>:</strong><em>LTM</em><strong>:</strong><em>LST</em><strong>:</strong><em>LPR</em><strong>:</strong><em>LFM</em>]</p>
+</dd>
+<dd>
+<p>[<strong>-x</strong>|<strong>--x-grid</strong> <strong>none</strong>]</p>
+</dd>
+<dd>
+<p>The x-axis label is quite complex to configure. If you don't have
+very special needs it is probably best to rely on the autoconfiguration
+to get this right. You can specify the string <code>none</code> to suppress the grid
+and labels altogether.</p>
+</dd>
+<dd>
+<p>The grid is defined by specifying a certain amount of time in the <em>?TM</em>
+positions. You can choose from <code>SECOND</code>, <code>MINUTE</code>, <code>HOUR</code>, <code>DAY</code>,
+<code>WEEK</code>, <code>MONTH</code> or <code>YEAR</code>. Then you define how many of these should
+pass between each line or label.  This pair (<em>?TM:?ST</em>) needs to be
+specified for the base grid (<em>G??</em>), the major grid (<em>M??</em>) and the
+labels (<em>L??</em>). For the labels you also must define a precision
+in <em>LPR</em> and a <em>strftime</em> format string in <em>LFM</em>.  <em>LPR</em> defines
+where each label will be placed. If it is zero, the label will be
+placed right under the corresponding line (useful for hours, dates
+etcetera).  If you specify a number of seconds here the label is
+centered on this interval (useful for Monday, January etcetera).</p>
+</dd>
+<dd>
+<pre>
+ --x-grid MINUTE:10:HOUR:1:HOUR:4:0:%X</pre>
+</dd>
+<dd>
+<p>This places grid lines every 10 minutes, major grid lines every hour,
+and labels every 4 hours. The labels are placed under the major grid
+lines as they specify exactly that time.</p>
+</dd>
+<dd>
+<pre>
+ --x-grid HOUR:8:DAY:1:DAY:1:0:%A</pre>
+</dd>
+<dd>
+<p>This places grid lines every 8 hours, major grid lines and labels
+each day. The labels are placed exactly between two major grid lines
+as they specify the complete day and not just midnight.</p>
+</dd>
+</li>
+<dt><strong><a name="item_y_2daxis">Y-Axis</a></strong>
+
+<dd>
+<p>[<strong>-y</strong>|<strong>--y-grid</strong> <em>grid step</em><strong>:</strong><em>label factor</em>]</p>
+</dd>
+<dd>
+<p>[<strong>-y</strong>|<strong>--y-grid</strong> <strong>none</strong>]</p>
+</dd>
+<dd>
+<p>Y-axis grid lines appear at each <em>grid step</em> interval.  Labels are
+placed every <em>label factor</em> lines.  You can specify <code>-y none</code> to
+suppress the grid and labels altogether.  The default for this option is
+to automatically select sensible values.</p>
+</dd>
+<dd>
+<p>If you have set --y-grid to 'none' not only the labels get supressed, also
+the space reserved for the labels is removed. You can still add space
+manually if you use the --units-length command to explicitly reserve space.</p>
+</dd>
+<dd>
+<p>[<strong>-Y</strong>|<strong>--alt-y-grid</strong>]</p>
+</dd>
+<dd>
+<p>Place the Y grid dynamically based on the graph's Y range. The algorithm
+ensures that you always have a grid, that there are enough but not too many
+grid lines, and that the grid is metric. That is the grid lines are placed
+every 1, 2, 5 or 10 units. This parameter will also ensure that you get
+enough decimals displayed even if your graph goes from 69.998 to 70.001. 
+(contributed by Sasha Mikheev).</p>
+</dd>
+<dd>
+<p>[<strong>-o</strong>|<strong>--logarithmic</strong>]</p>
+</dd>
+<dd>
+<p>Logarithmic y-axis scaling.</p>
+</dd>
+<dd>
+<p>[<strong>-X</strong>|<strong>--units-exponent</strong> <em>value</em>]</p>
+</dd>
+<dd>
+<p>This sets the 10**exponent scaling of the y-axis values. Normally,
+values will be scaled to the appropriate units (k, M, etc.).  However,
+you may wish to display units always in k (Kilo, 10e3) even if the data
+is in the M (Mega, 10e6) range, for instance. Value should be an
+integer which is a multiple of 3 between -18 and 18 inclusively.  It is
+the exponent on the units you wish to use. For example, use 3 to
+display the y-axis values in k (Kilo, 10e3, thousands), use -6 to
+display the y-axis values in u (Micro, 10e-6, millionths).  Use a value
+of 0 to prevent any scaling of the y-axis values.</p>
+</dd>
+<dd>
+<p>This option is very effective at confusing the heck out of the default
+rrdtool autoscaler and grid painter. If rrdtool detects that it is not
+successful in labeling the graph under the given circumstances, it will switch
+to the more robust <strong>--alt-y-grid</strong> mode.</p>
+</dd>
+<dd>
+<p>[<strong>-L</strong>|<strong>--units-length</strong> <em>value</em>]</p>
+</dd>
+<dd>
+<p>How many digits should rrdtool assume the y-axis labels to be? You
+may have to use this option to make enough space once you start
+fideling with the y-axis labeling.</p>
+</dd>
+<dd>
+<p>[<strong>--units=si</strong>]</p>
+</dd>
+<dd>
+<p>With this option y-axis values on logarithmic graphs will be scaled to 
+the appropriate units (k, M, etc.) instead of using exponential notation.
+Note that for linear graphs, SI notation is used by default.</p>
+</dd>
+</li>
+</dl>
+<dt><strong><a name="item_miscellaneous">Miscellaneous</a></strong>
+
+<dd>
+<p>[<strong>-z</strong>|<strong>--lazy</strong>]</p>
+</dd>
+<dd>
+<p>Only generate the graph if the current graph is out of date or not
+existent.</p>
+</dd>
+<dd>
+<p>[<strong>-f</strong>|<strong>--imginfo</strong> <em>printfstr</em>]</p>
+</dd>
+<dd>
+<p>After the image has been created, the graph function uses printf
+together with this format string to create output similar to the PRINT
+function, only that the printf function is supplied with the parameters
+<em>filename</em>, <em>xsize</em> and <em>ysize</em>. In order to generate an <strong>IMG</strong> tag
+suitable for including the graph into a web page, the command line
+would look like this:</p>
+</dd>
+<dd>
+<pre>
+ --imginfo '&lt;IMG SRC=&quot;/img/%s&quot; WIDTH=&quot;%lu&quot; HEIGHT=&quot;%lu&quot; ALT=&quot;Demo&quot;&gt;'</pre>
+</dd>
+<dd>
+<p>[<strong>-c</strong>|<strong>--color</strong> <em>COLORTAG</em>#<em>rrggbb</em>[<em>aa</em>]]</p>
+</dd>
+<dd>
+<p>Override the default colors for the standard elements of the graph. The
+<em>COLORTAG</em> is one of <code>BACK</code> background, <code>CANVAS</code> for the background of
+the actual graph, <code>SHADEA</code> for the left and top border, <code>SHADEB</code> for the
+right and bottom border, <code>GRID</code>, <code>MGRID</code> for the major grid, <code>FONT</code> for
+the color of the font, <code>AXIS</code> for the axis of the graph, <code>FRAME</code> for the
+line around the color spots and finally <code>ARROW</code> for the arrow head pointing
+up and forward. Each color is composed out of three hexadecimal numbers
+specifying its rgb color component (00 is off, FF is maximum) of red, green
+and blue. Optionally you may add another hexadecimal number specifying the
+transparency (FF is solid). You may set this option several times to alter
+multiple defaults.</p>
+</dd>
+<dd>
+<p>A green arrow is made by: <code>--color ARROW#00FF00</code></p>
+</dd>
+<dd>
+<p>[<strong>--zoom</strong> <em>factor</em>]</p>
+</dd>
+<dd>
+<p>Zoom the graphics by the given amount. The factor must be &gt; 0</p>
+</dd>
+<dd>
+<p>[<strong>-n</strong>|<strong>--font</strong> <em>FONTTAG</em><strong>:</strong><em>size</em><strong>:</strong>[<em>font</em>]]</p>
+</dd>
+<dd>
+<p>This lets you customize which font to use for the various text
+elements on the RRD graphs. <code>DEFAULT</code> sets the default value for all
+elements, <code>TITLE</code> for the title, <code>AXIS</code> for the axis labels, <code>UNIT</code>
+for the vertical unit label, <code>LEGEND</code> for the graph legend.</p>
+</dd>
+<dd>
+<p>Use Times for the title: <code>--font TITLE:13:/usr/lib/fonts/times.ttf</code></p>
+</dd>
+<dd>
+<p>If you do not give a font string you can modify just the sice of the default font:
+<code>--font TITLE:13:</code>.</p>
+</dd>
+<dd>
+<p>If you specify the size 0 then you can modify just the font without touching
+the size. This is especially usefull for altering the default font without
+resetting the default fontsizes: <code>--font DEFAULT:0:/usr/lib/fonts/times.ttf</code>.</p>
+</dd>
+<dd>
+<p>RRDtool comes with a preset default font. You can set the environment
+variable <code>RRD_DEFAULT_FONT</code> if you want to change this.</p>
+</dd>
+<dd>
+<p>Truetype fonts are only supported for PNG output. See below.</p>
+</dd>
+<dd>
+<p>[<strong>-R</strong>|<strong>--font-render-mode</strong> {<em>normal</em>,<em>light</em>,<em>mono</em>}]</p>
+</dd>
+<dd>
+<p>This lets you customize the strength of the font smoothing,
+or disable it entirely using <em>mono</em>. By default, <em>normal</em>
+font smoothing is used.</p>
+</dd>
+<dd>
+<p>[<strong>-B</strong>|<strong>--font-smoothing-threshold</strong> <em>size</em>]</p>
+</dd>
+<dd>
+<p>This specifies the largest font size which will be rendered
+bitmapped, that is, without any font smoothing. By default,
+no text is rendered bitmapped.</p>
+</dd>
+<dd>
+<p>[<strong>-E</strong>|<strong>--slope-mode</strong>]</p>
+</dd>
+<dd>
+<p>RRDtool graphs are composed of stair case curves by default. This is in line with
+the way RRDtool calculates its data. Some people favor a more 'organic' look
+for their graphs even though it is not all that true.</p>
+</dd>
+<dd>
+<p>[<strong>-a</strong>|<strong>--imgformat</strong> <strong>PNG</strong>|<strong>SVG</strong>|<strong>EPS</strong>|<strong>PDF</strong>]</p>
+</dd>
+<dd>
+<p>Image format for the generated graph. For the vector formats you can
+choose among the standard Postscript fonts Courier-Bold,
+Courier-BoldOblique, Courier-Oblique, Courier, Helvetica-Bold,
+Helvetica-BoldOblique, Helvetica-Oblique, Helvetica, Symbol,
+Times-Bold, Times-BoldItalic, Times-Italic, Times-Roman, and ZapfDingbats.</p>
+</dd>
+<dd>
+<p>[<strong>-i</strong>|<strong>--interlaced</strong>]</p>
+</dd>
+<dd>
+<p>If images are interlaced they become visible on browsers more quickly.</p>
+</dd>
+<dd>
+<p>[<strong>-g</strong>|<strong>--no-legend</strong>]</p>
+</dd>
+<dd>
+<p>Suppress generation of the legend; only render the graph.</p>
+</dd>
+<dd>
+<p>[<strong>-F</strong>|<strong>--force-rules-legend</strong>]</p>
+</dd>
+<dd>
+<p>Force the generation of HRULE and VRULE legends even if those HRULE or
+VRULE will not be drawn because out of graph boundaries (mimics
+behaviour of pre 1.0.42 versions).</p>
+</dd>
+<dd>
+<p>[<strong>-T</strong>|<strong>--tabwidth</strong> <em>value</em>]</p>
+</dd>
+<dd>
+<p>By default the tab-width is 40 pixels, use this option to change it.</p>
+</dd>
+<dd>
+<p>[<strong>-b</strong>|<strong>--base</strong> <em>value</em>]</p>
+</dd>
+<dd>
+<p>If you are graphing memory (and NOT network traffic) this switch
+should be set to 1024 so that one Kb is 1024 byte. For traffic
+measurement, 1 kb/s is 1000 b/s.</p>
+</dd>
+<dd>
+<p>[<strong>-W</strong>|<strong>--watermark</strong> <em>string</em>]</p>
+</dd>
+<dd>
+<p>Adds the given string as a watermark, horizontally centred, at the bottom 
+of the graph.</p>
+</dd>
+</li>
+<dt><strong><a name="item_data_and_variables">Data and variables</a></strong>
+
+<dd>
+<p><strong>DEF:</strong><em>vname</em><strong>=</strong><em>rrdfile</em><strong>:</strong><em>ds-name</em><strong>:</strong><em>CF</em>[<strong>:step=</strong><em>step</em>][<strong>:start=</strong><em>time</em>][<strong>:end=</strong><em>time</em>]</p>
+</dd>
+<dd>
+<p><strong>CDEF:</strong><em>vname</em><strong>=</strong><em>RPN expression</em></p>
+</dd>
+<dd>
+<p><strong>VDEF:</strong><em>vname</em><strong>=</strong><em>RPN expression</em></p>
+</dd>
+<dd>
+<p>You need at least one <strong>DEF</strong> statement to generate anything. The
+other statements are useful but optional.
+See <a href="././rrdgraph_data.html">the rrdgraph_data manpage</a> and <a href="././rrdgraph_rpn.html">the rrdgraph_rpn manpage</a> for the exact format.</p>
+</dd>
+</li>
+<dt><strong><a name="item_graph_and_print_elements">Graph and print elements</a></strong>
+
+<dd>
+<p>You need at least one graph element to generate an image and/or
+at least one print statement to generate a report.
+See <a href="././rrdgraph_graph.html">the rrdgraph_graph manpage</a> for the exact format.</p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<hr />
+<h1><a name="see_also">SEE ALSO</a></h1>
+<p><a href="././rrdgraph.html">the rrdgraph manpage</a> gives an overview of how <strong>rrdtool graph</strong> works.
+<a href="././rrdgraph_data.html">the rrdgraph_data manpage</a> describes <strong>DEF</strong>,<strong>CDEF</strong> and <strong>VDEF</strong> in detail.
+<a href="././rrdgraph_rpn.html">the rrdgraph_rpn manpage</a> describes the <strong>RPN</strong> language used in the <strong>?DEF</strong> statements.
+<a href="././rrdgraph_graph.html">the rrdgraph_graph manpage</a> page describes all of the graph and print functions.</p>
+<p>Make sure to read <a href="././rrdgraph_examples.html">the rrdgraph_examples manpage</a> for tips&amp;tricks.</p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Program by Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
+<p>This manual page by Alex van den Bogaerdt &lt;<a href="mailto:alex@ergens.op.het.net">alex@ergens.op.het.net</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdgraph.pod b/doc/rrdgraph.pod
new file mode 100644 (file)
index 0000000..9060bd8
--- /dev/null
@@ -0,0 +1,398 @@
+=head1 NAME
+
+rrdgraph - Round Robin Database tool grapher functions
+
+=head1 SYNOPSIS
+
+B<rrdtool graph> I<filename>
+[I<L<option|rrdgraph/OPTIONS>> ...]
+[I<L<data definition|rrdgraph_data/DEF>> ...]
+[I<L<data calculation|rrdgraph_data/CDEF>> ...]
+[I<L<variable definition|rrdgraph_data/VDEF>> ...]
+[I<L<graph element|rrdgraph_graph/GRAPH>> ...]
+[I<L<print element|rrdgraph_graph/PRINT>> ...]
+
+=head1 DESCRIPTION
+
+The B<graph> function of B<RRDtool> is used to present the
+data from an B<RRD> to a human viewer.  Its main purpose is to
+create a nice graphical representation, but it can also generate
+a numerical report.
+
+=head1 OVERVIEW
+
+B<rrdtool graph> needs data to work with, so you must use one or more
+B<L<data definition|rrdgraph_data/DEF>> statements to collect this
+data.  You are not limited to one database, it's perfectly legal to
+collect data from two or more databases (one per statement, though).
+
+If you want to display averages, maxima, percentiles, etcetera
+it is best to collect them now using the
+B<L<variable definition|rrdgraph_data/VDEF>> statement.
+Currently this makes no difference, but in a future version
+of rrdtool you may want to collect these values before consolidation.
+
+The data fetched from the B<RRA> is then B<consolidated> so that
+there is exactly one datapoint per pixel in the graph. If you do
+not take care yourself, B<RRDtool> will expand the range slightly
+if necessary. Note, in that case the first and/or last pixel may very
+well become unknown!
+
+Sometimes data is not exactly in the format you would like to display
+it. For instance, you might be collecting B<bytes> per second, but
+want to display B<bits> per second. This is what the B<L<data
+calculation|rrdgraph_data/CDEF>> command is designed for. After
+B<consolidating> the data, a copy is made and this copy is modified
+using a rather powerful B<L<RPN|rrdgraph_rpn/>> command set.
+
+When you are done fetching and processing the data, it is time to
+graph it (or print it).  This ends the B<rrdtool graph> sequence.
+
+=head1 OPTIONS
+
+=over 4
+
+=item filename
+
+The name and path of the graph to generate. It is recommended to
+end this in C<.png>, C<.svg> or C<.eps>, but B<RRDtool> does not enforce this.
+
+I<filename> can be 'C<->' to send the image to C<stdout>. In
+this case, no other output is generated.
+
+=item Time range
+
+[B<-s>|B<--start> I<time>]
+[B<-e>|B<--end> I<time>]
+[B<-S>|B<--step> I<seconds>]
+
+The start and end of the time series you would like to display, and which
+B<RRA> the data should come from.  Defaults are: 1 day ago until
+now, with the best possible resolution. B<Start> and B<end> can
+be specified in several formats, see
+L<AT-STYLE TIME SPECIFICATION|rrdfetch/> and L<rrdgraph_examples>.
+By default, B<rrdtool graph> calculates the width of one pixel in
+the time domain and tries to get data from an B<RRA> with that
+resolution.  With the B<step> option you can alter this behaviour.
+If you want B<rrdtool graph> to get data at a one-hour resolution
+from the B<RRD>, set B<step> to 3'600. Note: a step smaller than
+one pixel will silently be ignored.
+
+=item Labels
+
+[B<-t>|B<--title> I<string>]
+[B<-v>|B<--vertical-label> I<string>]
+
+A horizontal string at the top of the graph and/or a vertically
+placed string at the left hand side of the graph.
+
+=item Size
+
+[B<-w>|B<--width> I<pixels>]
+[B<-h>|B<--height> I<pixels>]
+[B<-j>|B<--only-graph>]
+
+The width and height of the B<canvas> (the part of the graph with
+the actual data and such). This defaults to 400 pixels by 100 pixels.
+
+If you specify the B<--only-graph> option and set the height E<lt> 32
+pixels you will get a tiny graph image (thumbnail) to use as an icon
+for use in an overview, for example. All labeling will be stripped off
+the graph.
+
+=item Limits
+
+[B<-u>|B<--upper-limit> I<value>]
+[B<-l>|B<--lower-limit> I<value>]
+[B<-r>|B<--rigid>]
+
+By default the graph will be autoscaling so that it will adjust the
+y-axis to the range of the data. You can change this behaviour by
+explicitly setting the limits. The displayed y-axis will then range at
+least from B<lower-limit> to B<upper-limit>. Autoscaling will still
+permit those boundaries to be stretched unless the B<rigid> option is
+set.
+
+[B<-A>|B<--alt-autoscale>]
+
+Sometimes the default algorithm for selecting the y-axis scale is not
+satisfactory. Normally the scale is selected from a predefined
+set of ranges and this fails miserably when you need to graph something
+like C<260 + 0.001 * sin(x)>. This option calculates the minimum and
+maximum y-axis from the actual minimum and maximum data values. Our example
+would display slightly less than C<260-0.001> to slightly more than
+C<260+0.001> (this feature was contributed by Sasha Mikheev).
+
+[B<-J>|B<--alt-autoscale-min>]
+
+Where C<--alt-autoscale> will modify both the absolute maximum AND minimum
+values, this option will only affect the minimum value. The maximum
+value, if not defined on the command line, will be 0. This option can
+be useful when graphing router traffic when the WAN line uses compression,
+and thus the throughput may be higher than the WAN line speed.
+
+[B<-M>|B<--alt-autoscale-max>]
+
+Where C<--alt-autoscale> will modify both the absolute maximum AND minimum
+values, this option will only affect the maximum value. The minimum
+value, if not defined on the command line, will be 0. This option can
+be useful when graphing router traffic when the WAN line uses compression,
+and thus the throughput may be higher than the WAN line speed.
+
+[B<-N>|B<--no-gridfit>]
+
+In order to avoid anti-aliasing effects gridlines are placed on
+integer pixel values. This is by default done by extending
+the scale so that gridlines happens to be spaced using an
+integer number of pixels and also start on an integer pixel value.
+This might extend the scale too much for some logarithmic scales
+and for linear scales where B<--alt-autoscale> is needed.
+Using B<--no-gridfit> disables modification of the scale.
+
+=item Grid
+
+=over 4
+
+=item X-Axis
+
+[B<-x>|B<--x-grid> I<GTM>B<:>I<GST>B<:>I<MTM>B<:>I<MST>B<:>I<LTM>B<:>I<LST>B<:>I<LPR>B<:>I<LFM>]
+
+[B<-x>|B<--x-grid> B<none>]
+
+The x-axis label is quite complex to configure. If you don't have
+very special needs it is probably best to rely on the autoconfiguration
+to get this right. You can specify the string C<none> to suppress the grid
+and labels altogether.
+
+The grid is defined by specifying a certain amount of time in the I<?TM>
+positions. You can choose from C<SECOND>, C<MINUTE>, C<HOUR>, C<DAY>,
+C<WEEK>, C<MONTH> or C<YEAR>. Then you define how many of these should
+pass between each line or label.  This pair (I<?TM:?ST>) needs to be
+specified for the base grid (I<G??>), the major grid (I<M??>) and the
+labels (I<L??>). For the labels you also must define a precision
+in I<LPR> and a I<strftime> format string in I<LFM>.  I<LPR> defines
+where each label will be placed. If it is zero, the label will be
+placed right under the corresponding line (useful for hours, dates
+etcetera).  If you specify a number of seconds here the label is
+centered on this interval (useful for Monday, January etcetera).
+
+ --x-grid MINUTE:10:HOUR:1:HOUR:4:0:%X
+
+This places grid lines every 10 minutes, major grid lines every hour,
+and labels every 4 hours. The labels are placed under the major grid
+lines as they specify exactly that time.
+
+ --x-grid HOUR:8:DAY:1:DAY:1:0:%A
+
+This places grid lines every 8 hours, major grid lines and labels
+each day. The labels are placed exactly between two major grid lines
+as they specify the complete day and not just midnight.
+
+=item Y-Axis
+
+[B<-y>|B<--y-grid> I<grid step>B<:>I<label factor>]
+
+[B<-y>|B<--y-grid> B<none>]
+
+Y-axis grid lines appear at each I<grid step> interval.  Labels are
+placed every I<label factor> lines.  You can specify C<-y none> to
+suppress the grid and labels altogether.  The default for this option is
+to automatically select sensible values.
+
+If you have set --y-grid to 'none' not only the labels get supressed, also
+the space reserved for the labels is removed. You can still add space
+manually if you use the --units-length command to explicitly reserve space.
+
+[B<-Y>|B<--alt-y-grid>]
+
+Place the Y grid dynamically based on the graph's Y range. The algorithm
+ensures that you always have a grid, that there are enough but not too many
+grid lines, and that the grid is metric. That is the grid lines are placed
+every 1, 2, 5 or 10 units. This parameter will also ensure that you get
+enough decimals displayed even if your graph goes from 69.998 to 70.001. 
+(contributed by Sasha Mikheev).
+
+[B<-o>|B<--logarithmic>]
+
+Logarithmic y-axis scaling.
+
+[B<-X>|B<--units-exponent> I<value>]
+
+This sets the 10**exponent scaling of the y-axis values. Normally,
+values will be scaled to the appropriate units (k, M, etc.).  However,
+you may wish to display units always in k (Kilo, 10e3) even if the data
+is in the M (Mega, 10e6) range, for instance. Value should be an
+integer which is a multiple of 3 between -18 and 18 inclusively.  It is
+the exponent on the units you wish to use. For example, use 3 to
+display the y-axis values in k (Kilo, 10e3, thousands), use -6 to
+display the y-axis values in u (Micro, 10e-6, millionths).  Use a value
+of 0 to prevent any scaling of the y-axis values.
+
+This option is very effective at confusing the heck out of the default
+rrdtool autoscaler and grid painter. If rrdtool detects that it is not
+successful in labeling the graph under the given circumstances, it will switch
+to the more robust B<--alt-y-grid> mode.
+
+[B<-L>|B<--units-length> I<value>]
+
+How many digits should rrdtool assume the y-axis labels to be? You
+may have to use this option to make enough space once you start
+fideling with the y-axis labeling.
+
+[B<--units=si>]
+
+With this option y-axis values on logarithmic graphs will be scaled to 
+the appropriate units (k, M, etc.) instead of using exponential notation.
+Note that for linear graphs, SI notation is used by default.
+
+=back
+
+=item Miscellaneous
+
+[B<-z>|B<--lazy>]
+
+Only generate the graph if the current graph is out of date or not
+existent.
+
+[B<-f>|B<--imginfo> I<printfstr>]
+
+After the image has been created, the graph function uses printf
+together with this format string to create output similar to the PRINT
+function, only that the printf function is supplied with the parameters
+I<filename>, I<xsize> and I<ysize>. In order to generate an B<IMG> tag
+suitable for including the graph into a web page, the command line
+would look like this:
+
+ --imginfo '<IMG SRC="/img/%s" WIDTH="%lu" HEIGHT="%lu" ALT="Demo">'
+
+[B<-c>|B<--color> I<COLORTAG>#I<rrggbb>[I<aa>]]
+
+Override the default colors for the standard elements of the graph. The
+I<COLORTAG> is one of C<BACK> background, C<CANVAS> for the background of
+the actual graph, C<SHADEA> for the left and top border, C<SHADEB> for the
+right and bottom border, C<GRID>, C<MGRID> for the major grid, C<FONT> for
+the color of the font, C<AXIS> for the axis of the graph, C<FRAME> for the
+line around the color spots and finally C<ARROW> for the arrow head pointing
+up and forward. Each color is composed out of three hexadecimal numbers
+specifying its rgb color component (00 is off, FF is maximum) of red, green
+and blue. Optionally you may add another hexadecimal number specifying the
+transparency (FF is solid). You may set this option several times to alter
+multiple defaults.
+
+A green arrow is made by: C<--color ARROW#00FF00>
+
+[B<--zoom> I<factor>]
+
+Zoom the graphics by the given amount. The factor must be E<gt> 0
+
+[B<-n>|B<--font> I<FONTTAG>B<:>I<size>B<:>[I<font>]]
+
+This lets you customize which font to use for the various text
+elements on the RRD graphs. C<DEFAULT> sets the default value for all
+elements, C<TITLE> for the title, C<AXIS> for the axis labels, C<UNIT>
+for the vertical unit label, C<LEGEND> for the graph legend.
+
+Use Times for the title: C<--font TITLE:13:/usr/lib/fonts/times.ttf>
+
+If you do not give a font string you can modify just the sice of the default font:
+C<--font TITLE:13:>.
+
+If you specify the size 0 then you can modify just the font without touching
+the size. This is especially usefull for altering the default font without
+resetting the default fontsizes: C<--font DEFAULT:0:/usr/lib/fonts/times.ttf>.
+
+RRDtool comes with a preset default font. You can set the environment
+variable C<RRD_DEFAULT_FONT> if you want to change this.
+
+Truetype fonts are only supported for PNG output. See below.
+
+[B<-R>|B<--font-render-mode> {I<normal>,I<light>,I<mono>}]
+
+This lets you customize the strength of the font smoothing,
+or disable it entirely using I<mono>. By default, I<normal>
+font smoothing is used.
+
+[B<-B>|B<--font-smoothing-threshold> I<size>]
+
+This specifies the largest font size which will be rendered
+bitmapped, that is, without any font smoothing. By default,
+no text is rendered bitmapped.
+
+[B<-E>|B<--slope-mode>]
+
+RRDtool graphs are composed of stair case curves by default. This is in line with
+the way RRDtool calculates its data. Some people favor a more 'organic' look
+for their graphs even though it is not all that true.
+
+[B<-a>|B<--imgformat> B<PNG>|B<SVG>|B<EPS>|B<PDF>]
+
+Image format for the generated graph. For the vector formats you can
+choose among the standard Postscript fonts Courier-Bold,
+Courier-BoldOblique, Courier-Oblique, Courier, Helvetica-Bold,
+Helvetica-BoldOblique, Helvetica-Oblique, Helvetica, Symbol,
+Times-Bold, Times-BoldItalic, Times-Italic, Times-Roman, and ZapfDingbats.
+
+[B<-i>|B<--interlaced>]
+
+If images are interlaced they become visible on browsers more quickly.
+
+[B<-g>|B<--no-legend>]
+
+Suppress generation of the legend; only render the graph.
+
+[B<-F>|B<--force-rules-legend>]
+
+Force the generation of HRULE and VRULE legends even if those HRULE or
+VRULE will not be drawn because out of graph boundaries (mimics
+behaviour of pre 1.0.42 versions).
+
+[B<-T>|B<--tabwidth> I<value>]
+
+By default the tab-width is 40 pixels, use this option to change it.
+
+[B<-b>|B<--base> I<value>]
+
+If you are graphing memory (and NOT network traffic) this switch
+should be set to 1024 so that one Kb is 1024 byte. For traffic
+measurement, 1 kb/s is 1000 b/s.
+
+[B<-W>|B<--watermark> I<string>]
+
+Adds the given string as a watermark, horizontally centred, at the bottom 
+of the graph.
+
+=item Data and variables
+
+B<DEF:>I<vname>B<=>I<rrdfile>B<:>I<ds-name>B<:>I<CF>[B<:step=>I<step>][B<:start=>I<time>][B<:end=>I<time>]
+
+B<CDEF:>I<vname>B<=>I<RPN expression>
+
+B<VDEF:>I<vname>B<=>I<RPN expression>
+
+You need at least one B<DEF> statement to generate anything. The
+other statements are useful but optional.
+See L<rrdgraph_data> and L<rrdgraph_rpn> for the exact format.
+
+=item Graph and print elements
+
+You need at least one graph element to generate an image and/or
+at least one print statement to generate a report.
+See L<rrdgraph_graph> for the exact format.
+
+=back
+
+=head1 SEE ALSO
+
+L<rrdgraph> gives an overview of how B<rrdtool graph> works.
+L<rrdgraph_data> describes B<DEF>,B<CDEF> and B<VDEF> in detail.
+L<rrdgraph_rpn> describes the B<RPN> language used in the B<?DEF> statements.
+L<rrdgraph_graph> page describes all of the graph and print functions.
+
+Make sure to read L<rrdgraph_examples> for tipsE<amp>tricks.
+
+=head1 AUTHOR
+
+Program by Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
+
+This manual page by Alex van den Bogaerdt E<lt>alex@ergens.op.het.netE<gt>
+
diff --git a/doc/rrdgraph.txt b/doc/rrdgraph.txt
new file mode 100644 (file)
index 0000000..4c8686a
--- /dev/null
@@ -0,0 +1,380 @@
+RRDGRAPH(1)                         rrdtool                        RRDGRAPH(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdgraph - Round Robin Database tool grapher functions
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       r\brr\brd\bdt\bto\boo\bol\bl g\bgr\bra\bap\bph\bh _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be [_\bo_\bp_\bt_\bi_\bo_\bn ...]  [_\bd_\ba_\bt_\ba _\bd_\be_\bf_\bi_\bn_\bi_\bt_\bi_\bo_\bn ...]  [_\bd_\ba_\bt_\ba _\bc_\ba_\bl_\b-
+       _\bc_\bu_\bl_\ba_\bt_\bi_\bo_\bn ...]  [_\bv_\ba_\br_\bi_\ba_\bb_\bl_\be _\bd_\be_\bf_\bi_\bn_\bi_\bt_\bi_\bo_\bn ...]  [_\bg_\br_\ba_\bp_\bh _\be_\bl_\be_\bm_\be_\bn_\bt ...]  [_\bp_\br_\bi_\bn_\bt
+       _\be_\bl_\be_\bm_\be_\bn_\bt ...]
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       The g\bgr\bra\bap\bph\bh function of R\bRR\bRD\bDt\bto\boo\bol\bl is used to present the data from an R\bRR\bRD\bD
+       to a human viewer.  Its main purpose is to create a nice graphical rep-
+       resentation, but it can also generate a numerical report.
+
+O\bOV\bVE\bER\bRV\bVI\bIE\bEW\bW
+       r\brr\brd\bdt\bto\boo\bol\bl g\bgr\bra\bap\bph\bh needs data to work with, so you must use one or more d\bda\bat\bta\ba
+       d\bde\bef\bfi\bin\bni\bit\bti\bio\bon\bn statements to collect this data.  You are not limited to one
+       database, it's perfectly legal to collect data from two or more
+       databases (one per statement, though).
+
+       If you want to display averages, maxima, percentiles, etcetera it is
+       best to collect them now using the v\bva\bar\bri\bia\bab\bbl\ble\be d\bde\bef\bfi\bin\bni\bit\bti\bio\bon\bn statement.  Cur-
+       rently this makes no difference, but in a future version of rrdtool you
+       may want to collect these values before consolidation.
+
+       The data fetched from the R\bRR\bRA\bA is then c\bco\bon\bns\bso\bol\bli\bid\bda\bat\bte\bed\bd so that there is
+       exactly one datapoint per pixel in the graph. If you do not take care
+       yourself, R\bRR\bRD\bDt\bto\boo\bol\bl will expand the range slightly if necessary. Note, in
+       that case the first and/or last pixel may very well become unknown!
+
+       Sometimes data is not exactly in the format you would like to display
+       it. For instance, you might be collecting b\bby\byt\bte\bes\bs per second, but want to
+       display b\bbi\bit\bts\bs per second. This is what the d\bda\bat\bta\ba c\bca\bal\blc\bcu\bul\bla\bat\bti\bio\bon\bn command is
+       designed for. After c\bco\bon\bns\bso\bol\bli\bid\bda\bat\bti\bin\bng\bg the data, a copy is made and this
+       copy is modified using a rather powerful R\bRP\bPN\bN command set.
+
+       When you are done fetching and processing the data, it is time to graph
+       it (or print it).  This ends the r\brr\brd\bdt\bto\boo\bol\bl g\bgr\bra\bap\bph\bh sequence.
+
+O\bOP\bPT\bTI\bIO\bON\bNS\bS
+       filename
+           The name and path of the graph to generate. It is recommended to
+           end this in ".png", ".svg" or ".eps", but R\bRR\bRD\bDt\bto\boo\bol\bl does not enforce
+           this.
+
+           _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be can be '"-"' to send the image to "stdout". In this case,
+           no other output is generated.
+
+       Time range
+           [-\b-s\bs|-\b--\b-s\bst\bta\bar\brt\bt _\bt_\bi_\bm_\be] [-\b-e\be|-\b--\b-e\ben\bnd\bd _\bt_\bi_\bm_\be] [-\b-S\bS|-\b--\b-s\bst\bte\bep\bp _\bs_\be_\bc_\bo_\bn_\bd_\bs]
+
+           The start and end of the time series you would like to display, and
+           which R\bRR\bRA\bA the data should come from.  Defaults are: 1 day ago until
+           now, with the best possible resolution. S\bSt\bta\bar\brt\bt and e\ben\bnd\bd can be speci-
+           fied in several formats, see AT-STYLE TIME SPECIFICATION and rrd-
+           graph_examples.  By default, r\brr\brd\bdt\bto\boo\bol\bl g\bgr\bra\bap\bph\bh calculates the width of
+           one pixel in the time domain and tries to get data from an R\bRR\bRA\bA with
+           that resolution.  With the s\bst\bte\bep\bp option you can alter this
+           behaviour.  If you want r\brr\brd\bdt\bto\boo\bol\bl g\bgr\bra\bap\bph\bh to get data at a one-hour
+           resolution from the R\bRR\bRD\bD, set s\bst\bte\bep\bp to 3'600. Note: a step smaller
+           than one pixel will silently be ignored.
+
+       Labels
+           [-\b-t\bt|-\b--\b-t\bti\bit\btl\ble\be _\bs_\bt_\br_\bi_\bn_\bg] [-\b-v\bv|-\b--\b-v\bve\ber\brt\bti\bic\bca\bal\bl-\b-l\bla\bab\bbe\bel\bl _\bs_\bt_\br_\bi_\bn_\bg]
+
+           A horizontal string at the top of the graph and/or a vertically
+           placed string at the left hand side of the graph.
+
+       Size
+           [-\b-w\bw|-\b--\b-w\bwi\bid\bdt\bth\bh _\bp_\bi_\bx_\be_\bl_\bs] [-\b-h\bh|-\b--\b-h\bhe\bei\big\bgh\bht\bt _\bp_\bi_\bx_\be_\bl_\bs] [-\b-j\bj|-\b--\b-o\bon\bnl\bly\by-\b-g\bgr\bra\bap\bph\bh]
+
+           The width and height of the c\bca\ban\bnv\bva\bas\bs (the part of the graph with the
+           actual data and such). This defaults to 400 pixels by 100 pixels.
+
+           If you specify the -\b--\b-o\bon\bnl\bly\by-\b-g\bgr\bra\bap\bph\bh option and set the height < 32 pix-
+           els you will get a tiny graph image (thumbnail) to use as an icon
+           for use in an overview, for example. All labeling will be stripped
+           off the graph.
+
+       Limits
+           [-\b-u\bu|-\b--\b-u\bup\bpp\bpe\ber\br-\b-l\bli\bim\bmi\bit\bt _\bv_\ba_\bl_\bu_\be] [-\b-l\bl|-\b--\b-l\blo\bow\bwe\ber\br-\b-l\bli\bim\bmi\bit\bt _\bv_\ba_\bl_\bu_\be] [-\b-r\br|-\b--\b-r\bri\big\bgi\bid\bd]
+
+           By default the graph will be autoscaling so that it will adjust the
+           y-axis to the range of the data. You can change this behaviour by
+           explicitly setting the limits. The displayed y-axis will then range
+           at least from l\blo\bow\bwe\ber\br-\b-l\bli\bim\bmi\bit\bt to u\bup\bpp\bpe\ber\br-\b-l\bli\bim\bmi\bit\bt. Autoscaling will still
+           permit those boundaries to be stretched unless the r\bri\big\bgi\bid\bd option is
+           set.
+
+           [-\b-A\bA|-\b--\b-a\bal\blt\bt-\b-a\bau\but\bto\bos\bsc\bca\bal\ble\be]
+
+           Sometimes the default algorithm for selecting the y-axis scale is
+           not satisfactory. Normally the scale is selected from a predefined
+           set of ranges and this fails miserably when you need to graph some-
+           thing like "260 + 0.001 * sin(x)". This option calculates the mini-
+           mum and maximum y-axis from the actual minimum and maximum data
+           values. Our example would display slightly less than "260-0.001" to
+           slightly more than "260+0.001" (this feature was contributed by
+           Sasha Mikheev).
+
+           [-\b-J\bJ|-\b--\b-a\bal\blt\bt-\b-a\bau\but\bto\bos\bsc\bca\bal\ble\be-\b-m\bmi\bin\bn]
+
+           Where "--alt-autoscale" will modify both the absolute maximum AND
+           minimum values, this option will only affect the minimum value. The
+           maximum value, if not defined on the command line, will be 0. This
+           option can be useful when graphing router traffic when the WAN line
+           uses compression, and thus the throughput may be higher than the
+           WAN line speed.
+
+           [-\b-M\bM|-\b--\b-a\bal\blt\bt-\b-a\bau\but\bto\bos\bsc\bca\bal\ble\be-\b-m\bma\bax\bx]
+
+           Where "--alt-autoscale" will modify both the absolute maximum AND
+           minimum values, this option will only affect the maximum value. The
+           minimum value, if not defined on the command line, will be 0. This
+           option can be useful when graphing router traffic when the WAN line
+           uses compression, and thus the throughput may be higher than the
+           WAN line speed.
+
+           [-\b-N\bN|-\b--\b-n\bno\bo-\b-g\bgr\bri\bid\bdf\bfi\bit\bt]
+
+           In order to avoid anti-aliasing effects gridlines are placed on
+           integer pixel values. This is by default done by extending the
+           scale so that gridlines happens to be spaced using an integer num-
+           ber of pixels and also start on an integer pixel value.  This might
+           extend the scale too much for some logarithmic scales and for lin-
+           ear scales where -\b--\b-a\bal\blt\bt-\b-a\bau\but\bto\bos\bsc\bca\bal\ble\be is needed.  Using -\b--\b-n\bno\bo-\b-g\bgr\bri\bid\bdf\bfi\bit\bt
+           disables modification of the scale.
+
+       Grid
+           X-Axis
+               [-\b-x\bx|-\b--\b-x\bx-\b-g\bgr\bri\bid\bd _\bG_\bT_\bM:\b:_\bG_\bS_\bT:\b:_\bM_\bT_\bM:\b:_\bM_\bS_\bT:\b:_\bL_\bT_\bM:\b:_\bL_\bS_\bT:\b:_\bL_\bP_\bR:\b:_\bL_\bF_\bM]
+
+               [-\b-x\bx|-\b--\b-x\bx-\b-g\bgr\bri\bid\bd n\bno\bon\bne\be]
+
+               The x-axis label is quite complex to configure. If you don't
+               have very special needs it is probably best to rely on the
+               autoconfiguration to get this right. You can specify the string
+               "none" to suppress the grid and labels altogether.
+
+               The grid is defined by specifying a certain amount of time in
+               the _\b?_\bT_\bM positions. You can choose from "SECOND", "MINUTE",
+               "HOUR", "DAY", "WEEK", "MONTH" or "YEAR". Then you define how
+               many of these should pass between each line or label.  This
+               pair (_\b?_\bT_\bM_\b:_\b?_\bS_\bT) needs to be specified for the base grid (_\bG_\b?_\b?),
+               the major grid (_\bM_\b?_\b?) and the labels (_\bL_\b?_\b?). For the labels you
+               also must define a precision in _\bL_\bP_\bR and a _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be format
+               string in _\bL_\bF_\bM.  _\bL_\bP_\bR defines where each label will be placed. If
+               it is zero, the label will be placed right under the corre-
+               sponding line (useful for hours, dates etcetera).  If you spec-
+               ify a number of seconds here the label is centered on this
+               interval (useful for Monday, January etcetera).
+
+                --x-grid MINUTE:10:HOUR:1:HOUR:4:0:%X
+
+               This places grid lines every 10 minutes, major grid lines every
+               hour, and labels every 4 hours. The labels are placed under the
+               major grid lines as they specify exactly that time.
+
+                --x-grid HOUR:8:DAY:1:DAY:1:0:%A
+
+               This places grid lines every 8 hours, major grid lines and
+               labels each day. The labels are placed exactly between two
+               major grid lines as they specify the complete day and not just
+               midnight.
+
+           Y-Axis
+               [-\b-y\by|-\b--\b-y\by-\b-g\bgr\bri\bid\bd _\bg_\br_\bi_\bd _\bs_\bt_\be_\bp:\b:_\bl_\ba_\bb_\be_\bl _\bf_\ba_\bc_\bt_\bo_\br]
+
+               [-\b-y\by|-\b--\b-y\by-\b-g\bgr\bri\bid\bd n\bno\bon\bne\be]
+
+               Y-axis grid lines appear at each _\bg_\br_\bi_\bd _\bs_\bt_\be_\bp interval.  Labels
+               are placed every _\bl_\ba_\bb_\be_\bl _\bf_\ba_\bc_\bt_\bo_\br lines.  You can specify "-y none"
+               to suppress the grid and labels altogether.  The default for
+               this option is to automatically select sensible values.
+
+               If you have set --y-grid to 'none' not only the labels get
+               supressed, also the space reserved for the labels is removed.
+               You can still add space manually if you use the --units-length
+               command to explicitly reserve space.
+
+               [-\b-Y\bY|-\b--\b-a\bal\blt\bt-\b-y\by-\b-g\bgr\bri\bid\bd]
+
+               Place the Y grid dynamically based on the graph's Y range. The
+               algorithm ensures that you always have a grid, that there are
+               enough but not too many grid lines, and that the grid is met-
+               ric. That is the grid lines are placed every 1, 2, 5 or 10
+               units. This parameter will also ensure that you get enough dec-
+               imals displayed even if your graph goes from 69.998 to 70.001.
+               (contributed by Sasha Mikheev).
+
+               [-\b-o\bo|-\b--\b-l\blo\bog\bga\bar\bri\bit\bth\bhm\bmi\bic\bc]
+
+               Logarithmic y-axis scaling.
+
+               [-\b-X\bX|-\b--\b-u\bun\bni\bit\bts\bs-\b-e\bex\bxp\bpo\bon\bne\ben\bnt\bt _\bv_\ba_\bl_\bu_\be]
+
+               This sets the 10**exponent scaling of the y-axis values. Nor-
+               mally, values will be scaled to the appropriate units (k, M,
+               etc.).  However, you may wish to display units always in k
+               (Kilo, 10e3) even if the data is in the M (Mega, 10e6) range,
+               for instance. Value should be an integer which is a multiple of
+               3 between -18 and 18 inclusively.  It is the exponent on the
+               units you wish to use. For example, use 3 to display the y-axis
+               values in k (Kilo, 10e3, thousands), use -6 to display the
+               y-axis values in u (Micro, 10e-6, millionths).  Use a value of
+               0 to prevent any scaling of the y-axis values.
+
+               This option is very effective at confusing the heck out of the
+               default rrdtool autoscaler and grid painter. If rrdtool detects
+               that it is not successful in labeling the graph under the given
+               circumstances, it will switch to the more robust -\b--\b-a\bal\blt\bt-\b-y\by-\b-g\bgr\bri\bid\bd
+               mode.
+
+               [-\b-L\bL|-\b--\b-u\bun\bni\bit\bts\bs-\b-l\ble\ben\bng\bgt\bth\bh _\bv_\ba_\bl_\bu_\be]
+
+               How many digits should rrdtool assume the y-axis labels to be?
+               You may have to use this option to make enough space once you
+               start fideling with the y-axis labeling.
+
+               [-\b--\b-u\bun\bni\bit\bts\bs=\b=s\bsi\bi]
+
+               With this option y-axis values on logarithmic graphs will be
+               scaled to the appropriate units (k, M, etc.) instead of using
+               exponential notation.  Note that for linear graphs, SI notation
+               is used by default.
+
+       Miscellaneous
+           [-\b-z\bz|-\b--\b-l\bla\baz\bzy\by]
+
+           Only generate the graph if the current graph is out of date or not
+           existent.
+
+           [-\b-f\bf|-\b--\b-i\bim\bmg\bgi\bin\bnf\bfo\bo _\bp_\br_\bi_\bn_\bt_\bf_\bs_\bt_\br]
+
+           After the image has been created, the graph function uses printf
+           together with this format string to create output similar to the
+           PRINT function, only that the printf function is supplied with the
+           parameters _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be, _\bx_\bs_\bi_\bz_\be and _\by_\bs_\bi_\bz_\be. In order to generate an I\bIM\bMG\bG
+           tag suitable for including the graph into a web page, the command
+           line would look like this:
+
+            --imginfo '<IMG SRC="/img/%s" WIDTH="%lu" HEIGHT="%lu" ALT="Demo">'
+
+           [-\b-c\bc|-\b--\b-c\bco\bol\blo\bor\br _\bC_\bO_\bL_\bO_\bR_\bT_\bA_\bG#_\br_\br_\bg_\bg_\bb_\bb[_\ba_\ba]]
+
+           Override the default colors for the standard elements of the graph.
+           The _\bC_\bO_\bL_\bO_\bR_\bT_\bA_\bG is one of "BACK" background, "CANVAS" for the back-
+           ground of the actual graph, "SHADEA" for the left and top border,
+           "SHADEB" for the right and bottom border, "GRID", "MGRID" for the
+           major grid, "FONT" for the color of the font, "AXIS" for the axis
+           of the graph, "FRAME" for the line around the color spots and
+           finally "ARROW" for the arrow head pointing up and forward. Each
+           color is composed out of three hexadecimal numbers specifying its
+           rgb color component (00 is off, FF is maximum) of red, green and
+           blue. Optionally you may add another hexadecimal number specifying
+           the transparency (FF is solid). You may set this option several
+           times to alter multiple defaults.
+
+           A green arrow is made by: "--color ARROW#00FF00"
+
+           [-\b--\b-z\bzo\boo\bom\bm _\bf_\ba_\bc_\bt_\bo_\br]
+
+           Zoom the graphics by the given amount. The factor must be > 0
+
+           [-\b-n\bn|-\b--\b-f\bfo\bon\bnt\bt _\bF_\bO_\bN_\bT_\bT_\bA_\bG:\b:_\bs_\bi_\bz_\be:\b:[_\bf_\bo_\bn_\bt]]
+
+           This lets you customize which font to use for the various text ele-
+           ments on the RRD graphs. "DEFAULT" sets the default value for all
+           elements, "TITLE" for the title, "AXIS" for the axis labels, "UNIT"
+           for the vertical unit label, "LEGEND" for the graph legend.
+
+           Use Times for the title: "--font TITLE:13:/usr/lib/fonts/times.ttf"
+
+           If you do not give a font string you can modify just the sice of
+           the default font: "--font TITLE:13:".
+
+           If you specify the size 0 then you can modify just the font without
+           touching the size. This is especially usefull for altering the
+           default font without resetting the default fontsizes: "--font
+           DEFAULT:0:/usr/lib/fonts/times.ttf".
+
+           RRDtool comes with a preset default font. You can set the environ-
+           ment variable "RRD_DEFAULT_FONT" if you want to change this.
+
+           Truetype fonts are only supported for PNG output. See below.
+
+           [-\b-R\bR|-\b--\b-f\bfo\bon\bnt\bt-\b-r\bre\ben\bnd\bde\ber\br-\b-m\bmo\bod\bde\be {_\bn_\bo_\br_\bm_\ba_\bl,_\bl_\bi_\bg_\bh_\bt,_\bm_\bo_\bn_\bo}]
+
+           This lets you customize the strength of the font smoothing, or dis-
+           able it entirely using _\bm_\bo_\bn_\bo. By default, _\bn_\bo_\br_\bm_\ba_\bl font smoothing is
+           used.
+
+           [-\b-B\bB|-\b--\b-f\bfo\bon\bnt\bt-\b-s\bsm\bmo\boo\bot\bth\bhi\bin\bng\bg-\b-t\bth\bhr\bre\bes\bsh\bho\bol\bld\bd _\bs_\bi_\bz_\be]
+
+           This specifies the largest font size which will be rendered
+           bitmapped, that is, without any font smoothing. By default, no text
+           is rendered bitmapped.
+
+           [-\b-E\bE|-\b--\b-s\bsl\blo\bop\bpe\be-\b-m\bmo\bod\bde\be]
+
+           RRDtool graphs are composed of stair case curves by default. This
+           is in line with the way RRDtool calculates its data. Some people
+           favor a more 'organic' look for their graphs even though it is not
+           all that true.
+
+           [-\b-a\ba|-\b--\b-i\bim\bmg\bgf\bfo\bor\brm\bma\bat\bt P\bPN\bNG\bG|S\bSV\bVG\bG|E\bEP\bPS\bS|P\bPD\bDF\bF]
+
+           Image format for the generated graph. For the vector formats you
+           can choose among the standard Postscript fonts Courier-Bold,
+           Courier-BoldOblique, Courier-Oblique, Courier, Helvetica-Bold, Hel-
+           vetica-BoldOblique, Helvetica-Oblique, Helvetica, Symbol,
+           Times-Bold, Times-BoldItalic, Times-Italic, Times-Roman, and ZapfD-
+           ingbats.
+
+           [-\b-i\bi|-\b--\b-i\bin\bnt\bte\ber\brl\bla\bac\bce\bed\bd]
+
+           If images are interlaced they become visible on browsers more
+           quickly.
+
+           [-\b-g\bg|-\b--\b-n\bno\bo-\b-l\ble\beg\bge\ben\bnd\bd]
+
+           Suppress generation of the legend; only render the graph.
+
+           [-\b-F\bF|-\b--\b-f\bfo\bor\brc\bce\be-\b-r\bru\bul\ble\bes\bs-\b-l\ble\beg\bge\ben\bnd\bd]
+
+           Force the generation of HRULE and VRULE legends even if those HRULE
+           or VRULE will not be drawn because out of graph boundaries (mimics
+           behaviour of pre 1.0.42 versions).
+
+           [-\b-T\bT|-\b--\b-t\bta\bab\bbw\bwi\bid\bdt\bth\bh _\bv_\ba_\bl_\bu_\be]
+
+           By default the tab-width is 40 pixels, use this option to change
+           it.
+
+           [-\b-b\bb|-\b--\b-b\bba\bas\bse\be _\bv_\ba_\bl_\bu_\be]
+
+           If you are graphing memory (and NOT network traffic) this switch
+           should be set to 1024 so that one Kb is 1024 byte. For traffic mea-
+           surement, 1 kb/s is 1000 b/s.
+
+           [-\b-W\bW|-\b--\b-w\bwa\bat\bte\ber\brm\bma\bar\brk\bk _\bs_\bt_\br_\bi_\bn_\bg]
+
+           Adds the given string as a watermark, horizontally centred, at the
+           bottom of the graph.
+
+       Data and variables
+           D\bDE\bEF\bF:\b:_\bv_\bn_\ba_\bm_\be=\b=_\br_\br_\bd_\bf_\bi_\bl_\be:\b:_\bd_\bs_\b-_\bn_\ba_\bm_\be:\b:_\bC_\bF[:\b:s\bst\bte\bep\bp=\b=_\bs_\bt_\be_\bp][:\b:s\bst\bta\bar\brt\bt=\b=_\bt_\bi_\bm_\be][:\b:e\ben\bnd\bd=\b=_\bt_\bi_\bm_\be]
+
+           C\bCD\bDE\bEF\bF:\b:_\bv_\bn_\ba_\bm_\be=\b=_\bR_\bP_\bN _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn
+
+           V\bVD\bDE\bEF\bF:\b:_\bv_\bn_\ba_\bm_\be=\b=_\bR_\bP_\bN _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn
+
+           You need at least one D\bDE\bEF\bF statement to generate anything. The other
+           statements are useful but optional.  See rrdgraph_data and rrd-
+           graph_rpn for the exact format.
+
+       Graph and print elements
+           You need at least one graph element to generate an image and/or at
+           least one print statement to generate a report.  See rrdgraph_graph
+           for the exact format.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+       rrdgraph gives an overview of how r\brr\brd\bdt\bto\boo\bol\bl g\bgr\bra\bap\bph\bh works.  rrdgraph_data
+       describes D\bDE\bEF\bF,C\bCD\bDE\bEF\bF and V\bVD\bDE\bEF\bF in detail.  rrdgraph_rpn describes the R\bRP\bPN\bN
+       language used in the ?\b?D\bDE\bEF\bF statements.  rrdgraph_graph page describes
+       all of the graph and print functions.
+
+       Make sure to read rrdgraph_examples for tips&tricks.
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Program by Tobias Oetiker <tobi@oetiker.ch>
+
+       This manual page by Alex van den Bogaerdt <alex@ergens.op.het.net>
+
+
+
+1.2.26                            2007-11-20                       RRDGRAPH(1)
diff --git a/doc/rrdgraph_data.1 b/doc/rrdgraph_data.1
new file mode 100644 (file)
index 0000000..1731aa6
--- /dev/null
@@ -0,0 +1,232 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDGRAPH_DATA 1"
+.TH RRDGRAPH_DATA 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdgraph_data \- preparing data for graphing in rrdtool graph
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fB\s-1DEF:\s0\fR\fI<vname>\fR=\fI<rrdfile>\fR:\fI<ds-name>\fR:\fI<\s-1CF\s0>\fR[:step=\fI<step>\fR][:start=\fI<time>\fR][:end=\fI<time>\fR][:reduce=\fI<\f(BI\s-1CF\s0\fI>\fR]
+.PP
+\&\fB\s-1VDEF\s0\fR:\fIvname\fR=\fI\s-1RPN\s0 expression\fR
+.PP
+\&\fB\s-1CDEF\s0\fR:\fIvname\fR=\fI\s-1RPN\s0 expression\fR
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+These three instructions extract data values out of the \fB\s-1RRD\s0\fR files,
+optionally altering them (think, for example, of a bytes to bits
+conversion). If so desired, you can also define variables containing
+useful information such as maximum, minimum etcetera. Two of the
+instructions use a language called \fB\s-1RPN\s0\fR which is described in its
+own manual page.
+.PP
+Variable names (\fIvname\fR) must be made up strings of the following characters
+\&\f(CW\*(C`A\-Z, a\-z, 0\-9, \-,_\*(C'\fR and a maximum length of 255 characters.
+.PP
+When picking variable names, make sure you do not choose a name that is
+already taken by an \s-1RPN\s0 operator. A save bet it to use lowercase or
+mixedcase names for variables since operators will always be in uppercase.
+.SH "DEF"
+.IX Header "DEF"
+\&\fB\s-1DEF:\s0\fR\fI<vname>\fR=\fI<rrdfile>\fR:\fI<ds-name>\fR:\fI<\s-1CF\s0>\fR[:step=\fI<step>\fR][:start=\fI<time>\fR][:end=\fI<time>\fR][:reduce=\fI<\f(BI\s-1CF\s0\fI>\fR]
+.PP
+This command fetches data from an \fB\s-1RRD\s0\fR file.  The virtual name
+\&\fIvname\fR can then be used throughout the rest of the script. By
+default, an \fB\s-1RRA\s0\fR which contains the correct consolidated data
+at an appropriate resolution will be chosen.  The resolution can
+be overridden with the \-\-step option.
+The resolution can again be overridden by specifying the \fBstep size\fR.
+The time span of this data is the same as for the graph by default,
+you can override this by specifying \fBstart and end\fR.  Remember to
+escape colons in the time specification!
+.PP
+If the resolution of the data is higher than the resolution of the
+graph, the data will be further consolidated. This may result in
+a graph that spans slightly more time than requested.
+Ideally each point in the graph should correspond with one \fB\s-1CDP\s0\fR
+from an \fB\s-1RRA\s0\fR.  For instance, if your \fB\s-1RRD\s0\fR has an \fB\s-1RRA\s0\fR with
+a resolution of 1800 seconds per \fB\s-1CDP\s0\fR, you should create an
+image with width 400 and time span 400*1800 seconds (use appropriate
+start and end times, such as \f(CW\*(C`\-\-start end\-8days8hours\*(C'\fR).
+.PP
+If consolidation needs to be done, the \fB\s-1CF\s0\fR of the \fB\s-1RRA\s0\fR specified in the
+\&\fB\s-1DEF\s0\fR itself will be used to reduce the data density. This behaviour can
+be changed using \f(CW\*(C`:reduce=\f(CI<\f(CB\s-1CF\s0\f(CI>\f(CW\*(C'\fR.  This optional parameter
+specifies the \fB\s-1CF\s0\fR to use during the data reduction phase.
+.PP
+Example:
+.PP
+.Vb 4
+\&        DEF:ds0=router.rrd:ds0:AVERAGE
+\&        DEF:ds0weekly=router.rrd:ds0:AVERAGE:step=7200
+\&        DEF:ds0weekly=router.rrd:ds0:AVERAGE:start=end\-1h
+\&        DEF:ds0weekly=router.rrd:ds0:AVERAGE:start=11\e:00:end=start+1h
+.Ve
+.SH "VDEF"
+.IX Header "VDEF"
+\&\fB\s-1VDEF\s0\fR:\fIvname\fR=\fI\s-1RPN\s0 expression\fR
+.PP
+This command returns a value and/or a time according to the \fB\s-1RPN\s0\fR
+statements used. The resulting \fIvname\fR will, depending on the
+functions used, have a value and a time component.  When you use
+this \fIvname\fR in another \fB\s-1RPN\s0\fR expression, you are effectively
+inserting its value just as if you had put a number at that place.
+The variable can also be used in the various graph and print
+elements.
+.PP
+Example: \f(CW\*(C`VDEF:avg=mydata,AVERAGE\*(C'\fR
+.PP
+Note that currently only agregation functions work in \s-1VDEF\s0 rpn expressions.
+Patches to change this are welcome.
+.SH "CDEF"
+.IX Header "CDEF"
+\&\fB\s-1CDEF\s0\fR:\fIvname\fR=\fI\s-1RPN\s0 expression\fR
+.PP
+This command creates a new set of data points (in memory only, not
+in the \fB\s-1RRD\s0\fR file) out of one or more other data series. The \fB\s-1RPN\s0\fR
+instructions are used to evaluate a mathematical function on each
+data point. The resulting \fIvname\fR can then be used further on in
+the script, just as if it were generated by a \fB\s-1DEF\s0\fR instruction.
+.PP
+Example: \f(CW\*(C`CDEF:mydatabits=mydata,8,*\*(C'\fR
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+rrdgraph gives an overview of how \fBrrdtool graph\fR works.
+rrdgraph_data describes \fB\s-1DEF\s0\fR,\fB\s-1CDEF\s0\fR and \fB\s-1VDEF\s0\fR in detail.
+rrdgraph_rpn describes the \fB\s-1RPN\s0\fR language used in the \fB?DEF\fR statements.
+rrdgraph_graph page describes all of the graph and print functions.
+.PP
+Make sure to read rrdgraph_examples for tips&tricks.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Program by Tobias Oetiker <tobi@oetiker.ch>
+.PP
+This manual page by Alex van den Bogaerdt <alex@ergens.op.het.net>
diff --git a/doc/rrdgraph_data.html b/doc/rrdgraph_data.html
new file mode 100644 (file)
index 0000000..2dfe9b0
--- /dev/null
@@ -0,0 +1,132 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdgraph_data</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#def">DEF</a></li>
+       <li><a href="#vdef">VDEF</a></li>
+       <li><a href="#cdef">CDEF</a></li>
+       <li><a href="#see_also">SEE ALSO</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdgraph_data - preparing data for graphing in rrdtool graph</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p><strong>DEF:</strong><em>&lt;vname&gt;</em>=<em>&lt;rrdfile&gt;</em>:<em>&lt;ds-name&gt;</em>:<em>&lt;CF&gt;</em>[:step=<em>&lt;step&gt;</em>][:start=<em>&lt;time&gt;</em>][:end=<em>&lt;time&gt;</em>][:reduce=<em>&lt;<strong>CF</strong>&gt;</em>]</p>
+<p><strong>VDEF</strong>:<em>vname</em>=<em>RPN expression</em></p>
+<p><strong>CDEF</strong>:<em>vname</em>=<em>RPN expression</em></p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>These three instructions extract data values out of the <strong>RRD</strong> files,
+optionally altering them (think, for example, of a bytes to bits
+conversion). If so desired, you can also define variables containing
+useful information such as maximum, minimum etcetera. Two of the
+instructions use a language called <strong>RPN</strong> which is described in its
+own manual page.</p>
+<p>Variable names (<em>vname</em>) must be made up strings of the following characters
+<code>A-Z, a-z, 0-9, -,_</code> and a maximum length of 255 characters.</p>
+<p>When picking variable names, make sure you do not choose a name that is
+already taken by an RPN operator. A save bet it to use lowercase or
+mixedcase names for variables since operators will always be in uppercase.</p>
+<p>
+</p>
+<hr />
+<h1><a name="def">DEF</a></h1>
+<p><strong>DEF:</strong><em>&lt;vname&gt;</em>=<em>&lt;rrdfile&gt;</em>:<em>&lt;ds-name&gt;</em>:<em>&lt;CF&gt;</em>[:step=<em>&lt;step&gt;</em>][:start=<em>&lt;time&gt;</em>][:end=<em>&lt;time&gt;</em>][:reduce=<em>&lt;<strong>CF</strong>&gt;</em>]</p>
+<p>This command fetches data from an <strong>RRD</strong> file.  The virtual name
+<em>vname</em> can then be used throughout the rest of the script. By
+default, an <strong>RRA</strong> which contains the correct consolidated data
+at an appropriate resolution will be chosen.  The resolution can
+be overridden with the <a href="././rrdgraph.html#item_time">--step</a> option.
+The resolution can again be overridden by specifying the <strong>step size</strong>.
+The time span of this data is the same as for the graph by default,
+you can override this by specifying <strong>start and end</strong>.  Remember to
+escape colons in the time specification!</p>
+<p>If the resolution of the data is higher than the resolution of the
+graph, the data will be further consolidated. This may result in
+a graph that spans slightly more time than requested.
+Ideally each point in the graph should correspond with one <strong>CDP</strong>
+from an <strong>RRA</strong>.  For instance, if your <strong>RRD</strong> has an <strong>RRA</strong> with
+a resolution of 1800 seconds per <strong>CDP</strong>, you should create an
+image with width 400 and time span 400*1800 seconds (use appropriate
+start and end times, such as <code>--start end-8days8hours</code>).</p>
+<p>If consolidation needs to be done, the <strong>CF</strong> of the <strong>RRA</strong> specified in the
+<strong>DEF</strong> itself will be used to reduce the data density. This behaviour can
+be changed using <code>:reduce=&lt;CF&gt;</code>.  This optional parameter
+specifies the <strong>CF</strong> to use during the data reduction phase.</p>
+<p>Example:</p>
+<pre>
+        DEF:ds0=router.rrd:ds0:AVERAGE
+        DEF:ds0weekly=router.rrd:ds0:AVERAGE:step=7200
+        DEF:ds0weekly=router.rrd:ds0:AVERAGE:start=end-1h
+        DEF:ds0weekly=router.rrd:ds0:AVERAGE:start=11\:00:end=start+1h</pre>
+<p>
+</p>
+<hr />
+<h1><a name="vdef">VDEF</a></h1>
+<p><strong>VDEF</strong>:<em>vname</em>=<em>RPN expression</em></p>
+<p>This command returns a value and/or a time according to the <strong>RPN</strong>
+statements used. The resulting <em>vname</em> will, depending on the
+functions used, have a value and a time component.  When you use
+this <em>vname</em> in another <strong>RPN</strong> expression, you are effectively
+inserting its value just as if you had put a number at that place.
+The variable can also be used in the various graph and print
+elements.</p>
+<p>Example: <code>VDEF:avg=mydata,AVERAGE</code></p>
+<p>Note that currently only agregation functions work in VDEF rpn expressions.
+Patches to change this are welcome.</p>
+<p>
+</p>
+<hr />
+<h1><a name="cdef">CDEF</a></h1>
+<p><strong>CDEF</strong>:<em>vname</em>=<em>RPN expression</em></p>
+<p>This command creates a new set of data points (in memory only, not
+in the <strong>RRD</strong> file) out of one or more other data series. The <strong>RPN</strong>
+instructions are used to evaluate a mathematical function on each
+data point. The resulting <em>vname</em> can then be used further on in
+the script, just as if it were generated by a <strong>DEF</strong> instruction.</p>
+<p>Example: <code>CDEF:mydatabits=mydata,8,*</code></p>
+<p>
+</p>
+<hr />
+<h1><a name="see_also">SEE ALSO</a></h1>
+<p><a href="././rrdgraph.html">the rrdgraph manpage</a> gives an overview of how <strong>rrdtool graph</strong> works.
+<a href="././rrdgraph_data.html">the rrdgraph_data manpage</a> describes <strong>DEF</strong>,<strong>CDEF</strong> and <strong>VDEF</strong> in detail.
+<a href="././rrdgraph_rpn.html">the rrdgraph_rpn manpage</a> describes the <strong>RPN</strong> language used in the <strong>?DEF</strong> statements.
+<a href="././rrdgraph_graph.html">the rrdgraph_graph manpage</a> page describes all of the graph and print functions.</p>
+<p>Make sure to read <a href="././rrdgraph_examples.html">the rrdgraph_examples manpage</a> for tips&amp;tricks.</p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Program by Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
+<p>This manual page by Alex van den Bogaerdt &lt;<a href="mailto:alex@ergens.op.het.net">alex@ergens.op.het.net</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdgraph_data.pod b/doc/rrdgraph_data.pod
new file mode 100644 (file)
index 0000000..6c8b28a
--- /dev/null
@@ -0,0 +1,106 @@
+=head1 NAME
+
+rrdgraph_data - preparing data for graphing in rrdtool graph
+
+=head1 SYNOPSIS
+
+B<DEF:>I<E<lt>vnameE<gt>>=I<E<lt>rrdfileE<gt>>:I<E<lt>ds-nameE<gt>>:I<E<lt>CFE<gt>>[:step=I<E<lt>stepE<gt>>][:start=I<E<lt>timeE<gt>>][:end=I<E<lt>timeE<gt>>][:reduce=I<E<lt>B<CF>E<gt>>]
+
+B<VDEF>:I<vname>=I<RPN expression>
+
+B<CDEF>:I<vname>=I<RPN expression>
+
+=head1 DESCRIPTION
+
+These three instructions extract data values out of the B<RRD> files,
+optionally altering them (think, for example, of a bytes to bits
+conversion). If so desired, you can also define variables containing
+useful information such as maximum, minimum etcetera. Two of the
+instructions use a language called B<RPN> which is described in its
+own manual page.
+
+Variable names (I<vname>) must be made up strings of the following characters
+C<A-Z, a-z, 0-9, -,_> and a maximum length of 255 characters.
+
+When picking variable names, make sure you do not choose a name that is
+already taken by an RPN operator. A save bet it to use lowercase or
+mixedcase names for variables since operators will always be in uppercase.
+
+=head1 DEF
+
+B<DEF:>I<E<lt>vnameE<gt>>=I<E<lt>rrdfileE<gt>>:I<E<lt>ds-nameE<gt>>:I<E<lt>CFE<gt>>[:step=I<E<lt>stepE<gt>>][:start=I<E<lt>timeE<gt>>][:end=I<E<lt>timeE<gt>>][:reduce=I<E<lt>B<CF>E<gt>>]
+
+This command fetches data from an B<RRD> file.  The virtual name
+I<vname> can then be used throughout the rest of the script. By
+default, an B<RRA> which contains the correct consolidated data
+at an appropriate resolution will be chosen.  The resolution can
+be overridden with the L<--step|rrdgraph/item_Time> option.
+The resolution can again be overridden by specifying the B<step size>.
+The time span of this data is the same as for the graph by default,
+you can override this by specifying B<start and end>.  Remember to
+escape colons in the time specification!
+
+If the resolution of the data is higher than the resolution of the
+graph, the data will be further consolidated. This may result in
+a graph that spans slightly more time than requested.
+Ideally each point in the graph should correspond with one B<CDP>
+from an B<RRA>.  For instance, if your B<RRD> has an B<RRA> with
+a resolution of 1800 seconds per B<CDP>, you should create an
+image with width 400 and time span 400*1800 seconds (use appropriate
+start and end times, such as C<--start end-8days8hours>).
+
+If consolidation needs to be done, the B<CF> of the B<RRA> specified in the
+B<DEF> itself will be used to reduce the data density. This behaviour can
+be changed using C<:reduce=I<E<lt>B<CF>E<gt>>>.  This optional parameter
+specifies the B<CF> to use during the data reduction phase.
+
+Example:
+
+        DEF:ds0=router.rrd:ds0:AVERAGE
+        DEF:ds0weekly=router.rrd:ds0:AVERAGE:step=7200
+        DEF:ds0weekly=router.rrd:ds0:AVERAGE:start=end-1h
+        DEF:ds0weekly=router.rrd:ds0:AVERAGE:start=11\:00:end=start+1h
+
+=head1 VDEF
+
+B<VDEF>:I<vname>=I<RPN expression>
+
+This command returns a value and/or a time according to the B<RPN>
+statements used. The resulting I<vname> will, depending on the
+functions used, have a value and a time component.  When you use
+this I<vname> in another B<RPN> expression, you are effectively
+inserting its value just as if you had put a number at that place.
+The variable can also be used in the various graph and print
+elements.
+
+Example: C<VDEF:avg=mydata,AVERAGE>
+
+Note that currently only agregation functions work in VDEF rpn expressions.
+Patches to change this are welcome.
+
+=head1 CDEF
+
+B<CDEF>:I<vname>=I<RPN expression>
+
+This command creates a new set of data points (in memory only, not
+in the B<RRD> file) out of one or more other data series. The B<RPN>
+instructions are used to evaluate a mathematical function on each
+data point. The resulting I<vname> can then be used further on in
+the script, just as if it were generated by a B<DEF> instruction.
+
+Example: C<CDEF:mydatabits=mydata,8,*>
+
+=head1 SEE ALSO
+
+L<rrdgraph> gives an overview of how B<rrdtool graph> works.
+L<rrdgraph_data> describes B<DEF>,B<CDEF> and B<VDEF> in detail.
+L<rrdgraph_rpn> describes the B<RPN> language used in the B<?DEF> statements.
+L<rrdgraph_graph> page describes all of the graph and print functions.
+
+Make sure to read L<rrdgraph_examples> for tipsE<amp>tricks.
+
+=head1 AUTHOR
+
+Program by Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
+
+This manual page by Alex van den Bogaerdt E<lt>alex@ergens.op.het.netE<gt>
diff --git a/doc/rrdgraph_data.txt b/doc/rrdgraph_data.txt
new file mode 100644 (file)
index 0000000..23fd316
--- /dev/null
@@ -0,0 +1,107 @@
+RRDGRAPH_DATA(1)                    rrdtool                   RRDGRAPH_DATA(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdgraph_data - preparing data for graphing in rrdtool graph
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       D\bDE\bEF\bF:\b:_\b<_\bv_\bn_\ba_\bm_\be_\b>=_\b<_\br_\br_\bd_\bf_\bi_\bl_\be_\b>:_\b<_\bd_\bs_\b-
+       _\bn_\ba_\bm_\be_\b>:_\b<_\bC_\bF_\b>[:step=_\b<_\bs_\bt_\be_\bp_\b>][:start=_\b<_\bt_\bi_\bm_\be_\b>][:end=_\b<_\bt_\bi_\bm_\be_\b>][:reduce=_\b<_\bC\bC_\bF\bF_\b>]
+
+       V\bVD\bDE\bEF\bF:_\bv_\bn_\ba_\bm_\be=_\bR_\bP_\bN _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn
+
+       C\bCD\bDE\bEF\bF:_\bv_\bn_\ba_\bm_\be=_\bR_\bP_\bN _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       These three instructions extract data values out of the R\bRR\bRD\bD files,
+       optionally altering them (think, for example, of a bytes to bits con-
+       version). If so desired, you can also define variables containing use-
+       ful information such as maximum, minimum etcetera. Two of the instruc-
+       tions use a language called R\bRP\bPN\bN which is described in its own manual
+       page.
+
+       Variable names (_\bv_\bn_\ba_\bm_\be) must be made up strings of the following charac-
+       ters "A-Z, a-z, 0-9, -,_" and a maximum length of 255 characters.
+
+       When picking variable names, make sure you do not choose a name that is
+       already taken by an RPN operator. A save bet it to use lowercase or
+       mixedcase names for variables since operators will always be in upper-
+       case.
+
+D\bDE\bEF\bF
+       D\bDE\bEF\bF:\b:_\b<_\bv_\bn_\ba_\bm_\be_\b>=_\b<_\br_\br_\bd_\bf_\bi_\bl_\be_\b>:_\b<_\bd_\bs_\b-
+       _\bn_\ba_\bm_\be_\b>:_\b<_\bC_\bF_\b>[:step=_\b<_\bs_\bt_\be_\bp_\b>][:start=_\b<_\bt_\bi_\bm_\be_\b>][:end=_\b<_\bt_\bi_\bm_\be_\b>][:reduce=_\b<_\bC\bC_\bF\bF_\b>]
+
+       This command fetches data from an R\bRR\bRD\bD file.  The virtual name _\bv_\bn_\ba_\bm_\be can
+       then be used throughout the rest of the script. By default, an R\bRR\bRA\bA
+       which contains the correct consolidated data at an appropriate resolu-
+       tion will be chosen.  The resolution can be overridden with the --step
+       option.  The resolution can again be overridden by specifying the s\bst\bte\bep\bp
+       s\bsi\biz\bze\be.  The time span of this data is the same as for the graph by
+       default, you can override this by specifying s\bst\bta\bar\brt\bt a\ban\bnd\bd e\ben\bnd\bd.  Remember
+       to escape colons in the time specification!
+
+       If the resolution of the data is higher than the resolution of the
+       graph, the data will be further consolidated. This may result in a
+       graph that spans slightly more time than requested.  Ideally each point
+       in the graph should correspond with one C\bCD\bDP\bP from an R\bRR\bRA\bA.  For instance,
+       if your R\bRR\bRD\bD has an R\bRR\bRA\bA with a resolution of 1800 seconds per C\bCD\bDP\bP, you
+       should create an image with width 400 and time span 400*1800 seconds
+       (use appropriate start and end times, such as "--start
+       end-8days8hours").
+
+       If consolidation needs to be done, the C\bCF\bF of the R\bRR\bRA\bA specified in the
+       D\bDE\bEF\bF itself will be used to reduce the data density. This behaviour can
+       be changed using ":reduce=<CF>".  This optional parameter specifies the
+       C\bCF\bF to use during the data reduction phase.
+
+       Example:
+
+               DEF:ds0=router.rrd:ds0:AVERAGE
+               DEF:ds0weekly=router.rrd:ds0:AVERAGE:step=7200
+               DEF:ds0weekly=router.rrd:ds0:AVERAGE:start=end-1h
+               DEF:ds0weekly=router.rrd:ds0:AVERAGE:start=11\:00:end=start+1h
+
+V\bVD\bDE\bEF\bF
+       V\bVD\bDE\bEF\bF:_\bv_\bn_\ba_\bm_\be=_\bR_\bP_\bN _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn
+
+       This command returns a value and/or a time according to the R\bRP\bPN\bN state-
+       ments used. The resulting _\bv_\bn_\ba_\bm_\be will, depending on the functions used,
+       have a value and a time component.  When you use this _\bv_\bn_\ba_\bm_\be in another
+       R\bRP\bPN\bN expression, you are effectively inserting its value just as if you
+       had put a number at that place.  The variable can also be used in the
+       various graph and print elements.
+
+       Example: "VDEF:avg=mydata,AVERAGE"
+
+       Note that currently only agregation functions work in VDEF rpn expres-
+       sions.  Patches to change this are welcome.
+
+C\bCD\bDE\bEF\bF
+       C\bCD\bDE\bEF\bF:_\bv_\bn_\ba_\bm_\be=_\bR_\bP_\bN _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn
+
+       This command creates a new set of data points (in memory only, not in
+       the R\bRR\bRD\bD file) out of one or more other data series. The R\bRP\bPN\bN instruc-
+       tions are used to evaluate a mathematical function on each data point.
+       The resulting _\bv_\bn_\ba_\bm_\be can then be used further on in the script, just as
+       if it were generated by a D\bDE\bEF\bF instruction.
+
+       Example: "CDEF:mydatabits=mydata,8,*"
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+       rrdgraph gives an overview of how r\brr\brd\bdt\bto\boo\bol\bl g\bgr\bra\bap\bph\bh works.  rrdgraph_data
+       describes D\bDE\bEF\bF,C\bCD\bDE\bEF\bF and V\bVD\bDE\bEF\bF in detail.  rrdgraph_rpn describes the R\bRP\bPN\bN
+       language used in the ?\b?D\bDE\bEF\bF statements.  rrdgraph_graph page describes
+       all of the graph and print functions.
+
+       Make sure to read rrdgraph_examples for tips&tricks.
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Program by Tobias Oetiker <tobi@oetiker.ch>
+
+       This manual page by Alex van den Bogaerdt <alex@ergens.op.het.net>
+
+
+
+1.2.26                            2007-11-20                  RRDGRAPH_DATA(1)
diff --git a/doc/rrdgraph_examples.1 b/doc/rrdgraph_examples.1
new file mode 100644 (file)
index 0000000..163f34f
--- /dev/null
@@ -0,0 +1,279 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDGRAPH_EXAMPLES 1"
+.TH RRDGRAPH_EXAMPLES 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdgraph_examples \- Examples for rrdtool graph
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBrrdtool graph /home/httpd/html/test.png \-\-img\-format \s-1PNG\s0\fR
+.PP
+followed by any of the examples below
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+For your convenience some of the commands are explained here
+by using detailed examples. They are not always cut-and-paste
+ready because comments are intermixed with the examples.
+.SH "EXAMPLES"
+.IX Header "EXAMPLES"
+.Sh "Data with multiple resolutions"
+.IX Subsection "Data with multiple resolutions"
+.Vb 7
+\&    \-\-end now \-\-start end\-120000s \-\-width 400
+\&    DEF:ds0a=/home/rrdtool/data/router1.rrd:ds0:AVERAGE
+\&    DEF:ds0b=/home/rrdtool/data/router1.rrd:ds0:AVERAGE:step=1800
+\&    DEF:ds0c=/home/rrdtool/data/router1.rrd:ds0:AVERAGE:step=7200
+\&    LINE1:ds0a#0000FF:"default resolution\el"
+\&    LINE1:ds0b#00CCFF:"resolution 1800 seconds per interval\el"
+\&    LINE1:ds0c#FF00FF:"resolution 7200 seconds per interval\el"
+.Ve
+.Sh "Nicely formatted legend section"
+.IX Subsection "Nicely formatted legend section"
+.Vb 10
+\&    DEF:ds0=/home/rrdtool/data/router1.rrd:ds0:AVERAGE
+\&    DEF:ds1=/home/rrdtool/data/router1.rrd:ds1:AVERAGE
+\&    VDEF:ds0max=ds0,MAXIMUM
+\&    VDEF:ds0avg=ds0,AVERAGE
+\&    VDEF:ds0min=ds0,MINIMUM
+\&    VDEF:ds0pct=ds0,95,PERCENT
+\&    VDEF:ds1max=ds1,MAXIMUM
+\&    VDEF:ds1avg=ds1,AVERAGE
+\&    VDEF:ds1min=ds1,MINIMUM
+\&    VDEF:ds1pct=ds1,95,PERCENT
+.Ve
+.PP
+Note: consolidation occurs here.
+.PP
+.Vb 2
+\&    CDEF:ds0bits=ds0,8,*
+\&    CDEF:ds1bits=ds1,8,*
+.Ve
+.PP
+Note: 10 spaces to move text to the right
+.PP
+.Vb 1
+\&    COMMENT:"          "
+.Ve
+.PP
+Note: the column titles have to be as wide as the columns
+.PP
+.Vb 3
+\&    COMMENT:"Maximum    "
+\&    COMMENT:"Average    "
+\&    COMMENT:"Minimum    "
+.Ve
+.PP
+.Vb 11
+\&    COMMENT:"95th percentile\el"
+\&    AREA:ds0bits#00C000:"Inbound "
+\&    GPRINT:ds0max:"%6.2lf %Sbps"
+\&    GPRINT:ds0avg:"%6.2lf %Sbps"
+\&    GPRINT:ds0min:"%6.2lf %Sbps"
+\&    GPRINT:ds0pct:"%6.2lf %Sbps\el"
+\&    LINE1:ds1bits#0000FF:"Outbound"
+\&    GPRINT:ds1max:"%6.2lf %Sbps"
+\&    GPRINT:ds1avg:"%6.2lf %Sbps"
+\&    GPRINT:ds1min:"%6.2lf %Sbps"
+\&    GPRINT:ds1pct:"%6.2lf %Sbps\el"
+.Ve
+.Sh "Offsetting a line on the y\-axis"
+.IX Subsection "Offsetting a line on the y-axis"
+Depending on your needs you can do this in two ways:
+.IP "\(bu" 4
+Offset the data, then graph this
+.Sp
+.Vb 1
+\&    DEF:mydata=my.rrd:ds:AVERAGE
+.Ve
+.Sp
+Note: this will also influence any other command that uses \*(L"data\*(R"
+.Sp
+.Vb 2
+\&    CDEF:data=mydata,100,+
+\&    LINE1:data#FF0000:"Data with offset"
+.Ve
+.IP "\(bu" 4
+Graph the original data, with an offset
+.Sp
+.Vb 1
+\&    DEF:mydata=my.rrd:ds:AVERAGE
+.Ve
+.Sp
+Note: no color in the first line so it is not visible
+.Sp
+.Vb 1
+\&    LINE1:100
+.Ve
+.Sp
+Note: the second line gets stacked on top of the first one
+.Sp
+.Vb 1
+\&    LINE1:data#FF0000:"Data with offset":STACK
+.Ve
+.Sh "Time ranges"
+.IX Subsection "Time ranges"
+.Vb 6
+\&    Last four weeks: \-\-start end\-4w \-\-end 00:00
+\&    January 2001:    \-\-start 20010101 \-\-end start+31d
+\&    January 2001:    \-\-start 20010101 \-\-end 20010201
+\&    Last hour:       \-\-start end\-1h
+\&    Last 24 hours:   <nothing at all>
+\&    Yesterday:       \-\-end 00:00
+.Ve
+.Sh "Viewing the current and previous week together"
+.IX Subsection "Viewing the current and previous week together"
+.Vb 3
+\&    \-\-end now \-\-start end\-1w
+\&    DEF:thisweek=router.rrd:ds0:AVERAGE
+\&    DEF:lastweek=router.rrd:ds0:AVERAGE:end=now\-1w:start=end\-1w
+.Ve
+.PP
+Shift the data forward by one week (604800 seconds)
+.PP
+.Vb 4
+\&    SHIFT:lastweek:604800
+\&    [ more of the usual VDEF and CDEF stuff if you like ]
+\&    AREA:lastweek#0000FF:Last\e week
+\&    LINE1:thisweek#FF0000:This\e week
+.Ve
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+rrdgraph gives an overview of how \fBrrdtool graph\fR works.
+rrdgraph_data describes \fB\s-1DEF\s0\fR,\fB\s-1CDEF\s0\fR and \fB\s-1VDEF\s0\fR in detail.
+rrdgraph_rpn describes the \fB\s-1RPN\s0\fR language used in the \fBxDEF\fR statements.
+rrdgraph_graph page describes all the graph and print functions.
+.PP
+Make sure to read rrdgraph_examples for tips&tricks.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Program by Tobias Oetiker <tobi@oetiker.ch>
+.PP
+This manual page by Alex van den Bogaerdt <alex@ergens.op.het.net>
diff --git a/doc/rrdgraph_examples.html b/doc/rrdgraph_examples.html
new file mode 100644 (file)
index 0000000..5ba61d6
--- /dev/null
@@ -0,0 +1,174 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdgraph_examples</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#examples">EXAMPLES</a></li>
+       <ul>
+
+               <li><a href="#data_with_multiple_resolutions">Data with multiple resolutions</a></li>
+               <li><a href="#nicely_formatted_legend_section">Nicely formatted legend section</a></li>
+               <li><a href="#offsetting_a_line_on_the_yaxis">Offsetting a line on the y-axis</a></li>
+               <li><a href="#time_ranges">Time ranges</a></li>
+               <li><a href="#viewing_the_current_and_previous_week_together">Viewing the current and previous week together</a></li>
+       </ul>
+
+       <li><a href="#see_also">SEE ALSO</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdgraph_examples - Examples for rrdtool graph</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p><strong>rrdtool graph /home/httpd/html/test.png --img-format PNG</strong></p>
+<p>followed by any of the examples below</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>For your convenience some of the commands are explained here
+by using detailed examples. They are not always cut-and-paste
+ready because comments are intermixed with the examples.</p>
+<p>
+</p>
+<hr />
+<h1><a name="examples">EXAMPLES</a></h1>
+<p>
+</p>
+<h2><a name="data_with_multiple_resolutions">Data with multiple resolutions</a></h2>
+<pre>
+    --end now --start end-120000s --width 400
+    DEF:ds0a=/home/rrdtool/data/router1.rrd:ds0:AVERAGE
+    DEF:ds0b=/home/rrdtool/data/router1.rrd:ds0:AVERAGE:step=1800
+    DEF:ds0c=/home/rrdtool/data/router1.rrd:ds0:AVERAGE:step=7200
+    LINE1:ds0a#0000FF:&quot;default resolution\l&quot;
+    LINE1:ds0b#00CCFF:&quot;resolution 1800 seconds per interval\l&quot;
+    LINE1:ds0c#FF00FF:&quot;resolution 7200 seconds per interval\l&quot;</pre>
+<p>
+</p>
+<h2><a name="nicely_formatted_legend_section">Nicely formatted legend section</a></h2>
+<pre>
+    DEF:ds0=/home/rrdtool/data/router1.rrd:ds0:AVERAGE
+    DEF:ds1=/home/rrdtool/data/router1.rrd:ds1:AVERAGE
+    VDEF:ds0max=ds0,MAXIMUM
+    VDEF:ds0avg=ds0,AVERAGE
+    VDEF:ds0min=ds0,MINIMUM
+    VDEF:ds0pct=ds0,95,PERCENT
+    VDEF:ds1max=ds1,MAXIMUM
+    VDEF:ds1avg=ds1,AVERAGE
+    VDEF:ds1min=ds1,MINIMUM
+    VDEF:ds1pct=ds1,95,PERCENT</pre>
+<p>Note: consolidation occurs here.</p>
+<pre>
+    CDEF:ds0bits=ds0,8,*
+    CDEF:ds1bits=ds1,8,*</pre>
+<p>Note: 10 spaces to move text to the right</p>
+<pre>
+    COMMENT:&quot;          &quot;</pre>
+<p>Note: the column titles have to be as wide as the columns</p>
+<pre>
+    COMMENT:&quot;Maximum    &quot;
+    COMMENT:&quot;Average    &quot;
+    COMMENT:&quot;Minimum    &quot;</pre>
+<pre>
+    COMMENT:&quot;95th percentile\l&quot;
+    AREA:ds0bits#00C000:&quot;Inbound &quot;
+    GPRINT:ds0max:&quot;%6.2lf %Sbps&quot;
+    GPRINT:ds0avg:&quot;%6.2lf %Sbps&quot;
+    GPRINT:ds0min:&quot;%6.2lf %Sbps&quot;
+    GPRINT:ds0pct:&quot;%6.2lf %Sbps\l&quot;
+    LINE1:ds1bits#0000FF:&quot;Outbound&quot;
+    GPRINT:ds1max:&quot;%6.2lf %Sbps&quot;
+    GPRINT:ds1avg:&quot;%6.2lf %Sbps&quot;
+    GPRINT:ds1min:&quot;%6.2lf %Sbps&quot;
+    GPRINT:ds1pct:&quot;%6.2lf %Sbps\l&quot;</pre>
+<p>
+</p>
+<h2><a name="offsetting_a_line_on_the_yaxis">Offsetting a line on the y-axis</a></h2>
+<p>Depending on your needs you can do this in two ways:</p>
+<ul>
+<li>
+<p>Offset the data, then graph this</p>
+<pre>
+    DEF:mydata=my.rrd:ds:AVERAGE</pre>
+<p>Note: this will also influence any other command that uses ``data''</p>
+<pre>
+    CDEF:data=mydata,100,+
+    LINE1:data#FF0000:&quot;Data with offset&quot;</pre>
+</li>
+<li>
+<p>Graph the original data, with an offset</p>
+<pre>
+    DEF:mydata=my.rrd:ds:AVERAGE</pre>
+<p>Note: no color in the first line so it is not visible</p>
+<pre>
+    LINE1:100</pre>
+<p>Note: the second line gets stacked on top of the first one</p>
+<pre>
+    LINE1:data#FF0000:&quot;Data with offset&quot;:STACK</pre>
+</li>
+</ul>
+<p>
+</p>
+<h2><a name="time_ranges">Time ranges</a></h2>
+<pre>
+    Last four weeks: --start end-4w --end 00:00
+    January 2001:    --start 20010101 --end start+31d
+    January 2001:    --start 20010101 --end 20010201
+    Last hour:       --start end-1h
+    Last 24 hours:   &lt;nothing at all&gt;
+    Yesterday:       --end 00:00</pre>
+<p>
+</p>
+<h2><a name="viewing_the_current_and_previous_week_together">Viewing the current and previous week together</a></h2>
+<pre>
+    --end now --start end-1w
+    DEF:thisweek=router.rrd:ds0:AVERAGE
+    DEF:lastweek=router.rrd:ds0:AVERAGE:end=now-1w:start=end-1w</pre>
+<p>Shift the data forward by one week (604800 seconds)</p>
+<pre>
+    SHIFT:lastweek:604800
+    [ more of the usual VDEF and CDEF stuff if you like ]
+    AREA:lastweek#0000FF:Last\ week
+    LINE1:thisweek#FF0000:This\ week</pre>
+<p>
+</p>
+<hr />
+<h1><a name="see_also">SEE ALSO</a></h1>
+<p><a href="././rrdgraph.html">the rrdgraph manpage</a> gives an overview of how <strong>rrdtool graph</strong> works.
+<a href="././rrdgraph_data.html">the rrdgraph_data manpage</a> describes <strong>DEF</strong>,<strong>CDEF</strong> and <strong>VDEF</strong> in detail.
+<a href="././rrdgraph_rpn.html">the rrdgraph_rpn manpage</a> describes the <strong>RPN</strong> language used in the <strong>xDEF</strong> statements.
+<a href="././rrdgraph_graph.html">the rrdgraph_graph manpage</a> page describes all the graph and print functions.</p>
+<p>Make sure to read <a href="././rrdgraph_examples.html">the rrdgraph_examples manpage</a> for tips&amp;tricks.</p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Program by Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
+<p>This manual page by Alex van den Bogaerdt &lt;<a href="mailto:alex@ergens.op.het.net">alex@ergens.op.het.net</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdgraph_examples.pod b/doc/rrdgraph_examples.pod
new file mode 100644 (file)
index 0000000..64e3840
--- /dev/null
@@ -0,0 +1,137 @@
+=head1 NAME
+
+rrdgraph_examples - Examples for rrdtool graph
+
+=head1 SYNOPSIS
+
+B<rrdtool graph /home/httpd/html/test.png --img-format PNG>
+
+followed by any of the examples below
+
+=head1 DESCRIPTION
+
+For your convenience some of the commands are explained here
+by using detailed examples. They are not always cut-and-paste
+ready because comments are intermixed with the examples.
+
+=head1 EXAMPLES
+
+=head2 Data with multiple resolutions
+
+    --end now --start end-120000s --width 400
+    DEF:ds0a=/home/rrdtool/data/router1.rrd:ds0:AVERAGE
+    DEF:ds0b=/home/rrdtool/data/router1.rrd:ds0:AVERAGE:step=1800
+    DEF:ds0c=/home/rrdtool/data/router1.rrd:ds0:AVERAGE:step=7200
+    LINE1:ds0a#0000FF:"default resolution\l"
+    LINE1:ds0b#00CCFF:"resolution 1800 seconds per interval\l"
+    LINE1:ds0c#FF00FF:"resolution 7200 seconds per interval\l"
+
+=head2 Nicely formatted legend section
+
+    DEF:ds0=/home/rrdtool/data/router1.rrd:ds0:AVERAGE
+    DEF:ds1=/home/rrdtool/data/router1.rrd:ds1:AVERAGE
+    VDEF:ds0max=ds0,MAXIMUM
+    VDEF:ds0avg=ds0,AVERAGE
+    VDEF:ds0min=ds0,MINIMUM
+    VDEF:ds0pct=ds0,95,PERCENT
+    VDEF:ds1max=ds1,MAXIMUM
+    VDEF:ds1avg=ds1,AVERAGE
+    VDEF:ds1min=ds1,MINIMUM
+    VDEF:ds1pct=ds1,95,PERCENT
+
+Note: consolidation occurs here.
+
+    CDEF:ds0bits=ds0,8,*
+    CDEF:ds1bits=ds1,8,*
+
+Note: 10 spaces to move text to the right
+
+    COMMENT:"          "
+
+Note: the column titles have to be as wide as the columns
+
+    COMMENT:"Maximum    "
+    COMMENT:"Average    "
+    COMMENT:"Minimum    "
+
+    COMMENT:"95th percentile\l"
+    AREA:ds0bits#00C000:"Inbound "
+    GPRINT:ds0max:"%6.2lf %Sbps"
+    GPRINT:ds0avg:"%6.2lf %Sbps"
+    GPRINT:ds0min:"%6.2lf %Sbps"
+    GPRINT:ds0pct:"%6.2lf %Sbps\l"
+    LINE1:ds1bits#0000FF:"Outbound"
+    GPRINT:ds1max:"%6.2lf %Sbps"
+    GPRINT:ds1avg:"%6.2lf %Sbps"
+    GPRINT:ds1min:"%6.2lf %Sbps"
+    GPRINT:ds1pct:"%6.2lf %Sbps\l"
+
+=head2 Offsetting a line on the y-axis
+
+Depending on your needs you can do this in two ways:
+
+=over 4
+
+=item *
+
+Offset the data, then graph this
+
+    DEF:mydata=my.rrd:ds:AVERAGE
+
+Note: this will also influence any other command that uses "data"
+
+    CDEF:data=mydata,100,+
+    LINE1:data#FF0000:"Data with offset"
+
+=item *
+
+Graph the original data, with an offset
+
+    DEF:mydata=my.rrd:ds:AVERAGE
+
+Note: no color in the first line so it is not visible
+
+    LINE1:100
+
+Note: the second line gets stacked on top of the first one
+
+    LINE1:data#FF0000:"Data with offset":STACK
+
+=back
+
+=head2 Time ranges
+
+    Last four weeks: --start end-4w --end 00:00
+    January 2001:    --start 20010101 --end start+31d
+    January 2001:    --start 20010101 --end 20010201
+    Last hour:       --start end-1h
+    Last 24 hours:   <nothing at all>
+    Yesterday:       --end 00:00
+
+=head2 Viewing the current and previous week together
+
+    --end now --start end-1w
+    DEF:thisweek=router.rrd:ds0:AVERAGE
+    DEF:lastweek=router.rrd:ds0:AVERAGE:end=now-1w:start=end-1w
+
+Shift the data forward by one week (604800 seconds)
+
+    SHIFT:lastweek:604800
+    [ more of the usual VDEF and CDEF stuff if you like ]
+    AREA:lastweek#0000FF:Last\ week
+    LINE1:thisweek#FF0000:This\ week
+
+=head1 SEE ALSO
+
+L<rrdgraph> gives an overview of how B<rrdtool graph> works.
+L<rrdgraph_data> describes B<DEF>,B<CDEF> and B<VDEF> in detail.
+L<rrdgraph_rpn> describes the B<RPN> language used in the B<xDEF> statements.
+L<rrdgraph_graph> page describes all the graph and print functions.
+
+Make sure to read L<rrdgraph_examples> for tipsE<amp>tricks.
+
+=head1 AUTHOR
+
+Program by Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
+
+This manual page by Alex van den Bogaerdt E<lt>alex@ergens.op.het.netE<gt>
diff --git a/doc/rrdgraph_examples.txt b/doc/rrdgraph_examples.txt
new file mode 100644 (file)
index 0000000..369e3b5
--- /dev/null
@@ -0,0 +1,131 @@
+RRDGRAPH_EXAMPLES(1)                rrdtool               RRDGRAPH_EXAMPLES(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdgraph_examples - Examples for rrdtool graph
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       r\brr\brd\bdt\bto\boo\bol\bl g\bgr\bra\bap\bph\bh /\b/h\bho\bom\bme\be/\b/h\bht\btt\btp\bpd\bd/\b/h\bht\btm\bml\bl/\b/t\bte\bes\bst\bt.\b.p\bpn\bng\bg -\b--\b-i\bim\bmg\bg-\b-f\bfo\bor\brm\bma\bat\bt P\bPN\bNG\bG
+
+       followed by any of the examples below
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       For your convenience some of the commands are explained here by using
+       detailed examples. They are not always cut-and-paste ready because com-
+       ments are intermixed with the examples.
+
+E\bEX\bXA\bAM\bMP\bPL\bLE\bES\bS
+       D\bDa\bat\bta\ba w\bwi\bit\bth\bh m\bmu\bul\blt\bti\bip\bpl\ble\be r\bre\bes\bso\bol\blu\but\bti\bio\bon\bns\bs
+
+           --end now --start end-120000s --width 400
+           DEF:ds0a=/home/rrdtool/data/router1.rrd:ds0:AVERAGE
+           DEF:ds0b=/home/rrdtool/data/router1.rrd:ds0:AVERAGE:step=1800
+           DEF:ds0c=/home/rrdtool/data/router1.rrd:ds0:AVERAGE:step=7200
+           LINE1:ds0a#0000FF:"default resolution\l"
+           LINE1:ds0b#00CCFF:"resolution 1800 seconds per interval\l"
+           LINE1:ds0c#FF00FF:"resolution 7200 seconds per interval\l"
+
+       N\bNi\bic\bce\bel\bly\by f\bfo\bor\brm\bma\bat\btt\bte\bed\bd l\ble\beg\bge\ben\bnd\bd s\bse\bec\bct\bti\bio\bon\bn
+
+           DEF:ds0=/home/rrdtool/data/router1.rrd:ds0:AVERAGE
+           DEF:ds1=/home/rrdtool/data/router1.rrd:ds1:AVERAGE
+           VDEF:ds0max=ds0,MAXIMUM
+           VDEF:ds0avg=ds0,AVERAGE
+           VDEF:ds0min=ds0,MINIMUM
+           VDEF:ds0pct=ds0,95,PERCENT
+           VDEF:ds1max=ds1,MAXIMUM
+           VDEF:ds1avg=ds1,AVERAGE
+           VDEF:ds1min=ds1,MINIMUM
+           VDEF:ds1pct=ds1,95,PERCENT
+
+       Note: consolidation occurs here.
+
+           CDEF:ds0bits=ds0,8,*
+           CDEF:ds1bits=ds1,8,*
+
+       Note: 10 spaces to move text to the right
+
+           COMMENT:"          "
+
+       Note: the column titles have to be as wide as the columns
+
+           COMMENT:"Maximum    "
+           COMMENT:"Average    "
+           COMMENT:"Minimum    "
+
+           COMMENT:"95th percentile\l"
+           AREA:ds0bits#00C000:"Inbound "
+           GPRINT:ds0max:"%6.2lf %Sbps"
+           GPRINT:ds0avg:"%6.2lf %Sbps"
+           GPRINT:ds0min:"%6.2lf %Sbps"
+           GPRINT:ds0pct:"%6.2lf %Sbps\l"
+           LINE1:ds1bits#0000FF:"Outbound"
+           GPRINT:ds1max:"%6.2lf %Sbps"
+           GPRINT:ds1avg:"%6.2lf %Sbps"
+           GPRINT:ds1min:"%6.2lf %Sbps"
+           GPRINT:ds1pct:"%6.2lf %Sbps\l"
+
+       O\bOf\bff\bfs\bse\bet\btt\bti\bin\bng\bg a\ba l\bli\bin\bne\be o\bon\bn t\bth\bhe\be y\by-\b-a\bax\bxi\bis\bs
+
+       Depending on your needs you can do this in two ways:
+
+       Â·   Offset the data, then graph this
+
+               DEF:mydata=my.rrd:ds:AVERAGE
+
+           Note: this will also influence any other command that uses "data"
+
+               CDEF:data=mydata,100,+
+               LINE1:data#FF0000:"Data with offset"
+
+       Â·   Graph the original data, with an offset
+
+               DEF:mydata=my.rrd:ds:AVERAGE
+
+           Note: no color in the first line so it is not visible
+
+               LINE1:100
+
+           Note: the second line gets stacked on top of the first one
+
+               LINE1:data#FF0000:"Data with offset":STACK
+
+       T\bTi\bim\bme\be r\bra\ban\bng\bge\bes\bs
+
+           Last four weeks: --start end-4w --end 00:00
+           January 2001:    --start 20010101 --end start+31d
+           January 2001:    --start 20010101 --end 20010201
+           Last hour:       --start end-1h
+           Last 24 hours:   <nothing at all>
+           Yesterday:       --end 00:00
+
+       V\bVi\bie\bew\bwi\bin\bng\bg t\bth\bhe\be c\bcu\bur\brr\bre\ben\bnt\bt a\ban\bnd\bd p\bpr\bre\bev\bvi\bio\bou\bus\bs w\bwe\bee\bek\bk t\bto\bog\bge\bet\bth\bhe\ber\br
+
+           --end now --start end-1w
+           DEF:thisweek=router.rrd:ds0:AVERAGE
+           DEF:lastweek=router.rrd:ds0:AVERAGE:end=now-1w:start=end-1w
+
+       Shift the data forward by one week (604800 seconds)
+
+           SHIFT:lastweek:604800
+           [ more of the usual VDEF and CDEF stuff if you like ]
+           AREA:lastweek#0000FF:Last\ week
+           LINE1:thisweek#FF0000:This\ week
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+       rrdgraph gives an overview of how r\brr\brd\bdt\bto\boo\bol\bl g\bgr\bra\bap\bph\bh works.  rrdgraph_data
+       describes D\bDE\bEF\bF,C\bCD\bDE\bEF\bF and V\bVD\bDE\bEF\bF in detail.  rrdgraph_rpn describes the R\bRP\bPN\bN
+       language used in the x\bxD\bDE\bEF\bF statements.  rrdgraph_graph page describes
+       all the graph and print functions.
+
+       Make sure to read rrdgraph_examples for tips&tricks.
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Program by Tobias Oetiker <tobi@oetiker.ch>
+
+       This manual page by Alex van den Bogaerdt <alex@ergens.op.het.net>
+
+
+
+1.2.26                            2007-11-20              RRDGRAPH_EXAMPLES(1)
diff --git a/doc/rrdgraph_graph.1 b/doc/rrdgraph_graph.1
new file mode 100644 (file)
index 0000000..24e39dd
--- /dev/null
@@ -0,0 +1,422 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDGRAPH_GRAPH 1"
+.TH RRDGRAPH_GRAPH 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdgraph_graph \- rrdtool graph command reference
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fB\s-1PRINT\s0\fR\fB:\fR\fIvname\fR\fB:\fR\fIformat\fR
+.PP
+\&\fB\s-1GPRINT\s0\fR\fB:\fR\fIvname\fR\fB:\fR\fIformat\fR
+.PP
+\&\fB\s-1COMMENT\s0\fR\fB:\fR\fItext\fR
+.PP
+\&\fB\s-1VRULE\s0\fR\fB:\fR\fItime\fR\fB#\fR\fIcolor\fR[\fB:\fR\fIlegend\fR]
+.PP
+\&\fB\s-1HRULE\s0\fR\fB:\fR\fIvalue\fR\fB#\fR\fIcolor\fR[\fB:\fR\fIlegend\fR]
+.PP
+\&\fB\s-1LINE\s0\fR[\fIwidth\fR]\fB:\fR\fIvalue\fR[\fB#\fR\fIcolor\fR][\fB:\fR[\fIlegend\fR][\fB:STACK\fR]]
+.PP
+\&\fB\s-1AREA\s0\fR\fB:\fR\fIvalue\fR[\fB#\fR\fIcolor\fR][\fB:\fR[\fIlegend\fR][\fB:STACK\fR]]
+.PP
+\&\fB\s-1TICK\s0\fR\fB:\fR\fIvname\fR\fB#\fR\fIrrggbb\fR[\fIaa\fR][\fB:\fR\fIfraction\fR[\fB:\fR\fIlegend\fR]]
+.PP
+\&\fB\s-1SHIFT\s0\fR\fB:\fR\fIvname\fR\fB:\fR\fIoffset\fR
+.PP
+\&\fB\s-1PRINT\s0\fR\fB:\fR\fIvname\fR\fB:\fR\fI\s-1CF\s0\fR\fB:\fR\fIformat\fR (deprecated)
+.PP
+\&\fB\s-1GPRINT\s0\fR\fB:\fR\fIvname\fR\fB:\fR\fI\s-1CF\s0\fR\fB:\fR\fIformat\fR (deprecated)
+.PP
+\&\fB\s-1STACK\s0\fR\fB:\fR\fIvname\fR\fB#\fR\fIcolor\fR[\fB:\fR\fIlegend\fR] (deprecated)
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+These instructions allow you to generate your image or report.
+If you don't use any graph elements, no graph is generated.
+Similarly, no report is generated if you don't use print options.
+.SH "PRINT"
+.IX Header "PRINT"
+.IP "\fB\s-1PRINT:\s0\fR\fIvname\fR\fB:\fR\fIformat\fR[\fB:strftime\fR]" 4
+.IX Item "PRINT:vname:format[:strftime]"
+Depending on the context, either the value component or the time
+component of a \fB\s-1VDEF\s0\fR is printed using \fIformat\fR. It is an error
+to specify a \fIvname\fR generated by a \fB\s-1DEF\s0\fR or \fB\s-1CDEF\s0\fR.
+.Sp
+Any text in \fIformat\fR is printed literally with one exception:
+The percent character introduces a formatter string. This string
+can be:
+.Sp
+For printing values:
+.RS 4
+.IP "\fB%%\fR" 4
+.IX Item "%%"
+just prints a literal '%' character
+.IP "\fB%#.#le\fR" 4
+.IX Item "%#.#le"
+prints numbers like 1.2346e+04. The optional integers # denote field
+width and decimal precision.
+.IP "\fB%#.#lf\fR" 4
+.IX Item "%#.#lf"
+prints numbers like 12345.6789, with optional field width
+and precision.
+.IP "\fB%s\fR" 4
+.IX Item "%s"
+place this after \fB%le\fR, \fB%lf\fR or \fB%lg\fR. This will be replaced by the
+appropriate \s-1SI\s0 magnitude unit and the value will be scaled
+accordingly (123456 \-> 123.456 k).
+.IP "\fB%S\fR" 4
+.IX Item "%S"
+is similar to \fB%s\fR. It does, however, use a previously defined
+magnitude unit. If there is no such unit yet, it tries to define
+one (just like \fB%s\fR) unless the value is zero, in which case the magnitude
+unit stays undefined. Thus, formatter strings using \fB%S\fR and no \fB%s\fR
+will all use the same magnitude unit except for zero values.
+.RE
+.RS 4
+.Sp
+If you \s-1PRINT\s0 a \s-1VDEF\s0 value, you can also print the time associated with it by appending the string
+\&\fB:strftime\fR to the format. Note that rrdtool uses the strftime function of your OSs clibrary. This means that
+the conversion specifier may vary. Check the manual page if you are uncertain. The following is a list of
+conversion specifiers usually supported across the board. 
+.IP "\fB%a\fR" 4
+.IX Item "%a"
+The abbreviated weekday name according to the current locale.
+.IP "\fB%A\fR" 4
+.IX Item "%A"
+The full weekday name according to the current locale.
+.IP "\fB%b\fR" 4
+.IX Item "%b"
+The abbreviated month name according to the current locale.
+.IP "\fB%B\fR" 4
+.IX Item "%B"
+The full month name according to the current locale.
+.IP "\fB%c\fR" 4
+.IX Item "%c"
+The preferred date and time representation for the current locale.
+.IP "\fB%d\fR" 4
+.IX Item "%d"
+The day of the month as a decimal number (range 01 to 31).
+.IP "\fB%H\fR" 4
+.IX Item "%H"
+The hour as a decimal number using a 24\-hour clock (range 00 to 23).
+.IP "\fB%I\fR" 4
+.IX Item "%I"
+The hour as a decimal number using a 12\-hour clock (range 01 to 12).
+.IP "\fB%j\fR" 4
+.IX Item "%j"
+The day of the year as a decimal number (range 001 to 366).
+.IP "\fB%m\fR" 4
+.IX Item "%m"
+The month as a decimal number (range 01 to 12).
+.IP "\fB%M\fR" 4
+.IX Item "%M"
+The minute as a decimal number (range 00 to 59).
+.IP "\fB%p\fR" 4
+.IX Item "%p"
+Either `\s-1AM\s0' or `\s-1PM\s0' according to the given time value, or the corresponding
+strings for the current locale.  Noon is treated as `pm' and midnight as
+`am'.  Note that in many locales and `pm' notation is unsupported and in
+such cases \f(CW%p\fR will return an empty string.
+.IP "\fB%S\fR" 4
+.IX Item "%S"
+The second as a decimal number (range 00 to 61).
+.IP "\fB%U\fR" 4
+.IX Item "%U"
+The  week  number  of  the current year as a decimal number, range 00 to 53, starting with the
+first Sunday as the first day of week 01. See also \f(CW%V\fR and \f(CW%W\fR.
+.IP "\fB%V\fR" 4
+.IX Item "%V"
+The \s-1ISO\s0 8601:1988 week number of the current year as a decimal number, range 01 to  53,  where
+week  1 is the first week that has at least 4 days in the current year, and with Monday as the
+first day of the week. See also \f(CW%U\fR and \f(CW%W\fR.
+.IP "\fB%w\fR" 4
+.IX Item "%w"
+The day of the week as a decimal, range 0 to 6, Sunday being 0.  See also \f(CW%u\fR.
+.IP "\fB%W\fR" 4
+.IX Item "%W"
+The week number of the current year as a decimal number, range 00 to  53,  starting  with  the
+first Monday as the first day of week 01.
+.IP "\fB%x\fR" 4
+.IX Item "%x"
+The preferred date representation for the current locale without the time.
+.IP "\fB%X\fR" 4
+.IX Item "%X"
+The preferred time representation for the current locale without the date.
+.IP "\fB%y\fR" 4
+.IX Item "%y"
+The year as a decimal number without a century (range 00 to 99).
+.IP "\fB%Y\fR" 4
+.IX Item "%Y"
+The year as a decimal number including the century.
+.IP "\fB%Z\fR" 4
+.IX Item "%Z"
+The time zone or name or abbreviation.
+.IP "\fB%%\fR" 4
+.IX Item "%%"
+A literal `%' character.
+.RE
+.RS 4
+.RE
+.IP "\fB\s-1PRINT:\s0\fR\fIvname\fR\fB:\fR\fI\s-1CF\s0\fR\fB:\fR\fIformat\fR" 4
+.IX Item "PRINT:vname:CF:format"
+\&\fIDeprecated. Use the new form of this command in new scripts.\fR
+The first form of this command is to be used with \fB\s-1CDEF\s0\fR \fIvname\fRs.
+.SH "GRAPH"
+.IX Header "GRAPH"
+.IP "\fB\s-1GPRINT\s0\fR\fB:\fR\fIvname\fR\fB:\fR\fIformat\fR" 4
+.IX Item "GPRINT:vname:format"
+This is the same as \f(CW\*(C`PRINT\*(C'\fR, but printed inside the graph.
+.IP "\fB\s-1GPRINT\s0\fR\fB:\fR\fIvname\fR\fB:\fR\fI\s-1CF\s0\fR\fB:\fR\fIformat\fR" 4
+.IX Item "GPRINT:vname:CF:format"
+\&\fIDeprecated. Use the new form of this command in new scripts.\fR
+This is the same as \f(CW\*(C`PRINT\*(C'\fR, but printed inside the graph.
+.IP "\fB\s-1COMMENT\s0\fR\fB:\fR\fItext\fR" 4
+.IX Item "COMMENT:text"
+Text is printed literally in the legend section of the graph. Note that in
+RRDtool 1.2 you have to escape colons in \s-1COMMENT\s0 text in the same way you
+have to escape them in \fB*PRINT\fR commands by writing \fB'\e:'\fR.
+.IP "\fB\s-1VRULE\s0\fR\fB:\fR\fItime\fR\fB#\fR\fIcolor\fR [\fB:\fR\fIlegend\fR ]" 4
+.IX Item "VRULE:time#color [:legend ]"
+Draw a vertical line at \fItime\fR.  Its color is composed from three
+hexadecimal numbers specifying the rgb color components (00 is off, \s-1FF\s0 is
+maximum) red, green and blue followed by an optional alpha. Optionally, a legend box and string is
+printed in the legend section. \fItime\fR may be a number or a variable
+from a \fB\s-1VDEF\s0\fR. It is an error to use \fIvname\fRs from \fB\s-1DEF\s0\fR or \fB\s-1CDEF\s0\fR here.
+.IP "\fB\s-1HRULE\s0\fR\fB:\fR\fIvalue\fR\fB#\fR\fIcolor\fR [ :\fIlegend\fR ]" 4
+.IX Item "HRULE:value#color [ :legend ]"
+Draw a horizontal line at \fIvalue\fR.  \s-1HRULE\s0 acts much like \s-1LINE\s0 except that
+will have no effect on the scale of the graph. If a \s-1HRULE\s0 is outside the
+graphing area it will just not be visible.
+.IP "\fB\s-1LINE\s0\fR[\fIwidth\fR]\fB:\fR\fIvalue\fR[\fB#\fR\fIcolor\fR][\fB:\fR[\fIlegend\fR][\fB:STACK\fR]]" 4
+.IX Item "LINE[width]:value[#color][:[legend][:STACK]]"
+Draw a line of the specified width onto the graph. \fIwidth\fR can be a
+floating point number. If the color is not specified, the drawing is done
+\&'invisibly'. This is useful when stacking something else on top of this
+line. Also optional is the legend box and string which will be printed in
+the legend section if specified. The \fBvalue\fR can be generated by \fB\s-1DEF\s0\fR,
+\&\fB\s-1VDEF\s0\fR, and \fB\s-1CDEF\s0\fR.  If the optional \fB\s-1STACK\s0\fR modifier is used, this line
+is stacked on top of the previous element which can be a \fB\s-1LINE\s0\fR or an
+\&\fB\s-1AREA\s0\fR.
+.Sp
+When you do not specify a color, you cannot specify a legend.  Should
+you want to use \s-1STACK\s0, use the \*(L"LINEx:<value>::STACK\*(R" form.
+.IP "\fB\s-1AREA\s0\fR\fB:\fR\fIvalue\fR[\fB#\fR\fIcolor\fR][\fB:\fR[\fIlegend\fR][\fB:STACK\fR]]" 4
+.IX Item "AREA:value[#color][:[legend][:STACK]]"
+See \fB\s-1LINE\s0\fR, however the area between the x\-axis and the line will
+be filled.
+.IP "\fB\s-1TICK\s0\fR\fB:\fR\fIvname\fR\fB#\fR\fIrrggbb\fR[\fIaa\fR][\fB:\fR\fIfraction\fR[\fB:\fR\fIlegend\fR]]" 4
+.IX Item "TICK:vname#rrggbb[aa][:fraction[:legend]]"
+Plot a tick mark (a vertical line) for each value of \fIvname\fR that is
+non-zero and not *UNKNOWN*. The \fIfraction\fR argument specifies the length of
+the tick mark as a fraction of the y\-axis; the default value is 0.1 (10% of
+the axis). Note that the color specification is not optional. The \s-1TICK\s0 marks normaly
+start at the lower edge of the graphing area. If the fraction is negative they start
+at the upper border of the graphing area.
+.IP "\fB\s-1SHIFT\s0\fR\fB:\fR\fIvname\fR\fB:\fR\fIoffset\fR" 4
+.IX Item "SHIFT:vname:offset"
+Using this command \fBRRDtool\fR will graph the following elements
+with the specified offset.  For instance, you can specify an
+offset of (\ 7*24*60*60\ =\ )\ 604'800\ seconds to \*(L"look back\*(R" one
+week. Make sure to tell the viewer of your graph you did this ...
+As with the other graphing elements, you can specify a number or
+a variable here.
+.IP "\fB\s-1STACK\s0\fR\fB:\fR\fIvname\fR\fB#\fR\fIcolor\fR[\fB:\fR\fIlegend\fR]" 4
+.IX Item "STACK:vname#color[:legend]"
+\&\fIDeprecated.  Use the \f(BI\s-1STACK\s0\fI modifiers on the other commands.\fR
+.PP
+\&\fBSome notes on stacking\fR
+.PP
+When stacking, an element is not placed above the X\-axis but rather
+on top of the previous element.  There must be something to stack
+upon.
+.PP
+You can use an \fBinvisible\fR \s-1LINE\s0 or \s-1AREA\s0 to stacked upon.
+.PP
+An \fBunknown\fR value makes the entire stack unknown from that moment on.
+You don't know where to begin (the unknown value) and therefore do
+not know where to end.
+.PP
+If you want to make sure you will be displaying a certain variable,
+make sure never to stack upon the unknown value.  Use a \s-1CDEF\s0 instruction
+with \fB\s-1IF\s0\fR and \fB\s-1UN\s0\fR to do so.
+.SH "NOTES on legend arguments"
+.IX Header "NOTES on legend arguments"
+.Sh "Escaping the colon"
+.IX Subsection "Escaping the colon"
+A colon ':' in a \fIlegend\fR argument will mark the end of the
+legend. To enter a ':' as part of a legend, the colon must be escaped
+with a backslash '\e:'.  Beware that many environments process
+backslashes themselves, so it may be necessary to write two
+backslashes in order to one being passed onto rrd_graph.
+.Sh "String Formatting"
+.IX Subsection "String Formatting"
+The text printed below the actual graph can be formatted by appending special
+escape characters at the end of a text. When ever such a character occurs,
+all pending text is pushed onto the graph according to the character
+specified.
+.PP
+Valid markers are: \fB\ej\fR for justified, \fB\el\fR for left aligned, \fB\er\fR for
+right aligned, and \fB\ec\fR for centered. In the next section there is an
+example showing how to use centered formatting.
+.PP
+\&\fB\en\fR is a valid alias for \fB\el\fR since incomplete parsing in earlier
+versions of rrdtool lead to this behaviour and a number of people has been using it.
+.PP
+Normally there are two space characters inserted between every two items
+printed into the graph. The space following a string can be suppressed by
+putting a \fB\eg\fR at the end of the string. The \fB\eg\fR also ignores any space
+inside the string if it is at the very end of the string. This can be used
+in connection with \fB%s\fR to suppress empty unit strings.
+.PP
+.Vb 1
+\& GPRINT:a:MAX:%lf%s\eg
+.Ve
+.PP
+A special case is \s-1COMMENT:\s0\fB\es\fR which inserts some additional vertical space
+before placing the next row of legends.
+.PP
+If you are using the proportional font in your graph, you can use tab
+characters or the sequence \fB\et\fR to line-up legend elements. Note that
+the tabs inserted are relative to the start of the current legend
+element!
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+rrdgraph gives an overview of how \fBrrdtool graph\fR works.
+rrdgraph_data describes \fB\s-1DEF\s0\fR,\fB\s-1CDEF\s0\fR and \fB\s-1VDEF\s0\fR in detail.
+rrdgraph_rpn describes the \fB\s-1RPN\s0\fR language used in the \fB?DEF\fR statements.
+rrdgraph_graph page describes all of the graph and print functions.
+.PP
+Make sure to read rrdgraph_examples for tips&tricks.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Program by Tobias Oetiker <tobi@oetiker.ch>
+.PP
+This manual page by Alex van den Bogaerdt <alex@ergens.op.het.net>
diff --git a/doc/rrdgraph_graph.html b/doc/rrdgraph_graph.html
new file mode 100644 (file)
index 0000000..88c8683
--- /dev/null
@@ -0,0 +1,446 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdgraph_graph</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#print">PRINT</a></li>
+       <li><a href="#graph">GRAPH</a></li>
+       <li><a href="#notes_on_legend_arguments">NOTES on legend arguments</a></li>
+       <ul>
+
+               <li><a href="#escaping_the_colon">Escaping the colon</a></li>
+               <li><a href="#string_formatting">String Formatting</a></li>
+       </ul>
+
+       <li><a href="#see_also">SEE ALSO</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<hr />
+<h1><a name="name">NAME</a></h1>
+<p>rrdgraph_graph - rrdtool graph command reference</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p><strong>PRINT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>format</em></p>
+<p><strong>GPRINT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>format</em></p>
+<p><strong>COMMENT</strong><strong>:</strong><em>text</em></p>
+<p><strong>VRULE</strong><strong>:</strong><em>time</em><strong>#</strong><em>color</em>[<strong>:</strong><em>legend</em>]</p>
+<p><strong>HRULE</strong><strong>:</strong><em>value</em><strong>#</strong><em>color</em>[<strong>:</strong><em>legend</em>]</p>
+<p><strong>LINE</strong>[<em>width</em>]<strong>:</strong><em>value</em>[<strong>#</strong><em>color</em>][<strong>:</strong>[<em>legend</em>][<strong>:STACK</strong>]]</p>
+<p><strong>AREA</strong><strong>:</strong><em>value</em>[<strong>#</strong><em>color</em>][<strong>:</strong>[<em>legend</em>][<strong>:STACK</strong>]]</p>
+<p><strong>TICK</strong><strong>:</strong><em>vname</em><strong>#</strong><em>rrggbb</em>[<em>aa</em>][<strong>:</strong><em>fraction</em>[<strong>:</strong><em>legend</em>]]</p>
+<p><strong>SHIFT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>offset</em></p>
+<p><strong>PRINT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>CF</em><strong>:</strong><em>format</em> (deprecated)</p>
+<p><strong>GPRINT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>CF</em><strong>:</strong><em>format</em> (deprecated)</p>
+<p><strong>STACK</strong><strong>:</strong><em>vname</em><strong>#</strong><em>color</em>[<strong>:</strong><em>legend</em>] (deprecated)</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>These instructions allow you to generate your image or report.
+If you don't use any graph elements, no graph is generated.
+Similarly, no report is generated if you don't use print options.</p>
+<p>
+</p>
+<hr />
+<h1><a name="print">PRINT</a></h1>
+<dl>
+<dt><strong><a name="item_print_3avname_3aformat_5b_3astrftime_5d"><strong>PRINT:</strong><em>vname</em><strong>:</strong><em>format</em>[<strong>:strftime</strong>]</a></strong>
+
+<dd>
+<p>Depending on the context, either the value component or the time
+component of a <strong>VDEF</strong> is printed using <em>format</em>. It is an error
+to specify a <em>vname</em> generated by a <strong>DEF</strong> or <strong>CDEF</strong>.</p>
+</dd>
+<dd>
+<p>Any text in <em>format</em> is printed literally with one exception:
+The percent character introduces a formatter string. This string
+can be:</p>
+</dd>
+<dd>
+<p>For printing values:</p>
+</dd>
+<dl>
+<dt><strong><a name="item___"><strong>%%</strong></a></strong>
+
+<dd>
+<p>just prints a literal '%' character</p>
+</dd>
+</li>
+<dt><strong><a name="item_____le"><strong>%#.#le</strong></a></strong>
+
+<dd>
+<p>prints numbers like 1.2346e+04. The optional integers # denote field
+width and decimal precision.</p>
+</dd>
+</li>
+<dt><strong><a name="item_____lf"><strong>%#.#lf</strong></a></strong>
+
+<dd>
+<p>prints numbers like 12345.6789, with optional field width
+and precision.</p>
+</dd>
+</li>
+<dt><strong><a name="item__s"><strong>%s</strong></a></strong>
+
+<dd>
+<p>place this after <strong>%le</strong>, <strong>%lf</strong> or <strong>%lg</strong>. This will be replaced by the
+appropriate SI magnitude unit and the value will be scaled
+accordingly (123456 -&gt; 123.456 k).</p>
+</dd>
+</li>
+<dt><strong><a name="item__s"><strong>%S</strong></a></strong>
+
+<dd>
+<p>is similar to <strong>%s</strong>. It does, however, use a previously defined
+magnitude unit. If there is no such unit yet, it tries to define
+one (just like <strong>%s</strong>) unless the value is zero, in which case the magnitude
+unit stays undefined. Thus, formatter strings using <strong>%S</strong> and no <strong>%s</strong>
+will all use the same magnitude unit except for zero values.</p>
+</dd>
+</li>
+</dl>
+<p>If you PRINT a VDEF value, you can also print the time associated with it by appending the string
+<strong>:strftime</strong> to the format. Note that rrdtool uses the strftime function of your OSs clibrary. This means that
+the conversion specifier may vary. Check the manual page if you are uncertain. The following is a list of
+conversion specifiers usually supported across the board.</p>
+<dl>
+<dt><strong><a name="item__a"><strong>%a</strong></a></strong>
+
+<dd>
+<p>The abbreviated weekday name according to the current locale.</p>
+</dd>
+</li>
+<dt><strong><a name="item__a"><strong>%A</strong></a></strong>
+
+<dd>
+<p>The full weekday name according to the current locale.</p>
+</dd>
+</li>
+<dt><strong><a name="item__b"><strong>%b</strong></a></strong>
+
+<dd>
+<p>The abbreviated month name according to the current locale.</p>
+</dd>
+</li>
+<dt><strong><a name="item__b"><strong>%B</strong></a></strong>
+
+<dd>
+<p>The full month name according to the current locale.</p>
+</dd>
+</li>
+<dt><strong><a name="item__c"><strong>%c</strong></a></strong>
+
+<dd>
+<p>The preferred date and time representation for the current locale.</p>
+</dd>
+</li>
+<dt><strong><a name="item__d"><strong>%d</strong></a></strong>
+
+<dd>
+<p>The day of the month as a decimal number (range 01 to 31).</p>
+</dd>
+</li>
+<dt><strong><a name="item__h"><strong>%H</strong></a></strong>
+
+<dd>
+<p>The hour as a decimal number using a 24-hour clock (range 00 to 23).</p>
+</dd>
+</li>
+<dt><strong><a name="item__i"><strong>%I</strong></a></strong>
+
+<dd>
+<p>The hour as a decimal number using a 12-hour clock (range 01 to 12).</p>
+</dd>
+</li>
+<dt><strong><a name="item__j"><strong>%j</strong></a></strong>
+
+<dd>
+<p>The day of the year as a decimal number (range 001 to 366).</p>
+</dd>
+</li>
+<dt><strong><a name="item__m"><strong>%m</strong></a></strong>
+
+<dd>
+<p>The month as a decimal number (range 01 to 12).</p>
+</dd>
+</li>
+<dt><strong><a name="item__m"><strong>%M</strong></a></strong>
+
+<dd>
+<p>The minute as a decimal number (range 00 to 59).</p>
+</dd>
+</li>
+<dt><strong><a name="item__p"><strong>%p</strong></a></strong>
+
+<dd>
+<p>Either `AM' or `PM' according to the given time value, or the corresponding
+strings for the current locale.  Noon is treated as `pm' and midnight as
+`am'.  Note that in many locales and `pm' notation is unsupported and in
+such cases %p will return an empty string.</p>
+</dd>
+</li>
+<dt><strong><strong>%S</strong></strong>
+
+<dd>
+<p>The second as a decimal number (range 00 to 61).</p>
+</dd>
+</li>
+<dt><strong><a name="item__u"><strong>%U</strong></a></strong>
+
+<dd>
+<p>The  week  number  of  the current year as a decimal number, range 00 to 53, starting with the
+first Sunday as the first day of week 01. See also %V and %W.</p>
+</dd>
+</li>
+<dt><strong><a name="item__v"><strong>%V</strong></a></strong>
+
+<dd>
+<p>The ISO 8601:1988 week number of the current year as a decimal number, range 01 to  53,  where
+week  1 is the first week that has at least 4 days in the current year, and with Monday as the
+first day of the week. See also %U and %W.</p>
+</dd>
+</li>
+<dt><strong><a name="item__w"><strong>%w</strong></a></strong>
+
+<dd>
+<p>The day of the week as a decimal, range 0 to 6, Sunday being 0.  See also %u.</p>
+</dd>
+</li>
+<dt><strong><a name="item__w"><strong>%W</strong></a></strong>
+
+<dd>
+<p>The week number of the current year as a decimal number, range 00 to  53,  starting  with  the
+first Monday as the first day of week 01.</p>
+</dd>
+</li>
+<dt><strong><a name="item__x"><strong>%x</strong></a></strong>
+
+<dd>
+<p>The preferred date representation for the current locale without the time.</p>
+</dd>
+</li>
+<dt><strong><a name="item__x"><strong>%X</strong></a></strong>
+
+<dd>
+<p>The preferred time representation for the current locale without the date.</p>
+</dd>
+</li>
+<dt><strong><a name="item__y"><strong>%y</strong></a></strong>
+
+<dd>
+<p>The year as a decimal number without a century (range 00 to 99).</p>
+</dd>
+</li>
+<dt><strong><a name="item__y"><strong>%Y</strong></a></strong>
+
+<dd>
+<p>The year as a decimal number including the century.</p>
+</dd>
+</li>
+<dt><strong><a name="item__z"><strong>%Z</strong></a></strong>
+
+<dd>
+<p>The time zone or name or abbreviation.</p>
+</dd>
+</li>
+<dt><strong><strong>%%</strong></strong>
+
+<dd>
+<p>A literal `%' character.</p>
+</dd>
+</li>
+</dl>
+<dt><strong><a name="item_print_3avname_3acf_3aformat"><strong>PRINT:</strong><em>vname</em><strong>:</strong><em>CF</em><strong>:</strong><em>format</em></a></strong>
+
+<dd>
+<p><em>Deprecated. Use the new form of this command in new scripts.</em>
+The first form of this command is to be used with <strong>CDEF</strong> <em>vname</em>s.</p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<hr />
+<h1><a name="graph">GRAPH</a></h1>
+<dl>
+<dt><strong><a name="item_gprint_3avname_3aformat"><strong>GPRINT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>format</em></a></strong>
+
+<dd>
+<p>This is the same as <code>PRINT</code>, but printed inside the graph.</p>
+</dd>
+</li>
+<dt><strong><a name="item_gprint_3avname_3acf_3aformat"><strong>GPRINT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>CF</em><strong>:</strong><em>format</em></a></strong>
+
+<dd>
+<p><em>Deprecated. Use the new form of this command in new scripts.</em>
+This is the same as <code>PRINT</code>, but printed inside the graph.</p>
+</dd>
+</li>
+<dt><strong><a name="item_comment_3atext"><strong>COMMENT</strong><strong>:</strong><em>text</em></a></strong>
+
+<dd>
+<p>Text is printed literally in the legend section of the graph. Note that in
+RRDtool 1.2 you have to escape colons in COMMENT text in the same way you
+have to escape them in <strong>*PRINT</strong> commands by writing <strong>'\:'</strong>.</p>
+</dd>
+</li>
+<dt><strong><a name="item_vrule_3atime_23color__5b_3alegend__5d"><strong>VRULE</strong><strong>:</strong><em>time</em><strong>#</strong><em>color</em> [<strong>:</strong><em>legend</em> ]</a></strong>
+
+<dd>
+<p>Draw a vertical line at <em>time</em>.  Its color is composed from three
+hexadecimal numbers specifying the rgb color components (00 is off, FF is
+maximum) red, green and blue followed by an optional alpha. Optionally, a legend box and string is
+printed in the legend section. <em>time</em> may be a number or a variable
+from a <strong>VDEF</strong>. It is an error to use <em>vname</em>s from <strong>DEF</strong> or <strong>CDEF</strong> here.</p>
+</dd>
+</li>
+<dt><strong><a name="item_hrule_3avalue_23color__5b__3alegend__5d"><strong>HRULE</strong><strong>:</strong><em>value</em><strong>#</strong><em>color</em> [ :<em>legend</em> ]</a></strong>
+
+<dd>
+<p>Draw a horizontal line at <em>value</em>.  HRULE acts much like LINE except that
+will have no effect on the scale of the graph. If a HRULE is outside the
+graphing area it will just not be visible.</p>
+</dd>
+</li>
+<dt><strong><a name="item_line_5bwidth_5d_3avalue_5b_23color_5d_5b_3a_5blege"><strong>LINE</strong>[<em>width</em>]<strong>:</strong><em>value</em>[<strong>#</strong><em>color</em>][<strong>:</strong>[<em>legend</em>][<strong>:STACK</strong>]]</a></strong>
+
+<dd>
+<p>Draw a line of the specified width onto the graph. <em>width</em> can be a
+floating point number. If the color is not specified, the drawing is done
+'invisibly'. This is useful when stacking something else on top of this
+line. Also optional is the legend box and string which will be printed in
+the legend section if specified. The <strong>value</strong> can be generated by <strong>DEF</strong>,
+<strong>VDEF</strong>, and <strong>CDEF</strong>.  If the optional <strong>STACK</strong> modifier is used, this line
+is stacked on top of the previous element which can be a <strong>LINE</strong> or an
+<strong>AREA</strong>.</p>
+</dd>
+<dd>
+<p>When you do not specify a color, you cannot specify a legend.  Should
+you want to use STACK, use the ``LINEx:&lt;value&gt;::STACK'' form.</p>
+</dd>
+</li>
+<dt><strong><a name="item_area_3avalue_5b_23color_5d_5b_3a_5blegend_5d_5b_3a"><strong>AREA</strong><strong>:</strong><em>value</em>[<strong>#</strong><em>color</em>][<strong>:</strong>[<em>legend</em>][<strong>:STACK</strong>]]</a></strong>
+
+<dd>
+<p>See <strong>LINE</strong>, however the area between the x-axis and the line will
+be filled.</p>
+</dd>
+</li>
+<dt><strong><a name="item_tick_3avname_23rrggbb_5baa_5d_5b_3afraction_5b_3al"><strong>TICK</strong><strong>:</strong><em>vname</em><strong>#</strong><em>rrggbb</em>[<em>aa</em>][<strong>:</strong><em>fraction</em>[<strong>:</strong><em>legend</em>]]</a></strong>
+
+<dd>
+<p>Plot a tick mark (a vertical line) for each value of <em>vname</em> that is
+non-zero and not *UNKNOWN*. The <em>fraction</em> argument specifies the length of
+the tick mark as a fraction of the y-axis; the default value is 0.1 (10% of
+the axis). Note that the color specification is not optional. The TICK marks normaly
+start at the lower edge of the graphing area. If the fraction is negative they start
+at the upper border of the graphing area.</p>
+</dd>
+</li>
+<dt><strong><a name="item_shift_3avname_3aoffset"><strong>SHIFT</strong><strong>:</strong><em>vname</em><strong>:</strong><em>offset</em></a></strong>
+
+<dd>
+<p>Using this command <strong>RRDtool</strong> will graph the following elements
+with the specified offset.  For instance, you can specify an
+offset of (&nbsp;7*24*60*60&nbsp;=&nbsp;)&nbsp;604'800&nbsp;seconds to ``look back'' one
+week. Make sure to tell the viewer of your graph you did this ...
+As with the other graphing elements, you can specify a number or
+a variable here.</p>
+</dd>
+</li>
+<dt><strong><a name="item_stack_3avname_23color_5b_3alegend_5d"><strong>STACK</strong><strong>:</strong><em>vname</em><strong>#</strong><em>color</em>[<strong>:</strong><em>legend</em>]</a></strong>
+
+<dd>
+<p><em>Deprecated.  Use the <strong>STACK</strong> modifiers on the other commands.</em></p>
+</dd>
+</li>
+</dl>
+<p><strong>Some notes on stacking</strong></p>
+<p>When stacking, an element is not placed above the X-axis but rather
+on top of the previous element.  There must be something to stack
+upon.</p>
+<p>You can use an <strong>invisible</strong> LINE or AREA to stacked upon.</p>
+<p>An <strong>unknown</strong> value makes the entire stack unknown from that moment on.
+You don't know where to begin (the unknown value) and therefore do
+not know where to end.</p>
+<p>If you want to make sure you will be displaying a certain variable,
+make sure never to stack upon the unknown value.  Use a CDEF instruction
+with <strong>IF</strong> and <strong>UN</strong> to do so.</p>
+<p>
+</p>
+<hr />
+<h1><a name="notes_on_legend_arguments">NOTES on legend arguments</a></h1>
+<p>
+</p>
+<h2><a name="escaping_the_colon">Escaping the colon</a></h2>
+<p>A colon ':' in a <em>legend</em> argument will mark the end of the
+legend. To enter a ':' as part of a legend, the colon must be escaped
+with a backslash '\:'.  Beware that many environments process
+backslashes themselves, so it may be necessary to write two
+backslashes in order to one being passed onto rrd_graph.</p>
+<p>
+</p>
+<h2><a name="string_formatting">String Formatting</a></h2>
+<p>The text printed below the actual graph can be formatted by appending special
+escape characters at the end of a text. When ever such a character occurs,
+all pending text is pushed onto the graph according to the character
+specified.</p>
+<p>Valid markers are: <strong>\j</strong> for justified, <strong>\l</strong> for left aligned, <strong>\r</strong> for
+right aligned, and <strong>\c</strong> for centered. In the next section there is an
+example showing how to use centered formatting.</p>
+<p><strong>\n</strong> is a valid alias for <strong>\l</strong> since incomplete parsing in earlier
+versions of rrdtool lead to this behaviour and a number of people has been using it.</p>
+<p>Normally there are two space characters inserted between every two items
+printed into the graph. The space following a string can be suppressed by
+putting a <strong>\g</strong> at the end of the string. The <strong>\g</strong> also ignores any space
+inside the string if it is at the very end of the string. This can be used
+in connection with <strong>%s</strong> to suppress empty unit strings.</p>
+<pre>
+ GPRINT:a:MAX:%lf%s\g</pre>
+<p>A special case is COMMENT:<strong>\s</strong> which inserts some additional vertical space
+before placing the next row of legends.</p>
+<p>If you are using the proportional font in your graph, you can use tab
+characters or the sequence <strong>\t</strong> to line-up legend elements. Note that
+the tabs inserted are relative to the start of the current legend
+element!</p>
+<p>
+</p>
+<hr />
+<h1><a name="see_also">SEE ALSO</a></h1>
+<p><a href="././rrdgraph.html">the rrdgraph manpage</a> gives an overview of how <strong>rrdtool graph</strong> works.
+<a href="././rrdgraph_data.html">the rrdgraph_data manpage</a> describes <strong>DEF</strong>,<strong>CDEF</strong> and <strong>VDEF</strong> in detail.
+<a href="././rrdgraph_rpn.html">the rrdgraph_rpn manpage</a> describes the <strong>RPN</strong> language used in the <strong>?DEF</strong> statements.
+<a href="././rrdgraph_graph.html">the rrdgraph_graph manpage</a> page describes all of the graph and print functions.</p>
+<p>Make sure to read <a href="././rrdgraph_examples.html">the rrdgraph_examples manpage</a> for tips&amp;tricks.</p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Program by Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
+<p>This manual page by Alex van den Bogaerdt &lt;<a href="mailto:alex@ergens.op.het.net">alex@ergens.op.het.net</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdgraph_graph.pod b/doc/rrdgraph_graph.pod
new file mode 100644 (file)
index 0000000..93bc1dd
--- /dev/null
@@ -0,0 +1,379 @@
+=pod
+
+=head1 NAME
+
+rrdgraph_graph - rrdtool graph command reference
+
+=head1 SYNOPSIS
+
+B<PRINT>B<:>I<vname>B<:>I<format>
+
+B<GPRINT>B<:>I<vname>B<:>I<format>
+
+B<COMMENT>B<:>I<text>
+
+B<VRULE>B<:>I<time>B<#>I<color>[B<:>I<legend>]
+
+B<HRULE>B<:>I<value>B<#>I<color>[B<:>I<legend>]
+
+B<LINE>[I<width>]B<:>I<value>[B<#>I<color>][B<:>[I<legend>][B<:STACK>]]
+
+B<AREA>B<:>I<value>[B<#>I<color>][B<:>[I<legend>][B<:STACK>]]
+
+B<TICK>B<:>I<vname>B<#>I<rrggbb>[I<aa>][B<:>I<fraction>[B<:>I<legend>]]
+
+B<SHIFT>B<:>I<vname>B<:>I<offset>
+
+=cut
+
+#
+#B<PART>B<:>I<vname>B<#>I<rrggbb>[I<aa>][B<:>I<legend>]
+#
+
+=pod
+
+B<PRINT>B<:>I<vname>B<:>I<CF>B<:>I<format> (deprecated)
+
+B<GPRINT>B<:>I<vname>B<:>I<CF>B<:>I<format> (deprecated)
+
+
+B<STACK>B<:>I<vname>B<#>I<color>[B<:>I<legend>] (deprecated)
+
+=head1 DESCRIPTION
+
+These instructions allow you to generate your image or report.
+If you don't use any graph elements, no graph is generated.
+Similarly, no report is generated if you don't use print options.
+
+=head1 PRINT
+
+=over 4
+
+
+=item B<PRINT:>I<vname>B<:>I<format>[B<:strftime>]
+
+Depending on the context, either the value component or the time
+component of a B<VDEF> is printed using I<format>. It is an error
+to specify a I<vname> generated by a B<DEF> or B<CDEF>.
+
+Any text in I<format> is printed literally with one exception:
+The percent character introduces a formatter string. This string
+can be:
+
+For printing values:
+
+=over 4
+
+=item B<%%>
+
+just prints a literal '%' character
+
+=item B<%#.#le>
+
+prints numbers like 1.2346e+04. The optional integers # denote field
+width and decimal precision.
+
+=item B<%#.#lf>
+
+prints numbers like 12345.6789, with optional field width
+and precision.
+
+=item B<%s>
+
+place this after B<%le>, B<%lf> or B<%lg>. This will be replaced by the
+appropriate SI magnitude unit and the value will be scaled
+accordingly (123456 -> 123.456 k).
+
+=item B<%S>
+
+is similar to B<%s>. It does, however, use a previously defined
+magnitude unit. If there is no such unit yet, it tries to define
+one (just like B<%s>) unless the value is zero, in which case the magnitude
+unit stays undefined. Thus, formatter strings using B<%S> and no B<%s>
+will all use the same magnitude unit except for zero values.
+
+=back
+
+If you PRINT a VDEF value, you can also print the time associated with it by appending the string
+B<:strftime> to the format. Note that rrdtool uses the strftime function of your OSs clibrary. This means that
+the conversion specifier may vary. Check the manual page if you are uncertain. The following is a list of
+conversion specifiers usually supported across the board. 
+
+=over 4
+
+=item B<%a>
+
+The abbreviated weekday name according to the current locale.
+
+=item B<%A>
+
+The full weekday name according to the current locale.
+
+=item B<%b>
+
+The abbreviated month name according to the current locale.
+
+=item B<%B>
+
+The full month name according to the current locale.
+
+=item B<%c>
+
+The preferred date and time representation for the current locale.
+
+=item B<%d>
+
+The day of the month as a decimal number (range 01 to 31).
+
+=item B<%H>
+
+The hour as a decimal number using a 24-hour clock (range 00 to 23).
+
+=item B<%I>
+
+The hour as a decimal number using a 12-hour clock (range 01 to 12).
+
+=item B<%j>
+
+The day of the year as a decimal number (range 001 to 366).
+
+=item B<%m>
+
+The month as a decimal number (range 01 to 12).
+
+=item B<%M>
+
+The minute as a decimal number (range 00 to 59).
+
+=item B<%p>
+
+Either `AM' or `PM' according to the given time value, or the corresponding
+strings for the current locale.  Noon is treated as `pm' and midnight as
+`am'.  Note that in many locales and `pm' notation is unsupported and in
+such cases %p will return an empty string.
+
+=item B<%S>
+
+The second as a decimal number (range 00 to 61).
+
+=item B<%U>
+
+The  week  number  of  the current year as a decimal number, range 00 to 53, starting with the
+first Sunday as the first day of week 01. See also %V and %W.
+
+=item B<%V>
+
+The ISO 8601:1988 week number of the current year as a decimal number, range 01 to  53,  where
+week  1 is the first week that has at least 4 days in the current year, and with Monday as the
+first day of the week. See also %U and %W.
+
+=item B<%w>
+
+The day of the week as a decimal, range 0 to 6, Sunday being 0.  See also %u.
+
+=item B<%W>
+
+The week number of the current year as a decimal number, range 00 to  53,  starting  with  the
+first Monday as the first day of week 01.
+
+=item B<%x>
+
+The preferred date representation for the current locale without the time.
+
+=item B<%X>
+
+The preferred time representation for the current locale without the date.
+
+=item B<%y>
+
+The year as a decimal number without a century (range 00 to 99).
+
+=item B<%Y>
+
+The year as a decimal number including the century.
+
+=item B<%Z>
+
+The time zone or name or abbreviation.
+
+=item B<%%>
+
+A literal `%' character.
+
+=back
+
+=item B<PRINT:>I<vname>B<:>I<CF>B<:>I<format>
+
+I<Deprecated. Use the new form of this command in new scripts.>
+The first form of this command is to be used with B<CDEF> I<vname>s.
+
+=back
+
+=head1 GRAPH
+
+=over 4
+
+=item B<GPRINT>B<:>I<vname>B<:>I<format>
+
+This is the same as C<PRINT>, but printed inside the graph.
+
+=item B<GPRINT>B<:>I<vname>B<:>I<CF>B<:>I<format>
+
+I<Deprecated. Use the new form of this command in new scripts.>
+This is the same as C<PRINT>, but printed inside the graph.
+
+=item B<COMMENT>B<:>I<text>
+
+Text is printed literally in the legend section of the graph. Note that in
+RRDtool 1.2 you have to escape colons in COMMENT text in the same way you
+have to escape them in B<*PRINT> commands by writing B<'\:'>.
+
+=item B<VRULE>B<:>I<time>B<#>I<color> [B<:>I<legend> ]
+
+Draw a vertical line at I<time>.  Its color is composed from three
+hexadecimal numbers specifying the rgb color components (00 is off, FF is
+maximum) red, green and blue followed by an optional alpha. Optionally, a legend box and string is
+printed in the legend section. I<time> may be a number or a variable
+from a B<VDEF>. It is an error to use I<vname>s from B<DEF> or B<CDEF> here.
+
+=item B<HRULE>B<:>I<value>B<#>I<color> [ :I<legend> ]
+
+Draw a horizontal line at I<value>.  HRULE acts much like LINE except that
+will have no effect on the scale of the graph. If a HRULE is outside the
+graphing area it will just not be visible.
+
+=item B<LINE>[I<width>]B<:>I<value>[B<#>I<color>][B<:>[I<legend>][B<:STACK>]]
+
+Draw a line of the specified width onto the graph. I<width> can be a
+floating point number. If the color is not specified, the drawing is done
+'invisibly'. This is useful when stacking something else on top of this
+line. Also optional is the legend box and string which will be printed in
+the legend section if specified. The B<value> can be generated by B<DEF>,
+B<VDEF>, and B<CDEF>.  If the optional B<STACK> modifier is used, this line
+is stacked on top of the previous element which can be a B<LINE> or an
+B<AREA>.
+
+When you do not specify a color, you cannot specify a legend.  Should
+you want to use STACK, use the "LINEx:<value>::STACK" form.
+
+=item B<AREA>B<:>I<value>[B<#>I<color>][B<:>[I<legend>][B<:STACK>]]
+
+See B<LINE>, however the area between the x-axis and the line will
+be filled.
+
+=item B<TICK>B<:>I<vname>B<#>I<rrggbb>[I<aa>][B<:>I<fraction>[B<:>I<legend>]]
+
+Plot a tick mark (a vertical line) for each value of I<vname> that is
+non-zero and not *UNKNOWN*. The I<fraction> argument specifies the length of
+the tick mark as a fraction of the y-axis; the default value is 0.1 (10% of
+the axis). Note that the color specification is not optional. The TICK marks normaly
+start at the lower edge of the graphing area. If the fraction is negative they start
+at the upper border of the graphing area.
+
+=item B<SHIFT>B<:>I<vname>B<:>I<offset>
+
+Using this command B<RRDtool> will graph the following elements
+with the specified offset.  For instance, you can specify an
+offset of S<( 7*24*60*60 = ) 604'800 seconds> to "look back" one
+week. Make sure to tell the viewer of your graph you did this ...
+As with the other graphing elements, you can specify a number or
+a variable here.
+
+=cut
+
+# This section describes the curruently defunct
+# PieChart code.
+#
+# =item B<PART>B<:>I<vname>B<#>I<rrggbb>[I<aa>][B<:>I<legend>]
+#
+# B<RRDtool> has now support for B<pie charts>. If you include the
+# B<PART> command, the canvas is extended to make room for a chart.
+# The size of the canvas is determined by the lesser of
+# L<width and height|rrdgraph/item_Size>.
+#
+# Pie parts will be concatenated, the first one will start at the
+# top and parts will be created clockwise.  The size of the part
+# is defined by the value part of the L<VDEF|rrdgraph_data/VDEF>
+# function.  It should return a number between 0 and 100, being a
+# percentage.  Providing wrong input will produce undefined results.
+#
+#
+
+=pod
+
+=item B<STACK>B<:>I<vname>B<#>I<color>[B<:>I<legend>]
+
+I<Deprecated.  Use the B<STACK> modifiers on the other commands.>
+
+=back
+
+B<Some notes on stacking>
+
+When stacking, an element is not placed above the X-axis but rather
+on top of the previous element.  There must be something to stack
+upon.
+
+You can use an B<invisible> LINE or AREA to stacked upon.
+
+An B<unknown> value makes the entire stack unknown from that moment on.
+You don't know where to begin (the unknown value) and therefore do
+not know where to end.
+
+If you want to make sure you will be displaying a certain variable,
+make sure never to stack upon the unknown value.  Use a CDEF instruction
+with B<IF> and B<UN> to do so.
+
+=head1 NOTES on legend arguments
+
+=head2 Escaping the colon
+
+A colon ':' in a I<legend> argument will mark the end of the
+legend. To enter a ':' as part of a legend, the colon must be escaped
+with a backslash '\:'.  Beware that many environments process
+backslashes themselves, so it may be necessary to write two
+backslashes in order to one being passed onto rrd_graph.
+
+=head2 String Formatting
+
+The text printed below the actual graph can be formatted by appending special
+escape characters at the end of a text. When ever such a character occurs,
+all pending text is pushed onto the graph according to the character
+specified.
+
+Valid markers are: B<\j> for justified, B<\l> for left aligned, B<\r> for
+right aligned, and B<\c> for centered. In the next section there is an
+example showing how to use centered formatting.
+
+B<\n> is a valid alias for B<\l> since incomplete parsing in earlier
+versions of rrdtool lead to this behaviour and a number of people has been using it.
+
+Normally there are two space characters inserted between every two items
+printed into the graph. The space following a string can be suppressed by
+putting a B<\g> at the end of the string. The B<\g> also ignores any space
+inside the string if it is at the very end of the string. This can be used
+in connection with B<%s> to suppress empty unit strings.
+
+ GPRINT:a:MAX:%lf%s\g
+
+A special case is COMMENT:B<\s> which inserts some additional vertical space
+before placing the next row of legends.
+
+If you are using the proportional font in your graph, you can use tab
+characters or the sequence B<\t> to line-up legend elements. Note that
+the tabs inserted are relative to the start of the current legend
+element!
+
+=head1 SEE ALSO
+
+L<rrdgraph> gives an overview of how B<rrdtool graph> works.
+L<rrdgraph_data> describes B<DEF>,B<CDEF> and B<VDEF> in detail.
+L<rrdgraph_rpn> describes the B<RPN> language used in the B<?DEF> statements.
+L<rrdgraph_graph> page describes all of the graph and print functions.
+
+Make sure to read L<rrdgraph_examples> for tipsE<amp>tricks.
+
+=head1 AUTHOR
+
+Program by Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
+
+This manual page by Alex van den Bogaerdt E<lt>alex@ergens.op.het.netE<gt>
diff --git a/doc/rrdgraph_graph.txt b/doc/rrdgraph_graph.txt
new file mode 100644 (file)
index 0000000..f024a06
--- /dev/null
@@ -0,0 +1,279 @@
+RRDGRAPH_GRAPH(1)                   rrdtool                  RRDGRAPH_GRAPH(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdgraph_graph - rrdtool graph command reference
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       P\bPR\bRI\bIN\bNT\bT:\b:_\bv_\bn_\ba_\bm_\be:\b:_\bf_\bo_\br_\bm_\ba_\bt
+
+       G\bGP\bPR\bRI\bIN\bNT\bT:\b:_\bv_\bn_\ba_\bm_\be:\b:_\bf_\bo_\br_\bm_\ba_\bt
+
+       C\bCO\bOM\bMM\bME\bEN\bNT\bT:\b:_\bt_\be_\bx_\bt
+
+       V\bVR\bRU\bUL\bLE\bE:\b:_\bt_\bi_\bm_\be#\b#_\bc_\bo_\bl_\bo_\br[:\b:_\bl_\be_\bg_\be_\bn_\bd]
+
+       H\bHR\bRU\bUL\bLE\bE:\b:_\bv_\ba_\bl_\bu_\be#\b#_\bc_\bo_\bl_\bo_\br[:\b:_\bl_\be_\bg_\be_\bn_\bd]
+
+       L\bLI\bIN\bNE\bE[_\bw_\bi_\bd_\bt_\bh]:\b:_\bv_\ba_\bl_\bu_\be[#\b#_\bc_\bo_\bl_\bo_\br][:\b:[_\bl_\be_\bg_\be_\bn_\bd][:\b:S\bST\bTA\bAC\bCK\bK]]
+
+       A\bAR\bRE\bEA\bA:\b:_\bv_\ba_\bl_\bu_\be[#\b#_\bc_\bo_\bl_\bo_\br][:\b:[_\bl_\be_\bg_\be_\bn_\bd][:\b:S\bST\bTA\bAC\bCK\bK]]
+
+       T\bTI\bIC\bCK\bK:\b:_\bv_\bn_\ba_\bm_\be#\b#_\br_\br_\bg_\bg_\bb_\bb[_\ba_\ba][:\b:_\bf_\br_\ba_\bc_\bt_\bi_\bo_\bn[:\b:_\bl_\be_\bg_\be_\bn_\bd]]
+
+       S\bSH\bHI\bIF\bFT\bT:\b:_\bv_\bn_\ba_\bm_\be:\b:_\bo_\bf_\bf_\bs_\be_\bt
+
+       P\bPR\bRI\bIN\bNT\bT:\b:_\bv_\bn_\ba_\bm_\be:\b:_\bC_\bF:\b:_\bf_\bo_\br_\bm_\ba_\bt (deprecated)
+
+       G\bGP\bPR\bRI\bIN\bNT\bT:\b:_\bv_\bn_\ba_\bm_\be:\b:_\bC_\bF:\b:_\bf_\bo_\br_\bm_\ba_\bt (deprecated)
+
+       S\bST\bTA\bAC\bCK\bK:\b:_\bv_\bn_\ba_\bm_\be#\b#_\bc_\bo_\bl_\bo_\br[:\b:_\bl_\be_\bg_\be_\bn_\bd] (deprecated)
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       These instructions allow you to generate your image or report.  If you
+       don't use any graph elements, no graph is generated.  Similarly, no
+       report is generated if you don't use print options.
+
+P\bPR\bRI\bIN\bNT\bT
+       P\bPR\bRI\bIN\bNT\bT:\b:_\bv_\bn_\ba_\bm_\be:\b:_\bf_\bo_\br_\bm_\ba_\bt[:\b:s\bst\btr\brf\bft\bti\bim\bme\be]
+           Depending on the context, either the value component or the time
+           component of a V\bVD\bDE\bEF\bF is printed using _\bf_\bo_\br_\bm_\ba_\bt. It is an error to
+           specify a _\bv_\bn_\ba_\bm_\be generated by a D\bDE\bEF\bF or C\bCD\bDE\bEF\bF.
+
+           Any text in _\bf_\bo_\br_\bm_\ba_\bt is printed literally with one exception: The
+           percent character introduces a formatter string. This string can
+           be:
+
+           For printing values:
+
+           %\b%%\b%  just prints a literal '%' character
+
+           %\b%#\b#.\b.#\b#l\ble\be
+               prints numbers like 1.2346e+04. The optional integers # denote
+               field width and decimal precision.
+
+           %\b%#\b#.\b.#\b#l\blf\bf
+               prints numbers like 12345.6789, with optional field width and
+               precision.
+
+           %\b%s\bs  place this after %\b%l\ble\be, %\b%l\blf\bf or %\b%l\blg\bg. This will be replaced by the
+               appropriate SI magnitude unit and the value will be scaled
+               accordingly (123456 -> 123.456 k).
+
+           %\b%S\bS  is similar to %\b%s\bs. It does, however, use a previously defined
+               magnitude unit. If there is no such unit yet, it tries to
+               define one (just like %\b%s\bs) unless the value is zero, in which
+               case the magnitude unit stays undefined. Thus, formatter
+               strings using %\b%S\bS and no %\b%s\bs will all use the same magnitude unit
+               except for zero values.
+
+           If you PRINT a VDEF value, you can also print the time associated
+           with it by appending the string :\b:s\bst\btr\brf\bft\bti\bim\bme\be to the format. Note that
+           rrdtool uses the strftime function of your OSs clibrary. This means
+           that the conversion specifier may vary. Check the manual page if
+           you are uncertain. The following is a list of conversion specifiers
+           usually supported across the board.
+
+           %\b%a\ba  The abbreviated weekday name according to the current locale.
+
+           %\b%A\bA  The full weekday name according to the current locale.
+
+           %\b%b\bb  The abbreviated month name according to the current locale.
+
+           %\b%B\bB  The full month name according to the current locale.
+
+           %\b%c\bc  The preferred date and time representation for the current
+               locale.
+
+           %\b%d\bd  The day of the month as a decimal number (range 01 to 31).
+
+           %\b%H\bH  The hour as a decimal number using a 24-hour clock (range 00 to
+               23).
+
+           %\b%I\bI  The hour as a decimal number using a 12-hour clock (range 01 to
+               12).
+
+           %\b%j\bj  The day of the year as a decimal number (range 001 to 366).
+
+           %\b%m\bm  The month as a decimal number (range 01 to 12).
+
+           %\b%M\bM  The minute as a decimal number (range 00 to 59).
+
+           %\b%p\bp  Either `AM' or `PM' according to the given time value, or the
+               corresponding strings for the current locale.  Noon is treated
+               as `pm' and midnight as `am'.  Note that in many locales and
+               `pm' notation is unsupported and in such cases %p will return
+               an empty string.
+
+           %\b%S\bS  The second as a decimal number (range 00 to 61).
+
+           %\b%U\bU  The  week  number  of  the current year as a decimal number,
+               range 00 to 53, starting with the first Sunday as the first day
+               of week 01. See also %V and %W.
+
+           %\b%V\bV  The ISO 8601:1988 week number of the current year as a decimal
+               number, range 01 to  53,  where week  1 is the first week that
+               has at least 4 days in the current year, and with Monday as the
+               first day of the week. See also %U and %W.
+
+           %\b%w\bw  The day of the week as a decimal, range 0 to 6, Sunday being 0.
+               See also %u.
+
+           %\b%W\bW  The week number of the current year as a decimal number, range
+               00 to  53,  starting  with  the first Monday as the first day
+               of week 01.
+
+           %\b%x\bx  The preferred date representation for the current locale with-
+               out the time.
+
+           %\b%X\bX  The preferred time representation for the current locale with-
+               out the date.
+
+           %\b%y\by  The year as a decimal number without a century (range 00 to
+               99).
+
+           %\b%Y\bY  The year as a decimal number including the century.
+
+           %\b%Z\bZ  The time zone or name or abbreviation.
+
+           %\b%%\b%  A literal `%' character.
+
+       P\bPR\bRI\bIN\bNT\bT:\b:_\bv_\bn_\ba_\bm_\be:\b:_\bC_\bF:\b:_\bf_\bo_\br_\bm_\ba_\bt
+           _\bD_\be_\bp_\br_\be_\bc_\ba_\bt_\be_\bd_\b. _\bU_\bs_\be _\bt_\bh_\be _\bn_\be_\bw _\bf_\bo_\br_\bm _\bo_\bf _\bt_\bh_\bi_\bs _\bc_\bo_\bm_\bm_\ba_\bn_\bd _\bi_\bn _\bn_\be_\bw _\bs_\bc_\br_\bi_\bp_\bt_\bs_\b.  The
+           first form of this command is to be used with C\bCD\bDE\bEF\bF _\bv_\bn_\ba_\bm_\bes.
+
+G\bGR\bRA\bAP\bPH\bH
+       G\bGP\bPR\bRI\bIN\bNT\bT:\b:_\bv_\bn_\ba_\bm_\be:\b:_\bf_\bo_\br_\bm_\ba_\bt
+           This is the same as "PRINT", but printed inside the graph.
+
+       G\bGP\bPR\bRI\bIN\bNT\bT:\b:_\bv_\bn_\ba_\bm_\be:\b:_\bC_\bF:\b:_\bf_\bo_\br_\bm_\ba_\bt
+           _\bD_\be_\bp_\br_\be_\bc_\ba_\bt_\be_\bd_\b. _\bU_\bs_\be _\bt_\bh_\be _\bn_\be_\bw _\bf_\bo_\br_\bm _\bo_\bf _\bt_\bh_\bi_\bs _\bc_\bo_\bm_\bm_\ba_\bn_\bd _\bi_\bn _\bn_\be_\bw _\bs_\bc_\br_\bi_\bp_\bt_\bs_\b.  This
+           is the same as "PRINT", but printed inside the graph.
+
+       C\bCO\bOM\bMM\bME\bEN\bNT\bT:\b:_\bt_\be_\bx_\bt
+           Text is printed literally in the legend section of the graph. Note
+           that in RRDtool 1.2 you have to escape colons in COMMENT text in
+           the same way you have to escape them in *\b*P\bPR\bRI\bIN\bNT\bT commands by writing
+           '\b'\\b\:\b:'\b'.
+
+       V\bVR\bRU\bUL\bLE\bE:\b:_\bt_\bi_\bm_\be#\b#_\bc_\bo_\bl_\bo_\br [:\b:_\bl_\be_\bg_\be_\bn_\bd ]
+           Draw a vertical line at _\bt_\bi_\bm_\be.  Its color is composed from three
+           hexadecimal numbers specifying the rgb color components (00 is off,
+           FF is maximum) red, green and blue followed by an optional alpha.
+           Optionally, a legend box and string is printed in the legend sec-
+           tion. _\bt_\bi_\bm_\be may be a number or a variable from a V\bVD\bDE\bEF\bF. It is an
+           error to use _\bv_\bn_\ba_\bm_\bes from D\bDE\bEF\bF or C\bCD\bDE\bEF\bF here.
+
+       H\bHR\bRU\bUL\bLE\bE:\b:_\bv_\ba_\bl_\bu_\be#\b#_\bc_\bo_\bl_\bo_\br [ :_\bl_\be_\bg_\be_\bn_\bd ]
+           Draw a horizontal line at _\bv_\ba_\bl_\bu_\be.  HRULE acts much like LINE except
+           that will have no effect on the scale of the graph. If a HRULE is
+           outside the graphing area it will just not be visible.
+
+       L\bLI\bIN\bNE\bE[_\bw_\bi_\bd_\bt_\bh]:\b:_\bv_\ba_\bl_\bu_\be[#\b#_\bc_\bo_\bl_\bo_\br][:\b:[_\bl_\be_\bg_\be_\bn_\bd][:\b:S\bST\bTA\bAC\bCK\bK]]
+           Draw a line of the specified width onto the graph. _\bw_\bi_\bd_\bt_\bh can be a
+           floating point number. If the color is not specified, the drawing
+           is done 'invisibly'. This is useful when stacking something else on
+           top of this line. Also optional is the legend box and string which
+           will be printed in the legend section if specified. The v\bva\bal\blu\bue\be can
+           be generated by D\bDE\bEF\bF, V\bVD\bDE\bEF\bF, and C\bCD\bDE\bEF\bF.  If the optional S\bST\bTA\bAC\bCK\bK modi-
+           fier is used, this line is stacked on top of the previous element
+           which can be a L\bLI\bIN\bNE\bE or an A\bAR\bRE\bEA\bA.
+
+           When you do not specify a color, you cannot specify a legend.
+           Should you want to use STACK, use the "LINEx:<value>::STACK" form.
+
+       A\bAR\bRE\bEA\bA:\b:_\bv_\ba_\bl_\bu_\be[#\b#_\bc_\bo_\bl_\bo_\br][:\b:[_\bl_\be_\bg_\be_\bn_\bd][:\b:S\bST\bTA\bAC\bCK\bK]]
+           See L\bLI\bIN\bNE\bE, however the area between the x-axis and the line will be
+           filled.
+
+       T\bTI\bIC\bCK\bK:\b:_\bv_\bn_\ba_\bm_\be#\b#_\br_\br_\bg_\bg_\bb_\bb[_\ba_\ba][:\b:_\bf_\br_\ba_\bc_\bt_\bi_\bo_\bn[:\b:_\bl_\be_\bg_\be_\bn_\bd]]
+           Plot a tick mark (a vertical line) for each value of _\bv_\bn_\ba_\bm_\be that is
+           non-zero and not *UNKNOWN*. The _\bf_\br_\ba_\bc_\bt_\bi_\bo_\bn argument specifies the
+           length of the tick mark as a fraction of the y-axis; the default
+           value is 0.1 (10% of the axis). Note that the color specification
+           is not optional. The TICK marks normaly start at the lower edge of
+           the graphing area. If the fraction is negative they start at the
+           upper border of the graphing area.
+
+       S\bSH\bHI\bIF\bFT\bT:\b:_\bv_\bn_\ba_\bm_\be:\b:_\bo_\bf_\bf_\bs_\be_\bt
+           Using this command R\bRR\bRD\bDt\bto\boo\bol\bl will graph the following elements with
+           the specified offset.  For instance, you can specify an offset of
+           ( 7*24*60*60 = ) 604'800 seconds to "look back" one week. Make sure
+           to tell the viewer of your graph you did this ...  As with the
+           other graphing elements, you can specify a number or a variable
+           here.
+
+       S\bST\bTA\bAC\bCK\bK:\b:_\bv_\bn_\ba_\bm_\be#\b#_\bc_\bo_\bl_\bo_\br[:\b:_\bl_\be_\bg_\be_\bn_\bd]
+           _\bD_\be_\bp_\br_\be_\bc_\ba_\bt_\be_\bd_\b.  _\bU_\bs_\be _\bt_\bh_\be _\bS\bS_\bT\bT_\bA\bA_\bC\bC_\bK\bK _\bm_\bo_\bd_\bi_\bf_\bi_\be_\br_\bs _\bo_\bn _\bt_\bh_\be _\bo_\bt_\bh_\be_\br _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\bs_\b.
+
+       S\bSo\bom\bme\be n\bno\bot\bte\bes\bs o\bon\bn s\bst\bta\bac\bck\bki\bin\bng\bg
+
+       When stacking, an element is not placed above the X-axis but rather on
+       top of the previous element.  There must be something to stack upon.
+
+       You can use an i\bin\bnv\bvi\bis\bsi\bib\bbl\ble\be LINE or AREA to stacked upon.
+
+       An u\bun\bnk\bkn\bno\bow\bwn\bn value makes the entire stack unknown from that moment on.
+       You don't know where to begin (the unknown value) and therefore do not
+       know where to end.
+
+       If you want to make sure you will be displaying a certain variable,
+       make sure never to stack upon the unknown value.  Use a CDEF instruc-
+       tion with I\bIF\bF and U\bUN\bN to do so.
+
+N\bNO\bOT\bTE\bES\bS o\bon\bn l\ble\beg\bge\ben\bnd\bd a\bar\brg\bgu\bum\bme\ben\bnt\bts\bs
+       E\bEs\bsc\bca\bap\bpi\bin\bng\bg t\bth\bhe\be c\bco\bol\blo\bon\bn
+
+       A colon ':' in a _\bl_\be_\bg_\be_\bn_\bd argument will mark the end of the legend. To
+       enter a ':' as part of a legend, the colon must be escaped with a back-
+       slash '\:'.  Beware that many environments process backslashes them-
+       selves, so it may be necessary to write two backslashes in order to one
+       being passed onto rrd_graph.
+
+       S\bSt\btr\bri\bin\bng\bg F\bFo\bor\brm\bma\bat\btt\bti\bin\bng\bg
+
+       The text printed below the actual graph can be formatted by appending
+       special escape characters at the end of a text. When ever such a char-
+       acter occurs, all pending text is pushed onto the graph according to
+       the character specified.
+
+       Valid markers are: \\b\j\bj for justified, \\b\l\bl for left aligned, \\b\r\br for right
+       aligned, and \\b\c\bc for centered. In the next section there is an example
+       showing how to use centered formatting.
+
+       \\b\n\bn is a valid alias for \\b\l\bl since incomplete parsing in earlier versions
+       of rrdtool lead to this behaviour and a number of people has been using
+       it.
+
+       Normally there are two space characters inserted between every two
+       items printed into the graph. The space following a string can be sup-
+       pressed by putting a \\b\g\bg at the end of the string. The \\b\g\bg also ignores
+       any space inside the string if it is at the very end of the string.
+       This can be used in connection with %\b%s\bs to suppress empty unit strings.
+
+        GPRINT:a:MAX:%lf%s\g
+
+       A special case is COMMENT:\\b\s\bs which inserts some additional vertical
+       space before placing the next row of legends.
+
+       If you are using the proportional font in your graph, you can use tab
+       characters or the sequence \\b\t\bt to line-up legend elements. Note that the
+       tabs inserted are relative to the start of the current legend element!
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+       rrdgraph gives an overview of how r\brr\brd\bdt\bto\boo\bol\bl g\bgr\bra\bap\bph\bh works.  rrdgraph_data
+       describes D\bDE\bEF\bF,C\bCD\bDE\bEF\bF and V\bVD\bDE\bEF\bF in detail.  rrdgraph_rpn describes the R\bRP\bPN\bN
+       language used in the ?\b?D\bDE\bEF\bF statements.  rrdgraph_graph page describes
+       all of the graph and print functions.
+
+       Make sure to read rrdgraph_examples for tips&tricks.
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Program by Tobias Oetiker <tobi@oetiker.ch>
+
+       This manual page by Alex van den Bogaerdt <alex@ergens.op.het.net>
+
+
+
+1.2.26                            2007-11-20                 RRDGRAPH_GRAPH(1)
diff --git a/doc/rrdgraph_rpn.1 b/doc/rrdgraph_rpn.1
new file mode 100644 (file)
index 0000000..0a7c740
--- /dev/null
@@ -0,0 +1,421 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDGRAPH_RPN 1"
+.TH RRDGRAPH_RPN 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdgraph_rpn \- About RPN Math in rrdtool graph
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fI\s-1RPN\s0 expression\fR:=\fIvname\fR|\fIoperator\fR|\fIvalue\fR[,\fI\s-1RPN\s0 expression\fR]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+If you have ever used a traditional \s-1HP\s0 calculator you already know
+\&\fB\s-1RPN\s0\fR. The idea behind \fB\s-1RPN\s0\fR is that you have a stack and push
+your data onto this stack. Whenever you execute an operation, it
+takes as many elements from the stack as needed. Pushing is done
+implicitly, so whenever you specify a number or a variable, it gets
+pushed onto the stack automatically.
+.PP
+At the end of the calculation there should be one and only one value left on
+the stack.  This is the outcome of the function and this is what is put into
+the \fIvname\fR.  For \fB\s-1CDEF\s0\fR instructions, the stack is processed for each
+data point on the graph. \fB\s-1VDEF\s0\fR instructions work on an entire data set in
+one run. Note, that currently \fB\s-1VDEF\s0\fR instructions only support a limited
+list of functions.
+.PP
+Example: \f(CW\*(C`VDEF:maximum=mydata,MAXIMUM\*(C'\fR
+.PP
+This will set variable \*(L"maximum\*(R" which you now can use in the rest
+of your \s-1RRD\s0 script.
+.PP
+Example: \f(CW\*(C`CDEF:mydatabits=mydata,8,*\*(C'\fR
+.PP
+This means:  push variable \fImydata\fR, push the number 8, execute
+the operator \fI*\fR. The operator needs two elements and uses those
+to return one value.  This value is then stored in \fImydatabits\fR.
+As you may have guessed, this instruction means nothing more than
+\&\fImydatabits = mydata * 8\fR.  The real power of \fB\s-1RPN\s0\fR lies in the
+fact that it is always clear in which order to process the input.
+For expressions like \f(CW\*(C`a = b + 3 * 5\*(C'\fR you need to multiply 3 with
+5 first before you add \fIb\fR to get \fIa\fR. However, with parentheses
+you could change this order: \f(CW\*(C`a = (b + 3) * 5\*(C'\fR. In \fB\s-1RPN\s0\fR, you
+would do \f(CW\*(C`a = b, 3, +, 5, *\*(C'\fR without the need for parentheses.
+.SH "OPERATORS"
+.IX Header "OPERATORS"
+.IP "Boolean operators" 4
+.IX Item "Boolean operators"
+\&\fB\s-1LT\s0, \s-1LE\s0, \s-1GT\s0, \s-1GE\s0, \s-1EQ\s0, \s-1NE\s0\fR
+.Sp
+Pop two elements from the stack, compare them for the selected condition
+and return 1 for true or 0 for false. Comparing an \fIunknown\fR or an
+\&\fIinfinite\fR value will always result in 0 (false).
+.Sp
+\&\fB\s-1UN\s0, \s-1ISINF\s0\fR
+.Sp
+Pop one element from the stack, compare this to \fIunknown\fR respectively
+to \fIpositive or negative infinity\fR. Returns 1 for true or 0 for false.
+.Sp
+\&\fB\s-1IF\s0\fR
+.Sp
+Pops three elements from the stack.  If the element popped last is 0
+(false), the value popped first is pushed back onto the stack,
+otherwise the value popped second is pushed back. This does, indeed,
+mean that any value other than 0 is considered to be true.
+.Sp
+Example: \f(CW\*(C`A,B,C,IF\*(C'\fR should be read as \f(CW\*(C`if (A) then (B) else (C)\*(C'\fR
+.Sp
+\&\&
+.IP "Comparing values" 4
+.IX Item "Comparing values"
+\&\fB\s-1MIN\s0, \s-1MAX\s0\fR
+.Sp
+Pops two elements from the stack and returns the smaller or larger,
+respectively.  Note that \fIinfinite\fR is larger than anything else.
+If one of the input numbers is \fIunknown\fR then the result of the operation will be
+\&\fIunknown\fR too.
+.Sp
+\&\fB\s-1LIMIT\s0\fR
+.Sp
+Pops two elements from the stack and uses them to define a range.
+Then it pops another element and if it falls inside the range, it
+is pushed back. If not, an \fIunknown\fR is pushed.
+.Sp
+The range defined includes the two boundaries (so: a number equal
+to one of the boundaries will be pushed back). If any of the three
+numbers involved is either \fIunknown\fR or \fIinfinite\fR this function
+will always return an \fIunknown\fR
+.Sp
+Example: \f(CW\*(C`CDEF:a=alpha,0,100,LIMIT\*(C'\fR will return \fIunknown\fR if
+alpha is lower than 0 or if it is higher than 100.
+.Sp
+\&\&
+.IP "Arithmetics" 4
+.IX Item "Arithmetics"
+\&\fB+, \-, *, /, %\fR
+.Sp
+Add, subtract, multiply, divide, modulo
+.Sp
+\&\fB\s-1SIN\s0, \s-1COS\s0, \s-1LOG\s0, \s-1EXP\s0, \s-1SQRT\s0\fR
+.Sp
+Sine and cosine (input in radians), log and exp (natural logarithm),
+square root.
+.Sp
+\&\fB\s-1ATAN\s0\fR
+.Sp
+Arctangent (output in radians).
+.Sp
+\&\fB\s-1ATAN2\s0\fR
+.Sp
+Arctangent of y,x components (output in radians).
+This pops one element from the stack, the x (cosine) component, and then
+a second, which is the y (sine) component.
+It then pushes the arctangent of their ratio, resolving the ambiguity between
+quadrants.
+.Sp
+Example: \f(CW\*(C`CDEF:angle=Y,X,ATAN2,RAD2DEG\*(C'\fR will convert \f(CW\*(C`X,Y\*(C'\fR
+components into an angle in degrees.
+.Sp
+\&\fB\s-1FLOOR\s0, \s-1CEIL\s0\fR
+.Sp
+Round down or up to the nearest integer.
+.Sp
+\&\fB\s-1DEG2RAD\s0, \s-1RAD2DEG\s0\fR
+.Sp
+Convert angle in degrees to radians, or radians to degrees.
+.Sp
+\&\fB\s-1ABS\s0\fR
+.Sp
+Take the absolute value.
+.IP "Set Operations" 4
+.IX Item "Set Operations"
+\&\fB\s-1SORT\s0, \s-1REV\s0\fR
+.Sp
+Pop one element from the stack.  This is the \fIcount\fR of items to be sorted
+(or reversed).  The top \fIcount\fR of the remaining elements are then sorted
+(or reversed) in place on the stack.
+.Sp
+Example: \f(CW\*(C`CDEF:x=v1,v2,v3,v4,v5,v6,6,SORT,POP,5,REV,POP,+,+,+,4,/\*(C'\fR will
+compute the average of the values v1 to v6 after removing the smallest and
+largest.
+.Sp
+\&\fB\s-1AVG\s0\fR
+.Sp
+Pop one element (\fIcount\fR) from the stack. Now pop \fIcount\fR elements and build the
+average, ignoring all \s-1UNKNOWN\s0 values in the process.
+.Sp
+Example: \f(CW\*(C`CDEF:x=a,b,c,d,4,AVG\*(C'\fR
+.Sp
+\&\fB\s-1TREND\s0\fR
+.Sp
+Create a \*(L"sliding window\*(R" average of another data series.
+.Sp
+Usage:
+CDEF:smoothed=x,1800,TREND
+.Sp
+This will create a half-hour (1800 second) sliding window average of x.  The
+average is essentially computed as shown here:
+.Sp
+.Vb 8
+\&                 +\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\-!\-\-\->
+\&                                                     now
+\&                       delay     t0
+\&                 <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
+\&                         delay       t1
+\&                     <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
+\&                              delay      t2
+\&                         <\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->
+.Ve
+.Sp
+.Vb 3
+\&     Value at sample (t0) will be the average between (t0\-delay) and (t0)
+\&     Value at sample (t1) will be the average between (t1\-delay) and (t1)
+\&     Value at sample (t2) will be the average between (t2\-delay) and (t2)
+.Ve
+.IP "Special values" 4
+.IX Item "Special values"
+\&\fB\s-1UNKN\s0\fR
+.Sp
+Pushes an unknown value on the stack
+.Sp
+\&\fB\s-1INF\s0, \s-1NEGINF\s0\fR
+.Sp
+Pushes a positive or negative infinite value on the stack. When
+such a value is graphed, it appears at the top or bottom of the
+graph, no matter what the actual value on the y\-axis is.
+.Sp
+\&\fB\s-1PREV\s0\fR
+.Sp
+Pushes an \fIunknown\fR value if this is the first value of a data
+set or otherwise the result of this \fB\s-1CDEF\s0\fR at the previous time
+step. This allows you to do calculations across the data.  This
+function cannot be used in \fB\s-1VDEF\s0\fR instructions.
+.Sp
+\&\fB\s-1PREV\s0(vname)\fR
+.Sp
+Pushes an \fIunknown\fR value if this is the first value of a data
+set or otherwise the result of the vname variable at the previous time
+step. This allows you to do calculations across the data. This
+function cannot be used in \fB\s-1VDEF\s0\fR instructions.
+.Sp
+\&\fB\s-1COUNT\s0\fR
+.Sp
+Pushes the number 1 if this is the first value of the data set, the
+number 2 if it is the second, and so on. This special value allows
+you to make calculations based on the position of the value within
+the data set. This function cannot be used in \fB\s-1VDEF\s0\fR instructions.
+.IP "Time" 4
+.IX Item "Time"
+Time inside RRDtool is measured in seconds since the epoch. The
+epoch is defined to be \f(CW\*(C`Thu\ Jan\ 1\ 00:00:00\ UTC\ 1970\*(C'\fR.
+.Sp
+\&\fB\s-1NOW\s0\fR
+.Sp
+Pushes the current time on the stack.
+.Sp
+\&\fB\s-1TIME\s0\fR
+.Sp
+Pushes the time the currently processed value was taken at onto the stack.
+.Sp
+\&\fB\s-1LTIME\s0\fR
+.Sp
+Takes the time as defined by \fB\s-1TIME\s0\fR, applies the time zone offset
+valid at that time including daylight saving time if your \s-1OS\s0 supports
+it, and pushes the result on the stack.  There is an elaborate example
+in the examples section below on how to use this.
+.IP "Processing the stack directly" 4
+.IX Item "Processing the stack directly"
+\&\fB\s-1DUP\s0, \s-1POP\s0, \s-1EXC\s0\fR
+.Sp
+Duplicate the top element, remove the top element, exchange the two
+top elements.
+.Sp
+\&\&
+.SH "VARIABLES"
+.IX Header "VARIABLES"
+These operators work only on \fB\s-1VDEF\s0\fR statements. Note that currently \s-1ONLY\s0 these work for \fB\s-1VDEF\s0\fR.
+.IP "\s-1MAXIMUM\s0, \s-1MINIMUM\s0, \s-1AVERAGE\s0" 4
+.IX Item "MAXIMUM, MINIMUM, AVERAGE"
+Return the corresponding value, \s-1MAXIMUM\s0 and \s-1MINIMUM\s0 also return
+the first occurrence of that value in the time component.
+.Sp
+Example: \f(CW\*(C`VDEF:avg=mydata,AVERAGE\*(C'\fR
+.IP "\s-1LAST\s0, \s-1FIRST\s0" 4
+.IX Item "LAST, FIRST"
+Return the last/first value including its time.  The time for
+\&\s-1FIRST\s0 is actually the start of the corresponding interval, whereas
+\&\s-1LAST\s0 returns the end of the corresponding interval.
+.Sp
+Example: \f(CW\*(C`VDEF:first=mydata,FIRST\*(C'\fR
+.IP "\s-1TOTAL\s0" 4
+.IX Item "TOTAL"
+Returns the rate from each defined time slot multiplied with the
+step size.  This can, for instance, return total bytes transfered
+when you have logged bytes per second. The time component returns
+the number of seconds.
+.Sp
+Example: \f(CW\*(C`VDEF:total=mydata,TOTAL\*(C'\fR
+.IP "\s-1PERCENT\s0" 4
+.IX Item "PERCENT"
+This should follow a \fB\s-1DEF\s0\fR or \fB\s-1CDEF\s0\fR \fIvname\fR. The \fIvname\fR is popped,
+another number is popped which is a certain percentage (0..100). The
+data set is then sorted and the value returned is chosen such that
+\&\fIpercentage\fR percent of the values is lower or equal than the result.
+\&\fIUnknown\fR values are considered lower than any finite number for this
+purpose so if this operator returns an \fIunknown\fR you have quite a lot
+of them in your data.  \fBInf\fRinite numbers are lesser, or more, than the
+finite numbers and are always more than the \fIUnknown\fR numbers.
+(NaN < \-INF < finite values < \s-1INF\s0)
+.Sp
+Example: \f(CW\*(C`VDEF:perc95=mydata,95,PERCENT\*(C'\fR
+.IP "\s-1LSLSLOPE\s0, \s-1LSLINT\s0, \s-1LSLCORREL\s0" 4
+.IX Item "LSLSLOPE, LSLINT, LSLCORREL"
+Return the parameters for a \fBL\fReast \fBS\fRquares \fBL\fRine \fI(y = mx +b)\fR 
+which approximate the provided dataset.  \s-1LSLSLOPE\s0 is the slope \fI(m)\fR of
+the line related to the \s-1COUNT\s0 position of the data.  \s-1LSLINT\s0 is the 
+y\-intercept \fI(b)\fR, which happens also to be the first data point on the 
+graph. \s-1LSLCORREL\s0 is the Correlation Coefficient (also know as Pearson's 
+Product Moment Correlation Coefficient).  It will range from 0 to +/\-1 
+and represents the quality of fit for the approximation.   
+.Sp
+Example: \f(CW\*(C`VDEF:slope=mydata,LSLSLOPE\*(C'\fR
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+rrdgraph gives an overview of how \fBrrdtool graph\fR works.
+rrdgraph_data describes \fB\s-1DEF\s0\fR,\fB\s-1CDEF\s0\fR and \fB\s-1VDEF\s0\fR in detail.
+rrdgraph_rpn describes the \fB\s-1RPN\s0\fR language used in the \fB?DEF\fR statements.
+rrdgraph_graph page describes all of the graph and print functions.
+.PP
+Make sure to read rrdgraph_examples for tips&tricks.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Program by Tobias Oetiker <tobi@oetiker.ch>
+.PP
+This manual page by Alex van den Bogaerdt <alex@ergens.op.het.net>
diff --git a/doc/rrdgraph_rpn.html b/doc/rrdgraph_rpn.html
new file mode 100644 (file)
index 0000000..aef75cf
--- /dev/null
@@ -0,0 +1,426 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdgraph_rpn</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#operators">OPERATORS</a></li>
+       <li><a href="#variables">VARIABLES</a></li>
+       <li><a href="#see_also">SEE ALSO</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdgraph_rpn - About RPN Math in rrdtool graph</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p><em>RPN expression</em>:=<em>vname</em>|<em>operator</em>|<em>value</em>[,<em>RPN expression</em>]</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>If you have ever used a traditional HP calculator you already know
+<strong>RPN</strong>. The idea behind <strong>RPN</strong> is that you have a stack and push
+your data onto this stack. Whenever you execute an operation, it
+takes as many elements from the stack as needed. Pushing is done
+implicitly, so whenever you specify a number or a variable, it gets
+pushed onto the stack automatically.</p>
+<p>At the end of the calculation there should be one and only one value left on
+the stack.  This is the outcome of the function and this is what is put into
+the <em>vname</em>.  For <strong>CDEF</strong> instructions, the stack is processed for each
+data point on the graph. <strong>VDEF</strong> instructions work on an entire data set in
+one run. Note, that currently <strong>VDEF</strong> instructions only support a limited
+list of functions.</p>
+<p>Example: <code>VDEF:maximum=mydata,MAXIMUM</code></p>
+<p>This will set variable ``maximum'' which you now can use in the rest
+of your RRD script.</p>
+<p>Example: <code>CDEF:mydatabits=mydata,8,*</code></p>
+<p>This means:  push variable <em>mydata</em>, push the number 8, execute
+the operator <em>*</em>. The operator needs two elements and uses those
+to return one value.  This value is then stored in <em>mydatabits</em>.
+As you may have guessed, this instruction means nothing more than
+<em>mydatabits = mydata * 8</em>.  The real power of <strong>RPN</strong> lies in the
+fact that it is always clear in which order to process the input.
+For expressions like <code>a = b + 3 * 5</code> you need to multiply 3 with
+5 first before you add <em>b</em> to get <em>a</em>. However, with parentheses
+you could change this order: <code>a = (b + 3) * 5</code>. In <strong>RPN</strong>, you
+would do <code>a = b, 3, +, 5, *</code> without the need for parentheses.</p>
+<p>
+</p>
+<hr />
+<h1><a name="operators">OPERATORS</a></h1>
+<dl>
+<dt><strong><a name="item_boolean_operators">Boolean operators</a></strong>
+
+<dd>
+<p><strong>LT, LE, GT, GE, EQ, NE</strong></p>
+</dd>
+<dd>
+<p>Pop two elements from the stack, compare them for the selected condition
+and return 1 for true or 0 for false. Comparing an <em>unknown</em> or an
+<em>infinite</em> value will always result in 0 (false).</p>
+</dd>
+<dd>
+<p><strong>UN, ISINF</strong></p>
+</dd>
+<dd>
+<p>Pop one element from the stack, compare this to <em>unknown</em> respectively
+to <em>positive or negative infinity</em>. Returns 1 for true or 0 for false.</p>
+</dd>
+<dd>
+<p><strong>IF</strong></p>
+</dd>
+<dd>
+<p>Pops three elements from the stack.  If the element popped last is 0
+(false), the value popped first is pushed back onto the stack,
+otherwise the value popped second is pushed back. This does, indeed,
+mean that any value other than 0 is considered to be true.</p>
+</dd>
+<dd>
+<p>Example: <code>A,B,C,IF</code> should be read as <code>if (A) then (B) else (C)</code></p>
+</dd>
+<dd>
+<p></p>
+</dd>
+</li>
+<dt><strong><a name="item_comparing_values">Comparing values</a></strong>
+
+<dd>
+<p><strong>MIN, MAX</strong></p>
+</dd>
+<dd>
+<p>Pops two elements from the stack and returns the smaller or larger,
+respectively.  Note that <em>infinite</em> is larger than anything else.
+If one of the input numbers is <em>unknown</em> then the result of the operation will be
+<em>unknown</em> too.</p>
+</dd>
+<dd>
+<p><strong>LIMIT</strong></p>
+</dd>
+<dd>
+<p>Pops two elements from the stack and uses them to define a range.
+Then it pops another element and if it falls inside the range, it
+is pushed back. If not, an <em>unknown</em> is pushed.</p>
+</dd>
+<dd>
+<p>The range defined includes the two boundaries (so: a number equal
+to one of the boundaries will be pushed back). If any of the three
+numbers involved is either <em>unknown</em> or <em>infinite</em> this function
+will always return an <em>unknown</em></p>
+</dd>
+<dd>
+<p>Example: <code>CDEF:a=alpha,0,100,LIMIT</code> will return <em>unknown</em> if
+alpha is lower than 0 or if it is higher than 100.</p>
+</dd>
+<dd>
+<p></p>
+</dd>
+</li>
+<dt><strong><a name="item_arithmetics">Arithmetics</a></strong>
+
+<dd>
+<p><strong>+, -, *, /, %</strong></p>
+</dd>
+<dd>
+<p>Add, subtract, multiply, divide, modulo</p>
+</dd>
+<dd>
+<p><strong>SIN, COS, LOG, EXP, SQRT</strong></p>
+</dd>
+<dd>
+<p>Sine and cosine (input in radians), log and exp (natural logarithm),
+square root.</p>
+</dd>
+<dd>
+<p><strong>ATAN</strong></p>
+</dd>
+<dd>
+<p>Arctangent (output in radians).</p>
+</dd>
+<dd>
+<p><strong>ATAN2</strong></p>
+</dd>
+<dd>
+<p>Arctangent of y,x components (output in radians).
+This pops one element from the stack, the x (cosine) component, and then
+a second, which is the y (sine) component.
+It then pushes the arctangent of their ratio, resolving the ambiguity between
+quadrants.</p>
+</dd>
+<dd>
+<p>Example: <code>CDEF:angle=Y,X,ATAN2,RAD2DEG</code> will convert <code>X,Y</code>
+components into an angle in degrees.</p>
+</dd>
+<dd>
+<p><strong>FLOOR, CEIL</strong></p>
+</dd>
+<dd>
+<p>Round down or up to the nearest integer.</p>
+</dd>
+<dd>
+<p><strong>DEG2RAD, RAD2DEG</strong></p>
+</dd>
+<dd>
+<p>Convert angle in degrees to radians, or radians to degrees.</p>
+</dd>
+<dd>
+<p><strong>ABS</strong></p>
+</dd>
+<dd>
+<p>Take the absolute value.</p>
+</dd>
+</li>
+<dt><strong><a name="item_set_operations">Set Operations</a></strong>
+
+<dd>
+<p><strong>SORT, REV</strong></p>
+</dd>
+<dd>
+<p>Pop one element from the stack.  This is the <em>count</em> of items to be sorted
+(or reversed).  The top <em>count</em> of the remaining elements are then sorted
+(or reversed) in place on the stack.</p>
+</dd>
+<dd>
+<p>Example: <code>CDEF:x=v1,v2,v3,v4,v5,v6,6,SORT,POP,5,REV,POP,+,+,+,4,/</code> will
+compute the average of the values v1 to v6 after removing the smallest and
+largest.</p>
+</dd>
+<dd>
+<p><strong>AVG</strong></p>
+</dd>
+<dd>
+<p>Pop one element (<em>count</em>) from the stack. Now pop <em>count</em> elements and build the
+average, ignoring all UNKNOWN values in the process.</p>
+</dd>
+<dd>
+<p>Example: <code>CDEF:x=a,b,c,d,4,AVG</code></p>
+</dd>
+<dd>
+<p><strong>TREND</strong></p>
+</dd>
+<dd>
+<p>Create a ``sliding window'' average of another data series.</p>
+</dd>
+<dd>
+<p>Usage:
+CDEF:smoothed=x,1800,TREND</p>
+</dd>
+<dd>
+<p>This will create a half-hour (1800 second) sliding window average of x.  The
+average is essentially computed as shown here:</p>
+</dd>
+<dd>
+<pre>
+                 +---!---!---!---!---!---!---!---!---&gt;
+                                                     now
+                       delay     t0
+                 &lt;---------------&gt;
+                         delay       t1
+                     &lt;---------------&gt;
+                              delay      t2
+                         &lt;---------------&gt;</pre>
+</dd>
+<dd>
+<pre>
+     Value at sample (t0) will be the average between (t0-delay) and (t0)
+     Value at sample (t1) will be the average between (t1-delay) and (t1)
+     Value at sample (t2) will be the average between (t2-delay) and (t2)</pre>
+</dd>
+</li>
+<dt><strong><a name="item_special_values">Special values</a></strong>
+
+<dd>
+<p><strong>UNKN</strong></p>
+</dd>
+<dd>
+<p>Pushes an unknown value on the stack</p>
+</dd>
+<dd>
+<p><strong>INF, NEGINF</strong></p>
+</dd>
+<dd>
+<p>Pushes a positive or negative infinite value on the stack. When
+such a value is graphed, it appears at the top or bottom of the
+graph, no matter what the actual value on the y-axis is.</p>
+</dd>
+<dd>
+<p><strong>PREV</strong></p>
+</dd>
+<dd>
+<p>Pushes an <em>unknown</em> value if this is the first value of a data
+set or otherwise the result of this <strong>CDEF</strong> at the previous time
+step. This allows you to do calculations across the data.  This
+function cannot be used in <strong>VDEF</strong> instructions.</p>
+</dd>
+<dd>
+<p><strong>PREV(vname)</strong></p>
+</dd>
+<dd>
+<p>Pushes an <em>unknown</em> value if this is the first value of a data
+set or otherwise the result of the vname variable at the previous time
+step. This allows you to do calculations across the data. This
+function cannot be used in <strong>VDEF</strong> instructions.</p>
+</dd>
+<dd>
+<p><strong>COUNT</strong></p>
+</dd>
+<dd>
+<p>Pushes the number 1 if this is the first value of the data set, the
+number 2 if it is the second, and so on. This special value allows
+you to make calculations based on the position of the value within
+the data set. This function cannot be used in <strong>VDEF</strong> instructions.</p>
+</dd>
+</li>
+<dt><strong><a name="item_time">Time</a></strong>
+
+<dd>
+<p>Time inside RRDtool is measured in seconds since the epoch. The
+epoch is defined to be <code>Thu&nbsp;Jan&nbsp;&nbsp;1&nbsp;00:00:00&nbsp;UTC&nbsp;1970</code>.</p>
+</dd>
+<dd>
+<p><strong>NOW</strong></p>
+</dd>
+<dd>
+<p>Pushes the current time on the stack.</p>
+</dd>
+<dd>
+<p><strong>TIME</strong></p>
+</dd>
+<dd>
+<p>Pushes the time the currently processed value was taken at onto the stack.</p>
+</dd>
+<dd>
+<p><strong>LTIME</strong></p>
+</dd>
+<dd>
+<p>Takes the time as defined by <strong>TIME</strong>, applies the time zone offset
+valid at that time including daylight saving time if your OS supports
+it, and pushes the result on the stack.  There is an elaborate example
+in the examples section below on how to use this.</p>
+</dd>
+</li>
+<dt><strong><a name="item_processing_the_stack_directly">Processing the stack directly</a></strong>
+
+<dd>
+<p><strong>DUP, POP, EXC</strong></p>
+</dd>
+<dd>
+<p>Duplicate the top element, remove the top element, exchange the two
+top elements.</p>
+</dd>
+<dd>
+<p></p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<hr />
+<h1><a name="variables">VARIABLES</a></h1>
+<p>These operators work only on <strong>VDEF</strong> statements. Note that currently ONLY these work for <strong>VDEF</strong>.</p>
+<dl>
+<dt><strong><a name="item_maximum_2c_minimum_2c_average">MAXIMUM, MINIMUM, AVERAGE</a></strong>
+
+<dd>
+<p>Return the corresponding value, MAXIMUM and MINIMUM also return
+the first occurrence of that value in the time component.</p>
+</dd>
+<dd>
+<p>Example: <code>VDEF:avg=mydata,AVERAGE</code></p>
+</dd>
+</li>
+<dt><strong><a name="item_last_2c_first">LAST, FIRST</a></strong>
+
+<dd>
+<p>Return the last/first value including its time.  The time for
+FIRST is actually the start of the corresponding interval, whereas
+LAST returns the end of the corresponding interval.</p>
+</dd>
+<dd>
+<p>Example: <code>VDEF:first=mydata,FIRST</code></p>
+</dd>
+</li>
+<dt><strong><a name="item_total">TOTAL</a></strong>
+
+<dd>
+<p>Returns the rate from each defined time slot multiplied with the
+step size.  This can, for instance, return total bytes transfered
+when you have logged bytes per second. The time component returns
+the number of seconds.</p>
+</dd>
+<dd>
+<p>Example: <code>VDEF:total=mydata,TOTAL</code></p>
+</dd>
+</li>
+<dt><strong><a name="item_percent">PERCENT</a></strong>
+
+<dd>
+<p>This should follow a <strong>DEF</strong> or <strong>CDEF</strong> <em>vname</em>. The <em>vname</em> is popped,
+another number is popped which is a certain percentage (0..100). The
+data set is then sorted and the value returned is chosen such that
+<em>percentage</em> percent of the values is lower or equal than the result.
+<em>Unknown</em> values are considered lower than any finite number for this
+purpose so if this operator returns an <em>unknown</em> you have quite a lot
+of them in your data.  <strong>Inf</strong>inite numbers are lesser, or more, than the
+finite numbers and are always more than the <em>Unknown</em> numbers.
+(NaN &lt; -INF &lt; finite values &lt; INF)</p>
+</dd>
+<dd>
+<p>Example: <code>VDEF:perc95=mydata,95,PERCENT</code></p>
+</dd>
+</li>
+<dt><strong><a name="item_lslslope_2c_lslint_2c_lslcorrel">LSLSLOPE, LSLINT, LSLCORREL</a></strong>
+
+<dd>
+<p>Return the parameters for a <strong>L</strong>east <strong>S</strong>quares <strong>L</strong>ine <em>(y = mx +b)</em> 
+which approximate the provided dataset.  LSLSLOPE is the slope <em>(m)</em> of
+the line related to the COUNT position of the data.  LSLINT is the 
+y-intercept <em>(b)</em>, which happens also to be the first data point on the 
+graph. LSLCORREL is the Correlation Coefficient (also know as Pearson's 
+Product Moment Correlation Coefficient).  It will range from 0 to +/-1 
+and represents the quality of fit for the approximation.</p>
+</dd>
+<dd>
+<p>Example: <code>VDEF:slope=mydata,LSLSLOPE</code></p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<hr />
+<h1><a name="see_also">SEE ALSO</a></h1>
+<p><a href="././rrdgraph.html">the rrdgraph manpage</a> gives an overview of how <strong>rrdtool graph</strong> works.
+<a href="././rrdgraph_data.html">the rrdgraph_data manpage</a> describes <strong>DEF</strong>,<strong>CDEF</strong> and <strong>VDEF</strong> in detail.
+<a href="././rrdgraph_rpn.html">the rrdgraph_rpn manpage</a> describes the <strong>RPN</strong> language used in the <strong>?DEF</strong> statements.
+<a href="././rrdgraph_graph.html">the rrdgraph_graph manpage</a> page describes all of the graph and print functions.</p>
+<p>Make sure to read <a href="././rrdgraph_examples.html">the rrdgraph_examples manpage</a> for tips&amp;tricks.</p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Program by Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
+<p>This manual page by Alex van den Bogaerdt &lt;<a href="mailto:alex@ergens.op.het.net">alex@ergens.op.het.net</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdgraph_rpn.pod b/doc/rrdgraph_rpn.pod
new file mode 100644 (file)
index 0000000..b2a84dd
--- /dev/null
@@ -0,0 +1,312 @@
+=head1 NAME
+
+rrdgraph_rpn - About RPN Math in rrdtool graph
+
+=head1 SYNOPSIS
+
+I<RPN expression>:=I<vname>|I<operator>|I<value>[,I<RPN expression>]
+
+=head1 DESCRIPTION
+
+If you have ever used a traditional HP calculator you already know
+B<RPN>. The idea behind B<RPN> is that you have a stack and push
+your data onto this stack. Whenever you execute an operation, it
+takes as many elements from the stack as needed. Pushing is done
+implicitly, so whenever you specify a number or a variable, it gets
+pushed onto the stack automatically.
+
+At the end of the calculation there should be one and only one value left on
+the stack.  This is the outcome of the function and this is what is put into
+the I<vname>.  For B<CDEF> instructions, the stack is processed for each
+data point on the graph. B<VDEF> instructions work on an entire data set in
+one run. Note, that currently B<VDEF> instructions only support a limited
+list of functions.
+
+Example: C<VDEF:maximum=mydata,MAXIMUM>
+
+This will set variable "maximum" which you now can use in the rest
+of your RRD script.
+
+Example: C<CDEF:mydatabits=mydata,8,*>
+
+This means:  push variable I<mydata>, push the number 8, execute
+the operator I<*>. The operator needs two elements and uses those
+to return one value.  This value is then stored in I<mydatabits>.
+As you may have guessed, this instruction means nothing more than
+I<mydatabits = mydata * 8>.  The real power of B<RPN> lies in the
+fact that it is always clear in which order to process the input.
+For expressions like C<a = b + 3 * 5> you need to multiply 3 with
+5 first before you add I<b> to get I<a>. However, with parentheses
+you could change this order: C<a = (b + 3) * 5>. In B<RPN>, you
+would do C<a = b, 3, +, 5, *> without the need for parentheses.
+
+=head1 OPERATORS
+
+=over 4
+
+=item Boolean operators
+
+B<LT, LE, GT, GE, EQ, NE>
+
+Pop two elements from the stack, compare them for the selected condition
+and return 1 for true or 0 for false. Comparing an I<unknown> or an
+I<infinite> value will always result in 0 (false).
+
+B<UN, ISINF>
+
+Pop one element from the stack, compare this to I<unknown> respectively
+to I<positive or negative infinity>. Returns 1 for true or 0 for false.
+
+B<IF>
+
+Pops three elements from the stack.  If the element popped last is 0
+(false), the value popped first is pushed back onto the stack,
+otherwise the value popped second is pushed back. This does, indeed,
+mean that any value other than 0 is considered to be true.
+
+Example: C<A,B,C,IF> should be read as C<if (A) then (B) else (C)>
+
+Z<>
+
+=item Comparing values
+
+B<MIN, MAX>
+
+Pops two elements from the stack and returns the smaller or larger,
+respectively.  Note that I<infinite> is larger than anything else.
+If one of the input numbers is I<unknown> then the result of the operation will be
+I<unknown> too.
+
+B<LIMIT>
+
+Pops two elements from the stack and uses them to define a range.
+Then it pops another element and if it falls inside the range, it
+is pushed back. If not, an I<unknown> is pushed.
+
+The range defined includes the two boundaries (so: a number equal
+to one of the boundaries will be pushed back). If any of the three
+numbers involved is either I<unknown> or I<infinite> this function
+will always return an I<unknown>
+
+Example: C<CDEF:a=alpha,0,100,LIMIT> will return I<unknown> if
+alpha is lower than 0 or if it is higher than 100.
+
+Z<>
+
+=item Arithmetics
+
+B<+, -, *, /, %>
+
+Add, subtract, multiply, divide, modulo
+
+B<SIN, COS, LOG, EXP, SQRT>
+
+Sine and cosine (input in radians), log and exp (natural logarithm),
+square root.
+
+B<ATAN>
+
+Arctangent (output in radians).
+
+B<ATAN2>
+
+Arctangent of y,x components (output in radians).
+This pops one element from the stack, the x (cosine) component, and then
+a second, which is the y (sine) component.
+It then pushes the arctangent of their ratio, resolving the ambiguity between
+quadrants.
+
+Example: C<CDEF:angle=Y,X,ATAN2,RAD2DEG> will convert C<X,Y>
+components into an angle in degrees.
+
+B<FLOOR, CEIL>
+
+Round down or up to the nearest integer.
+
+B<DEG2RAD, RAD2DEG>
+
+Convert angle in degrees to radians, or radians to degrees.
+
+B<ABS>
+
+Take the absolute value.
+
+=item Set Operations
+
+B<SORT, REV>
+
+Pop one element from the stack.  This is the I<count> of items to be sorted
+(or reversed).  The top I<count> of the remaining elements are then sorted
+(or reversed) in place on the stack.
+
+Example: C<CDEF:x=v1,v2,v3,v4,v5,v6,6,SORT,POP,5,REV,POP,+,+,+,4,/> will
+compute the average of the values v1 to v6 after removing the smallest and
+largest.
+
+B<AVG>
+
+Pop one element (I<count>) from the stack. Now pop I<count> elements and build the
+average, ignoring all UNKNOWN values in the process.
+
+Example: C<CDEF:x=a,b,c,d,4,AVG>
+
+B<TREND>
+
+Create a "sliding window" average of another data series.
+
+Usage:
+CDEF:smoothed=x,1800,TREND
+
+This will create a half-hour (1800 second) sliding window average of x.  The
+average is essentially computed as shown here:
+
+                 +---!---!---!---!---!---!---!---!--->
+                                                     now
+                       delay     t0
+                 <--------------->
+                         delay       t1
+                     <--------------->
+                              delay      t2
+                         <--------------->
+
+
+     Value at sample (t0) will be the average between (t0-delay) and (t0)
+     Value at sample (t1) will be the average between (t1-delay) and (t1)
+     Value at sample (t2) will be the average between (t2-delay) and (t2)
+
+=item Special values
+
+B<UNKN>
+
+Pushes an unknown value on the stack
+
+B<INF, NEGINF>
+
+Pushes a positive or negative infinite value on the stack. When
+such a value is graphed, it appears at the top or bottom of the
+graph, no matter what the actual value on the y-axis is.
+
+B<PREV>
+
+Pushes an I<unknown> value if this is the first value of a data
+set or otherwise the result of this B<CDEF> at the previous time
+step. This allows you to do calculations across the data.  This
+function cannot be used in B<VDEF> instructions.
+
+B<PREV(vname)>
+
+Pushes an I<unknown> value if this is the first value of a data
+set or otherwise the result of the vname variable at the previous time
+step. This allows you to do calculations across the data. This
+function cannot be used in B<VDEF> instructions.
+
+B<COUNT>
+
+Pushes the number 1 if this is the first value of the data set, the
+number 2 if it is the second, and so on. This special value allows
+you to make calculations based on the position of the value within
+the data set. This function cannot be used in B<VDEF> instructions.
+
+=item Time
+
+Time inside RRDtool is measured in seconds since the epoch. The
+epoch is defined to be S<C<Thu Jan  1 00:00:00 UTC 1970>>.
+
+B<NOW>
+
+Pushes the current time on the stack.
+
+B<TIME>
+
+Pushes the time the currently processed value was taken at onto the stack.
+
+B<LTIME>
+
+Takes the time as defined by B<TIME>, applies the time zone offset
+valid at that time including daylight saving time if your OS supports
+it, and pushes the result on the stack.  There is an elaborate example
+in the examples section below on how to use this.
+
+=item Processing the stack directly
+
+B<DUP, POP, EXC>
+
+Duplicate the top element, remove the top element, exchange the two
+top elements.
+
+Z<>
+
+=back
+
+=head1 VARIABLES
+
+These operators work only on B<VDEF> statements. Note that currently ONLY these work for B<VDEF>.
+
+=over 4
+
+=item MAXIMUM, MINIMUM, AVERAGE
+
+Return the corresponding value, MAXIMUM and MINIMUM also return
+the first occurrence of that value in the time component.
+
+Example: C<VDEF:avg=mydata,AVERAGE>
+
+=item LAST, FIRST
+
+Return the last/first value including its time.  The time for
+FIRST is actually the start of the corresponding interval, whereas
+LAST returns the end of the corresponding interval.
+
+Example: C<VDEF:first=mydata,FIRST>
+
+=item TOTAL
+
+Returns the rate from each defined time slot multiplied with the
+step size.  This can, for instance, return total bytes transfered
+when you have logged bytes per second. The time component returns
+the number of seconds.
+
+Example: C<VDEF:total=mydata,TOTAL>
+
+=item PERCENT
+
+This should follow a B<DEF> or B<CDEF> I<vname>. The I<vname> is popped,
+another number is popped which is a certain percentage (0..100). The
+data set is then sorted and the value returned is chosen such that
+I<percentage> percent of the values is lower or equal than the result.
+I<Unknown> values are considered lower than any finite number for this
+purpose so if this operator returns an I<unknown> you have quite a lot
+of them in your data.  B<Inf>inite numbers are lesser, or more, than the
+finite numbers and are always more than the I<Unknown> numbers.
+(NaN E<lt> -INF E<lt> finite values E<lt> INF)
+
+Example: C<VDEF:perc95=mydata,95,PERCENT>
+
+=item LSLSLOPE, LSLINT, LSLCORREL
+
+Return the parameters for a B<L>east B<S>quares B<L>ine I<(y = mx +b)> 
+which approximate the provided dataset.  LSLSLOPE is the slope I<(m)> of
+the line related to the COUNT position of the data.  LSLINT is the 
+y-intercept I<(b)>, which happens also to be the first data point on the 
+graph. LSLCORREL is the Correlation Coefficient (also know as Pearson's 
+Product Moment Correlation Coefficient).  It will range from 0 to +/-1 
+and represents the quality of fit for the approximation.   
+
+Example: C<VDEF:slope=mydata,LSLSLOPE>
+
+=back
+
+=head1 SEE ALSO
+
+L<rrdgraph> gives an overview of how B<rrdtool graph> works.
+L<rrdgraph_data> describes B<DEF>,B<CDEF> and B<VDEF> in detail.
+L<rrdgraph_rpn> describes the B<RPN> language used in the B<?DEF> statements.
+L<rrdgraph_graph> page describes all of the graph and print functions.
+
+Make sure to read L<rrdgraph_examples> for tipsE<amp>tricks.
+
+=head1 AUTHOR
+
+Program by Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
+
+This manual page by Alex van den Bogaerdt E<lt>alex@ergens.op.het.netE<gt>
diff --git a/doc/rrdgraph_rpn.txt b/doc/rrdgraph_rpn.txt
new file mode 100644 (file)
index 0000000..d115537
--- /dev/null
@@ -0,0 +1,293 @@
+RRDGRAPH_RPN(1)                     rrdtool                    RRDGRAPH_RPN(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdgraph_rpn - About RPN Math in rrdtool graph
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       _\bR_\bP_\bN _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn:=_\bv_\bn_\ba_\bm_\be|_\bo_\bp_\be_\br_\ba_\bt_\bo_\br|_\bv_\ba_\bl_\bu_\be[,_\bR_\bP_\bN _\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn]
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       If you have ever used a traditional HP calculator you already know R\bRP\bPN\bN.
+       The idea behind R\bRP\bPN\bN is that you have a stack and push your data onto
+       this stack. Whenever you execute an operation, it takes as many ele-
+       ments from the stack as needed. Pushing is done implicitly, so whenever
+       you specify a number or a variable, it gets pushed onto the stack auto-
+       matically.
+
+       At the end of the calculation there should be one and only one value
+       left on the stack.  This is the outcome of the function and this is
+       what is put into the _\bv_\bn_\ba_\bm_\be.  For C\bCD\bDE\bEF\bF instructions, the stack is pro-
+       cessed for each data point on the graph. V\bVD\bDE\bEF\bF instructions work on an
+       entire data set in one run. Note, that currently V\bVD\bDE\bEF\bF instructions only
+       support a limited list of functions.
+
+       Example: "VDEF:maximum=mydata,MAXIMUM"
+
+       This will set variable "maximum" which you now can use in the rest of
+       your RRD script.
+
+       Example: "CDEF:mydatabits=mydata,8,*"
+
+       This means:  push variable _\bm_\by_\bd_\ba_\bt_\ba, push the number 8, execute the oper-
+       ator _\b*. The operator needs two elements and uses those to return one
+       value.  This value is then stored in _\bm_\by_\bd_\ba_\bt_\ba_\bb_\bi_\bt_\bs.  As you may have
+       guessed, this instruction means nothing more than _\bm_\by_\bd_\ba_\bt_\ba_\bb_\bi_\bt_\bs _\b= _\bm_\by_\bd_\ba_\bt_\ba _\b*
+       _\b8.  The real power of R\bRP\bPN\bN lies in the fact that it is always clear in
+       which order to process the input.  For expressions like "a = b + 3 * 5"
+       you need to multiply 3 with 5 first before you add _\bb to get _\ba. However,
+       with parentheses you could change this order: "a = (b + 3) * 5". In
+       R\bRP\bPN\bN, you would do "a = b, 3, +, 5, *" without the need for parentheses.
+
+O\bOP\bPE\bER\bRA\bAT\bTO\bOR\bRS\bS
+       Boolean operators
+           L\bLT\bT,\b, L\bLE\bE,\b, G\bGT\bT,\b, G\bGE\bE,\b, E\bEQ\bQ,\b, N\bNE\bE
+
+           Pop two elements from the stack, compare them for the selected con-
+           dition and return 1 for true or 0 for false. Comparing an _\bu_\bn_\bk_\bn_\bo_\bw_\bn
+           or an _\bi_\bn_\bf_\bi_\bn_\bi_\bt_\be value will always result in 0 (false).
+
+           U\bUN\bN,\b, I\bIS\bSI\bIN\bNF\bF
+
+           Pop one element from the stack, compare this to _\bu_\bn_\bk_\bn_\bo_\bw_\bn respec-
+           tively to _\bp_\bo_\bs_\bi_\bt_\bi_\bv_\be _\bo_\br _\bn_\be_\bg_\ba_\bt_\bi_\bv_\be _\bi_\bn_\bf_\bi_\bn_\bi_\bt_\by. Returns 1 for true or 0
+           for false.
+
+           I\bIF\bF
+
+           Pops three elements from the stack.  If the element popped last is
+           0 (false), the value popped first is pushed back onto the stack,
+           otherwise the value popped second is pushed back. This does,
+           indeed, mean that any value other than 0 is considered to be true.
+
+           Example: "A,B,C,IF" should be read as "if (A) then (B) else (C)"
+
+
+
+       Comparing values
+           M\bMI\bIN\bN,\b, M\bMA\bAX\bX
+
+           Pops two elements from the stack and returns the smaller or larger,
+           respectively.  Note that _\bi_\bn_\bf_\bi_\bn_\bi_\bt_\be is larger than anything else.  If
+           one of the input numbers is _\bu_\bn_\bk_\bn_\bo_\bw_\bn then the result of the opera-
+           tion will be _\bu_\bn_\bk_\bn_\bo_\bw_\bn too.
+
+           L\bLI\bIM\bMI\bIT\bT
+
+           Pops two elements from the stack and uses them to define a range.
+           Then it pops another element and if it falls inside the range, it
+           is pushed back. If not, an _\bu_\bn_\bk_\bn_\bo_\bw_\bn is pushed.
+
+           The range defined includes the two boundaries (so: a number equal
+           to one of the boundaries will be pushed back). If any of the three
+           numbers involved is either _\bu_\bn_\bk_\bn_\bo_\bw_\bn or _\bi_\bn_\bf_\bi_\bn_\bi_\bt_\be this function will
+           always return an _\bu_\bn_\bk_\bn_\bo_\bw_\bn
+
+           Example: "CDEF:a=alpha,0,100,LIMIT" will return _\bu_\bn_\bk_\bn_\bo_\bw_\bn if alpha is
+           lower than 0 or if it is higher than 100.
+
+
+
+       Arithmetics
+           +\b+,\b, -\b-,\b, *\b*,\b, /\b/,\b, %\b%
+
+           Add, subtract, multiply, divide, modulo
+
+           S\bSI\bIN\bN,\b, C\bCO\bOS\bS,\b, L\bLO\bOG\bG,\b, E\bEX\bXP\bP,\b, S\bSQ\bQR\bRT\bT
+
+           Sine and cosine (input in radians), log and exp (natural loga-
+           rithm), square root.
+
+           A\bAT\bTA\bAN\bN
+
+           Arctangent (output in radians).
+
+           A\bAT\bTA\bAN\bN2\b2
+
+           Arctangent of y,x components (output in radians).  This pops one
+           element from the stack, the x (cosine) component, and then a sec-
+           ond, which is the y (sine) component.  It then pushes the arctan-
+           gent of their ratio, resolving the ambiguity between quadrants.
+
+           Example: "CDEF:angle=Y,X,ATAN2,RAD2DEG" will convert "X,Y" compo-
+           nents into an angle in degrees.
+
+           F\bFL\bLO\bOO\bOR\bR,\b, C\bCE\bEI\bIL\bL
+
+           Round down or up to the nearest integer.
+
+           D\bDE\bEG\bG2\b2R\bRA\bAD\bD,\b, R\bRA\bAD\bD2\b2D\bDE\bEG\bG
+
+           Convert angle in degrees to radians, or radians to degrees.
+
+           A\bAB\bBS\bS
+
+           Take the absolute value.
+
+       Set Operations
+           S\bSO\bOR\bRT\bT,\b, R\bRE\bEV\bV
+
+           Pop one element from the stack.  This is the _\bc_\bo_\bu_\bn_\bt of items to be
+           sorted (or reversed).  The top _\bc_\bo_\bu_\bn_\bt of the remaining elements are
+           then sorted (or reversed) in place on the stack.
+
+           Example: "CDEF:x=v1,v2,v3,v4,v5,v6,6,SORT,POP,5,REV,POP,+,+,+,4,/"
+           will compute the average of the values v1 to v6 after removing the
+           smallest and largest.
+
+           A\bAV\bVG\bG
+
+           Pop one element (_\bc_\bo_\bu_\bn_\bt) from the stack. Now pop _\bc_\bo_\bu_\bn_\bt elements and
+           build the average, ignoring all UNKNOWN values in the process.
+
+           Example: "CDEF:x=a,b,c,d,4,AVG"
+
+           T\bTR\bRE\bEN\bND\bD
+
+           Create a "sliding window" average of another data series.
+
+           Usage: CDEF:smoothed=x,1800,TREND
+
+           This will create a half-hour (1800 second) sliding window average
+           of x.  The average is essentially computed as shown here:
+
+                            +---!---!---!---!---!---!---!---!--->
+                                                                now
+                                  delay     t0
+                            <--------------->
+                                    delay       t1
+                                <--------------->
+                                         delay      t2
+                                    <--------------->
+
+                Value at sample (t0) will be the average between (t0-delay) and (t0)
+                Value at sample (t1) will be the average between (t1-delay) and (t1)
+                Value at sample (t2) will be the average between (t2-delay) and (t2)
+
+       Special values
+           U\bUN\bNK\bKN\bN
+
+           Pushes an unknown value on the stack
+
+           I\bIN\bNF\bF,\b, N\bNE\bEG\bGI\bIN\bNF\bF
+
+           Pushes a positive or negative infinite value on the stack. When
+           such a value is graphed, it appears at the top or bottom of the
+           graph, no matter what the actual value on the y-axis is.
+
+           P\bPR\bRE\bEV\bV
+
+           Pushes an _\bu_\bn_\bk_\bn_\bo_\bw_\bn value if this is the first value of a data set or
+           otherwise the result of this C\bCD\bDE\bEF\bF at the previous time step. This
+           allows you to do calculations across the data.  This function can-
+           not be used in V\bVD\bDE\bEF\bF instructions.
+
+           P\bPR\bRE\bEV\bV(\b(v\bvn\bna\bam\bme\be)\b)
+
+           Pushes an _\bu_\bn_\bk_\bn_\bo_\bw_\bn value if this is the first value of a data set or
+           otherwise the result of the vname variable at the previous time
+           step. This allows you to do calculations across the data. This
+           function cannot be used in V\bVD\bDE\bEF\bF instructions.
+
+           C\bCO\bOU\bUN\bNT\bT
+
+           Pushes the number 1 if this is the first value of the data set, the
+           number 2 if it is the second, and so on. This special value allows
+           you to make calculations based on the position of the value within
+           the data set. This function cannot be used in V\bVD\bDE\bEF\bF instructions.
+
+       Time
+           Time inside RRDtool is measured in seconds since the epoch. The
+           epoch is defined to be "Thu Jan 1 00:00:00 UTC 1970".
+
+           N\bNO\bOW\bW
+
+           Pushes the current time on the stack.
+
+           T\bTI\bIM\bME\bE
+
+           Pushes the time the currently processed value was taken at onto the
+           stack.
+
+           L\bLT\bTI\bIM\bME\bE
+
+           Takes the time as defined by T\bTI\bIM\bME\bE, applies the time zone offset
+           valid at that time including daylight saving time if your OS sup-
+           ports it, and pushes the result on the stack.  There is an elabo-
+           rate example in the examples section below on how to use this.
+
+       Processing the stack directly
+           D\bDU\bUP\bP,\b, P\bPO\bOP\bP,\b, E\bEX\bXC\bC
+
+           Duplicate the top element, remove the top element, exchange the two
+           top elements.
+
+
+
+V\bVA\bAR\bRI\bIA\bAB\bBL\bLE\bES\bS
+       These operators work only on V\bVD\bDE\bEF\bF statements. Note that currently ONLY
+       these work for V\bVD\bDE\bEF\bF.
+
+       MAXIMUM, MINIMUM, AVERAGE
+           Return the corresponding value, MAXIMUM and MINIMUM also return the
+           first occurrence of that value in the time component.
+
+           Example: "VDEF:avg=mydata,AVERAGE"
+
+       LAST, FIRST
+           Return the last/first value including its time.  The time for FIRST
+           is actually the start of the corresponding interval, whereas LAST
+           returns the end of the corresponding interval.
+
+           Example: "VDEF:first=mydata,FIRST"
+
+       TOTAL
+           Returns the rate from each defined time slot multiplied with the
+           step size.  This can, for instance, return total bytes transfered
+           when you have logged bytes per second. The time component returns
+           the number of seconds.
+
+           Example: "VDEF:total=mydata,TOTAL"
+
+       PERCENT
+           This should follow a D\bDE\bEF\bF or C\bCD\bDE\bEF\bF _\bv_\bn_\ba_\bm_\be. The _\bv_\bn_\ba_\bm_\be is popped,
+           another number is popped which is a certain percentage (0..100).
+           The data set is then sorted and the value returned is chosen such
+           that _\bp_\be_\br_\bc_\be_\bn_\bt_\ba_\bg_\be percent of the values is lower or equal than the
+           result.  _\bU_\bn_\bk_\bn_\bo_\bw_\bn values are considered lower than any finite number
+           for this purpose so if this operator returns an _\bu_\bn_\bk_\bn_\bo_\bw_\bn you have
+           quite a lot of them in your data.  I\bIn\bnf\bfinite numbers are lesser, or
+           more, than the finite numbers and are always more than the _\bU_\bn_\bk_\bn_\bo_\bw_\bn
+           numbers.  (NaN < -INF < finite values < INF)
+
+           Example: "VDEF:perc95=mydata,95,PERCENT"
+
+       LSLSLOPE, LSLINT, LSLCORREL
+           Return the parameters for a L\bLeast S\bSquares L\bLine _\b(_\by _\b= _\bm_\bx _\b+_\bb_\b) which
+           approximate the provided dataset.  LSLSLOPE is the slope _\b(_\bm_\b) of the
+           line related to the COUNT position of the data.  LSLINT is the
+           y-intercept _\b(_\bb_\b), which happens also to be the first data point on
+           the graph. LSLCORREL is the Correlation Coefficient (also know as
+           Pearson's Product Moment Correlation Coefficient).  It will range
+           from 0 to +/-1 and represents the quality of fit for the approxima-
+           tion.
+
+           Example: "VDEF:slope=mydata,LSLSLOPE"
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+       rrdgraph gives an overview of how r\brr\brd\bdt\bto\boo\bol\bl g\bgr\bra\bap\bph\bh works.  rrdgraph_data
+       describes D\bDE\bEF\bF,C\bCD\bDE\bEF\bF and V\bVD\bDE\bEF\bF in detail.  rrdgraph_rpn describes the R\bRP\bPN\bN
+       language used in the ?\b?D\bDE\bEF\bF statements.  rrdgraph_graph page describes
+       all of the graph and print functions.
+
+       Make sure to read rrdgraph_examples for tips&tricks.
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Program by Tobias Oetiker <tobi@oetiker.ch>
+
+       This manual page by Alex van den Bogaerdt <alex@ergens.op.het.net>
+
+
+
+1.2.26                            2007-11-20                   RRDGRAPH_RPN(1)
diff --git a/doc/rrdinfo.1 b/doc/rrdinfo.1
new file mode 100644 (file)
index 0000000..69f48fa
--- /dev/null
@@ -0,0 +1,185 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDINFO 1"
+.TH RRDINFO 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdinfo \- extract header information from an RRD
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBrrdtool\fR \fBinfo\fR \fIfilename.rrd\fR
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fBinfo\fR function prints the header information from an \s-1RRD\s0 in
+a parsing friendly format.
+.PP
+Check rrdcreate if you are uncertain about the meaning of the
+individual keys.
+.SH "EXAMPLE"
+.IX Header "EXAMPLE"
+This is the output generated by running \fBinfo\fR on a simple \s-1RRD\s0 which
+contains two data sources and one \s-1RRA\s0. Note that the number after the
+\&\fIlast_update\fR keyword is in seconds since 1970. The string \fBNaN\fR
+stands for \fI*UNKNOWN*\fR data. In the example it means that this \s-1RRD\s0
+has neither minimum nor maximum values defined for either of its
+data sources.
+.PP
+.Vb 24
+\& filename = "random.rrd"
+\& rrd_version = "0001"
+\& step = 300
+\& last_update = 955892996
+\& ds[a].type = "GAUGE"
+\& ds[a].minimal_heartbeat = 600
+\& ds[a].min = NaN
+\& ds[a].max = NaN
+\& ds[a].last_ds = "UNKN"
+\& ds[a].value = 2.1824421548e+04
+\& ds[a].unknown_sec = 0
+\& ds[b].type = "GAUGE"
+\& ds[b].minimal_heartbeat = 600
+\& ds[b].min = NaN
+\& ds[b].max = NaN
+\& ds[b].last_ds = "UNKN"
+\& ds[b].value = 3.9620838224e+03
+\& ds[b].unknown_sec = 0
+\& rra[0].cf = "AVERAGE"
+\& rra[0].pdp_per_row = 1
+\& rra[0].cdp_prep[0].value = nan
+\& rra[0].cdp_prep[0].unknown_datapoints = 0
+\& rra[0].cdp_prep[1].value = nan
+\& rra[0].cdp_prep[1].unknown_datapoints = 0
+.Ve
+.IP "\fIfilename.rrd\fR" 8
+.IX Item "filename.rrd"
+The name of the \fB\s-1RRD\s0\fR you want to examine.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Tobias Oetiker <tobi@oetiker.ch>
diff --git a/doc/rrdinfo.html b/doc/rrdinfo.html
new file mode 100644 (file)
index 0000000..8490112
--- /dev/null
@@ -0,0 +1,95 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdinfo</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#example">EXAMPLE</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdinfo - extract header information from an RRD</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p><strong>rrdtool</strong> <strong>info</strong> <em>filename.rrd</em></p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>The <strong>info</strong> function prints the header information from an RRD in
+a parsing friendly format.</p>
+<p>Check <a href="././rrdcreate.html">the rrdcreate manpage</a> if you are uncertain about the meaning of the
+individual keys.</p>
+<p>
+</p>
+<hr />
+<h1><a name="example">EXAMPLE</a></h1>
+<p>This is the output generated by running <strong>info</strong> on a simple RRD which
+contains two data sources and one RRA. Note that the number after the
+<em>last_update</em> keyword is in seconds since 1970. The string <strong>NaN</strong>
+stands for <em>*UNKNOWN*</em> data. In the example it means that this RRD
+has neither minimum nor maximum values defined for either of its
+data sources.</p>
+<pre>
+ filename = &quot;random.rrd&quot;
+ rrd_version = &quot;0001&quot;
+ step = 300
+ last_update = 955892996
+ ds[a].type = &quot;GAUGE&quot;
+ ds[a].minimal_heartbeat = 600
+ ds[a].min = NaN
+ ds[a].max = NaN
+ ds[a].last_ds = &quot;UNKN&quot;
+ ds[a].value = 2.1824421548e+04
+ ds[a].unknown_sec = 0
+ ds[b].type = &quot;GAUGE&quot;
+ ds[b].minimal_heartbeat = 600
+ ds[b].min = NaN
+ ds[b].max = NaN
+ ds[b].last_ds = &quot;UNKN&quot;
+ ds[b].value = 3.9620838224e+03
+ ds[b].unknown_sec = 0
+ rra[0].cf = &quot;AVERAGE&quot;
+ rra[0].pdp_per_row = 1
+ rra[0].cdp_prep[0].value = nan
+ rra[0].cdp_prep[0].unknown_datapoints = 0
+ rra[0].cdp_prep[1].value = nan
+ rra[0].cdp_prep[1].unknown_datapoints = 0</pre>
+<dl>
+<dt><strong><a name="item_filename_2errd"><em>filename.rrd</em></a></strong>
+
+<dd>
+<p>The name of the <strong>RRD</strong> you want to examine.</p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdinfo.pod b/doc/rrdinfo.pod
new file mode 100644 (file)
index 0000000..e83d8d6
--- /dev/null
@@ -0,0 +1,62 @@
+=head1 NAME
+
+rrdinfo - extract header information from an RRD
+
+=head1 SYNOPSIS
+
+B<rrdtool> B<info> I<filename.rrd>
+
+=head1 DESCRIPTION
+
+The B<info> function prints the header information from an RRD in
+a parsing friendly format.
+
+Check L<rrdcreate> if you are uncertain about the meaning of the
+individual keys.
+
+=head1 EXAMPLE
+
+This is the output generated by running B<info> on a simple RRD which
+contains two data sources and one RRA. Note that the number after the
+I<last_update> keyword is in seconds since 1970. The string B<NaN>
+stands for I<*UNKNOWN*> data. In the example it means that this RRD
+has neither minimum nor maximum values defined for either of its
+data sources.
+
+ filename = "random.rrd"
+ rrd_version = "0001"
+ step = 300
+ last_update = 955892996
+ ds[a].type = "GAUGE"
+ ds[a].minimal_heartbeat = 600
+ ds[a].min = NaN
+ ds[a].max = NaN
+ ds[a].last_ds = "UNKN"
+ ds[a].value = 2.1824421548e+04
+ ds[a].unknown_sec = 0
+ ds[b].type = "GAUGE"
+ ds[b].minimal_heartbeat = 600
+ ds[b].min = NaN
+ ds[b].max = NaN
+ ds[b].last_ds = "UNKN"
+ ds[b].value = 3.9620838224e+03
+ ds[b].unknown_sec = 0
+ rra[0].cf = "AVERAGE"
+ rra[0].pdp_per_row = 1
+ rra[0].cdp_prep[0].value = nan
+ rra[0].cdp_prep[0].unknown_datapoints = 0
+ rra[0].cdp_prep[1].value = nan
+ rra[0].cdp_prep[1].unknown_datapoints = 0
+
+=over 8
+
+=item I<filename.rrd>
+
+The name of the B<RRD> you want to examine.
+
+=back
+
+=head1 AUTHOR
+
+Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
+
diff --git a/doc/rrdinfo.txt b/doc/rrdinfo.txt
new file mode 100644 (file)
index 0000000..c59a5b5
--- /dev/null
@@ -0,0 +1,58 @@
+RRDINFO(1)                          rrdtool                         RRDINFO(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdinfo - extract header information from an RRD
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       r\brr\brd\bdt\bto\boo\bol\bl i\bin\bnf\bfo\bo _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be_\b._\br_\br_\bd
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       The i\bin\bnf\bfo\bo function prints the header information from an RRD in a pars-
+       ing friendly format.
+
+       Check rrdcreate if you are uncertain about the meaning of the individ-
+       ual keys.
+
+E\bEX\bXA\bAM\bMP\bPL\bLE\bE
+       This is the output generated by running i\bin\bnf\bfo\bo on a simple RRD which con-
+       tains two data sources and one RRA. Note that the number after the
+       _\bl_\ba_\bs_\bt_\b__\bu_\bp_\bd_\ba_\bt_\be keyword is in seconds since 1970. The string N\bNa\baN\bN stands for
+       _\b*_\bU_\bN_\bK_\bN_\bO_\bW_\bN_\b* data. In the example it means that this RRD has neither mini-
+       mum nor maximum values defined for either of its data sources.
+
+        filename = "random.rrd"
+        rrd_version = "0001"
+        step = 300
+        last_update = 955892996
+        ds[a].type = "GAUGE"
+        ds[a].minimal_heartbeat = 600
+        ds[a].min = NaN
+        ds[a].max = NaN
+        ds[a].last_ds = "UNKN"
+        ds[a].value = 2.1824421548e+04
+        ds[a].unknown_sec = 0
+        ds[b].type = "GAUGE"
+        ds[b].minimal_heartbeat = 600
+        ds[b].min = NaN
+        ds[b].max = NaN
+        ds[b].last_ds = "UNKN"
+        ds[b].value = 3.9620838224e+03
+        ds[b].unknown_sec = 0
+        rra[0].cf = "AVERAGE"
+        rra[0].pdp_per_row = 1
+        rra[0].cdp_prep[0].value = nan
+        rra[0].cdp_prep[0].unknown_datapoints = 0
+        rra[0].cdp_prep[1].value = nan
+        rra[0].cdp_prep[1].unknown_datapoints = 0
+
+       _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be_\b._\br_\br_\bd
+               The name of the R\bRR\bRD\bD you want to examine.
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Tobias Oetiker <tobi@oetiker.ch>
+
+
+
+1.2.26                            2007-11-20                        RRDINFO(1)
diff --git a/doc/rrdlast.1 b/doc/rrdlast.1
new file mode 100644 (file)
index 0000000..1e93c14
--- /dev/null
@@ -0,0 +1,147 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDLAST 1"
+.TH RRDLAST 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdlast \- Return the date of the last data sample in an RRD
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBrrdtool\fR \fBlast\fR \fIfilename\fR
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fBlast\fR function returns the \s-1UNIX\s0 timestamp of the most recent
+update of the \s-1RRD\s0.
+.IP "\fIfilename\fR" 8
+.IX Item "filename"
+The name of the \fB\s-1RRD\s0\fR that contains the data.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Russ Wright <rwwright@home.com>
diff --git a/doc/rrdlast.html b/doc/rrdlast.html
new file mode 100644 (file)
index 0000000..0406125
--- /dev/null
@@ -0,0 +1,57 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdlast</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdlast - Return the date of the last data sample in an RRD</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p><strong>rrdtool</strong> <strong>last</strong> <em>filename</em></p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>The <strong>last</strong> function returns the UNIX timestamp of the most recent
+update of the RRD.</p>
+<dl>
+<dt><strong><a name="item_filename"><em>filename</em></a></strong>
+
+<dd>
+<p>The name of the <strong>RRD</strong> that contains the data.</p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Russ Wright &lt;<a href="mailto:rwwright@home.com">rwwright@home.com</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdlast.pod b/doc/rrdlast.pod
new file mode 100644 (file)
index 0000000..a3eb7fe
--- /dev/null
@@ -0,0 +1,27 @@
+=head1 NAME
+
+rrdlast - Return the date of the last data sample in an RRD
+
+=head1 SYNOPSIS
+
+B<rrdtool> B<last> I<filename>
+
+=head1 DESCRIPTION
+
+The B<last> function returns the UNIX timestamp of the most recent
+update of the RRD.
+
+=over 8
+
+=item I<filename>
+
+The name of the B<RRD> that contains the data.
+
+=back
+
+=head1 AUTHOR
+
+Russ Wright <rwwright@home.com>
+
+
+
diff --git a/doc/rrdlast.txt b/doc/rrdlast.txt
new file mode 100644 (file)
index 0000000..bb2e707
--- /dev/null
@@ -0,0 +1,23 @@
+RRDLAST(1)                          rrdtool                         RRDLAST(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdlast - Return the date of the last data sample in an RRD
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       r\brr\brd\bdt\bto\boo\bol\bl l\bla\bas\bst\bt _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       The l\bla\bas\bst\bt function returns the UNIX timestamp of the most recent update
+       of the RRD.
+
+       _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
+               The name of the R\bRR\bRD\bD that contains the data.
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Russ Wright <rwwright@home.com>
+
+
+
+1.2.26                            2007-11-20                        RRDLAST(1)
diff --git a/doc/rrdlastupdate.1 b/doc/rrdlastupdate.1
new file mode 100644 (file)
index 0000000..459daae
--- /dev/null
@@ -0,0 +1,147 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDLASTUPDATE 1"
+.TH RRDLASTUPDATE 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdlastupdate \- Return the most recent update to an RRD
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBrrdtool\fR \fBlastupdate\fR \fIfilename\fR
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fBlastupdate\fR function returns the \s-1UNIX\s0 timestamp and the 
+value stored for each datum in the most recent update of an \s-1RRD\s0.
+.IP "\fIfilename\fR" 8
+.IX Item "filename"
+The name of the \fB\s-1RRD\s0\fR that contains the data.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Andy Riebs <andy.riebs@hp.com>
diff --git a/doc/rrdlastupdate.html b/doc/rrdlastupdate.html
new file mode 100644 (file)
index 0000000..05ff422
--- /dev/null
@@ -0,0 +1,57 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdlastupdate</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdlastupdate - Return the most recent update to an RRD</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p><strong>rrdtool</strong> <strong>lastupdate</strong> <em>filename</em></p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>The <strong>lastupdate</strong> function returns the UNIX timestamp and the 
+value stored for each datum in the most recent update of an RRD.</p>
+<dl>
+<dt><strong><a name="item_filename"><em>filename</em></a></strong>
+
+<dd>
+<p>The name of the <strong>RRD</strong> that contains the data.</p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Andy Riebs &lt;<a href="mailto:andy.riebs@hp.com">andy.riebs@hp.com</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdlastupdate.pod b/doc/rrdlastupdate.pod
new file mode 100644 (file)
index 0000000..37013cf
--- /dev/null
@@ -0,0 +1,27 @@
+=head1 NAME
+
+rrdlastupdate - Return the most recent update to an RRD
+
+=head1 SYNOPSIS
+
+B<rrdtool> B<lastupdate> I<filename>
+
+=head1 DESCRIPTION
+
+The B<lastupdate> function returns the UNIX timestamp and the 
+value stored for each datum in the most recent update of an RRD.
+
+=over 8
+
+=item I<filename>
+
+The name of the B<RRD> that contains the data.
+
+=back
+
+=head1 AUTHOR
+
+Andy Riebs <andy.riebs@hp.com>
+
+
+
diff --git a/doc/rrdlastupdate.txt b/doc/rrdlastupdate.txt
new file mode 100644 (file)
index 0000000..8264e80
--- /dev/null
@@ -0,0 +1,23 @@
+RRDLASTUPDATE(1)                    rrdtool                   RRDLASTUPDATE(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdlastupdate - Return the most recent update to an RRD
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       r\brr\brd\bdt\bto\boo\bol\bl l\bla\bas\bst\btu\bup\bpd\bda\bat\bte\be _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       The l\bla\bas\bst\btu\bup\bpd\bda\bat\bte\be function returns the UNIX timestamp and the value stored
+       for each datum in the most recent update of an RRD.
+
+       _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
+               The name of the R\bRR\bRD\bD that contains the data.
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Andy Riebs <andy.riebs@hp.com>
+
+
+
+1.2.26                            2007-11-20                  RRDLASTUPDATE(1)
diff --git a/doc/rrdresize.1 b/doc/rrdresize.1
new file mode 100644 (file)
index 0000000..61e4577
--- /dev/null
@@ -0,0 +1,171 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDRESIZE 1"
+.TH RRDRESIZE 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdresize \- alters the size of an RRA and creates a new .rrd file
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBrrdtool\fR \fBresize\fR \fIfilename\fR \fIrra-num\fR  \fB\s-1GROW\s0\fR\fI|\fR\fB\s-1SHRINK\s0\fR \fIrows\fR
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fBresize\fR function is used to modify the number of rows in
+an \fB\s-1RRA\s0\fR.
+.IP "\fIfilename\fR" 8
+.IX Item "filename"
+the name of the \fB\s-1RRD\s0\fR you want to alter.
+.IP "\fIrra-num\fR" 8
+.IX Item "rra-num"
+the \fB\s-1RRA\s0\fR you want to alter. You can find the number using \fBrrdtool info\fR.
+.IP "\fB\s-1GROW\s0\fR" 8
+.IX Item "GROW"
+used if you want to add extra rows to an \s-1RRA\s0. The extra rows will be inserted
+as the rows that are oldest.
+.IP "\fB\s-1SHRINK\s0\fR" 8
+.IX Item "SHRINK"
+used if you want to remove rows from an \s-1RRA\s0. The rows that will be removed
+are the oldest rows.
+.IP "\fIrows\fR" 8
+.IX Item "rows"
+the number of rows you want to add or remove.
+.SH "NOTES"
+.IX Header "NOTES"
+The new .rrd file, with the modified RRAs, is written to the file
+\&\fBresize.rrd\fR in the current directory.  \fBThe original .rrd file is not
+modified\fR.
+.PP
+It is possible to abuse this tool and get strange results
+by first removing some rows and then reinserting the same amount (effectively
+clearing them to be Unknown). You may thus end up with unknown data in one
+\&\s-1RRA\s0 while at the same timestamp this data is available in another \s-1RRA\s0.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Alex van den Bogaerdt <alex@ergens.op.het.net>
diff --git a/doc/rrdresize.html b/doc/rrdresize.html
new file mode 100644 (file)
index 0000000..497044e
--- /dev/null
@@ -0,0 +1,95 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdresize</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#notes">NOTES</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdresize - alters the size of an RRA and creates a new .rrd file</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p><strong>rrdtool</strong> <strong>resize</strong> <em>filename</em> <em>rra-num</em>  <strong>GROW</strong><em>|</em><strong>SHRINK</strong> <em>rows</em></p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>The <strong>resize</strong> function is used to modify the number of rows in
+an <strong>RRA</strong>.</p>
+<dl>
+<dt><strong><a name="item_filename"><em>filename</em></a></strong>
+
+<dd>
+<p>the name of the <strong>RRD</strong> you want to alter.</p>
+</dd>
+</li>
+<dt><strong><a name="item_rra_2dnum"><em>rra-num</em></a></strong>
+
+<dd>
+<p>the <strong>RRA</strong> you want to alter. You can find the number using <strong>rrdtool info</strong>.</p>
+</dd>
+</li>
+<dt><strong><a name="item_grow"><strong>GROW</strong></a></strong>
+
+<dd>
+<p>used if you want to add extra rows to an RRA. The extra rows will be inserted
+as the rows that are oldest.</p>
+</dd>
+</li>
+<dt><strong><a name="item_shrink"><strong>SHRINK</strong></a></strong>
+
+<dd>
+<p>used if you want to remove rows from an RRA. The rows that will be removed
+are the oldest rows.</p>
+</dd>
+</li>
+<dt><strong><a name="item_rows"><em>rows</em></a></strong>
+
+<dd>
+<p>the number of rows you want to add or remove.</p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<hr />
+<h1><a name="notes">NOTES</a></h1>
+<p>The new .rrd file, with the modified RRAs, is written to the file
+<strong>resize.rrd</strong> in the current directory.  <strong>The original .rrd file is not
+modified</strong>.</p>
+<p>It is possible to abuse this tool and get strange results
+by first removing some rows and then reinserting the same amount (effectively
+clearing them to be Unknown). You may thus end up with unknown data in one
+RRA while at the same timestamp this data is available in another RRA.</p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Alex van den Bogaerdt &lt;<a href="mailto:alex@ergens.op.het.net">alex@ergens.op.het.net</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdresize.pod b/doc/rrdresize.pod
new file mode 100644 (file)
index 0000000..917f3fe
--- /dev/null
@@ -0,0 +1,54 @@
+=head1 NAME
+
+rrdresize - alters the size of an RRA and creates a new .rrd file
+
+=head1 SYNOPSIS
+
+B<rrdtool> B<resize> I<filename> I<rra-num>  B<GROW>I<|>B<SHRINK> I<rows>
+
+=head1 DESCRIPTION
+
+The B<resize> function is used to modify the number of rows in
+an B<RRA>.
+
+=over 8
+
+=item I<filename>
+
+the name of the B<RRD> you want to alter.
+
+=item I<rra-num>
+
+the B<RRA> you want to alter. You can find the number using B<rrdtool info>.
+
+=item B<GROW>
+
+used if you want to add extra rows to an RRA. The extra rows will be inserted
+as the rows that are oldest.
+
+=item B<SHRINK>
+
+used if you want to remove rows from an RRA. The rows that will be removed
+are the oldest rows.
+
+=item I<rows>
+
+the number of rows you want to add or remove.
+
+=back
+
+=head1 NOTES
+
+The new .rrd file, with the modified RRAs, is written to the file
+B<resize.rrd> in the current directory.  B<The original .rrd file is not
+modified>.
+
+It is possible to abuse this tool and get strange results
+by first removing some rows and then reinserting the same amount (effectively
+clearing them to be Unknown). You may thus end up with unknown data in one
+RRA while at the same timestamp this data is available in another RRA.
+
+=head1 AUTHOR
+
+Alex van den Bogaerdt <alex@ergens.op.het.net>
+
diff --git a/doc/rrdresize.txt b/doc/rrdresize.txt
new file mode 100644 (file)
index 0000000..3c703a4
--- /dev/null
@@ -0,0 +1,44 @@
+RRDRESIZE(1)                        rrdtool                       RRDRESIZE(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdresize - alters the size of an RRA and creates a new .rrd file
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       r\brr\brd\bdt\bto\boo\bol\bl r\bre\bes\bsi\biz\bze\be _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be _\br_\br_\ba_\b-_\bn_\bu_\bm  G\bGR\bRO\bOW\bW_\b|S\bSH\bHR\bRI\bIN\bNK\bK _\br_\bo_\bw_\bs
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       The r\bre\bes\bsi\biz\bze\be function is used to modify the number of rows in an R\bRR\bRA\bA.
+
+       _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
+               the name of the R\bRR\bRD\bD you want to alter.
+
+       _\br_\br_\ba_\b-_\bn_\bu_\bm the R\bRR\bRA\bA you want to alter. You can find the number using r\brr\brd\bd-\b-
+               t\bto\boo\bol\bl i\bin\bnf\bfo\bo.
+
+       G\bGR\bRO\bOW\bW    used if you want to add extra rows to an RRA. The extra rows
+               will be inserted as the rows that are oldest.
+
+       S\bSH\bHR\bRI\bIN\bNK\bK  used if you want to remove rows from an RRA. The rows that will
+               be removed are the oldest rows.
+
+       _\br_\bo_\bw_\bs    the number of rows you want to add or remove.
+
+N\bNO\bOT\bTE\bES\bS
+       The new .rrd file, with the modified RRAs, is written to the file
+       r\bre\bes\bsi\biz\bze\be.\b.r\brr\brd\bd in the current directory.  T\bTh\bhe\be o\bor\bri\big\bgi\bin\bna\bal\bl .\b.r\brr\brd\bd f\bfi\bil\ble\be i\bis\bs n\bno\bot\bt
+       m\bmo\bod\bdi\bif\bfi\bie\bed\bd.
+
+       It is possible to abuse this tool and get strange results by first
+       removing some rows and then reinserting the same amount (effectively
+       clearing them to be Unknown). You may thus end up with unknown data in
+       one RRA while at the same timestamp this data is available in another
+       RRA.
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Alex van den Bogaerdt <alex@ergens.op.het.net>
+
+
+
+1.2.26                            2007-11-20                      RRDRESIZE(1)
diff --git a/doc/rrdrestore.1 b/doc/rrdrestore.1
new file mode 100644 (file)
index 0000000..997f308
--- /dev/null
@@ -0,0 +1,158 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDRESTORE 1"
+.TH RRDRESTORE 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdrestore \- Restore the contents of an RRD from its XML dump format
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBrrdtool\fR \fBrestore\fR \fIfilename.xml\fR \fIfilename.rrd\fR
+[\fB\-\-range\-check\fR|\fB\-r\fR]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fBrestore\fR function reads the \s-1XML\s0 representation of an \s-1RRD\s0 and converts
+it to the native \fB\s-1RRD\s0\fR format.
+.IP "\fIfilename.xml\fR" 8
+.IX Item "filename.xml"
+The name of the \fB\s-1XML\s0\fR file you want to restore.
+.IP "\fIfilename.rrd\fR" 8
+.IX Item "filename.rrd"
+The name of the \fB\s-1RRD\s0\fR to restore.
+.IP "\fB\-\-range\-check\fR|\fB\-r\fR" 8
+.IX Item "--range-check|-r"
+Make sure the values in the RRAs do not exceed the limits defined for
+the various data sources.
+.IP "\fB\-\-force\-overwrite\fR|\fB\-f\fR" 8
+.IX Item "--force-overwrite|-f"
+Allows \fBRRDtool\fR to overwrite the destination \fB\s-1RRD\s0\fR.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Tobias Oetiker <tobi@oetiker.ch>
diff --git a/doc/rrdrestore.html b/doc/rrdrestore.html
new file mode 100644 (file)
index 0000000..4f49fa5
--- /dev/null
@@ -0,0 +1,77 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdrestore</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdrestore - Restore the contents of an RRD from its XML dump format</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p><strong>rrdtool</strong> <strong>restore</strong> <em>filename.xml</em> <em>filename.rrd</em>
+[<strong>--range-check</strong>|<strong>-r</strong>]</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>The <strong>restore</strong> function reads the XML representation of an RRD and converts
+it to the native <strong>RRD</strong> format.</p>
+<dl>
+<dt><strong><a name="item_filename_2exml"><em>filename.xml</em></a></strong>
+
+<dd>
+<p>The name of the <strong>XML</strong> file you want to restore.</p>
+</dd>
+</li>
+<dt><strong><a name="item_filename_2errd"><em>filename.rrd</em></a></strong>
+
+<dd>
+<p>The name of the <strong>RRD</strong> to restore.</p>
+</dd>
+</li>
+<dt><strong><a name="item__2d_2drange_2dcheck_7c_2dr"><strong>--range-check</strong>|<strong>-r</strong></a></strong>
+
+<dd>
+<p>Make sure the values in the RRAs do not exceed the limits defined for
+the various data sources.</p>
+</dd>
+</li>
+<dt><strong><a name="item__2d_2dforce_2doverwrite_7c_2df"><strong>--force-overwrite</strong>|<strong>-f</strong></a></strong>
+
+<dd>
+<p>Allows <strong>RRDtool</strong> to overwrite the destination <strong>RRD</strong>.</p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdrestore.pod b/doc/rrdrestore.pod
new file mode 100644 (file)
index 0000000..e098e0d
--- /dev/null
@@ -0,0 +1,38 @@
+=head1 NAME
+
+rrdrestore - Restore the contents of an RRD from its XML dump format
+
+=head1 SYNOPSIS
+
+B<rrdtool> B<restore> I<filename.xml> I<filename.rrd>
+S<[B<--range-check>|B<-r>]>
+
+=head1 DESCRIPTION
+
+The B<restore> function reads the XML representation of an RRD and converts
+it to the native B<RRD> format.
+
+=over 8
+
+=item I<filename.xml>
+
+The name of the B<XML> file you want to restore.
+
+=item I<filename.rrd>
+
+The name of the B<RRD> to restore.
+
+=item B<--range-check>|B<-r>
+
+Make sure the values in the RRAs do not exceed the limits defined for
+the various data sources.
+
+=item B<--force-overwrite>|B<-f>
+
+Allows B<RRDtool> to overwrite the destination B<RRD>.
+
+=back
+
+=head1 AUTHOR
+
+Tobias Oetiker <tobi@oetiker.ch>
diff --git a/doc/rrdrestore.txt b/doc/rrdrestore.txt
new file mode 100644 (file)
index 0000000..d8c1136
--- /dev/null
@@ -0,0 +1,33 @@
+RRDRESTORE(1)                       rrdtool                      RRDRESTORE(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdrestore - Restore the contents of an RRD from its XML dump format
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       r\brr\brd\bdt\bto\boo\bol\bl r\bre\bes\bst\bto\bor\bre\be _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be_\b._\bx_\bm_\bl _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be_\b._\br_\br_\bd [-\b--\b-r\bra\ban\bng\bge\be-\b-c\bch\bhe\bec\bck\bk|-\b-r\br]
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       The r\bre\bes\bst\bto\bor\bre\be function reads the XML representation of an RRD and con-
+       verts it to the native R\bRR\bRD\bD format.
+
+       _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be_\b._\bx_\bm_\bl
+               The name of the X\bXM\bML\bL file you want to restore.
+
+       _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be_\b._\br_\br_\bd
+               The name of the R\bRR\bRD\bD to restore.
+
+       -\b--\b-r\bra\ban\bng\bge\be-\b-c\bch\bhe\bec\bck\bk|-\b-r\br
+               Make sure the values in the RRAs do not exceed the limits
+               defined for the various data sources.
+
+       -\b--\b-f\bfo\bor\brc\bce\be-\b-o\bov\bve\ber\brw\bwr\bri\bit\bte\be|-\b-f\bf
+               Allows R\bRR\bRD\bDt\bto\boo\bol\bl to overwrite the destination R\bRR\bRD\bD.
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Tobias Oetiker <tobi@oetiker.ch>
+
+
+
+1.2.26                            2007-11-20                     RRDRESTORE(1)
diff --git a/doc/rrdthreads.1 b/doc/rrdthreads.1
new file mode 100644 (file)
index 0000000..214c122
--- /dev/null
@@ -0,0 +1,228 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDTHREADS 1"
+.TH RRDTHREADS 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdthreads \- Provisions for linking the RRD library to use in multi\-threaded programs
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+Using librrd in multi-threaded programs requires some extra
+precautions, as the \s-1RRD\s0 library in its original form was not
+thread-safe at all. This document describes requirements and pitfalls
+on the way to use the multi-threaded version of librrd in your own
+programs. It also gives hints for future \s-1RRD\s0 development to keep the
+library thread\-safe.
+.PP
+Currently only some \s-1RRD\s0 operations are implemented in a thread-safe
+way. They all end in the usual "\f(CW\*(C`_r\*(C'\fR" suffix.
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+In order to use librrd in multi-threaded programs you must:
+.IP "\(bu" 4
+Link with \fIlibrrd_th\fR instead of \fIlibrrd\fR (use \f(CW\*(C`\-lrrd_th\*(C'\fR when
+linking)
+.IP "\(bu" 4
+Use the "\f(CW\*(C`_r\*(C'\fR" functions instead of the normal API-functions
+.IP "\(bu" 4
+Do not use any at-style time specifications. Parsing of such time
+specifications is terribly non\-thread\-safe.
+.IP "\(bu" 4
+Never use non *\f(CW\*(C`_r\*(C'\fR functions unless it is explicitly documented that
+the function is tread\-safe.
+.IP "\(bu" 4
+Every thread \s-1SHOULD\s0 call \f(CW\*(C`rrd_get_context()\*(C'\fR before its first call to
+any \f(CW\*(C`librrd_th\*(C'\fR function in order to set up thread specific data. This
+is not strictly required, but it is the only way to test if memory
+allocation can be done by this function. Otherwise the program may die
+with a \s-1SIGSEGV\s0 in a low-memory situation.
+.IP "\(bu" 4
+Always call \f(CW\*(C`rrd_error_clear()\*(C'\fR before any call to the
+library. Otherwise the call might fail due to some earlier error.
+.Sh "\s-1NOTES\s0 \s-1FOR\s0 \s-1RRD\s0 \s-1CONTRIBUTORS\s0"
+.IX Subsection "NOTES FOR RRD CONTRIBUTORS"
+Some precautions must be followed when developing \s-1RRD\s0 from now on:
+.IP "\(bu" 4
+Only use thread-safe functions in library code. Many often used libc
+functions aren't thread\-safe. Take care in the following
+situations or when using the following library functions:
+.RS 4
+.IP "\(bu" 4
+Direct calls to \f(CW\*(C`strerror()\*(C'\fR must be avoided: use \f(CW\*(C`rrd_strerror()\*(C'\fR
+instead, it provides a per-thread error message.
+.IP "\(bu" 4
+The \f(CW\*(C`getpw*\*(C'\fR, \f(CW\*(C`getgr*\*(C'\fR, \f(CW\*(C`gethost*\*(C'\fR function families (and some more
+\&\f(CW\*(C`get*\*(C'\fR functions) are not thread\-safe: use the *\f(CW\*(C`_r\*(C'\fR variants
+.IP "\(bu" 4
+Time functions: \f(CW\*(C`asctime\*(C'\fR, \f(CW\*(C`ctime\*(C'\fR, \f(CW\*(C`gmtime\*(C'\fR, \f(CW\*(C`localtime\*(C'\fR: use
+*\f(CW\*(C`_r\*(C'\fR variants
+.IP "\(bu" 4
+\&\f(CW\*(C`strtok\*(C'\fR: use \f(CW\*(C`strtok_r\*(C'\fR
+.IP "\(bu" 4
+\&\f(CW\*(C`tmpnam\*(C'\fR: use \f(CW\*(C`tmpnam_r\*(C'\fR
+.IP "\(bu" 4
+Many others (lookup documentation)
+.RE
+.RS 4
+.RE
+.IP "\(bu" 4
+A header file named \fIrrd_is_thread_safe.h\fR is provided
+that works with the \s-1GNU\s0 C\-preprocessor to \*(L"poison\*(R" some of the most
+common non-thread-safe functions using the \f(CW\*(C`#pragma GCC poison\*(C'\fR
+directive. Just include this header in source files you want to keep
+thread\-safe.
+.IP "\(bu" 4
+Do not introduce global variables!
+.Sp
+If you really, really have to use a global variable you may add a new
+field to the \f(CW\*(C`rrd_context\*(C'\fR structure and modify \fIrrd_error.c\fR,
+\&\fIrrd_thread_safe.c\fR and \fIrrd_non_thread_safe.c\fR
+.IP "\(bu" 4
+Do not use \f(CW\*(C`getopt\*(C'\fR or \f(CW\*(C`getopt_long\*(C'\fR in *\f(CW\*(C`_r\*(C'\fR (neither directly nor
+indirectly).
+.Sp
+\&\f(CW\*(C`getopt\*(C'\fR uses global variables and behaves badly in a multi-threaded
+application when called concurrently. Instead provide a *_r function
+taking all options as function parameters. You may provide argc and
+**argv arguments for variable length argument lists. See
+\&\f(CW\*(C`rrd_update_r\*(C'\fR as an example.
+.IP "\(bu" 4
+Do not use the \f(CW\*(C`parsetime\*(C'\fR function!
+.Sp
+It uses lots of global variables. You may use it in functions not designed
+to be thread\-safe, like in functions wrapping the \f(CW\*(C`_r\*(C'\fR version of some
+operation (e.g., \f(CW\*(C`rrd_create\*(C'\fR, but not in \f(CW\*(C`rrd_create_r\*(C'\fR)
+.Sh "\s-1CURRENTLY\s0 \s-1IMPLEMENTED\s0 \s-1THREAD\s0 \s-1SAFE\s0 \s-1FUNCTIONS\s0"
+.IX Subsection "CURRENTLY IMPLEMENTED THREAD SAFE FUNCTIONS"
+Currently there exist thread-safe variants of \f(CW\*(C`rrd_update\*(C'\fR,
+\&\f(CW\*(C`rrd_create\*(C'\fR, \f(CW\*(C`rrd_dump\*(C'\fR, \f(CW\*(C`rrd_info\*(C'\fR, \f(CW\*(C`rrd_last\*(C'\fR, and \f(CW\*(C`rrd_fetch\*(C'\fR.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Peter Stamfest <peter@stamfest.at>
diff --git a/doc/rrdthreads.html b/doc/rrdthreads.html
new file mode 100644 (file)
index 0000000..a20a111
--- /dev/null
@@ -0,0 +1,155 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdthreads</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <ul>
+
+               <li><a href="#notes_for_rrd_contributors">NOTES FOR RRD CONTRIBUTORS</a></li>
+               <li><a href="#currently_implemented_thread_safe_functions">CURRENTLY IMPLEMENTED THREAD SAFE FUNCTIONS</a></li>
+       </ul>
+
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdthreads - Provisions for linking the RRD library to use in multi-threaded programs</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p>Using librrd in multi-threaded programs requires some extra
+precautions, as the RRD library in its original form was not
+thread-safe at all. This document describes requirements and pitfalls
+on the way to use the multi-threaded version of librrd in your own
+programs. It also gives hints for future RRD development to keep the
+library thread-safe.</p>
+<p>Currently only some RRD operations are implemented in a thread-safe
+way. They all end in the usual ``<code>_r</code>'' suffix.</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>In order to use librrd in multi-threaded programs you must:</p>
+<ul>
+<li>
+<p>Link with <em>librrd_th</em> instead of <em>librrd</em> (use <code>-lrrd_th</code> when
+linking)</p>
+</li>
+<li>
+<p>Use the ``<code>_r</code>'' functions instead of the normal API-functions</p>
+</li>
+<li>
+<p>Do not use any at-style time specifications. Parsing of such time
+specifications is terribly non-thread-safe.</p>
+</li>
+<li>
+<p>Never use non *<code>_r</code> functions unless it is explicitly documented that
+the function is tread-safe.</p>
+</li>
+<li>
+<p>Every thread SHOULD call <code>rrd_get_context()</code> before its first call to
+any <code>librrd_th</code> function in order to set up thread specific data. This
+is not strictly required, but it is the only way to test if memory
+allocation can be done by this function. Otherwise the program may die
+with a SIGSEGV in a low-memory situation.</p>
+</li>
+<li>
+<p>Always call <code>rrd_error_clear()</code> before any call to the
+library. Otherwise the call might fail due to some earlier error.</p>
+</li>
+</ul>
+<p>
+</p>
+<h2><a name="notes_for_rrd_contributors">NOTES FOR RRD CONTRIBUTORS</a></h2>
+<p>Some precautions must be followed when developing RRD from now on:</p>
+<ul>
+<li>
+<p>Only use thread-safe functions in library code. Many often used libc
+functions aren't thread-safe. Take care in the following
+situations or when using the following library functions:</p>
+<ul>
+<li>
+<p>Direct calls to <code>strerror()</code> must be avoided: use <code>rrd_strerror()</code>
+instead, it provides a per-thread error message.</p>
+</li>
+<li>
+<p>The <code>getpw*</code>, <code>getgr*</code>, <code>gethost*</code> function families (and some more
+<code>get*</code> functions) are not thread-safe: use the *<code>_r</code> variants</p>
+</li>
+<li>
+<p>Time functions: <code>asctime</code>, <code>ctime</code>, <code>gmtime</code>, <code>localtime</code>: use
+*<code>_r</code> variants</p>
+</li>
+<li>
+<p><code>strtok</code>: use <code>strtok_r</code></p>
+</li>
+<li>
+<p><code>tmpnam</code>: use <code>tmpnam_r</code></p>
+</li>
+<li>
+<p>Many others (lookup documentation)</p>
+</li>
+</ul>
+<li>
+<p>A header file named <em>rrd_is_thread_safe.h</em> is provided
+that works with the GNU C-preprocessor to ``poison'' some of the most
+common non-thread-safe functions using the <code>#pragma GCC poison</code>
+directive. Just include this header in source files you want to keep
+thread-safe.</p>
+</li>
+<li>
+<p>Do not introduce global variables!</p>
+<p>If you really, really have to use a global variable you may add a new
+field to the <code>rrd_context</code> structure and modify <em>rrd_error.c</em>,
+<em>rrd_thread_safe.c</em> and <em>rrd_non_thread_safe.c</em></p>
+</li>
+<li>
+<p>Do not use <code>getopt</code> or <code>getopt_long</code> in *<code>_r</code> (neither directly nor
+indirectly).</p>
+<p><code>getopt</code> uses global variables and behaves badly in a multi-threaded
+application when called concurrently. Instead provide a *_r function
+taking all options as function parameters. You may provide argc and
+**argv arguments for variable length argument lists. See
+<code>rrd_update_r</code> as an example.</p>
+</li>
+<li>
+<p>Do not use the <code>parsetime</code> function!</p>
+<p>It uses lots of global variables. You may use it in functions not designed
+to be thread-safe, like in functions wrapping the <code>_r</code> version of some
+operation (e.g., <code>rrd_create</code>, but not in <code>rrd_create_r</code>)</p>
+</li>
+</ul>
+<p>
+</p>
+<h2><a name="currently_implemented_thread_safe_functions">CURRENTLY IMPLEMENTED THREAD SAFE FUNCTIONS</a></h2>
+<p>Currently there exist thread-safe variants of <code>rrd_update</code>,
+<code>rrd_create</code>, <code>rrd_dump</code>, <code>rrd_info</code>, <code>rrd_last</code>, and <code>rrd_fetch</code>.</p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Peter Stamfest &lt;<a href="mailto:peter@stamfest.at">peter@stamfest.at</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdthreads.pod b/doc/rrdthreads.pod
new file mode 100644 (file)
index 0000000..ace7ee8
--- /dev/null
@@ -0,0 +1,144 @@
+=head1 NAME
+
+rrdthreads - Provisions for linking the RRD library to use in multi-threaded programs
+
+=head1 SYNOPSIS
+
+Using librrd in multi-threaded programs requires some extra
+precautions, as the RRD library in its original form was not
+thread-safe at all. This document describes requirements and pitfalls
+on the way to use the multi-threaded version of librrd in your own
+programs. It also gives hints for future RRD development to keep the
+library thread-safe.
+
+Currently only some RRD operations are implemented in a thread-safe
+way. They all end in the usual "C<_r>" suffix.
+
+=head1 DESCRIPTION
+
+In order to use librrd in multi-threaded programs you must:
+
+=over
+
+=item *
+
+Link with F<librrd_th> instead of F<librrd> (use C<-lrrd_th> when
+linking)
+
+=item *
+
+Use the "C<_r>" functions instead of the normal API-functions
+
+=item *
+
+Do not use any at-style time specifications. Parsing of such time
+specifications is terribly non-thread-safe.
+
+=item *
+
+Never use non *C<_r> functions unless it is explicitly documented that
+the function is tread-safe.
+
+=item *
+
+Every thread SHOULD call C<rrd_get_context()> before its first call to
+any C<librrd_th> function in order to set up thread specific data. This
+is not strictly required, but it is the only way to test if memory
+allocation can be done by this function. Otherwise the program may die
+with a SIGSEGV in a low-memory situation.
+
+=item *
+
+Always call C<rrd_error_clear()> before any call to the
+library. Otherwise the call might fail due to some earlier error.
+
+=back
+
+=head2 NOTES FOR RRD CONTRIBUTORS
+
+Some precautions must be followed when developing RRD from now on:
+
+=over
+
+=item *
+
+Only use thread-safe functions in library code. Many often used libc
+functions aren't thread-safe. Take care in the following
+situations or when using the following library functions:
+
+=over
+
+=item *
+
+Direct calls to C<strerror()> must be avoided: use C<rrd_strerror()>
+instead, it provides a per-thread error message.
+
+=item *
+
+The C<getpw*>, C<getgr*>, C<gethost*> function families (and some more
+C<get*> functions) are not thread-safe: use the *C<_r> variants
+
+=item *
+
+Time functions: C<asctime>, C<ctime>, C<gmtime>, C<localtime>: use
+*C<_r> variants
+
+=item *
+
+C<strtok>: use C<strtok_r>
+
+=item *
+
+C<tmpnam>: use C<tmpnam_r>
+
+=item *
+
+Many others (lookup documentation)
+
+=back
+
+=item *
+
+A header file named F<rrd_is_thread_safe.h> is provided
+that works with the GNU C-preprocessor to "poison" some of the most
+common non-thread-safe functions using the C<#pragma GCC poison>
+directive. Just include this header in source files you want to keep
+thread-safe.
+
+=item *
+
+Do not introduce global variables!
+
+If you really, really have to use a global variable you may add a new
+field to the C<rrd_context> structure and modify F<rrd_error.c>,
+F<rrd_thread_safe.c> and F<rrd_non_thread_safe.c>
+
+=item *
+
+Do not use C<getopt> or C<getopt_long> in *C<_r> (neither directly nor
+indirectly).
+
+C<getopt> uses global variables and behaves badly in a multi-threaded
+application when called concurrently. Instead provide a *_r function
+taking all options as function parameters. You may provide argc and
+**argv arguments for variable length argument lists. See
+C<rrd_update_r> as an example.
+
+=item *
+
+Do not use the C<parsetime> function!
+
+It uses lots of global variables. You may use it in functions not designed
+to be thread-safe, like in functions wrapping the C<_r> version of some
+operation (e.g., C<rrd_create>, but not in C<rrd_create_r>)
+
+=back
+
+=head2 CURRENTLY IMPLEMENTED THREAD SAFE FUNCTIONS
+
+Currently there exist thread-safe variants of C<rrd_update>,
+C<rrd_create>, C<rrd_dump>, C<rrd_info>, C<rrd_last>, and C<rrd_fetch>.
+
+=head1 AUTHOR
+
+Peter Stamfest E<lt>peter@stamfest.atE<gt>
diff --git a/doc/rrdthreads.txt b/doc/rrdthreads.txt
new file mode 100644 (file)
index 0000000..a186f8c
--- /dev/null
@@ -0,0 +1,103 @@
+RRDTHREADS(1)                       rrdtool                      RRDTHREADS(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdthreads - Provisions for linking the RRD library to use in
+       multi-threaded programs
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       Using librrd in multi-threaded programs requires some extra precau-
+       tions, as the RRD library in its original form was not thread-safe at
+       all. This document describes requirements and pitfalls on the way to
+       use the multi-threaded version of librrd in your own programs. It also
+       gives hints for future RRD development to keep the library thread-safe.
+
+       Currently only some RRD operations are implemented in a thread-safe
+       way. They all end in the usual ""_r"" suffix.
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       In order to use librrd in multi-threaded programs you must:
+
+       Â·   Link with _\bl_\bi_\bb_\br_\br_\bd_\b__\bt_\bh instead of _\bl_\bi_\bb_\br_\br_\bd (use "-lrrd_th" when linking)
+
+       Â·   Use the ""_r"" functions instead of the normal API-functions
+
+       Â·   Do not use any at-style time specifications. Parsing of such time
+           specifications is terribly non-thread-safe.
+
+       Â·   Never use non *"_r" functions unless it is explicitly documented
+           that the function is tread-safe.
+
+       Â·   Every thread SHOULD call "rrd_get_context()" before its first call
+           to any "librrd_th" function in order to set up thread specific
+           data. This is not strictly required, but it is the only way to test
+           if memory allocation can be done by this function. Otherwise the
+           program may die with a SIGSEGV in a low-memory situation.
+
+       Â·   Always call "rrd_error_clear()" before any call to the library.
+           Otherwise the call might fail due to some earlier error.
+
+       N\bNO\bOT\bTE\bES\bS F\bFO\bOR\bR R\bRR\bRD\bD C\bCO\bON\bNT\bTR\bRI\bIB\bBU\bUT\bTO\bOR\bRS\bS
+
+       Some precautions must be followed when developing RRD from now on:
+
+       Â·   Only use thread-safe functions in library code. Many often used
+           libc functions aren't thread-safe. Take care in the following situ-
+           ations or when using the following library functions:
+
+           Â·   Direct calls to "strerror()" must be avoided: use "rrd_str-
+               error()" instead, it provides a per-thread error message.
+
+           Â·   The "getpw*", "getgr*", "gethost*" function families (and some
+               more "get*" functions) are not thread-safe: use the *"_r" vari-
+               ants
+
+           Â·   Time functions: "asctime", "ctime", "gmtime", "localtime": use
+               *"_r" variants
+
+           Â·   "strtok": use "strtok_r"
+
+           Â·   "tmpnam": use "tmpnam_r"
+
+           Â·   Many others (lookup documentation)
+
+       Â·   A header file named _\br_\br_\bd_\b__\bi_\bs_\b__\bt_\bh_\br_\be_\ba_\bd_\b__\bs_\ba_\bf_\be_\b._\bh is provided that works
+           with the GNU C-preprocessor to "poison" some of the most common
+           non-thread-safe functions using the "#pragma GCC poison" directive.
+           Just include this header in source files you want to keep
+           thread-safe.
+
+       Â·   Do not introduce global variables!
+
+           If you really, really have to use a global variable you may add a
+           new field to the "rrd_context" structure and modify _\br_\br_\bd_\b__\be_\br_\br_\bo_\br_\b._\bc,
+           _\br_\br_\bd_\b__\bt_\bh_\br_\be_\ba_\bd_\b__\bs_\ba_\bf_\be_\b._\bc and _\br_\br_\bd_\b__\bn_\bo_\bn_\b__\bt_\bh_\br_\be_\ba_\bd_\b__\bs_\ba_\bf_\be_\b._\bc
+
+       Â·   Do not use "getopt" or "getopt_long" in *"_r" (neither directly nor
+           indirectly).
+
+           "getopt" uses global variables and behaves badly in a multi-
+           threaded application when called concurrently. Instead provide a
+           *_r function taking all options as function parameters. You may
+           provide argc and **argv arguments for variable length argument
+           lists. See "rrd_update_r" as an example.
+
+       Â·   Do not use the "parsetime" function!
+
+           It uses lots of global variables. You may use it in functions not
+           designed to be thread-safe, like in functions wrapping the "_r"
+           version of some operation (e.g., "rrd_create", but not in "rrd_cre-
+           ate_r")
+
+       C\bCU\bUR\bRR\bRE\bEN\bNT\bTL\bLY\bY I\bIM\bMP\bPL\bLE\bEM\bME\bEN\bNT\bTE\bED\bD T\bTH\bHR\bRE\bEA\bAD\bD S\bSA\bAF\bFE\bE F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS
+
+       Currently there exist thread-safe variants of "rrd_update", "rrd_cre-
+       ate", "rrd_dump", "rrd_info", "rrd_last", and "rrd_fetch".
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Peter Stamfest <peter@stamfest.at>
+
+
+
+1.2.26                            2007-11-20                     RRDTHREADS(1)
diff --git a/doc/rrdtool-dump.dtd b/doc/rrdtool-dump.dtd
new file mode 100644 (file)
index 0000000..4dc2ca2
--- /dev/null
@@ -0,0 +1,39 @@
+<!-- rrdtool-dump.dtd -->
+<!-- wolfgang{dot}schrimm{at}urz{dot}uni-heidelberg{dot}de -->
+
+<!-- root element -->
+<!ELEMENT rrd (version, step, lastupdate, ds+, rra+)>
+
+<!-- rrd's children -->
+<!ELEMENT version (#PCDATA)>
+<!ELEMENT step (#PCDATA)>
+<!ELEMENT lastupdate (#PCDATA)>
+<!-- There are two different elements with the same name -->
+<!-- /rrd/ds and /rrd/rra/cdp_prep/ds                    -->
+<!ELEMENT ds ((name, type, minimal_heartbeat, min, max, last_ds, value, 
+unknown_sec)|(value, unknown_datapoints))>
+<!ELEMENT rra (cf, pdp_per_row, xff, cdp_prep, database)>
+
+<!-- ds's children -->
+<!ELEMENT name (#PCDATA)>
+<!ELEMENT type (#PCDATA)>
+<!ELEMENT minimal_heartbeat (#PCDATA)>
+<!ELEMENT min (#PCDATA)>
+<!ELEMENT max (#PCDATA)>
+<!ELEMENT last_ds (#PCDATA)>
+<!ELEMENT unknown_sec (#PCDATA)>
+<!ELEMENT unknown_datapoints (#PCDATA)>
+<!-- There are two different elements with the same name -->
+<!-- /rrd/ds/value and /rrd/rra/cdp_prep/ds/value        -->
+<!ELEMENT value (#PCDATA)>
+
+<!-- rra's children -->
+<!ELEMENT cf (#PCDATA)>
+<!ELEMENT pdp_per_row (#PCDATA)>
+<!ELEMENT xff (#PCDATA)>
+<!ELEMENT cdp_prep (ds+)>
+<!ELEMENT database (row+)>
+
+<!-- database's children -->
+<!ELEMENT row (v+)>
+<!ELEMENT v (#PCDATA)>
diff --git a/doc/rrdtool-xport.dtd b/doc/rrdtool-xport.dtd
new file mode 100644 (file)
index 0000000..0e68015
--- /dev/null
@@ -0,0 +1,32 @@
+<!-- rrdtool-xport.dtd                                     -->
+<!-- the attributes of the row and the t elements are used -->
+<!-- in the examples/shared-demo.pl, but not in the output -->
+<!-- of the native xport command.                          -->
+<!-- wolfgang{dot}schrimm{at}urz{dot}uni-heidelberg{dot}de -->
+
+<!-- root element -->
+<!ELEMENT xport (meta, data)>
+
+<!-- root's children -->
+<!ELEMENT meta (start, step, end, rows, columns, legend)>
+<!ELEMENT data (row+)>
+
+<!-- meta's children -->
+<!ELEMENT start (#PCDATA)>
+<!ELEMENT step (#PCDATA)>
+<!ELEMENT end (#PCDATA)>
+<!ELEMENT rows (#PCDATA)>
+<!ELEMENT columns (#PCDATA)>
+<!ELEMENT legend (entry+)>
+
+<!-- legend's children -->
+<!ELEMENT entry (#PCDATA)>
+
+<!-- data's children -->
+<!ELEMENT row (t, v+)>
+<!ATTLIST row id CDATA #IMPLIED>
+
+<!-- row's children -->
+<!ELEMENT t (#PCDATA)>
+<!ATTLIST t is CDATA #IMPLIED>
+<!ELEMENT v (#PCDATA)>
diff --git a/doc/rrdtool.1 b/doc/rrdtool.1
new file mode 100644 (file)
index 0000000..8212c45
--- /dev/null
@@ -0,0 +1,406 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDTOOL 1"
+.TH RRDTOOL 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdtool \- Round Robin Database Tool
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBrrdtool\fR \fB\-\fR [workdir]| \fIfunction\fR
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+.Sh "\s-1OVERVIEW\s0"
+.IX Subsection "OVERVIEW"
+It is pretty easy to gather status information from all sorts of
+things, ranging from the temperature in your office to the number of
+octets which have passed through the \s-1FDDI\s0 interface of your
+router. But it is not so trivial to store this data in an efficient and
+systematic manner. This is where \fBRRDtool\fR comes in handy. It lets you
+\&\fIlog and analyze\fR the data you gather from all kinds of data-sources
+(\fB\s-1DS\s0\fR). The data analysis part of RRDtool is based on the ability to
+quickly generate graphical representations of the data values
+collected over a definable time period.
+.PP
+In this man page you will find general information on the design and
+functionality of the Round Robin Database Tool (RRDtool). For a more
+detailed description of how to use the individual functions of
+\&\fBRRDtool\fR check the corresponding man page.
+.PP
+For an introduction to the usage of RRDtool make sure you consult the
+rrdtutorial.
+.Sh "\s-1FUNCTIONS\s0"
+.IX Subsection "FUNCTIONS"
+While the man pages talk of command line switches you have to set in
+order to make \fBRRDtool\fR work it is important to note that
+\&\fBRRDtool\fR can be remotely controlled through a set of pipes. This
+saves a considerable amount of startup time when you plan to make
+\&\fBRRDtool\fR do a lot of things quickly. Check the section on \*(L"Remote Control\*(R" further down. There is also a number of language bindings
+for RRDtool which allow you to use it directly from perl, python, tcl,
+php, etc.
+.IP "\fBcreate\fR" 8
+.IX Item "create"
+Set up a new Round Robin Database (\s-1RRD\s0). Check rrdcreate.
+.IP "\fBupdate\fR" 8
+.IX Item "update"
+Store new data values into an \s-1RRD\s0. Check rrdupdate.
+.IP "\fBupdatev\fR" 8
+.IX Item "updatev"
+Operationally equivalent to \fBupdate\fR except for output. Check rrdupdate.
+.IP "\fBgraph\fR" 8
+.IX Item "graph"
+Create a graph from data stored in one or several RRDs. Apart from
+generating graphs, data can also be extracted to stdout. Check rrdgraph.
+.IP "\fBdump\fR" 8
+.IX Item "dump"
+Dump the contents of an \s-1RRD\s0 in plain \s-1ASCII\s0. In connection with restore
+you can use this to move an \s-1RRD\s0 from one computer architecture to
+another.  Check rrddump.
+.IP "\fBrestore\fR" 8
+.IX Item "restore"
+Restore an \s-1RRD\s0 in \s-1XML\s0 format to a binary \s-1RRD\s0. Check rrdrestore
+.IP "\fBfetch\fR" 8
+.IX Item "fetch"
+Get data for a certain time period from a \s-1RRD\s0. The graph function
+uses fetch to retrieve its data from an \s-1RRD\s0. Check rrdfetch.
+.IP "\fBtune\fR" 8
+.IX Item "tune"
+Alter setup of an \s-1RRD\s0. Check rrdtune.
+.IP "\fBlast\fR" 8
+.IX Item "last"
+Find the last update time of an \s-1RRD\s0. Check rrdlast.
+.IP "\fBinfo\fR" 8
+.IX Item "info"
+Get information about an \s-1RRD\s0. Check rrdinfo.
+.IP "\fBrrdresize\fR" 8
+.IX Item "rrdresize"
+Change the size of individual RRAs. This is dangerous! Check rrdresize.
+.IP "\fBxport\fR" 8
+.IX Item "xport"
+Export data retrieved from one or several RRDs. Check rrdxport
+.IP "\fBrrdcgi\fR" 8
+.IX Item "rrdcgi"
+This is a standalone tool for producing \s-1RRD\s0 graphs on the fly. Check
+rrdcgi.
+.Sh "\s-1HOW\s0 \s-1DOES\s0 \s-1RRDTOOL\s0 \s-1WORK\s0?"
+.IX Subsection "HOW DOES RRDTOOL WORK?"
+.IP "Data Acquisition" 8
+.IX Item "Data Acquisition"
+When monitoring the state of a system, it is convenient to have the
+data available at a constant time interval. Unfortunately, you may not
+always be able to fetch data at exactly the time you want
+to. Therefore \fBRRDtool\fR lets you update the logfile at any time you
+want. It will automatically interpolate the value of the data-source
+(\fB\s-1DS\s0\fR) at the latest official time-slot (intervall) and write this
+interpolated value to the log. The original value you have supplied is
+stored as well and is also taken into account when interpolating the
+next log entry.
+.IP "Consolidation" 8
+.IX Item "Consolidation"
+You may log data at a 1 minute interval, but you might also be
+interested to know the development of the data over the last year. You
+could do this by simply storing the data in 1 minute intervals for the
+whole year. While this would take considerable disk space it would
+also take a lot of time to analyze the data when you wanted to create
+a graph covering the whole year. \fBRRDtool\fR offers a solution to this
+problem through its data consolidation feature. When setting up an
+Round Robin Database (\fB\s-1RRD\s0\fR), you can define at which interval this
+consolidation should occur, and what consolidation function (\fB\s-1CF\s0\fR)
+(average, minimum, maximum, total, last) should be used to build the
+consolidated values (see rrdcreate). You can define any number of
+different consolidation setups within one \fB\s-1RRD\s0\fR. They will all be
+maintained on the fly when new data is loaded into the \fB\s-1RRD\s0\fR.
+.IP "Round Robin Archives" 8
+.IX Item "Round Robin Archives"
+Data values of the same consolidation setup are stored into Round
+Robin Archives (\fB\s-1RRA\s0\fR). This is a very efficient manner to store data
+for a certain amount of time, while using a known and constant amount
+of storage space.
+.Sp
+It works like this: If you want to store 1'000 values in 5 minute
+interval, \fBRRDtool\fR will allocate space for 1'000 data values and a
+header area. In the header it will store a pointer telling which slots
+(value) in the storage area was last written to. New values are
+written to the Round Robin Archive in, you guessed it, a round robin
+manner. This automatically limits the history to the last 1'000 values
+(in our example). Because you can define several \fB\s-1RRA\s0\fRs within a
+single \fB\s-1RRD\s0\fR, you can setup another one, for storing 750 data values
+at a 2 hour interval, for example, and thus keep a log for the last
+two months at a lower resolution.
+.Sp
+The use of \fB\s-1RRA\s0\fRs guarantees that the \fB\s-1RRD\s0\fR does not grow over
+time and that old data is automatically eliminated. By using the
+consolidation feature, you can still keep data for a very long time,
+while gradually reducing the resolution of the data along the time
+axis.
+.Sp
+Using different consolidation functions (\fB\s-1CF\s0\fR) allows you to store
+exactly the type of information that actually interests you: the maximum
+one minute traffic on the \s-1LAN\s0, the minimum temperature of your wine cellar,
+the total minutes of down time, etc.
+.IP "Unknown Data" 8
+.IX Item "Unknown Data"
+As mentioned earlier, the \fB\s-1RRD\s0\fR stores data at a constant
+interval. Sometimes it may happen that no new data is available when a
+value has to be written to the \fB\s-1RRD\s0\fR. Data acquisition may not be
+possible for one reason or other. With \fBRRDtool\fR you can handle these
+situations by storing an \fI*UNKNOWN*\fR value into the database. The
+value '\fI*UNKNOWN*\fR' is supported through all the functions of the
+tool. When consolidating a data set, the amount of \fI*UNKNOWN*\fR data
+values is accounted for and when a new consolidated value is ready to
+be written to its Round Robin Archive (\fB\s-1RRA\s0\fR), a validity check is
+performed to make sure that the percentage of unknown values in the
+data point is above a configurable level. If not, an \fI*UNKNOWN*\fR value
+will be written to the \fB\s-1RRA\s0\fR.
+.IP "Graphing" 8
+.IX Item "Graphing"
+\&\fBRRDtool\fR allows you to generate reports in numerical and
+graphical form based on the data stored in one or several
+\&\fB\s-1RRD\s0\fRs. The graphing feature is fully configurable. Size, color and
+contents of the graph can be defined freely. Check rrdgraph
+for more information on this.
+.IP "Aberrant Behavior Detection" 8
+.IX Item "Aberrant Behavior Detection"
+by Jake Brutlag
+.Sp
+\&\fBRRDtool\fR provides the building blocks for near real-time aberrant
+behavior detection. These components include:
+.RS 8
+.IP "*" 4
+An algorithm for predicting the value of a time series one time step
+into the future.
+.IP "*" 4
+A measure of deviation between predicted and observed values.
+.IP "*" 4
+A mechanism to decide if and when an observed value or sequence of
+observed values is \fItoo deviant\fR from the predicted value(s).
+.RE
+.RS 8
+.Sp
+Here is a brief explanation of these components:
+.Sp
+The Holt-Winters time series forecasting algorithm is an on-line (or
+incremental) algorithm that adaptively predicts future observations in
+a time series. Its forecast is the sum of three components: a baseline
+(or intercept), a linear trend over time (or slope), and a seasonal
+coefficient (a periodic effect, such as a daily cycle). There is one
+seasonal coefficient for each time point in the period (cycle). After
+a value is observed, each of these components is updated via
+exponential smoothing. This means that the algorithm \*(L"learns\*(R" from
+past values and uses them to predict the future. The rate of
+adaptation is governed by 3 parameters, alpha (intercept), beta
+(slope), and gamma (seasonal). The prediction can also be viewed as a
+smoothed value for the time series.
+.Sp
+The measure of deviation is a seasonal weighted absolute
+deviation. The term \fIseasonal\fR means deviation is measured separately
+for each time point in the seasonal cycle. As with Holt-Winters
+forecasting, deviation is predicted using the measure computed from
+past values (but only at that point in the seasonal cycle). After the
+value is observed, the algorithm learns from the observed value via
+exponential smoothing. Confidence bands for the observed time series
+are generated by scaling the sequence of predicted deviation values
+(we usually think of the sequence as a continuous line rather than a
+set of discrete points).
+.Sp
+Aberrant behavior (a potential failure) is reported whenever the
+number of times the observed value violates the confidence bands meets
+or exceeds a specified threshold within a specified temporal window
+(e.g. 5 violations during the past 45 minutes with a value observed
+every 5 minutes).
+.Sp
+This functionality is embedded in a set of related \fBRRAs\fR. In
+particular, a \s-1FAILURES\s0 \fB\s-1RRA\s0\fR logs potential failures. With these data
+you could, for example, use a front-end application to \fBRRDtool\fR to
+initiate real-time alerts.
+.Sp
+For a detailed description on how to set this up, see rrdcreate.
+.RE
+.Sh "\s-1REMOTE\s0 \s-1CONTROL\s0"
+.IX Subsection "REMOTE CONTROL"
+When you start \fBRRDtool\fR with the command line option '\fB\-\fR' it waits
+for input via standard input (\s-1STDIN\s0). With this feature you can
+improve performance by attaching \fBRRDtool\fR to another process (\s-1MRTG\s0
+is one example) through a set of pipes. Over these pipes \fBRRDtool\fR
+accepts the same arguments as on the command line and some special
+commands like \fBquit, cd, mkdir\fR and \fBls\fR. For detailed help on the
+server commands type:
+.PP
+.Vb 1
+\&   rrdtool help cd|mkdir|pwd|ls|quit
+.Ve
+.PP
+When a command is completed, RRDtool will print the string  '\f(CW\*(C`OK\*(C'\fR',
+followed by timing information of the form \fBu:\fR\fIusertime\fR
+\&\fBs:\fR\fIsystemtime\fR. Both values are the running totals of seconds since
+RRDtool was started. If an error occurs, a line of the form '\f(CW\*(C`ERROR:\*(C'\fR
+\&\fIDescription of error\fR' will be printed instead. \fBRRDtool\fR will not abort,
+unless something realy serious happens. If
+a \fBworkdir\fR is specified and the \s-1UID\s0 is 0, RRDtool will do a chroot to that
+workdir. If the \s-1UID\s0 is not 0, RRDtool only changes the current directory to
+\&\fBworkdir\fR.
+.Sh "\s-1RRD\s0 Server"
+.IX Subsection "RRD Server"
+If you want to create a RRD\-Server, you must choose a \s-1TCP/IP\s0 Service
+number and add them to \fI/etc/services\fR like this:
+.PP
+.Vb 1
+\& rrdsrv      13900/tcp                       # RRD server
+.Ve
+.PP
+Attention: the \s-1TCP\s0 port 13900 isn't officially registered for
+rrdsrv. You can use any unused port in your services file, but the
+server and the client system must use the same port, of course.
+.PP
+With this configuration you can add RRDtool as meta-server to
+\&\fI/etc/inetd.conf\fR. For example:
+.PP
+.Vb 1
+\& rrdsrv stream tcp nowait root /opt/rrd/bin/rrdtool rrdtool \- /var/rrd
+.Ve
+.PP
+Don't forget to create the database directory /var/rrd and
+reinitialize your inetd.
+.PP
+If all was setup correctly, you can access the server with perl
+sockets, tools like netcat, or in a quick interactive test by using
+\&'telnet localhost rrdsrv'.
+.PP
+\&\fB\s-1NOTE:\s0\fR that there is no authentication with this feature! Do not setup
+such a port unless you are sure what you are doing.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+rrdcreate, rrdupdate, rrdgraph, rrddump, rrdfetch, rrdtune, rrdlast, rrdxport
+.SH "BUGS"
+.IX Header "BUGS"
+Bugs? Features!
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Tobias Oetiker <tobi@oetiker.ch>
diff --git a/doc/rrdtool.html b/doc/rrdtool.html
new file mode 100644 (file)
index 0000000..2673b6b
--- /dev/null
@@ -0,0 +1,376 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdtool</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <ul>
+
+               <li><a href="#overview">OVERVIEW</a></li>
+               <li><a href="#functions">FUNCTIONS</a></li>
+               <li><a href="#how_does_rrdtool_work">HOW DOES RRDTOOL WORK?</a></li>
+               <li><a href="#remote_control">REMOTE CONTROL</a></li>
+               <li><a href="#rrd_server">RRD Server</a></li>
+       </ul>
+
+       <li><a href="#see_also">SEE ALSO</a></li>
+       <li><a href="#bugs">BUGS</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdtool - Round Robin Database Tool</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p><strong>rrdtool</strong> <strong>-</strong> [workdir]| <em>function</em></p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>
+</p>
+<h2><a name="overview">OVERVIEW</a></h2>
+<p>It is pretty easy to gather status information from all sorts of
+things, ranging from the temperature in your office to the number of
+octets which have passed through the FDDI interface of your
+router. But it is not so trivial to store this data in an efficient and
+systematic manner. This is where <strong>RRDtool</strong> comes in handy. It lets you
+<em>log and analyze</em> the data you gather from all kinds of data-sources
+(<strong>DS</strong>). The data analysis part of RRDtool is based on the ability to
+quickly generate graphical representations of the data values
+collected over a definable time period.</p>
+<p>In this man page you will find general information on the design and
+functionality of the Round Robin Database Tool (RRDtool). For a more
+detailed description of how to use the individual functions of
+<strong>RRDtool</strong> check the corresponding man page.</p>
+<p>For an introduction to the usage of RRDtool make sure you consult the
+<a href="././rrdtutorial.html">the rrdtutorial manpage</a>.</p>
+<p>
+</p>
+<h2><a name="functions">FUNCTIONS</a></h2>
+<p>While the man pages talk of command line switches you have to set in
+order to make <strong>RRDtool</strong> work it is important to note that
+<strong>RRDtool</strong> can be remotely controlled through a set of pipes. This
+saves a considerable amount of startup time when you plan to make
+<strong>RRDtool</strong> do a lot of things quickly. Check the section on <a href="#remote_control">Remote Control</a> further down. There is also a number of language bindings
+for RRDtool which allow you to use it directly from perl, python, tcl,
+php, etc.</p>
+<dl>
+<dt><strong><a name="item_create"><strong>create</strong></a></strong>
+
+<dd>
+<p>Set up a new Round Robin Database (RRD). Check <a href="././rrdcreate.html">the rrdcreate manpage</a>.</p>
+</dd>
+</li>
+<dt><strong><a name="item_update"><strong>update</strong></a></strong>
+
+<dd>
+<p>Store new data values into an RRD. Check <a href="././rrdupdate.html">the rrdupdate manpage</a>.</p>
+</dd>
+</li>
+<dt><strong><a name="item_updatev"><strong>updatev</strong></a></strong>
+
+<dd>
+<p>Operationally equivalent to <strong>update</strong> except for output. Check <a href="././rrdupdate.html">the rrdupdate manpage</a>.</p>
+</dd>
+</li>
+<dt><strong><a name="item_graph"><strong>graph</strong></a></strong>
+
+<dd>
+<p>Create a graph from data stored in one or several RRDs. Apart from
+generating graphs, data can also be extracted to stdout. Check <a href="././rrdgraph.html">the rrdgraph manpage</a>.</p>
+</dd>
+</li>
+<dt><strong><a name="item_dump"><strong>dump</strong></a></strong>
+
+<dd>
+<p>Dump the contents of an RRD in plain ASCII. In connection with restore
+you can use this to move an RRD from one computer architecture to
+another.  Check <a href="././rrddump.html">the rrddump manpage</a>.</p>
+</dd>
+</li>
+<dt><strong><a name="item_restore"><strong>restore</strong></a></strong>
+
+<dd>
+<p>Restore an RRD in XML format to a binary RRD. Check <a href="././rrdrestore.html">the rrdrestore manpage</a></p>
+</dd>
+</li>
+<dt><strong><a name="item_fetch"><strong>fetch</strong></a></strong>
+
+<dd>
+<p>Get data for a certain time period from a RRD. The graph function
+uses fetch to retrieve its data from an RRD. Check <a href="././rrdfetch.html">the rrdfetch manpage</a>.</p>
+</dd>
+</li>
+<dt><strong><a name="item_tune"><strong>tune</strong></a></strong>
+
+<dd>
+<p>Alter setup of an RRD. Check <a href="././rrdtune.html">the rrdtune manpage</a>.</p>
+</dd>
+</li>
+<dt><strong><a name="item_last"><strong>last</strong></a></strong>
+
+<dd>
+<p>Find the last update time of an RRD. Check <a href="././rrdlast.html">the rrdlast manpage</a>.</p>
+</dd>
+</li>
+<dt><strong><a name="item_info"><strong>info</strong></a></strong>
+
+<dd>
+<p>Get information about an RRD. Check <a href="././rrdinfo.html">the rrdinfo manpage</a>.</p>
+</dd>
+</li>
+<dt><strong><a name="item_rrdresize"><strong>rrdresize</strong></a></strong>
+
+<dd>
+<p>Change the size of individual RRAs. This is dangerous! Check <a href="././rrdresize.html">the rrdresize manpage</a>.</p>
+</dd>
+</li>
+<dt><strong><a name="item_xport"><strong>xport</strong></a></strong>
+
+<dd>
+<p>Export data retrieved from one or several RRDs. Check <a href="././rrdxport.html">the rrdxport manpage</a></p>
+</dd>
+</li>
+<dt><strong><a name="item_rrdcgi"><strong>rrdcgi</strong></a></strong>
+
+<dd>
+<p>This is a standalone tool for producing RRD graphs on the fly. Check
+<a href="././rrdcgi.html">the rrdcgi manpage</a>.</p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<h2><a name="how_does_rrdtool_work">HOW DOES RRDTOOL WORK?</a></h2>
+<dl>
+<dt><strong><a name="item_data_acquisition">Data Acquisition</a></strong>
+
+<dd>
+<p>When monitoring the state of a system, it is convenient to have the
+data available at a constant time interval. Unfortunately, you may not
+always be able to fetch data at exactly the time you want
+to. Therefore <strong>RRDtool</strong> lets you update the logfile at any time you
+want. It will automatically interpolate the value of the data-source
+(<strong>DS</strong>) at the latest official time-slot (intervall) and write this
+interpolated value to the log. The original value you have supplied is
+stored as well and is also taken into account when interpolating the
+next log entry.</p>
+</dd>
+</li>
+<dt><strong><a name="item_consolidation">Consolidation</a></strong>
+
+<dd>
+<p>You may log data at a 1 minute interval, but you might also be
+interested to know the development of the data over the last year. You
+could do this by simply storing the data in 1 minute intervals for the
+whole year. While this would take considerable disk space it would
+also take a lot of time to analyze the data when you wanted to create
+a graph covering the whole year. <strong>RRDtool</strong> offers a solution to this
+problem through its data consolidation feature. When setting up an
+Round Robin Database (<strong>RRD</strong>), you can define at which interval this
+consolidation should occur, and what consolidation function (<strong>CF</strong>)
+(average, minimum, maximum, total, last) should be used to build the
+consolidated values (see rrdcreate). You can define any number of
+different consolidation setups within one <strong>RRD</strong>. They will all be
+maintained on the fly when new data is loaded into the <strong>RRD</strong>.</p>
+</dd>
+</li>
+<dt><strong><a name="item_round_robin_archives">Round Robin Archives</a></strong>
+
+<dd>
+<p>Data values of the same consolidation setup are stored into Round
+Robin Archives (<strong>RRA</strong>). This is a very efficient manner to store data
+for a certain amount of time, while using a known and constant amount
+of storage space.</p>
+</dd>
+<dd>
+<p>It works like this: If you want to store 1'000 values in 5 minute
+interval, <strong>RRDtool</strong> will allocate space for 1'000 data values and a
+header area. In the header it will store a pointer telling which slots
+(value) in the storage area was last written to. New values are
+written to the Round Robin Archive in, you guessed it, a round robin
+manner. This automatically limits the history to the last 1'000 values
+(in our example). Because you can define several <strong>RRA</strong>s within a
+single <strong>RRD</strong>, you can setup another one, for storing 750 data values
+at a 2 hour interval, for example, and thus keep a log for the last
+two months at a lower resolution.</p>
+</dd>
+<dd>
+<p>The use of <strong>RRA</strong>s guarantees that the <strong>RRD</strong> does not grow over
+time and that old data is automatically eliminated. By using the
+consolidation feature, you can still keep data for a very long time,
+while gradually reducing the resolution of the data along the time
+axis.</p>
+</dd>
+<dd>
+<p>Using different consolidation functions (<strong>CF</strong>) allows you to store
+exactly the type of information that actually interests you: the maximum
+one minute traffic on the LAN, the minimum temperature of your wine cellar,
+the total minutes of down time, etc.</p>
+</dd>
+</li>
+<dt><strong><a name="item_unknown_data">Unknown Data</a></strong>
+
+<dd>
+<p>As mentioned earlier, the <strong>RRD</strong> stores data at a constant
+interval. Sometimes it may happen that no new data is available when a
+value has to be written to the <strong>RRD</strong>. Data acquisition may not be
+possible for one reason or other. With <strong>RRDtool</strong> you can handle these
+situations by storing an <em>*UNKNOWN*</em> value into the database. The
+value '<em>*UNKNOWN*</em>' is supported through all the functions of the
+tool. When consolidating a data set, the amount of <em>*UNKNOWN*</em> data
+values is accounted for and when a new consolidated value is ready to
+be written to its Round Robin Archive (<strong>RRA</strong>), a validity check is
+performed to make sure that the percentage of unknown values in the
+data point is above a configurable level. If not, an <em>*UNKNOWN*</em> value
+will be written to the <strong>RRA</strong>.</p>
+</dd>
+</li>
+<dt><strong><a name="item_graphing">Graphing</a></strong>
+
+<dd>
+<p><strong>RRDtool</strong> allows you to generate reports in numerical and
+graphical form based on the data stored in one or several
+<strong>RRD</strong>s. The graphing feature is fully configurable. Size, color and
+contents of the graph can be defined freely. Check <a href="././rrdgraph.html">the rrdgraph manpage</a>
+for more information on this.</p>
+</dd>
+</li>
+<dt><strong><a name="item_aberrant_behavior_detection">Aberrant Behavior Detection</a></strong>
+
+<dd>
+<p>by Jake Brutlag</p>
+</dd>
+<dd>
+<p><strong>RRDtool</strong> provides the building blocks for near real-time aberrant
+behavior detection. These components include:</p>
+</dd>
+<ul>
+<li>
+<p>An algorithm for predicting the value of a time series one time step
+into the future.</p>
+</li>
+<li>
+<p>A measure of deviation between predicted and observed values.</p>
+</li>
+<li>
+<p>A mechanism to decide if and when an observed value or sequence of
+observed values is <em>too deviant</em> from the predicted value(s).</p>
+</li>
+</ul>
+<p>Here is a brief explanation of these components:</p>
+<p>The Holt-Winters time series forecasting algorithm is an on-line (or
+incremental) algorithm that adaptively predicts future observations in
+a time series. Its forecast is the sum of three components: a baseline
+(or intercept), a linear trend over time (or slope), and a seasonal
+coefficient (a periodic effect, such as a daily cycle). There is one
+seasonal coefficient for each time point in the period (cycle). After
+a value is observed, each of these components is updated via
+exponential smoothing. This means that the algorithm ``learns'' from
+past values and uses them to predict the future. The rate of
+adaptation is governed by 3 parameters, alpha (intercept), beta
+(slope), and gamma (seasonal). The prediction can also be viewed as a
+smoothed value for the time series.</p>
+<p>The measure of deviation is a seasonal weighted absolute
+deviation. The term <em>seasonal</em> means deviation is measured separately
+for each time point in the seasonal cycle. As with Holt-Winters
+forecasting, deviation is predicted using the measure computed from
+past values (but only at that point in the seasonal cycle). After the
+value is observed, the algorithm learns from the observed value via
+exponential smoothing. Confidence bands for the observed time series
+are generated by scaling the sequence of predicted deviation values
+(we usually think of the sequence as a continuous line rather than a
+set of discrete points).</p>
+<p>Aberrant behavior (a potential failure) is reported whenever the
+number of times the observed value violates the confidence bands meets
+or exceeds a specified threshold within a specified temporal window
+(e.g. 5 violations during the past 45 minutes with a value observed
+every 5 minutes).</p>
+<p>This functionality is embedded in a set of related <strong>RRAs</strong>. In
+particular, a FAILURES <strong>RRA</strong> logs potential failures. With these data
+you could, for example, use a front-end application to <strong>RRDtool</strong> to
+initiate real-time alerts.</p>
+<p>For a detailed description on how to set this up, see <a href="././rrdcreate.html">the rrdcreate manpage</a>.</p>
+</dl>
+<p>
+</p>
+<h2><a name="remote_control">REMOTE CONTROL</a></h2>
+<p>When you start <strong>RRDtool</strong> with the command line option '<strong>-</strong>' it waits
+for input via standard input (STDIN). With this feature you can
+improve performance by attaching <strong>RRDtool</strong> to another process (MRTG
+is one example) through a set of pipes. Over these pipes <strong>RRDtool</strong>
+accepts the same arguments as on the command line and some special
+commands like <strong>quit, cd, mkdir</strong> and <strong>ls</strong>. For detailed help on the
+server commands type:</p>
+<pre>
+   rrdtool help cd|mkdir|pwd|ls|quit</pre>
+<p>When a command is completed, RRDtool will print the string  '<code>OK</code>',
+followed by timing information of the form <strong>u:</strong><em>usertime</em>
+<strong>s:</strong><em>systemtime</em>. Both values are the running totals of seconds since
+RRDtool was started. If an error occurs, a line of the form '<code>ERROR:</code>
+<em>Description of error</em>' will be printed instead. <strong>RRDtool</strong> will not abort,
+unless something realy serious happens. If
+a <strong>workdir</strong> is specified and the UID is 0, RRDtool will do a chroot to that
+workdir. If the UID is not 0, RRDtool only changes the current directory to
+<strong>workdir</strong>.</p>
+<p>
+</p>
+<h2><a name="rrd_server">RRD Server</a></h2>
+<p>If you want to create a RRD-Server, you must choose a TCP/IP Service
+number and add them to <em>/etc/services</em> like this:</p>
+<pre>
+ rrdsrv      13900/tcp                       # RRD server</pre>
+<p>Attention: the TCP port 13900 isn't officially registered for
+rrdsrv. You can use any unused port in your services file, but the
+server and the client system must use the same port, of course.</p>
+<p>With this configuration you can add RRDtool as meta-server to
+<em>/etc/inetd.conf</em>. For example:</p>
+<pre>
+ rrdsrv stream tcp nowait root /opt/rrd/bin/rrdtool rrdtool - /var/rrd</pre>
+<p>Don't forget to create the database directory /var/rrd and
+reinitialize your inetd.</p>
+<p>If all was setup correctly, you can access the server with perl
+sockets, tools like netcat, or in a quick interactive test by using
+'telnet localhost rrdsrv'.</p>
+<p><strong>NOTE:</strong> that there is no authentication with this feature! Do not setup
+such a port unless you are sure what you are doing.</p>
+<p>
+</p>
+<hr />
+<h1><a name="see_also">SEE ALSO</a></h1>
+<p>rrdcreate, rrdupdate, rrdgraph, rrddump, rrdfetch, rrdtune, rrdlast, rrdxport</p>
+<p>
+</p>
+<hr />
+<h1><a name="bugs">BUGS</a></h1>
+<p>Bugs? Features!</p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdtool.pod b/doc/rrdtool.pod
new file mode 100644 (file)
index 0000000..cd3c785
--- /dev/null
@@ -0,0 +1,312 @@
+=head1 NAME
+
+rrdtool - Round Robin Database Tool
+
+=head1 SYNOPSIS
+
+B<rrdtool> B<-> [workdir]| I<function>
+
+=head1 DESCRIPTION
+
+=head2 OVERVIEW
+
+It is pretty easy to gather status information from all sorts of
+things, ranging from the temperature in your office to the number of
+octets which have passed through the FDDI interface of your
+router. But it is not so trivial to store this data in an efficient and
+systematic manner. This is where B<RRDtool> comes in handy. It lets you
+I<log and analyze> the data you gather from all kinds of data-sources
+(B<DS>). The data analysis part of RRDtool is based on the ability to
+quickly generate graphical representations of the data values
+collected over a definable time period.
+
+In this man page you will find general information on the design and
+functionality of the Round Robin Database Tool (RRDtool). For a more
+detailed description of how to use the individual functions of
+B<RRDtool> check the corresponding man page.
+
+For an introduction to the usage of RRDtool make sure you consult the
+L<rrdtutorial>.
+
+=head2 FUNCTIONS
+
+While the man pages talk of command line switches you have to set in
+order to make B<RRDtool> work it is important to note that
+B<RRDtool> can be remotely controlled through a set of pipes. This
+saves a considerable amount of startup time when you plan to make
+B<RRDtool> do a lot of things quickly. Check the section on L<"Remote
+Control"> further down. There is also a number of language bindings
+for RRDtool which allow you to use it directly from perl, python, tcl,
+php, etc.
+
+=over 8
+
+=item B<create>
+
+Set up a new Round Robin Database (RRD). Check L<rrdcreate>.
+
+=item B<update>
+
+Store new data values into an RRD. Check L<rrdupdate>.
+
+=item B<updatev>
+
+Operationally equivalent to B<update> except for output. Check L<rrdupdate>.
+
+=item B<graph>
+
+Create a graph from data stored in one or several RRDs. Apart from
+generating graphs, data can also be extracted to stdout. Check L<rrdgraph>.
+
+=item B<dump>
+
+Dump the contents of an RRD in plain ASCII. In connection with restore
+you can use this to move an RRD from one computer architecture to
+another.  Check L<rrddump>.
+
+=item B<restore>
+
+Restore an RRD in XML format to a binary RRD. Check L<rrdrestore>
+
+=item B<fetch>
+
+Get data for a certain time period from a RRD. The graph function
+uses fetch to retrieve its data from an RRD. Check L<rrdfetch>.
+
+=item B<tune>
+
+Alter setup of an RRD. Check L<rrdtune>.
+
+=item B<last>
+
+Find the last update time of an RRD. Check L<rrdlast>.
+
+=item B<info>
+
+Get information about an RRD. Check L<rrdinfo>.
+
+=item B<rrdresize>
+
+Change the size of individual RRAs. This is dangerous! Check L<rrdresize>.
+
+=item B<xport>
+
+Export data retrieved from one or several RRDs. Check L<rrdxport>
+
+=item B<rrdcgi>
+
+This is a standalone tool for producing RRD graphs on the fly. Check
+L<rrdcgi>.
+
+=back
+
+=head2 HOW DOES RRDTOOL WORK?
+
+=over 8
+
+=item Data Acquisition
+
+When monitoring the state of a system, it is convenient to have the
+data available at a constant time interval. Unfortunately, you may not
+always be able to fetch data at exactly the time you want
+to. Therefore B<RRDtool> lets you update the logfile at any time you
+want. It will automatically interpolate the value of the data-source
+(B<DS>) at the latest official time-slot (intervall) and write this
+interpolated value to the log. The original value you have supplied is
+stored as well and is also taken into account when interpolating the
+next log entry.
+
+=item Consolidation
+
+You may log data at a 1 minute interval, but you might also be
+interested to know the development of the data over the last year. You
+could do this by simply storing the data in 1 minute intervals for the
+whole year. While this would take considerable disk space it would
+also take a lot of time to analyze the data when you wanted to create
+a graph covering the whole year. B<RRDtool> offers a solution to this
+problem through its data consolidation feature. When setting up an
+Round Robin Database (B<RRD>), you can define at which interval this
+consolidation should occur, and what consolidation function (B<CF>)
+(average, minimum, maximum, total, last) should be used to build the
+consolidated values (see rrdcreate). You can define any number of
+different consolidation setups within one B<RRD>. They will all be
+maintained on the fly when new data is loaded into the B<RRD>.
+
+=item Round Robin Archives
+
+Data values of the same consolidation setup are stored into Round
+Robin Archives (B<RRA>). This is a very efficient manner to store data
+for a certain amount of time, while using a known and constant amount
+of storage space.
+
+It works like this: If you want to store 1'000 values in 5 minute
+interval, B<RRDtool> will allocate space for 1'000 data values and a
+header area. In the header it will store a pointer telling which slots
+(value) in the storage area was last written to. New values are
+written to the Round Robin Archive in, you guessed it, a round robin
+manner. This automatically limits the history to the last 1'000 values
+(in our example). Because you can define several B<RRA>s within a
+single B<RRD>, you can setup another one, for storing 750 data values
+at a 2 hour interval, for example, and thus keep a log for the last
+two months at a lower resolution.
+
+The use of B<RRA>s guarantees that the B<RRD> does not grow over
+time and that old data is automatically eliminated. By using the
+consolidation feature, you can still keep data for a very long time,
+while gradually reducing the resolution of the data along the time
+axis.
+
+Using different consolidation functions (B<CF>) allows you to store
+exactly the type of information that actually interests you: the maximum
+one minute traffic on the LAN, the minimum temperature of your wine cellar,
+the total minutes of down time, etc.
+
+=item Unknown Data
+
+As mentioned earlier, the B<RRD> stores data at a constant
+interval. Sometimes it may happen that no new data is available when a
+value has to be written to the B<RRD>. Data acquisition may not be
+possible for one reason or other. With B<RRDtool> you can handle these
+situations by storing an I<*UNKNOWN*> value into the database. The
+value 'I<*UNKNOWN*>' is supported through all the functions of the
+tool. When consolidating a data set, the amount of I<*UNKNOWN*> data
+values is accounted for and when a new consolidated value is ready to
+be written to its Round Robin Archive (B<RRA>), a validity check is
+performed to make sure that the percentage of unknown values in the
+data point is above a configurable level. If not, an I<*UNKNOWN*> value
+will be written to the B<RRA>.
+
+=item Graphing
+
+B<RRDtool> allows you to generate reports in numerical and
+graphical form based on the data stored in one or several
+B<RRD>s. The graphing feature is fully configurable. Size, color and
+contents of the graph can be defined freely. Check L<rrdgraph>
+for more information on this.
+
+=item Aberrant Behavior Detection
+
+by Jake Brutlag
+
+B<RRDtool> provides the building blocks for near real-time aberrant
+behavior detection. These components include:
+
+=over
+
+=item *
+
+An algorithm for predicting the value of a time series one time step
+into the future.
+
+=item *
+
+A measure of deviation between predicted and observed values.
+
+=item *
+
+A mechanism to decide if and when an observed value or sequence of
+observed values is I<too deviant> from the predicted value(s).
+
+=back
+
+Here is a brief explanation of these components:
+
+The Holt-Winters time series forecasting algorithm is an on-line (or
+incremental) algorithm that adaptively predicts future observations in
+a time series. Its forecast is the sum of three components: a baseline
+(or intercept), a linear trend over time (or slope), and a seasonal
+coefficient (a periodic effect, such as a daily cycle). There is one
+seasonal coefficient for each time point in the period (cycle). After
+a value is observed, each of these components is updated via
+exponential smoothing. This means that the algorithm "learns" from
+past values and uses them to predict the future. The rate of
+adaptation is governed by 3 parameters, alpha (intercept), beta
+(slope), and gamma (seasonal). The prediction can also be viewed as a
+smoothed value for the time series.
+
+The measure of deviation is a seasonal weighted absolute
+deviation. The term I<seasonal> means deviation is measured separately
+for each time point in the seasonal cycle. As with Holt-Winters
+forecasting, deviation is predicted using the measure computed from
+past values (but only at that point in the seasonal cycle). After the
+value is observed, the algorithm learns from the observed value via
+exponential smoothing. Confidence bands for the observed time series
+are generated by scaling the sequence of predicted deviation values
+(we usually think of the sequence as a continuous line rather than a
+set of discrete points).
+
+Aberrant behavior (a potential failure) is reported whenever the
+number of times the observed value violates the confidence bands meets
+or exceeds a specified threshold within a specified temporal window
+(e.g. 5 violations during the past 45 minutes with a value observed
+every 5 minutes).
+
+This functionality is embedded in a set of related B<RRAs>. In
+particular, a FAILURES B<RRA> logs potential failures. With these data
+you could, for example, use a front-end application to B<RRDtool> to
+initiate real-time alerts.
+
+For a detailed description on how to set this up, see L<rrdcreate>.
+
+=back
+
+=head2 REMOTE CONTROL
+
+When you start B<RRDtool> with the command line option 'B<->' it waits
+for input via standard input (STDIN). With this feature you can
+improve performance by attaching B<RRDtool> to another process (MRTG
+is one example) through a set of pipes. Over these pipes B<RRDtool>
+accepts the same arguments as on the command line and some special
+commands like B<quit, cd, mkdir> and B<ls>. For detailed help on the
+server commands type:
+
+   rrdtool help cd|mkdir|pwd|ls|quit
+
+When a command is completed, RRDtool will print the string  'C<OK>',
+followed by timing information of the form B<u:>I<usertime>
+B<s:>I<systemtime>. Both values are the running totals of seconds since
+RRDtool was started. If an error occurs, a line of the form 'C<ERROR:>
+I<Description of error>' will be printed instead. B<RRDtool> will not abort,
+unless something realy serious happens. If
+a B<workdir> is specified and the UID is 0, RRDtool will do a chroot to that
+workdir. If the UID is not 0, RRDtool only changes the current directory to
+B<workdir>.
+
+=head2 RRD Server
+
+If you want to create a RRD-Server, you must choose a TCP/IP Service
+number and add them to I</etc/services> like this:
+
+ rrdsrv      13900/tcp                       # RRD server
+
+Attention: the TCP port 13900 isn't officially registered for
+rrdsrv. You can use any unused port in your services file, but the
+server and the client system must use the same port, of course.
+
+With this configuration you can add RRDtool as meta-server to
+I</etc/inetd.conf>. For example:
+
+ rrdsrv stream tcp nowait root /opt/rrd/bin/rrdtool rrdtool - /var/rrd
+
+Don't forget to create the database directory /var/rrd and
+reinitialize your inetd.
+
+If all was setup correctly, you can access the server with perl
+sockets, tools like netcat, or in a quick interactive test by using
+'telnet localhost rrdsrv'.
+
+B<NOTE:> that there is no authentication with this feature! Do not setup
+such a port unless you are sure what you are doing.
+
+=head1 SEE ALSO
+
+rrdcreate, rrdupdate, rrdgraph, rrddump, rrdfetch, rrdtune, rrdlast, rrdxport
+
+=head1 BUGS
+
+Bugs? Features!
+
+=head1 AUTHOR
+
+Tobias Oetiker <tobi@oetiker.ch>
+
diff --git a/doc/rrdtool.txt b/doc/rrdtool.txt
new file mode 100644 (file)
index 0000000..9c6c6dc
--- /dev/null
@@ -0,0 +1,276 @@
+RRDTOOL(1)                          rrdtool                         RRDTOOL(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdtool - Round Robin Database Tool
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       r\brr\brd\bdt\bto\boo\bol\bl -\b- [workdir]| _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       O\bOV\bVE\bER\bRV\bVI\bIE\bEW\bW
+
+       It is pretty easy to gather status information from all sorts of
+       things, ranging from the temperature in your office to the number of
+       octets which have passed through the FDDI interface of your router. But
+       it is not so trivial to store this data in an efficient and systematic
+       manner. This is where R\bRR\bRD\bDt\bto\boo\bol\bl comes in handy. It lets you _\bl_\bo_\bg _\ba_\bn_\bd _\ba_\bn_\ba_\b-
+       _\bl_\by_\bz_\be the data you gather from all kinds of data-sources (D\bDS\bS). The data
+       analysis part of RRDtool is based on the ability to quickly generate
+       graphical representations of the data values collected over a definable
+       time period.
+
+       In this man page you will find general information on the design and
+       functionality of the Round Robin Database Tool (RRDtool). For a more
+       detailed description of how to use the individual functions of R\bRR\bRD\bDt\bto\boo\bol\bl
+       check the corresponding man page.
+
+       For an introduction to the usage of RRDtool make sure you consult the
+       rrdtutorial.
+
+       F\bFU\bUN\bNC\bCT\bTI\bIO\bON\bNS\bS
+
+       While the man pages talk of command line switches you have to set in
+       order to make R\bRR\bRD\bDt\bto\boo\bol\bl work it is important to note that R\bRR\bRD\bDt\bto\boo\bol\bl can be
+       remotely controlled through a set of pipes. This saves a considerable
+       amount of startup time when you plan to make R\bRR\bRD\bDt\bto\boo\bol\bl do a lot of things
+       quickly. Check the section on "Remote Control" further down. There is
+       also a number of language bindings for RRDtool which allow you to use
+       it directly from perl, python, tcl, php, etc.
+
+       c\bcr\bre\bea\bat\bte\be  Set up a new Round Robin Database (RRD). Check rrdcreate.
+
+       u\bup\bpd\bda\bat\bte\be  Store new data values into an RRD. Check rrdupdate.
+
+       u\bup\bpd\bda\bat\bte\bev\bv Operationally equivalent to u\bup\bpd\bda\bat\bte\be except for output. Check
+               rrdupdate.
+
+       g\bgr\bra\bap\bph\bh   Create a graph from data stored in one or several RRDs. Apart
+               from generating graphs, data can also be extracted to stdout.
+               Check rrdgraph.
+
+       d\bdu\bum\bmp\bp    Dump the contents of an RRD in plain ASCII. In connection with
+               restore you can use this to move an RRD from one computer
+               architecture to another.  Check rrddump.
+
+       r\bre\bes\bst\bto\bor\bre\be Restore an RRD in XML format to a binary RRD. Check rrdrestore
+
+       f\bfe\bet\btc\bch\bh   Get data for a certain time period from a RRD. The graph func-
+               tion uses fetch to retrieve its data from an RRD. Check rrd-
+               fetch.
+
+       t\btu\bun\bne\be    Alter setup of an RRD. Check rrdtune.
+
+       l\bla\bas\bst\bt    Find the last update time of an RRD. Check rrdlast.
+
+       i\bin\bnf\bfo\bo    Get information about an RRD. Check rrdinfo.
+
+       r\brr\brd\bdr\bre\bes\bsi\biz\bze\be
+               Change the size of individual RRAs. This is dangerous! Check
+               rrdresize.
+
+       x\bxp\bpo\bor\brt\bt   Export data retrieved from one or several RRDs. Check rrdxport
+
+       r\brr\brd\bdc\bcg\bgi\bi  This is a standalone tool for producing RRD graphs on the fly.
+               Check rrdcgi.
+
+       H\bHO\bOW\bW D\bDO\bOE\bES\bS R\bRR\bRD\bDT\bTO\bOO\bOL\bL W\bWO\bOR\bRK\bK?\b?
+
+
+       Data Acquisition
+               When monitoring the state of a system, it is convenient to have
+               the data available at a constant time interval. Unfortunately,
+               you may not always be able to fetch data at exactly the time
+               you want to. Therefore R\bRR\bRD\bDt\bto\boo\bol\bl lets you update the logfile at
+               any time you want. It will automatically interpolate the value
+               of the data-source (D\bDS\bS) at the latest official time-slot
+               (intervall) and write this interpolated value to the log. The
+               original value you have supplied is stored as well and is also
+               taken into account when interpolating the next log entry.
+
+       Consolidation
+               You may log data at a 1 minute interval, but you might also be
+               interested to know the development of the data over the last
+               year. You could do this by simply storing the data in 1 minute
+               intervals for the whole year. While this would take consider-
+               able disk space it would also take a lot of time to analyze the
+               data when you wanted to create a graph covering the whole year.
+               R\bRR\bRD\bDt\bto\boo\bol\bl offers a solution to this problem through its data con-
+               solidation feature. When setting up an Round Robin Database
+               (R\bRR\bRD\bD), you can define at which interval this consolidation
+               should occur, and what consolidation function (C\bCF\bF) (average,
+               minimum, maximum, total, last) should be used to build the con-
+               solidated values (see rrdcreate). You can define any number of
+               different consolidation setups within one R\bRR\bRD\bD. They will all be
+               maintained on the fly when new data is loaded into the R\bRR\bRD\bD.
+
+       Round Robin Archives
+               Data values of the same consolidation setup are stored into
+               Round Robin Archives (R\bRR\bRA\bA). This is a very efficient manner to
+               store data for a certain amount of time, while using a known
+               and constant amount of storage space.
+
+               It works like this: If you want to store 1'000 values in 5
+               minute interval, R\bRR\bRD\bDt\bto\boo\bol\bl will allocate space for 1'000 data
+               values and a header area. In the header it will store a pointer
+               telling which slots (value) in the storage area was last writ-
+               ten to. New values are written to the Round Robin Archive in,
+               you guessed it, a round robin manner. This automatically limits
+               the history to the last 1'000 values (in our example). Because
+               you can define several R\bRR\bRA\bAs within a single R\bRR\bRD\bD, you can setup
+               another one, for storing 750 data values at a 2 hour interval,
+               for example, and thus keep a log for the last two months at a
+               lower resolution.
+
+               The use of R\bRR\bRA\bAs guarantees that the R\bRR\bRD\bD does not grow over time
+               and that old data is automatically eliminated. By using the
+               consolidation feature, you can still keep data for a very long
+               time, while gradually reducing the resolution of the data along
+               the time axis.
+
+               Using different consolidation functions (C\bCF\bF) allows you to
+               store exactly the type of information that actually interests
+               you: the maximum one minute traffic on the LAN, the minimum
+               temperature of your wine cellar, the total minutes of down
+               time, etc.
+
+       Unknown Data
+               As mentioned earlier, the R\bRR\bRD\bD stores data at a constant inter-
+               val. Sometimes it may happen that no new data is available when
+               a value has to be written to the R\bRR\bRD\bD. Data acquisition may not
+               be possible for one reason or other. With R\bRR\bRD\bDt\bto\boo\bol\bl you can han-
+               dle these situations by storing an _\b*_\bU_\bN_\bK_\bN_\bO_\bW_\bN_\b* value into the
+               database. The value '_\b*_\bU_\bN_\bK_\bN_\bO_\bW_\bN_\b*' is supported through all the
+               functions of the tool. When consolidating a data set, the
+               amount of _\b*_\bU_\bN_\bK_\bN_\bO_\bW_\bN_\b* data values is accounted for and when a new
+               consolidated value is ready to be written to its Round Robin
+               Archive (R\bRR\bRA\bA), a validity check is performed to make sure that
+               the percentage of unknown values in the data point is above a
+               configurable level. If not, an _\b*_\bU_\bN_\bK_\bN_\bO_\bW_\bN_\b* value will be written
+               to the R\bRR\bRA\bA.
+
+       Graphing
+               R\bRR\bRD\bDt\bto\boo\bol\bl allows you to generate reports in numerical and graphi-
+               cal form based on the data stored in one or several R\bRR\bRD\bDs. The
+               graphing feature is fully configurable. Size, color and con-
+               tents of the graph can be defined freely. Check rrdgraph for
+               more information on this.
+
+       Aberrant Behavior Detection
+               by Jake Brutlag
+
+               R\bRR\bRD\bDt\bto\boo\bol\bl provides the building blocks for near real-time aber-
+               rant behavior detection. These components include:
+
+               *   An algorithm for predicting the value of a time series one
+                   time step into the future.
+
+               *   A measure of deviation between predicted and observed val-
+                   ues.
+
+               *   A mechanism to decide if and when an observed value or
+                   sequence of observed values is _\bt_\bo_\bo _\bd_\be_\bv_\bi_\ba_\bn_\bt from the pre-
+                   dicted value(s).
+
+               Here is a brief explanation of these components:
+
+               The Holt-Winters time series forecasting algorithm is an on-
+               line (or incremental) algorithm that adaptively predicts future
+               observations in a time series. Its forecast is the sum of three
+               components: a baseline (or intercept), a linear trend over time
+               (or slope), and a seasonal coefficient (a periodic effect, such
+               as a daily cycle). There is one seasonal coefficient for each
+               time point in the period (cycle). After a value is observed,
+               each of these components is updated via exponential smoothing.
+               This means that the algorithm "learns" from past values and
+               uses them to predict the future. The rate of adaptation is gov-
+               erned by 3 parameters, alpha (intercept), beta (slope), and
+               gamma (seasonal). The prediction can also be viewed as a
+               smoothed value for the time series.
+
+               The measure of deviation is a seasonal weighted absolute devia-
+               tion. The term _\bs_\be_\ba_\bs_\bo_\bn_\ba_\bl means deviation is measured separately
+               for each time point in the seasonal cycle. As with Holt-Winters
+               forecasting, deviation is predicted using the measure computed
+               from past values (but only at that point in the seasonal
+               cycle). After the value is observed, the algorithm learns from
+               the observed value via exponential smoothing. Confidence bands
+               for the observed time series are generated by scaling the
+               sequence of predicted deviation values (we usually think of the
+               sequence as a continuous line rather than a set of discrete
+               points).
+
+               Aberrant behavior (a potential failure) is reported whenever
+               the number of times the observed value violates the confidence
+               bands meets or exceeds a specified threshold within a specified
+               temporal window (e.g. 5 violations during the past 45 minutes
+               with a value observed every 5 minutes).
+
+               This functionality is embedded in a set of related R\bRR\bRA\bAs\bs. In
+               particular, a FAILURES R\bRR\bRA\bA logs potential failures. With these
+               data you could, for example, use a front-end application to
+               R\bRR\bRD\bDt\bto\boo\bol\bl to initiate real-time alerts.
+
+               For a detailed description on how to set this up, see rrdcre-
+               ate.
+
+       R\bRE\bEM\bMO\bOT\bTE\bE C\bCO\bON\bNT\bTR\bRO\bOL\bL
+
+       When you start R\bRR\bRD\bDt\bto\boo\bol\bl with the command line option '-\b-' it waits for
+       input via standard input (STDIN). With this feature you can improve
+       performance by attaching R\bRR\bRD\bDt\bto\boo\bol\bl to another process (MRTG is one exam-
+       ple) through a set of pipes. Over these pipes R\bRR\bRD\bDt\bto\boo\bol\bl accepts the same
+       arguments as on the command line and some special commands like q\bqu\bui\bit\bt,\b,
+       c\bcd\bd,\b, m\bmk\bkd\bdi\bir\br and l\bls\bs. For detailed help on the server commands type:
+
+          rrdtool help cd|mkdir|pwd|ls|quit
+
+       When a command is completed, RRDtool will print the string  '"OK"',
+       followed by timing information of the form u\bu:\b:_\bu_\bs_\be_\br_\bt_\bi_\bm_\be s\bs:\b:_\bs_\by_\bs_\bt_\be_\bm_\bt_\bi_\bm_\be.
+       Both values are the running totals of seconds since RRDtool was
+       started. If an error occurs, a line of the form '"ERROR:" _\bD_\be_\bs_\bc_\br_\bi_\bp_\bt_\bi_\bo_\bn
+       _\bo_\bf _\be_\br_\br_\bo_\br' will be printed instead. R\bRR\bRD\bDt\bto\boo\bol\bl will not abort, unless some-
+       thing realy serious happens. If a w\bwo\bor\brk\bkd\bdi\bir\br is specified and the UID is
+       0, RRDtool will do a chroot to that workdir. If the UID is not 0, RRD-
+       tool only changes the current directory to w\bwo\bor\brk\bkd\bdi\bir\br.
+
+       R\bRR\bRD\bD S\bSe\ber\brv\bve\ber\br
+
+       If you want to create a RRD-Server, you must choose a TCP/IP Service
+       number and add them to _\b/_\be_\bt_\bc_\b/_\bs_\be_\br_\bv_\bi_\bc_\be_\bs like this:
+
+        rrdsrv      13900/tcp                       # RRD server
+
+       Attention: the TCP port 13900 isn't officially registered for rrdsrv.
+       You can use any unused port in your services file, but the server and
+       the client system must use the same port, of course.
+
+       With this configuration you can add RRDtool as meta-server to
+       _\b/_\be_\bt_\bc_\b/_\bi_\bn_\be_\bt_\bd_\b._\bc_\bo_\bn_\bf. For example:
+
+        rrdsrv stream tcp nowait root /opt/rrd/bin/rrdtool rrdtool - /var/rrd
+
+       Don't forget to create the database directory /var/rrd and reinitialize
+       your inetd.
+
+       If all was setup correctly, you can access the server with perl sock-
+       ets, tools like netcat, or in a quick interactive test by using 'telnet
+       localhost rrdsrv'.
+
+       N\bNO\bOT\bTE\bE:\b: that there is no authentication with this feature! Do not setup
+       such a port unless you are sure what you are doing.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+       rrdcreate, rrdupdate, rrdgraph, rrddump, rrdfetch, rrdtune, rrdlast,
+       rrdxport
+
+B\bBU\bUG\bGS\bS
+       Bugs? Features!
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Tobias Oetiker <tobi@oetiker.ch>
+
+
+
+1.2.26                            2007-11-20                        RRDTOOL(1)
diff --git a/doc/rrdtune.1 b/doc/rrdtune.1
new file mode 100644 (file)
index 0000000..8dbc440
--- /dev/null
@@ -0,0 +1,276 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDTUNE 1"
+.TH RRDTUNE 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdtune \- Modify some basic properties of a Round Robin Database
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBrrdtool\fR \fBtune\fR \fIfilename\fR
+[\fB\-\-heartbeat\fR|\fB\-h\fR\ \fIds-name\fR:\fIheartbeat\fR]
+[\fB\-\-minimum\fR|\fB\-i\fR\ \fIds-name\fR:\fImin\fR]
+[\fB\-\-maximum\fR|\fB\-a\fR\ \fIds-name\fR:\fImax\fR]
+[\fB\-\-data\-source\-type\fR|\fB\-d\fR\ \fIds-name\fR:\fI\s-1DST\s0\fR]
+[\fB\-\-data\-source\-rename\fR|\fB\-r\fR\ \fIold-name\fR:\fInew-name\fR]
+[\fB\-\-deltapos\fR\ \fIscale-value\fR]
+[\fB\-\-deltaneg\fR\ \fIscale-value\fR]
+[\fB\-\-failure\-threshold\fR\ \fIfailure-threshold\fR]
+[\fB\-\-window\-length\fR\ \fIwindow-length\fR]
+[\fB\-\-alpha\fR\ \fIadaption-parameter\fR]
+[\fB\-\-beta\fR\ \fIadaption-parameter\fR]
+[\fB\-\-gamma\fR\ \fIadaption-parameter\fR]
+[\fB\-\-gamma\-deviation\fR\ \fIadaption-parameter\fR]
+[\fB\-\-aberrant\-reset\fR\ \fIds-name\fR]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The tune option allows you to alter some of the basic configuration
+values stored in the header area of a Round Robin Database (\fB\s-1RRD\s0\fR).
+.PP
+One application of the \fBtune\fR function is to relax the
+validation rules on an \fB\s-1RRD\s0\fR. This allows to fill a new \fB\s-1RRD\s0\fR with
+data available in larger intervals than what you would normally want
+to permit. Be very careful with tune operations for \s-1COMPUTE\s0 data sources.
+Setting the \fImin\fR, \fImax\fR, and  \fIheartbeat\fR for a \s-1COMPUTE\s0 data source
+without changing the data source type to a non-COMPUTE \fB\s-1DST\s0\fR \s-1WILL\s0 corrupt
+the data source header in the \fB\s-1RRD\s0\fR.
+.PP
+A second application of the \fBtune\fR function is to set or alter parameters
+used by the specialized function \fBRRAs\fR for aberrant behavior detection.
+.IP "\fIfilename\fR" 8
+.IX Item "filename"
+The name of the \fB\s-1RRD\s0\fR you want to tune.
+.IP "\fB\-\-heartbeat\fR|\fB\-h\fR\ \fIds-name\fR:\fIheartbeat\fR" 8
+.IX Item "--heartbeat|-hds-name:heartbeat"
+modify the \fIheartbeat\fR of a data source. By setting this to a high
+value the \s-1RRD\s0 will accept things like one value per day.
+.IP "\fB\-\-minimum\fR|\fB\-i\fR\ \fIds-name\fR:\fImin\fR" 8
+.IX Item "--minimum|-ids-name:min"
+alter the minimum value acceptable as input from the data source.
+Setting \fImin\fR to 'U' will disable this limit.
+.IP "\fB\-\-maximum\fR|\fB\-a\fR\ \fIds-name\fR:\fImax\fR" 8
+.IX Item "--maximum|-ads-name:max"
+alter the maximum value acceptable as input from the data source.
+Setting \fImax\fR to 'U' will disable this limit.
+.IP "\fB\-\-data\-source\-type\fR|\fB\-d\fR\ \fIds-name\fR:\fI\s-1DST\s0\fR" 8
+.IX Item "--data-source-type|-dds-name:DST"
+alter the type \fB\s-1DST\s0\fR of a data source.
+.IP "\fB\-\-data\-source\-rename\fR|\fB\-r\fR\ \fIold-name\fR:\fInew-name\fR" 8
+.IX Item "--data-source-rename|-rold-name:new-name"
+rename a data source.
+.IP "\fB\-\-deltapos\fR\ \fIscale-value\fR" 8
+.IX Item "--deltaposscale-value"
+Alter the deviation scaling factor for the upper bound of the
+confidence band used internally to calculate violations for the
+\&\s-1FAILURES\s0 \fB\s-1RRA\s0\fR. The default value is 2. Note that this parameter is
+not related to graphing confidence bounds which must be specified as a
+\&\s-1CDEF\s0 argument to generate a graph with confidence bounds. The graph
+scale factor need not to agree with the value used internally by the
+\&\s-1FAILURES\s0 \fB\s-1RRA\s0\fR.
+.IP "\fB\-\-deltaneg\fR\ \fIscale-value\fR" 8
+.IX Item "--deltanegscale-value"
+Alter the deviation scaling factor for the lower bound of the confidence band
+used internally to calculate violations for the \s-1FAILURES\s0 \fB\s-1RRA\s0\fR. The default
+value is 2. As with \fB\-\-deltapos\fR, this argument is unrelated to the scale
+factor chosen when graphing confidence bounds.
+.IP "\fB\-\-failure\-threshold\fR\ \fIfailure-threshold\fR" 8
+.IX Item "--failure-thresholdfailure-threshold"
+Alter the number of confidence bound violations that constitute a failure for
+purposes of the \s-1FAILURES\s0 \fB\s-1RRA\s0\fR. This must be an integer less than or equal to
+the window length of the \s-1FAILURES\s0 \fB\s-1RRA\s0\fR. This restriction is not verified by
+the tune option, so one can reset failure-threshold and window-length
+simultaneously. Setting this option will reset the count of violations to 0.
+.IP "\fB\-\-window\-length\fR\ \fIwindow-length\fR" 8
+.IX Item "--window-lengthwindow-length"
+Alter the number of time points in the temporal window for determining
+failures. This must be an integer greater than or equal to the window
+length of the \s-1FAILURES\s0 \fB\s-1RRA\s0\fR and less than or equal to 28. Setting
+this option will reset the count of violations to 0.
+.IP "\fB\-\-alpha\fR\ \fIadaption-parameter\fR" 8
+.IX Item "--alphaadaption-parameter"
+Alter the intercept adaptation parameter for the Holt-Winters
+forecasting algorithm. This parameter must be between 0 and 1.
+.IP "\fB\-\-beta\fR\ \fIadaption-parameter\fR" 8
+.IX Item "--betaadaption-parameter"
+Alter the slope adaptation parameter for the Holt-Winters forecasting
+algorithm. This parameter must be between 0 and 1.
+.IP "\fB\-\-gamma\fR\ \fIadaption-parameter\fR" 8
+.IX Item "--gammaadaption-parameter"
+Alter the seasonal coefficient adaptation parameter for the \s-1SEASONAL\s0
+\&\fB\s-1RRA\s0\fR. This parameter must be between 0 and 1.
+.IP "\fB\-\-gamma\-deviation\fR\ \fIadaption-parameter\fR" 8
+.IX Item "--gamma-deviationadaption-parameter"
+Alter the seasonal deviation adaptation parameter for the \s-1DEVSEASONAL\s0
+\&\fB\s-1RRA\s0\fR. This parameter must be between 0 and 1.
+.IP "\fB\-\-aberrant\-reset\fR\ \fIds-name\fR" 8
+.IX Item "--aberrant-resetds-name"
+This option causes the aberrant behavior detection algorithm to reset
+for the specified data source; that is, forget all it is has learnt so far.
+Specifically, for the \s-1HWPREDICT\s0 \fB\s-1RRA\s0\fR, it sets the intercept and slope
+coefficients to unknown. For the \s-1SEASONAL\s0 \fB\s-1RRA\s0\fR, it sets all seasonal
+coefficients to unknown. For the \s-1DEVSEASONAL\s0 \fB\s-1RRA\s0\fR, it sets all seasonal
+deviation coefficients to unknown. For the \s-1FAILURES\s0 \fB\s-1RRA\s0\fR, it erases
+the violation history. Note that reset does not erase past predictions
+(the values of the \s-1HWPREDICT\s0 \fB\s-1RRA\s0\fR), predicted deviations (the values of the
+\&\s-1DEVPREDICT\s0 \fB\s-1RRA\s0\fR), or failure history (the values of the \s-1FAILURES\s0 \fB\s-1RRA\s0\fR).
+This option will function even if not all the listed \fBRRAs\fR are present.
+.Sp
+Due to the implementation of this option, there is an indirect impact on
+other data sources in the \s-1RRD\s0. A smoothing algorithm is applied to
+\&\s-1SEASONAL\s0 and \s-1DEVSEASONAL\s0 values on a periodic basis. During bootstrap
+initialization this smoothing is deferred. For efficiency, the implementation
+of smoothing is not data source specific. This means that utilizing
+reset for one data source will delay running the smoothing algorithm
+for all data sources in the file. This is unlikely to have serious
+consequences, unless the data being collected for the non-reset data sources
+is unusually volatile during the reinitialization period of the reset
+data source.
+.Sp
+Use of this tuning option is advised when the behavior of the data source
+time series changes in a drastic and permanent manner.
+.SH "EXAMPLE 1"
+.IX Header "EXAMPLE 1"
+\&\f(CW\*(C`rrdtool tune data.rrd \-h in:100000 \-h out:100000 \-h through:100000\*(C'\fR
+.PP
+Set the minimum required heartbeat for data sources 'in', 'out'
+and 'through' to 10'000 seconds which is a little over one day in data.rrd.
+This would allow to feed old data from \s-1MRTG\-2\s0.0 right into
+RRDtool without generating *UNKNOWN* entries.
+.SH "EXAMPLE 2"
+.IX Header "EXAMPLE 2"
+\&\f(CW\*(C`rrdtool tune monitor.rrd \-\-window\-length 5 \-\-failure\-threshold 3\*(C'\fR
+.PP
+If the \s-1FAILURES\s0 \fB\s-1RRA\s0\fR is implicitly created, the default
+window-length is 9 and the default failure-threshold is 7. This
+command now defines a failure as 3 or more violations in a temporal
+window of 5 time points.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Tobias Oetiker <tobi@oetiker.ch>
diff --git a/doc/rrdtune.html b/doc/rrdtune.html
new file mode 100644 (file)
index 0000000..59925ff
--- /dev/null
@@ -0,0 +1,232 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdtune</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#example_1">EXAMPLE 1</a></li>
+       <li><a href="#example_2">EXAMPLE 2</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdtune - Modify some basic properties of a Round Robin Database</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p><strong>rrdtool</strong> <strong>tune</strong> <em>filename</em>
+[<strong>--heartbeat</strong>|<strong>-h</strong>&nbsp;<em>ds-name</em>:<em>heartbeat</em>]
+[<strong>--minimum</strong>|<strong>-i</strong>&nbsp;<em>ds-name</em>:<em>min</em>]
+[<strong>--maximum</strong>|<strong>-a</strong>&nbsp;<em>ds-name</em>:<em>max</em>]
+[<strong>--data-source-type</strong>|<strong>-d</strong>&nbsp;<em>ds-name</em>:<em>DST</em>]
+[<strong>--data-source-rename</strong>|<strong>-r</strong>&nbsp;<em>old-name</em>:<em>new-name</em>]
+[<strong>--deltapos</strong>&nbsp;<em>scale-value</em>]
+[<strong>--deltaneg</strong>&nbsp;<em>scale-value</em>]
+[<strong>--failure-threshold</strong>&nbsp;<em>failure-threshold</em>]
+[<strong>--window-length</strong>&nbsp;<em>window-length</em>]
+[<strong>--alpha</strong>&nbsp;<em>adaption-parameter</em>]
+[<strong>--beta</strong>&nbsp;<em>adaption-parameter</em>]
+[<strong>--gamma</strong>&nbsp;<em>adaption-parameter</em>]
+[<strong>--gamma-deviation</strong>&nbsp;<em>adaption-parameter</em>]
+[<strong>--aberrant-reset</strong>&nbsp;<em>ds-name</em>]</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>The tune option allows you to alter some of the basic configuration
+values stored in the header area of a Round Robin Database (<strong>RRD</strong>).</p>
+<p>One application of the <strong>tune</strong> function is to relax the
+validation rules on an <strong>RRD</strong>. This allows to fill a new <strong>RRD</strong> with
+data available in larger intervals than what you would normally want
+to permit. Be very careful with tune operations for COMPUTE data sources.
+Setting the <em>min</em>, <em>max</em>, and  <em>heartbeat</em> for a COMPUTE data source
+without changing the data source type to a non-COMPUTE <strong>DST</strong> WILL corrupt
+the data source header in the <strong>RRD</strong>.</p>
+<p>A second application of the <strong>tune</strong> function is to set or alter parameters
+used by the specialized function <strong>RRAs</strong> for aberrant behavior detection.</p>
+<dl>
+<dt><strong><a name="item_filename"><em>filename</em></a></strong>
+
+<dd>
+<p>The name of the <strong>RRD</strong> you want to tune.</p>
+</dd>
+</li>
+<dt><strong><a name="item__2d_2dheartbeat_7c_2dh_ds_2dname_3aheartbeat"><strong>--heartbeat</strong>|<strong>-h</strong>&nbsp;<em>ds-name</em>:<em>heartbeat</em></a></strong>
+
+<dd>
+<p>modify the <em>heartbeat</em> of a data source. By setting this to a high
+value the RRD will accept things like one value per day.</p>
+</dd>
+</li>
+<dt><strong><a name="item__2d_2dminimum_7c_2di_ds_2dname_3amin"><strong>--minimum</strong>|<strong>-i</strong>&nbsp;<em>ds-name</em>:<em>min</em></a></strong>
+
+<dd>
+<p>alter the minimum value acceptable as input from the data source.
+Setting <em>min</em> to 'U' will disable this limit.</p>
+</dd>
+</li>
+<dt><strong><a name="item__2d_2dmaximum_7c_2da_ds_2dname_3amax"><strong>--maximum</strong>|<strong>-a</strong>&nbsp;<em>ds-name</em>:<em>max</em></a></strong>
+
+<dd>
+<p>alter the maximum value acceptable as input from the data source.
+Setting <em>max</em> to 'U' will disable this limit.</p>
+</dd>
+</li>
+<dt><strong><a name="item__2d_2ddata_2dsource_2dtype_7c_2dd_ds_2dname_3adst"><strong>--data-source-type</strong>|<strong>-d</strong>&nbsp;<em>ds-name</em>:<em>DST</em></a></strong>
+
+<dd>
+<p>alter the type <strong>DST</strong> of a data source.</p>
+</dd>
+</li>
+<dt><strong><a name="item__2d_2ddata_2dsource_2drename_7c_2dr_old_2dname_3an"><strong>--data-source-rename</strong>|<strong>-r</strong>&nbsp;<em>old-name</em>:<em>new-name</em></a></strong>
+
+<dd>
+<p>rename a data source.</p>
+</dd>
+</li>
+<dt><strong><a name="item__2d_2ddeltapos_scale_2dvalue"><strong>--deltapos</strong>&nbsp;<em>scale-value</em></a></strong>
+
+<dd>
+<p>Alter the deviation scaling factor for the upper bound of the
+confidence band used internally to calculate violations for the
+FAILURES <strong>RRA</strong>. The default value is 2. Note that this parameter is
+not related to graphing confidence bounds which must be specified as a
+CDEF argument to generate a graph with confidence bounds. The graph
+scale factor need not to agree with the value used internally by the
+FAILURES <strong>RRA</strong>.</p>
+</dd>
+</li>
+<dt><strong><a name="item__2d_2ddeltaneg_scale_2dvalue"><strong>--deltaneg</strong>&nbsp;<em>scale-value</em></a></strong>
+
+<dd>
+<p>Alter the deviation scaling factor for the lower bound of the confidence band
+used internally to calculate violations for the FAILURES <strong>RRA</strong>. The default
+value is 2. As with <strong>--deltapos</strong>, this argument is unrelated to the scale
+factor chosen when graphing confidence bounds.</p>
+</dd>
+</li>
+<dt><strong><a name="item__2d_2dfailure_2dthreshold_failure_2dthreshold"><strong>--failure-threshold</strong>&nbsp;<em>failure-threshold</em></a></strong>
+
+<dd>
+<p>Alter the number of confidence bound violations that constitute a failure for
+purposes of the FAILURES <strong>RRA</strong>. This must be an integer less than or equal to
+the window length of the FAILURES <strong>RRA</strong>. This restriction is not verified by
+the tune option, so one can reset failure-threshold and window-length
+simultaneously. Setting this option will reset the count of violations to 0.</p>
+</dd>
+</li>
+<dt><strong><a name="item__2d_2dwindow_2dlength_window_2dlength"><strong>--window-length</strong>&nbsp;<em>window-length</em></a></strong>
+
+<dd>
+<p>Alter the number of time points in the temporal window for determining
+failures. This must be an integer greater than or equal to the window
+length of the FAILURES <strong>RRA</strong> and less than or equal to 28. Setting
+this option will reset the count of violations to 0.</p>
+</dd>
+</li>
+<dt><strong><a name="item__2d_2dalpha_adaption_2dparameter"><strong>--alpha</strong>&nbsp;<em>adaption-parameter</em></a></strong>
+
+<dd>
+<p>Alter the intercept adaptation parameter for the Holt-Winters
+forecasting algorithm. This parameter must be between 0 and 1.</p>
+</dd>
+</li>
+<dt><strong><a name="item__2d_2dbeta_adaption_2dparameter"><strong>--beta</strong>&nbsp;<em>adaption-parameter</em></a></strong>
+
+<dd>
+<p>Alter the slope adaptation parameter for the Holt-Winters forecasting
+algorithm. This parameter must be between 0 and 1.</p>
+</dd>
+</li>
+<dt><strong><a name="item__2d_2dgamma_adaption_2dparameter"><strong>--gamma</strong>&nbsp;<em>adaption-parameter</em></a></strong>
+
+<dd>
+<p>Alter the seasonal coefficient adaptation parameter for the SEASONAL
+<strong>RRA</strong>. This parameter must be between 0 and 1.</p>
+</dd>
+</li>
+<dt><strong><a name="item__2d_2dgamma_2ddeviation_adaption_2dparameter"><strong>--gamma-deviation</strong>&nbsp;<em>adaption-parameter</em></a></strong>
+
+<dd>
+<p>Alter the seasonal deviation adaptation parameter for the DEVSEASONAL
+<strong>RRA</strong>. This parameter must be between 0 and 1.</p>
+</dd>
+</li>
+<dt><strong><a name="item__2d_2daberrant_2dreset_ds_2dname"><strong>--aberrant-reset</strong>&nbsp;<em>ds-name</em></a></strong>
+
+<dd>
+<p>This option causes the aberrant behavior detection algorithm to reset
+for the specified data source; that is, forget all it is has learnt so far.
+Specifically, for the HWPREDICT <strong>RRA</strong>, it sets the intercept and slope
+coefficients to unknown. For the SEASONAL <strong>RRA</strong>, it sets all seasonal
+coefficients to unknown. For the DEVSEASONAL <strong>RRA</strong>, it sets all seasonal
+deviation coefficients to unknown. For the FAILURES <strong>RRA</strong>, it erases
+the violation history. Note that reset does not erase past predictions
+(the values of the HWPREDICT <strong>RRA</strong>), predicted deviations (the values of the
+DEVPREDICT <strong>RRA</strong>), or failure history (the values of the FAILURES <strong>RRA</strong>).
+This option will function even if not all the listed <strong>RRAs</strong> are present.</p>
+</dd>
+<dd>
+<p>Due to the implementation of this option, there is an indirect impact on
+other data sources in the RRD. A smoothing algorithm is applied to
+SEASONAL and DEVSEASONAL values on a periodic basis. During bootstrap
+initialization this smoothing is deferred. For efficiency, the implementation
+of smoothing is not data source specific. This means that utilizing
+reset for one data source will delay running the smoothing algorithm
+for all data sources in the file. This is unlikely to have serious
+consequences, unless the data being collected for the non-reset data sources
+is unusually volatile during the reinitialization period of the reset
+data source.</p>
+</dd>
+<dd>
+<p>Use of this tuning option is advised when the behavior of the data source
+time series changes in a drastic and permanent manner.</p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<hr />
+<h1><a name="example_1">EXAMPLE 1</a></h1>
+<p><code>rrdtool tune data.rrd -h in:100000 -h out:100000 -h through:100000</code></p>
+<p>Set the minimum required heartbeat for data sources 'in', 'out'
+and 'through' to 10'000 seconds which is a little over one day in data.rrd.
+This would allow to feed old data from MRTG-2.0 right into
+RRDtool without generating *UNKNOWN* entries.</p>
+<p>
+</p>
+<hr />
+<h1><a name="example_2">EXAMPLE 2</a></h1>
+<p><code>rrdtool tune monitor.rrd --window-length 5 --failure-threshold 3</code></p>
+<p>If the FAILURES <strong>RRA</strong> is implicitly created, the default
+window-length is 9 and the default failure-threshold is 7. This
+command now defines a failure as 3 or more violations in a temporal
+window of 5 time points.</p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdtune.pod b/doc/rrdtune.pod
new file mode 100644 (file)
index 0000000..5e9029b
--- /dev/null
@@ -0,0 +1,170 @@
+=head1 NAME
+
+rrdtune - Modify some basic properties of a Round Robin Database
+
+=head1 SYNOPSIS
+
+B<rrdtool> B<tune> I<filename>
+S<[B<--heartbeat>|B<-h> I<ds-name>:I<heartbeat>]>
+S<[B<--minimum>|B<-i> I<ds-name>:I<min>]>
+S<[B<--maximum>|B<-a> I<ds-name>:I<max>]>
+S<[B<--data-source-type>|B<-d> I<ds-name>:I<DST>]>
+S<[B<--data-source-rename>|B<-r> I<old-name>:I<new-name>]>
+S<[B<--deltapos> I<scale-value>]>
+S<[B<--deltaneg> I<scale-value>]>
+S<[B<--failure-threshold> I<failure-threshold>]>
+S<[B<--window-length> I<window-length>]>
+S<[B<--alpha> I<adaption-parameter>]>
+S<[B<--beta> I<adaption-parameter>]>
+S<[B<--gamma> I<adaption-parameter>]>
+S<[B<--gamma-deviation> I<adaption-parameter>]>
+S<[B<--aberrant-reset> I<ds-name>]>
+
+=head1 DESCRIPTION
+
+The tune option allows you to alter some of the basic configuration
+values stored in the header area of a Round Robin Database (B<RRD>).
+
+One application of the B<tune> function is to relax the
+validation rules on an B<RRD>. This allows to fill a new B<RRD> with
+data available in larger intervals than what you would normally want
+to permit. Be very careful with tune operations for COMPUTE data sources.
+Setting the I<min>, I<max>, and  I<heartbeat> for a COMPUTE data source
+without changing the data source type to a non-COMPUTE B<DST> WILL corrupt
+the data source header in the B<RRD>.
+
+A second application of the B<tune> function is to set or alter parameters
+used by the specialized function B<RRAs> for aberrant behavior detection.
+
+=over 8
+
+=item I<filename>
+
+The name of the B<RRD> you want to tune.
+
+=item S<B<--heartbeat>|B<-h> I<ds-name>:I<heartbeat>>
+
+modify the I<heartbeat> of a data source. By setting this to a high
+value the RRD will accept things like one value per day.
+
+=item S<B<--minimum>|B<-i> I<ds-name>:I<min>>
+
+alter the minimum value acceptable as input from the data source.
+Setting I<min> to 'U' will disable this limit.
+
+=item S<B<--maximum>|B<-a> I<ds-name>:I<max>>
+
+alter the maximum value acceptable as input from the data source.
+Setting I<max> to 'U' will disable this limit.
+
+=item S<B<--data-source-type>|B<-d> I<ds-name>:I<DST>>
+
+alter the type B<DST> of a data source.
+
+=item S<B<--data-source-rename>|B<-r> I<old-name>:I<new-name>>
+
+rename a data source.
+
+=item S<B<--deltapos> I<scale-value>>
+
+Alter the deviation scaling factor for the upper bound of the
+confidence band used internally to calculate violations for the
+FAILURES B<RRA>. The default value is 2. Note that this parameter is
+not related to graphing confidence bounds which must be specified as a
+CDEF argument to generate a graph with confidence bounds. The graph
+scale factor need not to agree with the value used internally by the
+FAILURES B<RRA>.
+
+=item S<B<--deltaneg> I<scale-value>>
+
+Alter the deviation scaling factor for the lower bound of the confidence band
+used internally to calculate violations for the FAILURES B<RRA>. The default
+value is 2. As with B<--deltapos>, this argument is unrelated to the scale
+factor chosen when graphing confidence bounds.
+
+=item S<B<--failure-threshold> I<failure-threshold>>
+
+Alter the number of confidence bound violations that constitute a failure for
+purposes of the FAILURES B<RRA>. This must be an integer less than or equal to
+the window length of the FAILURES B<RRA>. This restriction is not verified by
+the tune option, so one can reset failure-threshold and window-length
+simultaneously. Setting this option will reset the count of violations to 0.
+
+=item S<B<--window-length> I<window-length>>
+
+Alter the number of time points in the temporal window for determining
+failures. This must be an integer greater than or equal to the window
+length of the FAILURES B<RRA> and less than or equal to 28. Setting
+this option will reset the count of violations to 0.
+
+=item S<B<--alpha> I<adaption-parameter>>
+
+Alter the intercept adaptation parameter for the Holt-Winters
+forecasting algorithm. This parameter must be between 0 and 1.
+
+=item S<B<--beta> I<adaption-parameter>>
+
+Alter the slope adaptation parameter for the Holt-Winters forecasting
+algorithm. This parameter must be between 0 and 1.
+
+=item S<B<--gamma> I<adaption-parameter>>
+
+Alter the seasonal coefficient adaptation parameter for the SEASONAL
+B<RRA>. This parameter must be between 0 and 1.
+
+=item S<B<--gamma-deviation> I<adaption-parameter>>
+
+Alter the seasonal deviation adaptation parameter for the DEVSEASONAL
+B<RRA>. This parameter must be between 0 and 1.
+
+=item S<B<--aberrant-reset> I<ds-name>>
+
+This option causes the aberrant behavior detection algorithm to reset
+for the specified data source; that is, forget all it is has learnt so far.
+Specifically, for the HWPREDICT B<RRA>, it sets the intercept and slope
+coefficients to unknown. For the SEASONAL B<RRA>, it sets all seasonal
+coefficients to unknown. For the DEVSEASONAL B<RRA>, it sets all seasonal
+deviation coefficients to unknown. For the FAILURES B<RRA>, it erases
+the violation history. Note that reset does not erase past predictions
+(the values of the HWPREDICT B<RRA>), predicted deviations (the values of the
+DEVPREDICT B<RRA>), or failure history (the values of the FAILURES B<RRA>).
+This option will function even if not all the listed B<RRAs> are present.
+
+Due to the implementation of this option, there is an indirect impact on
+other data sources in the RRD. A smoothing algorithm is applied to
+SEASONAL and DEVSEASONAL values on a periodic basis. During bootstrap
+initialization this smoothing is deferred. For efficiency, the implementation
+of smoothing is not data source specific. This means that utilizing
+reset for one data source will delay running the smoothing algorithm
+for all data sources in the file. This is unlikely to have serious
+consequences, unless the data being collected for the non-reset data sources
+is unusually volatile during the reinitialization period of the reset
+data source.
+
+Use of this tuning option is advised when the behavior of the data source
+time series changes in a drastic and permanent manner.
+
+=back
+
+=head1 EXAMPLE 1
+
+C<rrdtool tune data.rrd -h in:100000 -h out:100000 -h through:100000>
+
+Set the minimum required heartbeat for data sources 'in', 'out'
+and 'through' to 10'000 seconds which is a little over one day in data.rrd.
+This would allow to feed old data from MRTG-2.0 right into
+RRDtool without generating *UNKNOWN* entries.
+
+=head1 EXAMPLE 2
+
+C<rrdtool tune monitor.rrd --window-length 5 --failure-threshold 3>
+
+If the FAILURES B<RRA> is implicitly created, the default
+window-length is 9 and the default failure-threshold is 7. This
+command now defines a failure as 3 or more violations in a temporal
+window of 5 time points.
+
+=head1 AUTHOR
+
+Tobias Oetiker <tobi@oetiker.ch>
+
diff --git a/doc/rrdtune.txt b/doc/rrdtune.txt
new file mode 100644 (file)
index 0000000..e09b273
--- /dev/null
@@ -0,0 +1,152 @@
+RRDTUNE(1)                          rrdtool                         RRDTUNE(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdtune - Modify some basic properties of a Round Robin Database
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       r\brr\brd\bdt\bto\boo\bol\bl t\btu\bun\bne\be _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be [-\b--\b-h\bhe\bea\bar\brt\btb\bbe\bea\bat\bt|-\b-h\bh _\bd_\bs_\b-_\bn_\ba_\bm_\be:_\bh_\be_\ba_\br_\bt_\bb_\be_\ba_\bt] [-\b--\b-m\bmi\bin\bni\bi-\b-
+       m\bmu\bum\bm|-\b-i\bi _\bd_\bs_\b-_\bn_\ba_\bm_\be:_\bm_\bi_\bn] [-\b--\b-m\bma\bax\bxi\bim\bmu\bum\bm|-\b-a\ba _\bd_\bs_\b-_\bn_\ba_\bm_\be:_\bm_\ba_\bx]
+       [-\b--\b-d\bda\bat\bta\ba-\b-s\bso\bou\bur\brc\bce\be-\b-t\bty\byp\bpe\be|-\b-d\bd _\bd_\bs_\b-_\bn_\ba_\bm_\be:_\bD_\bS_\bT] [-\b--\b-d\bda\bat\bta\ba-\b-s\bso\bou\bur\brc\bce\be-\b-r\bre\ben\bna\bam\bme\be|-\b-r\br _\bo_\bl_\bd_\b-
+       _\bn_\ba_\bm_\be:_\bn_\be_\bw_\b-_\bn_\ba_\bm_\be] [-\b--\b-d\bde\bel\blt\bta\bap\bpo\bos\bs _\bs_\bc_\ba_\bl_\be_\b-_\bv_\ba_\bl_\bu_\be] [-\b--\b-d\bde\bel\blt\bta\ban\bne\beg\bg _\bs_\bc_\ba_\bl_\be_\b-_\bv_\ba_\bl_\bu_\be]
+       [-\b--\b-f\bfa\bai\bil\blu\bur\bre\be-\b-t\bth\bhr\bre\bes\bsh\bho\bol\bld\bd _\bf_\ba_\bi_\bl_\bu_\br_\be_\b-_\bt_\bh_\br_\be_\bs_\bh_\bo_\bl_\bd] [-\b--\b-w\bwi\bin\bnd\bdo\bow\bw-\b-l\ble\ben\bng\bgt\bth\bh _\bw_\bi_\bn_\bd_\bo_\bw_\b-_\bl_\be_\bn_\bg_\bt_\bh]
+       [-\b--\b-a\bal\blp\bph\bha\ba _\ba_\bd_\ba_\bp_\bt_\bi_\bo_\bn_\b-_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br] [-\b--\b-b\bbe\bet\bta\ba _\ba_\bd_\ba_\bp_\bt_\bi_\bo_\bn_\b-_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br] [-\b--\b-g\bga\bam\bmm\bma\ba _\ba_\bd_\ba_\bp_\b-
+       _\bt_\bi_\bo_\bn_\b-_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br] [-\b--\b-g\bga\bam\bmm\bma\ba-\b-d\bde\bev\bvi\bia\bat\bti\bio\bon\bn _\ba_\bd_\ba_\bp_\bt_\bi_\bo_\bn_\b-_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br] [-\b--\b-a\bab\bbe\ber\br-\b-
+       r\bra\ban\bnt\bt-\b-r\bre\bes\bse\bet\bt _\bd_\bs_\b-_\bn_\ba_\bm_\be]
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       The tune option allows you to alter some of the basic configuration
+       values stored in the header area of a Round Robin Database (R\bRR\bRD\bD).
+
+       One application of the t\btu\bun\bne\be function is to relax the validation rules
+       on an R\bRR\bRD\bD. This allows to fill a new R\bRR\bRD\bD with data available in larger
+       intervals than what you would normally want to permit. Be very careful
+       with tune operations for COMPUTE data sources.  Setting the _\bm_\bi_\bn, _\bm_\ba_\bx,
+       and  _\bh_\be_\ba_\br_\bt_\bb_\be_\ba_\bt for a COMPUTE data source without changing the data
+       source type to a non-COMPUTE D\bDS\bST\bT WILL corrupt the data source header in
+       the R\bRR\bRD\bD.
+
+       A second application of the t\btu\bun\bne\be function is to set or alter parameters
+       used by the specialized function R\bRR\bRA\bAs\bs for aberrant behavior detection.
+
+       _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
+               The name of the R\bRR\bRD\bD you want to tune.
+
+       -\b--\b-h\bhe\bea\bar\brt\btb\bbe\bea\bat\bt|-\b-h\bh _\bd_\bs_\b-_\bn_\ba_\bm_\be:_\bh_\be_\ba_\br_\bt_\bb_\be_\ba_\bt
+               modify the _\bh_\be_\ba_\br_\bt_\bb_\be_\ba_\bt of a data source. By setting this to a
+               high value the RRD will accept things like one value per day.
+
+       -\b--\b-m\bmi\bin\bni\bim\bmu\bum\bm|-\b-i\bi _\bd_\bs_\b-_\bn_\ba_\bm_\be:_\bm_\bi_\bn
+               alter the minimum value acceptable as input from the data
+               source.  Setting _\bm_\bi_\bn to 'U' will disable this limit.
+
+       -\b--\b-m\bma\bax\bxi\bim\bmu\bum\bm|-\b-a\ba _\bd_\bs_\b-_\bn_\ba_\bm_\be:_\bm_\ba_\bx
+               alter the maximum value acceptable as input from the data
+               source.  Setting _\bm_\ba_\bx to 'U' will disable this limit.
+
+       -\b--\b-d\bda\bat\bta\ba-\b-s\bso\bou\bur\brc\bce\be-\b-t\bty\byp\bpe\be|-\b-d\bd _\bd_\bs_\b-_\bn_\ba_\bm_\be:_\bD_\bS_\bT
+               alter the type D\bDS\bST\bT of a data source.
+
+       -\b--\b-d\bda\bat\bta\ba-\b-s\bso\bou\bur\brc\bce\be-\b-r\bre\ben\bna\bam\bme\be|-\b-r\br _\bo_\bl_\bd_\b-_\bn_\ba_\bm_\be:_\bn_\be_\bw_\b-_\bn_\ba_\bm_\be
+               rename a data source.
+
+       -\b--\b-d\bde\bel\blt\bta\bap\bpo\bos\bs _\bs_\bc_\ba_\bl_\be_\b-_\bv_\ba_\bl_\bu_\be
+               Alter the deviation scaling factor for the upper bound of the
+               confidence band used internally to calculate violations for the
+               FAILURES R\bRR\bRA\bA. The default value is 2. Note that this parameter
+               is not related to graphing confidence bounds which must be
+               specified as a CDEF argument to generate a graph with confi-
+               dence bounds. The graph scale factor need not to agree with the
+               value used internally by the FAILURES R\bRR\bRA\bA.
+
+       -\b--\b-d\bde\bel\blt\bta\ban\bne\beg\bg _\bs_\bc_\ba_\bl_\be_\b-_\bv_\ba_\bl_\bu_\be
+               Alter the deviation scaling factor for the lower bound of the
+               confidence band used internally to calculate violations for the
+               FAILURES R\bRR\bRA\bA. The default value is 2. As with -\b--\b-d\bde\bel\blt\bta\bap\bpo\bos\bs, this
+               argument is unrelated to the scale factor chosen when graphing
+               confidence bounds.
+
+       -\b--\b-f\bfa\bai\bil\blu\bur\bre\be-\b-t\bth\bhr\bre\bes\bsh\bho\bol\bld\bd _\bf_\ba_\bi_\bl_\bu_\br_\be_\b-_\bt_\bh_\br_\be_\bs_\bh_\bo_\bl_\bd
+               Alter the number of confidence bound violations that constitute
+               a failure for purposes of the FAILURES R\bRR\bRA\bA. This must be an
+               integer less than or equal to the window length of the FAILURES
+               R\bRR\bRA\bA. This restriction is not verified by the tune option, so
+               one can reset failure-threshold and window-length simultane-
+               ously. Setting this option will reset the count of violations
+               to 0.
+
+       -\b--\b-w\bwi\bin\bnd\bdo\bow\bw-\b-l\ble\ben\bng\bgt\bth\bh _\bw_\bi_\bn_\bd_\bo_\bw_\b-_\bl_\be_\bn_\bg_\bt_\bh
+               Alter the number of time points in the temporal window for
+               determining failures. This must be an integer greater than or
+               equal to the window length of the FAILURES R\bRR\bRA\bA and less than or
+               equal to 28. Setting this option will reset the count of viola-
+               tions to 0.
+
+       -\b--\b-a\bal\blp\bph\bha\ba _\ba_\bd_\ba_\bp_\bt_\bi_\bo_\bn_\b-_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
+               Alter the intercept adaptation parameter for the Holt-Winters
+               forecasting algorithm. This parameter must be between 0 and 1.
+
+       -\b--\b-b\bbe\bet\bta\ba _\ba_\bd_\ba_\bp_\bt_\bi_\bo_\bn_\b-_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
+               Alter the slope adaptation parameter for the Holt-Winters fore-
+               casting algorithm. This parameter must be between 0 and 1.
+
+       -\b--\b-g\bga\bam\bmm\bma\ba _\ba_\bd_\ba_\bp_\bt_\bi_\bo_\bn_\b-_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
+               Alter the seasonal coefficient adaptation parameter for the
+               SEASONAL R\bRR\bRA\bA. This parameter must be between 0 and 1.
+
+       -\b--\b-g\bga\bam\bmm\bma\ba-\b-d\bde\bev\bvi\bia\bat\bti\bio\bon\bn _\ba_\bd_\ba_\bp_\bt_\bi_\bo_\bn_\b-_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
+               Alter the seasonal deviation adaptation parameter for the
+               DEVSEASONAL R\bRR\bRA\bA. This parameter must be between 0 and 1.
+
+       -\b--\b-a\bab\bbe\ber\brr\bra\ban\bnt\bt-\b-r\bre\bes\bse\bet\bt _\bd_\bs_\b-_\bn_\ba_\bm_\be
+               This option causes the aberrant behavior detection algorithm to
+               reset for the specified data source; that is, forget all it is
+               has learnt so far.  Specifically, for the HWPREDICT R\bRR\bRA\bA, it
+               sets the intercept and slope coefficients to unknown. For the
+               SEASONAL R\bRR\bRA\bA, it sets all seasonal coefficients to unknown. For
+               the DEVSEASONAL R\bRR\bRA\bA, it sets all seasonal deviation coeffi-
+               cients to unknown. For the FAILURES R\bRR\bRA\bA, it erases the viola-
+               tion history. Note that reset does not erase past predictions
+               (the values of the HWPREDICT R\bRR\bRA\bA), predicted deviations (the
+               values of the DEVPREDICT R\bRR\bRA\bA), or failure history (the values
+               of the FAILURES R\bRR\bRA\bA).  This option will function even if not
+               all the listed R\bRR\bRA\bAs\bs are present.
+
+               Due to the implementation of this option, there is an indirect
+               impact on other data sources in the RRD. A smoothing algorithm
+               is applied to SEASONAL and DEVSEASONAL values on a periodic
+               basis. During bootstrap initialization this smoothing is
+               deferred. For efficiency, the implementation of smoothing is
+               not data source specific. This means that utilizing reset for
+               one data source will delay running the smoothing algorithm for
+               all data sources in the file. This is unlikely to have serious
+               consequences, unless the data being collected for the non-reset
+               data sources is unusually volatile during the reinitialization
+               period of the reset data source.
+
+               Use of this tuning option is advised when the behavior of the
+               data source time series changes in a drastic and permanent man-
+               ner.
+
+E\bEX\bXA\bAM\bMP\bPL\bLE\bE 1\b1
+       "rrdtool tune data.rrd -h in:100000 -h out:100000 -h through:100000"
+
+       Set the minimum required heartbeat for data sources 'in', 'out' and
+       'through' to 10'000 seconds which is a little over one day in data.rrd.
+       This would allow to feed old data from MRTG-2.0 right into RRDtool
+       without generating *UNKNOWN* entries.
+
+E\bEX\bXA\bAM\bMP\bPL\bLE\bE 2\b2
+       "rrdtool tune monitor.rrd --window-length 5 --failure-threshold 3"
+
+       If the FAILURES R\bRR\bRA\bA is implicitly created, the default window-length is
+       9 and the default failure-threshold is 7. This command now defines a
+       failure as 3 or more violations in a temporal window of 5 time points.
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Tobias Oetiker <tobi@oetiker.ch>
+
+
+
+1.2.26                            2007-11-20                        RRDTUNE(1)
diff --git a/doc/rrdtutorial.1 b/doc/rrdtutorial.1
new file mode 100644 (file)
index 0000000..efec405
--- /dev/null
@@ -0,0 +1,1363 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDTUTORIAL 1"
+.TH RRDTUTORIAL 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdtutorial \- Alex van den Bogaerdt's RRDtool tutorial
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+RRDtool is written by Tobias Oetiker <tobi@oetiker.ch> with
+contributions from many people all around the world. This document is
+written by Alex van den Bogaerdt <alex@ergens.op.het.net> to help you
+understand what RRDtool is and what it can do for you.
+.PP
+The documentation provided with RRDtool can be too technical for some
+people. This tutorial is here to help you understand the basics of
+RRDtool. It should prepare you to read the documentation yourself.
+It also explains the general things about statistics with a focus on
+networking.
+.SH "TUTORIAL"
+.IX Header "TUTORIAL"
+.Sh "Important"
+.IX Subsection "Important"
+Please don't skip ahead in this document!  The first part of this
+document explains the basics and may be boring.  But if you don't
+understand the basics, the examples will not be as meaningful to you.
+.Sh "What is RRDtool?"
+.IX Subsection "What is RRDtool?"
+RRDtool refers to Round Robin Database tool.
+Round robin is a technique that works with a fixed amount of data, and a
+pointer to the current element. Think of a circle with some dots plotted
+on the edge \*(-- these dots are the places where data can be stored. Draw an
+arrow from the center of the circle to one of the dots \*(-- this is the pointer.
+When the current data is read or written, the pointer moves to the next
+element. As we are on a circle there is neither a beginning nor an end, you can
+go on and on and on. After a while, all the available places will be used and
+the process automatically reuses old locations. This way, the dataset
+will not grow in size and therefore requires no maintenance.
+RRDtool works with with Round Robin Databases (RRDs). It stores and retrieves
+data from them.
+.Sh "What data can be put into an \s-1RRD\s0?"
+.IX Subsection "What data can be put into an RRD?"
+You name it, it will probably fit as long as it is some sort of time-series
+data. This means you have to be able to measure some value at several points in time and
+provide this information to RRDtool. If you can do this, RRDtool will be
+able to store it. The values must be numerical but don't have to be
+integers, as is the case with \s-1MRTG\s0 (the next section will give more details
+on this more specialized application).
+.PP
+Many examples below talk about \s-1SNMP\s0 which is an acronym for Simple Network
+Management Protocol. \*(L"Simple\*(R" refers to the protocol \*(-- it does not
+mean it is simple to manage or monitor a network. After working your
+way through this document, you should know enough to be able to
+understand what people are talking about. For now, just realize that
+\&\s-1SNMP\s0 can be used to query devices for the values of counters they keep. It
+is the value from those counters that we want to store in the \s-1RRD\s0.
+.Sh "What can I do with this tool?"
+.IX Subsection "What can I do with this tool?"
+RRDtool originated from \s-1MRTG\s0 (Multi Router Traffic Grapher). \s-1MRTG\s0
+started as a tiny little script for graphing the use of a university's
+connection to the Internet. \s-1MRTG\s0 was later (ab\-)used as a tool for
+graphing other data sources including temperature, speed, voltage,
+number of printouts and the like.
+.PP
+Most likely you will start to use RRDtool to store and process data
+collected via \s-1SNMP\s0. The data will most likely be bytes (or bits)
+transfered from and to a network or a computer.  But it can also be
+used to display tidal waves, solar radiation, power consumption,
+number of visitors at an exhibition, noise levels near an airport,
+temperature on your favorite holiday location, temperature in the
+fridge and whatever you imagination can come up with.
+.PP
+You only need a sensor to measure the data and be able to feed the
+numbers into RRDtool. RRDtool then lets you create a database, store
+data in it, retrieve that data and create graphs in \s-1PNG\s0 format for
+display on a web browser. Those \s-1PNG\s0 images are dependent on the data
+you collected and could be, for instance, an overview of the average
+network usage, or the peaks that occurred.
+.Sh "What if I still have problems after reading this document?"
+.IX Subsection "What if I still have problems after reading this document?"
+First of all: read it again! You may have missed something.
+If you are unable to compile the sources and you have a fairly common
+\&\s-1OS\s0, it will probably not be the fault of RRDtool. There may be pre-compiled
+versions around on the Internet. If they come from trusted sources, get
+one of those.
+.PP
+If on the other hand the program works but does not give you the
+expected results, it will be a problem with configuring it. Review
+your configuration and compare it with the examples that follow.
+.PP
+There is a mailing list and an archive of it. Read the list for a few
+weeks and search the archive. It is considered rude to just ask
+a question without searching the archives: your problem may already have been
+solved for somebody else!  This is true for most, if not all, mailing lists
+and not only for this particular one. Look in the documentation that
+came with RRDtool for the location and usage of the list.
+.PP
+I suggest you take a moment to subscribe to the mailing list right now
+by sending an email to <rrd\-users\-request@lists.oetiker.ch> with a
+subject of \*(L"subscribe\*(R". If you ever want to leave this list, just write
+an email to the same address but now with a subject of \*(L"unsubscribe\*(R".
+.Sh "How will you help me?"
+.IX Subsection "How will you help me?"
+By giving you some detailed descriptions with detailed examples.
+I assume that following the instructions in the order presented
+will give you enough knowledge of RRDtool to experiment for yourself.
+If it doesn't work the first time, don't give up. Reread the stuff that
+you did understand, you may have missed something.
+.PP
+By following the examples you get some hands-on experience and, even
+more important, some background information of how it works.
+.PP
+You will need to know something about hexadecimal numbers. If you don't
+then start with reading bin_dec_hex before you continue here.
+.Sh "Your first Round Robin Database"
+.IX Subsection "Your first Round Robin Database"
+In my opinion the best way to learn something is to actually do it.
+Why not start right now?  We will create a database, put some values
+in it and extract this data again.  Your output should be the same
+as the output that is included in this document.
+.PP
+We will start with some easy stuff and compare a car with a router,
+or compare kilometers (miles if you wish) with bits and bytes. It's
+all the same: some number over some time.
+.PP
+Assume we have a device that transfers bytes to and from the Internet.
+This device keeps a counter that starts at zero when it is turned on,
+increasing with every byte that is transfered. This counter will probably have
+a maximum value. If this value is reached and an extra byte is counted,
+the counter starts over at zero. This is the same as many counters
+in the world such as the mileage counter in a car.
+.PP
+Most discussions about networking talk about bits per second so lets
+get used to that right away. Assume a byte is eight bits and start to
+think in bits not bytes. The counter, however, still counts bytes!
+In the \s-1SNMP\s0 world most of the counters are 32 bits. That means they are
+counting from 0 to 4'294'967'295. We will use these values in the examples.
+The device, when asked, returns the current value of the counter. We
+know the time that has passes since we last asked so we now know how
+many bytes have been transfered ***on average*** per second. This is
+not very hard to calculate. First in words, then in calculations:
+.IP "1." 3
+Take the current counter, subtract the previous value from it.
+.IP "2." 3
+Do the same with the current time and the previous time (in seconds).
+.IP "3." 3
+Divide the outcome of (1) by the outcome of (2), the result is
+the amount of bytes per second. Multiply by eight to get the
+number of bits per second (bps).
+.PP
+.Vb 1
+\&  bps = (counter_now \- counter_before) / (time_now \- time_before) * 8
+.Ve
+.PP
+For some people it may help to translate this to an automobile example.
+Do not try this example, and if you do, don't blame me for the results!
+.PP
+People who are not used to think in kilometers per hour can translate
+most into miles per hour by dividing km by 1.6 (close enough).
+I will use the following abbreviations:
+.PP
+.Vb 6
+\& M:    meter
+\& KM:   kilometer (= 1'000 meters).
+\& H:    hour
+\& S:    second
+\& KM/H: kilometers per hour
+\& M/S:  meters per second
+.Ve
+.PP
+You are driving a car. At 12:05 you read the counter in the dashboard
+and it tells you that the car has moved 12'345 \s-1KM\s0 until that moment.
+At 12:10 you look again, it reads 12'357 \s-1KM\s0. This means you have
+traveled 12 \s-1KM\s0 in five minutes. A scientist would translate that
+into meters per second and this makes a nice comparison toward the
+problem of (bytes per five minutes) versus (bits per second).
+.PP
+We traveled 12 kilometers which is 12'000 meters. We did that in five
+minutes or 300 seconds. Our speed is 12'000M / 300S or 40 M/S.
+.PP
+We could also calculate the speed in \s-1KM/H:\s0 12 times 5 minutes
+is an hour, so we have to multiply 12 \s-1KM\s0 by 12 to get 144 \s-1KM/H\s0.
+For our native English speaking friends: that's 90 \s-1MPH\s0 so don't
+try this example at home or where I live :)
+.PP
+Remember: these numbers are averages only.  There is no way to figure out
+from the numbers, if you drove at a constant speed.  There is an example
+later on in this tutorial that explains this.
+.PP
+I hope you understand that there is no difference in calculating M/S or
+bps; only the way we collect the data is different. Even the K from kilo
+is the same as in networking terms k also means 1'000.
+.PP
+We will now create a database where we can keep all these interesting
+numbers. The method used to start the program may differ slightly from
+\&\s-1OS\s0 to \s-1OS\s0, but I assume you can figure it out if it works different on
+your's. Make sure you do not overwrite any file on your system when
+executing the following command and type the whole line as one long
+line (I had to split it for readability)
+and skip all of the '\e' characters.
+.PP
+.Vb 5
+\&   rrdtool create test.rrd             \e
+\&            \-\-start 920804400          \e
+\&            DS:speed:COUNTER:600:U:U   \e
+\&            RRA:AVERAGE:0.5:1:24       \e
+\&            RRA:AVERAGE:0.5:6:10
+.Ve
+.PP
+(So enter: \f(CW\*(C`rrdtool create test.rrd \-\-start 920804400 DS ...\*(C'\fR)
+.Sh "What has been created?"
+.IX Subsection "What has been created?"
+We created the round robin database called test (test.rrd) which starts at
+noon the day I started writing this document, 7th of March, 1999 (this date
+translates to 920'804'400 seconds as explained below). Our database holds
+one data source (\s-1DS\s0) named \*(L"speed\*(R" that represents a counter. This counter
+is read every five minutes (this is the default therefore you don't have to
+put \f(CW\*(C`\-\-step=300\*(C'\fR).  In the same database two round robin archives (RRAs)
+are kept, one averages the data every time it is read (e.g., there's nothing
+to average) and keeps 24 samples (24 times 5 minutes is 2 hours). The other
+averages 6 values (half hour) and contains 10 such averages (e.g. 5 hours).
+.PP
+RRDtool works with special time stamps coming from the \s-1UNIX\s0 world.
+This time stamp is the number of seconds that passed since January
+1st 1970 \s-1UTC\s0.  The time stamp value is translated into local time and
+it will therefore look different for different time zones.
+.PP
+Chances are that you are not in the same part of the world as I am.
+This means your time zone is different. In all examples where I talk
+about time, the hours may be wrong for you. This has little effect on
+the results of the examples, just correct the hours while reading.
+As an example: where I will see \*(L"12:05\*(R" the \s-1UK\s0 folks will see \*(L"11:05\*(R".
+.PP
+We now have to fill our database with some numbers. We'll pretend to
+have read the following numbers:
+.PP
+.Vb 15
+\& 12:05  12345 KM
+\& 12:10  12357 KM
+\& 12:15  12363 KM
+\& 12:20  12363 KM
+\& 12:25  12363 KM
+\& 12:30  12373 KM
+\& 12:35  12383 KM
+\& 12:40  12393 KM
+\& 12:45  12399 KM
+\& 12:50  12405 KM
+\& 12:55  12411 KM
+\& 13:00  12415 KM
+\& 13:05  12420 KM
+\& 13:10  12422 KM
+\& 13:15  12423 KM
+.Ve
+.PP
+We fill the database as follows:
+.PP
+.Vb 5
+\& rrdtool update test.rrd 920804700:12345 920805000:12357 920805300:12363
+\& rrdtool update test.rrd 920805600:12363 920805900:12363 920806200:12373
+\& rrdtool update test.rrd 920806500:12383 920806800:12393 920807100:12399
+\& rrdtool update test.rrd 920807400:12405 920807700:12411 920808000:12415
+\& rrdtool update test.rrd 920808300:12420 920808600:12422 920808900:12423
+.Ve
+.PP
+This reads: update our test database with the following numbers
+.PP
+.Vb 2
+\& time 920804700, value 12345
+\& time 920805000, value 12357
+.Ve
+.PP
+etcetera.
+.PP
+As you can see, it is possible to feed more than one value into the
+database in one command. I had to stop at three for readability but
+the real maximum per line is \s-1OS\s0 dependent.
+.PP
+We can now retrieve the data from our database using \*(L"rrdtool fetch\*(R":
+.PP
+.Vb 1
+\& rrdtool fetch test.rrd AVERAGE \-\-start 920804400 \-\-end 920809200
+.Ve
+.PP
+It should return the following output:
+.PP
+.Vb 1
+\&                          speed
+.Ve
+.PP
+.Vb 16
+\& 920804700: nan
+\& 920805000: 4.0000000000e\-02
+\& 920805300: 2.0000000000e\-02
+\& 920805600: 0.0000000000e+00
+\& 920805900: 0.0000000000e+00
+\& 920806200: 3.3333333333e\-02
+\& 920806500: 3.3333333333e\-02
+\& 920806800: 3.3333333333e\-02
+\& 920807100: 2.0000000000e\-02
+\& 920807400: 2.0000000000e\-02
+\& 920807700: 2.0000000000e\-02
+\& 920808000: 1.3333333333e\-02
+\& 920808300: 1.6666666667e\-02
+\& 920808600: 6.6666666667e\-03
+\& 920808900: 3.3333333333e\-03
+\& 920809200: nan
+.Ve
+.PP
+If it doesn't, something may be wrong.  Perhaps your \s-1OS\s0 will print
+\&\*(L"NaN\*(R" in a different form. \*(L"NaN\*(R" stands for \*(L"Not A Number\*(R".  If your \s-1OS\s0
+writes \*(L"U\*(R" or \*(L"\s-1UNKN\s0\*(R" or something similar that's okay.  If something
+else is wrong, it will probably be due to an error you made (assuming
+that my tutorial is correct of course :\-). In that case: delete the
+database and try again.  Sometimes things change.  This example used
+to provide numbers like \*(L"0.04\*(R" in stead of \*(L"4.00000e\-02\*(R".  Those are
+really the same numbers, just written down differently.  Don't be
+alarmed if a future version of rrdtool displays a slightly different
+form of output. The examples in this document are correct for version
+1.2.0 of RRDtool.
+.PP
+The meaning of the above output will become clear below.
+.Sh "Time to create some graphics"
+.IX Subsection "Time to create some graphics"
+Try the following command:
+.PP
+.Vb 4
+\& rrdtool graph speed.png                                 \e
+\&         \-\-start 920804400 \-\-end 920808000               \e
+\&         DEF:myspeed=test.rrd:speed:AVERAGE              \e
+\&         LINE2:myspeed#FF0000
+.Ve
+.PP
+This will create speed.png which starts at 12:00 and ends at 13:00.
+There is a definition of a variable called myspeed, using the data from \s-1RRA\s0
+\&\*(L"speed\*(R" out of database \*(L"test.rrd\*(R". The line drawn is 2 pixels high
+and represents the variable myspeed. The color is red (specified by
+its rgb\-representation, see below).
+.PP
+You'll notice that the start of the graph is not at 12:00 but at 12:05.
+This is because we have insufficient data to tell the average before
+that time. This will only happen when you miss some samples, this will
+not happen a lot, hopefully.
+.PP
+If this has worked: congratulations! If not, check what went wrong.
+.PP
+The colors are built up from red, green and blue. For each of the
+components, you specify how much to use in hexadecimal where 00 means
+not included and \s-1FF\s0 means fully included.
+The \*(L"color\*(R" white is a mixture of red, green and blue: \s-1FFFFFF\s0
+The \*(L"color\*(R" black is all colors off: 000000
+.PP
+.Vb 5
+\&   red     #FF0000
+\&   green   #00FF00
+\&   blue    #0000FF
+\&   magenta #FF00FF     (mixed red with blue)
+\&   gray    #555555     (one third of all components)
+.Ve
+.PP
+Additionally you can add an alpha channel (transparency).  The default
+will be \*(L"\s-1FF\s0\*(R" which means non\-transparent.
+.PP
+The \s-1PNG\s0 you just created can be displayed using your favorite image
+viewer.  Web browsers will display the \s-1PNG\s0 via the \s-1URL\s0
+\&\*(L"file:///the/path/to/speed.png\*(R"
+.Sh "Graphics with some math"
+.IX Subsection "Graphics with some math"
+When looking at the image, you notice that the horizontal axis is labeled
+12:10, 12:20, 12:30, 12:40 and 12:50. Sometimes a label doesn't fit (12:00
+and 13:00 would be candidates) so they are skipped.
+.PP
+The vertical axis displays the range we entered. We provided
+kilometers and when divided by 300 seconds, we get very small
+numbers. To be exact, the first value was 12 (12'357\-12'345) and divided
+by 300 this makes 0.04, which is displayed by RRDtool as \*(L"40 m\*(R"
+meaning \*(L"40/1'000\*(R". The \*(L"m\*(R" (milli) has nothing to do with meters,
+kilometers or millimeters! RRDtool doesn't know about the physical
+units of our data, it just works with dimensionless numbers.
+.PP
+If we had measured our distances in meters, this would have been
+(12'357'000\-12'345'000)/300 = 12'000/300 = 40.
+.PP
+As most people have a better feel for numbers in this range, we'll
+correct that. We could recreate our database and store the correct
+data, but there is a better way: we do some calculations while creating
+the png file!
+.PP
+.Vb 6
+\&   rrdtool graph speed2.png                           \e
+\&      \-\-start 920804400 \-\-end 920808000               \e
+\&      \-\-vertical\-label m/s                            \e
+\&      DEF:myspeed=test.rrd:speed:AVERAGE              \e
+\&      CDEF:realspeed=myspeed,1000,\e*                  \e
+\&      LINE2:realspeed#FF0000
+.Ve
+.PP
+Note: Make sure not to forget the backslash \e in front of the
+multiplication operator * above. The backslash is needed to \*(L"escape\*(R"
+the * as some operating systems might interpret and expand * instead
+of passing it to the rrdtool command.
+.PP
+After viewing this \s-1PNG\s0, you notice the \*(L"m\*(R" (milli) has
+disappeared. This it what the correct result would be. Also, a label
+has been added to the image.  Apart from the things mentioned above,
+the \s-1PNG\s0 should look the same.
+.PP
+The calculations are specified in the \s-1CDEF\s0 part above and are in
+Reverse Polish Notation (\*(L"\s-1RPN\s0\*(R"). What we requested RRDtool to do is:
+\&\*(L"take the data source myspeed and the number 1000; multiply
+those\*(R". Don't bother with \s-1RPN\s0 yet, it will be explained later on in
+more detail. Also, you may want to read my tutorial on CDEFs and Steve
+Rader's tutorial on \s-1RPN\s0. But first finish this tutorial.
+.PP
+Hang on! If we can multiply values with 1'000, it should also be possible
+to display kilometers per hour from the same data!
+.PP
+To change a value that is measured in meters per second:
+.PP
+.Vb 3
+\& Calculate meters per hour:     value * 3'600
+\& Calculate kilometers per hour: value / 1'000
+\& Together this makes:           value * (3'600/1'000) or value * 3.6
+.Ve
+.PP
+In our example database we made a mistake and we need to compensate for
+this by multiplying with 1'000. Applying that correction:
+.PP
+.Vb 1
+\& value * 3.6  * 1'000 == value * 3'600
+.Ve
+.PP
+Now let's create this \s-1PNG\s0, and add some more magic ...
+.PP
+.Vb 10
+\& rrdtool graph speed3.png                             \e
+\&      \-\-start 920804400 \-\-end 920808000               \e
+\&      \-\-vertical\-label km/h                           \e
+\&      DEF:myspeed=test.rrd:speed:AVERAGE              \e
+\&      "CDEF:kmh=myspeed,3600,*"                       \e
+\&      CDEF:fast=kmh,100,GT,kmh,0,IF                   \e
+\&      CDEF:good=kmh,100,GT,0,kmh,IF                   \e
+\&      HRULE:100#0000FF:"Maximum allowed"              \e
+\&      AREA:good#00FF00:"Good speed"                   \e
+\&      AREA:fast#FF0000:"Too fast"
+.Ve
+.PP
+Note: here we use another means to escape the * operator by enclosing
+the whole string in double quotes.
+.PP
+This graph looks much better. Speed is shown in \s-1KM/H\s0 and there is even
+an extra line with the maximum allowed speed (on the road I travel
+on). I also changed the colors used to display speed and changed it
+from a line into an area.
+.PP
+The calculations are more complex now. For speed measurements within
+the speed limit they are:
+.PP
+.Vb 2
+\&   Check if kmh is greater than 100    ( kmh,100 ) GT
+\&   If so, return 0, else kmh           ((( kmh,100 ) GT ), 0, kmh) IF
+.Ve
+.PP
+For values above the speed limit:
+.PP
+.Vb 2
+\&   Check if kmh is greater than 100    ( kmh,100 ) GT
+\&   If so, return kmh, else return 0    ((( kmh,100) GT ), kmh, 0) IF
+.Ve
+.Sh "Graphics Magic"
+.IX Subsection "Graphics Magic"
+I like to believe there are virtually no limits to how RRDtool graph
+can manipulate data. I will not explain how it works, but look at the
+following \s-1PNG:\s0
+.PP
+.Vb 12
+\&   rrdtool graph speed4.png                           \e
+\&      \-\-start 920804400 \-\-end 920808000               \e
+\&      \-\-vertical\-label km/h                           \e
+\&      DEF:myspeed=test.rrd:speed:AVERAGE              \e
+\&      "CDEF:kmh=myspeed,3600,*"                       \e
+\&      CDEF:fast=kmh,100,GT,100,0,IF                   \e
+\&      CDEF:over=kmh,100,GT,kmh,100,\-,0,IF             \e
+\&      CDEF:good=kmh,100,GT,0,kmh,IF                   \e
+\&      HRULE:100#0000FF:"Maximum allowed"              \e
+\&      AREA:good#00FF00:"Good speed"                   \e
+\&      AREA:fast#550000:"Too fast"                     \e
+\&      STACK:over#FF0000:"Over speed"
+.Ve
+.PP
+Let's create a quick and dirty \s-1HTML\s0 page to view the three PNGs:
+.PP
+.Vb 7
+\&   <HTML><HEAD><TITLE>Speed</TITLE></HEAD><BODY>
+\&   <IMG src="speed2.png" alt="Speed in meters per second">
+\&   <BR>
+\&   <IMG src="speed3.png" alt="Speed in kilometers per hour">
+\&   <BR>
+\&   <IMG src="speed4.png" alt="Traveled too fast?">
+\&   </BODY></HTML>
+.Ve
+.PP
+Name the file \*(L"speed.html\*(R" or similar, and look at it in your web browser.
+.PP
+Now, all you have to do is measure the values regularly and update the
+database.  When you want to view the data, recreate the PNGs and make
+sure to refresh them in your browser. (Note: just clicking reload may
+not be enough, especially when proxies are involved.  Try shift-reload
+or ctrl\-F5).
+.Sh "Updates in Reality"
+.IX Subsection "Updates in Reality"
+We've already used the \f(CW\*(C`update\*(C'\fR command: it took one or more
+parameters in the form of \*(L"<time>:<value>\*(R". You'll be glad to know
+that you can specify the current time by filling in a \*(L"N\*(R" as the time.
+Or you could use the \*(L"time\*(R" function in Perl (the shortest example in
+this tutorial):
+.PP
+.Vb 1
+\&   perl \-e 'print time, "\en" '
+.Ve
+.PP
+How to run a program on regular intervals is \s-1OS\s0 specific. But here is
+an example in pseudo code:
+.PP
+.Vb 2
+\&   \- Get the value and put it in variable "$speed"
+\&   \- rrdtool update speed.rrd N:$speed
+.Ve
+.PP
+(do not try this with our test database, we'll use it in further examples)
+.PP
+This is all. Run the above script every five minutes. When you need to know
+what the graphs look like, run the examples above. You could put them
+in a script as well. After running that script, view the page
+index.html we created above.
+.Sh "Some words on \s-1SNMP\s0"
+.IX Subsection "Some words on SNMP"
+I can imagine very few people that will be able to get real data from
+their car every five minutes. All other people will have to settle for
+some other kind of counter. You could measure the number of pages
+printed by a printer, for example, the cups of coffee made by the
+coffee machine, a device that counts the electricity used,
+whatever. Any incrementing counter can be monitored and graphed using
+the stuff you learned so far. Later on we will also be able to monitor
+other types of values like temperature.
+.PP
+Most (?) people interested in RRDtool will use the counter that keeps track
+of octets (bytes) transfered by a network device. So let's do just
+that next. We will start with a description of how to collect data.
+.PP
+Some people will make a remark that there are tools which can do this data
+collection for you. They are right! However, I feel it is important that
+you understand they are not necessary. When you have to determine why
+things went wrong you need to know how they work.
+.PP
+One tool used in the example has been talked about very briefly in the
+beginning of this document, it is called \s-1SNMP\s0. It is a way of talking
+to networked equipment. The tool I use below is called \*(L"snmpget\*(R" and
+this is how it works:
+.PP
+.Vb 1
+\&   snmpget device password OID
+.Ve
+.PP
+or
+.PP
+.Vb 1
+\&   snmpget \-v[version] \-c[password] device OID
+.Ve
+.PP
+For device you substitute the name, or the \s-1IP\s0 address, of your device.
+For password you use the \*(L"community read string\*(R" as it is called in the
+\&\s-1SNMP\s0 world.  For some devices the default of \*(L"public\*(R" might work, however
+this can be disabled, altered or protected for privacy and security
+reasons.  Read the documentation that comes with your device or program.
+.PP
+Then there is this parameter, called \s-1OID\s0, which means \*(L"object identifier\*(R".
+.PP
+When you start to learn about \s-1SNMP\s0 it looks very confusing. It isn't
+all that difficult when you look at the Management Information Base
+(\*(L"\s-1MIB\s0\*(R").  It is an upside-down tree that describes data, with a single node
+as the root and from there a number of branches.  These branches end
+up in another node, they branch out, etc.  All the branches have a name
+and they form the path that we follow all the way down.  The branches
+that we follow are named: iso, org, dod, internet, mgmt and mib\-2.
+These names can also be written down as numbers and are 1 3 6 1 2 1.
+.PP
+.Vb 1
+\&   iso.org.dod.internet.mgmt.mib\-2 (1.3.6.1.2.1)
+.Ve
+.PP
+There is a lot of confusion about the leading dot that some programs
+use.  There is *no* leading dot in an \s-1OID\s0.  However, some programs
+can use the above part of OIDs as a default.  To indicate the difference
+between abbreviated OIDs and full OIDs they need a leading dot when
+you specify the complete \s-1OID\s0.  Often those programs will leave out
+the default portion when returning the data to you.  To make things
+worse, they have several default prefixes ...
+.PP
+Ok, lets continue to the start of our \s-1OID:\s0 we had 1.3.6.1.2.1
+From there, we are especially interested in the branch \*(L"interfaces\*(R"
+which has number 2 (e.g., 1.3.6.1.2.1.2 or 1.3.6.1.2.1.interfaces).
+.PP
+First, we have to get some \s-1SNMP\s0 program. First look if there is a
+pre-compiled package available for your \s-1OS\s0. This is the preferred way.
+If not, you will have to get the sources yourself and compile those.
+The Internet is full of sources, programs etc. Find information using
+a search engine or whatever you prefer.
+.PP
+Assume you got the program. First try to collect some data that is
+available on most systems. Remember: there is a short name for the
+part of the tree that interests us most in the world we live in!
+.PP
+I will give an example which can be used on Fedora Core 3.  If it
+doesn't work for you, work your way through the manual of snmp and
+adapt the example to make it work.
+.PP
+.Vb 1
+\&   snmpget \-v2c \-c public myrouter system.sysDescr.0
+.Ve
+.PP
+The device should answer with a description of itself, perhaps an
+empty one. Until you got a valid answer from a device, perhaps using a
+different \*(L"password\*(R", or a different device, there is no point in
+continuing.
+.PP
+.Vb 1
+\&   snmpget \-v2c \-c public myrouter interfaces.ifNumber.0
+.Ve
+.PP
+Hopefully you get a number as a result, the number of interfaces.
+If so, you can carry on and try a different program called \*(L"snmpwalk\*(R".
+.PP
+.Vb 1
+\&   snmpwalk \-v2c \-c public myrouter interfaces.ifTable.ifEntry.ifDescr
+.Ve
+.PP
+If it returns with a list of interfaces, you're almost there.
+Here's an example:
+   [user@host /home/alex]$ snmpwalk \-v2c \-c public cisco 2.2.1.2
+.PP
+.Vb 5
+\&   interfaces.ifTable.ifEntry.ifDescr.1 = "BRI0: B\-Channel 1"
+\&   interfaces.ifTable.ifEntry.ifDescr.2 = "BRI0: B\-Channel 2"
+\&   interfaces.ifTable.ifEntry.ifDescr.3 = "BRI0" Hex: 42 52 49 30
+\&   interfaces.ifTable.ifEntry.ifDescr.4 = "Ethernet0"
+\&   interfaces.ifTable.ifEntry.ifDescr.5 = "Loopback0"
+.Ve
+.PP
+On this cisco equipment, I would like to monitor the \*(L"Ethernet0\*(R"
+interface and from the above output I see that it is number four. I try:
+.PP
+.Vb 1
+\&   [user@host /home/alex]$ snmpget \-v2c \-c public cisco 2.2.1.10.4 2.2.1.16.4
+.Ve
+.PP
+.Vb 2
+\&   interfaces.ifTable.ifEntry.ifInOctets.4 = 2290729126
+\&   interfaces.ifTable.ifEntry.ifOutOctets.4 = 1256486519
+.Ve
+.PP
+So now I have two OIDs to monitor and they are (in full, this time):
+.PP
+.Vb 1
+\&   1.3.6.1.2.1.2.2.1.10
+.Ve
+.PP
+and
+.PP
+.Vb 1
+\&   1.3.6.1.2.1.2.2.1.16
+.Ve
+.PP
+both with an interface number of 4.
+.PP
+Don't get fooled, this wasn't my first try. It took some time for me too
+to understand what all these numbers mean. It does help a lot when they
+get translated into descriptive text... At least, when people are talking
+about MIBs and OIDs you know what it's all about.
+Do not forget the interface number (0 if it is not interface dependent)
+and try snmpwalk if you don't get an answer from snmpget.
+.PP
+If you understand the above section and get numbers from your device, continue
+on with this tutorial. If not, then go back and re-read this part.
+.Sh "A Real World Example"
+.IX Subsection "A Real World Example"
+Let the fun begin. First, create a new database. It contains data from
+two counters, called input and output. The data is put into archives
+that average it. They take 1, 6, 24 or 288 samples at a time.
+They also go into archives that keep the maximum numbers. This will be
+explained later on. The time in-between samples is 300 seconds, a good
+starting point, which is the same as five minutes.
+.PP
+.Vb 4
+\& 1 sample "averaged" stays 1 period of 5 minutes
+\& 6 samples averaged become one average on 30 minutes
+\& 24 samples averaged become one average on 2 hours
+\& 288 samples averaged become one average on 1 day
+.Ve
+.PP
+Lets try to be compatible with \s-1MRTG\s0 which stores about the following
+amount of data:
+.PP
+.Vb 4
+\& 600 5\-minute samples:    2   days and 2 hours
+\& 600 30\-minute samples:  12.5 days
+\& 600 2\-hour samples:     50   days
+\& 732 1\-day samples:     732   days
+.Ve
+.PP
+These ranges are appended, so the total amount of data stored in the
+database is approximately 797 days. RRDtool stores the data
+differently, it doesn't start the \*(L"weekly\*(R" archive where the \*(L"daily\*(R"
+archive stopped. For both archives the most recent data will be near
+\&\*(L"now\*(R" and therefore we will need to keep more data than \s-1MRTG\s0 does!
+.PP
+We will need:
+.PP
+.Vb 4
+\& 600 samples of 5 minutes  (2 days and 2 hours)
+\& 700 samples of 30 minutes (2 days and 2 hours, plus 12.5 days)
+\& 775 samples of 2 hours    (above + 50 days)
+\& 797 samples of 1 day      (above + 732 days, rounded up to 797)
+.Ve
+.PP
+.Vb 11
+\&   rrdtool create myrouter.rrd         \e
+\&            DS:input:COUNTER:600:U:U   \e
+\&            DS:output:COUNTER:600:U:U  \e
+\&            RRA:AVERAGE:0.5:1:600      \e
+\&            RRA:AVERAGE:0.5:6:700      \e
+\&            RRA:AVERAGE:0.5:24:775     \e
+\&            RRA:AVERAGE:0.5:288:797    \e
+\&            RRA:MAX:0.5:1:600          \e
+\&            RRA:MAX:0.5:6:700          \e
+\&            RRA:MAX:0.5:24:775         \e
+\&            RRA:MAX:0.5:288:797
+.Ve
+.PP
+Next thing to do is to collect data and store it. Here is an example.
+It is written partially in pseudo code,  you will have to find out what
+to do exactly on your \s-1OS\s0 to make it work.
+.PP
+.Vb 8
+\&   while not the end of the universe
+\&   do
+\&      get result of
+\&         snmpget router community 2.2.1.10.4
+\&      into variable $in
+\&      get result of
+\&         snmpget router community 2.2.1.16.4
+\&      into variable $out
+.Ve
+.PP
+.Vb 1
+\&      rrdtool update myrouter.rrd N:$in:$out
+.Ve
+.PP
+.Vb 2
+\&      wait for 5 minutes
+\&   done
+.Ve
+.PP
+Then, after collecting data for a day, try to create an image using:
+.PP
+.Vb 5
+\&   rrdtool graph myrouter\-day.png \-\-start \-86400 \e
+\&            DEF:inoctets=myrouter.rrd:input:AVERAGE \e
+\&            DEF:outoctets=myrouter.rrd:output:AVERAGE \e
+\&            AREA:inoctets#00FF00:"In traffic" \e
+\&            LINE1:outoctets#0000FF:"Out traffic"
+.Ve
+.PP
+This should produce a picture with one day worth of traffic.
+One day is 24 hours of 60 minutes of 60 seconds: 24*60*60=86'400, we
+start at now minus 86'400 seconds. We define (with DEFs) inoctets and
+outoctets as the average values from the database myrouter.rrd and draw
+an area for the \*(L"in\*(R" traffic and a line for the \*(L"out\*(R" traffic.
+.PP
+View the image and keep logging data for a few more days.
+If you like, you could try the examples from the test database and
+see if you can get various options and calculations to work.
+.PP
+Suggestion: Display in bytes per second and in bits per second. Make
+the Ethernet graphics go red if they are over four megabits per
+second.
+.Sh "Consolidation Functions"
+.IX Subsection "Consolidation Functions"
+A few paragraphs back I mentioned the possibility of keeping
+the maximum values instead of the average values. Let's go
+into this a bit more.
+.PP
+Recall all the stuff about the speed of the car. Suppose we drove at 144
+\&\s-1KM/H\s0 during 5 minutes and then were stopped by the police for 25 minutes.
+At the end of the lecture we would take our laptop and create and view the
+image taken from the database. If we look at the second \s-1RRA\s0 we did
+create, we would have the average from 6 samples. The samples measured
+would be 144+0+0+0+0+0=144, divided by 30 minutes, corrected for the
+error by 1000, translated into \s-1KM/H\s0, with a result of 24 \s-1KM/H\s0.
+I would still get a ticket but not for speeding anymore :)
+.PP
+Obviously, in this case we shouldn't look at the averages. In some
+cases they are handy. If you want to know how many \s-1KM\s0 you had traveled,
+the averaged picture would be the right one to look at. On the other hand, for
+the speed that we traveled at, the maximum numbers seen is much more
+interesting. Later we will see more types.
+.PP
+It is the same for data. If you want to know the amount, look at the
+averages. If you want to know the rate, look at the maximum.
+Over time, they will grow apart more and more. In the last database
+we have created, there are two archives that keep data per day. The
+archive that keeps averages will show low numbers, the archive that
+shows maxima will have higher numbers.
+.PP
+For my car this would translate in averages per day of 96/24=4 \s-1KM/H\s0
+(as I travel about 94 kilometers on a day) during working days, and
+maxima of 120 \s-1KM/H\s0 (my top speed that I reach every day).
+.PP
+Big difference. Do not look at the second graph to estimate the
+distances that I travel and do not look at the first graph to
+estimate my speed. This will work if the samples are close together,
+as they are in five minutes, but not if you average.
+.PP
+On some days, I go for a long ride. If I go across Europe and travel
+for 12 hours, the first graph will rise to about 60 \s-1KM/H\s0. The second
+one will show 180 \s-1KM/H\s0. This means that I traveled a distance of 60
+\&\s-1KM/H\s0 times 24 H = 1440 \s-1KM\s0. I did this with a higher speed and a
+maximum around 180 \s-1KM/H\s0. However, it probably doesn't mean that I
+traveled for 8 hours at a constant speed of 180 \s-1KM/H\s0!
+.PP
+This is a real example: go with the flow through Germany (fast!) and stop
+a few times for gas and coffee. Drive slowly through Austria and the
+Netherlands. Be careful in the mountains and villages. If you would
+look at the graphs created from the five-minute averages you would
+get a totally different picture. You would see the same values on the
+average and maximum graphs (provided I measured every 300 seconds).
+You would be able to see when I stopped, when I was in top gear, when
+I drove over fast highways etc. The granularity of the data is much
+higher, so you can see more. However, this takes 12 samples per hour,
+or 288 values per day, so it would be a lot of data over a longer
+period of time. Therefore we average it, eventually to one value per
+day. From this one value, we cannot see much detail, of course.
+.PP
+Make sure you understand the last few paragraphs. There is no value
+in only a line and a few axis, you need to know what they mean and
+interpret the data in ana appropriate way. This is true for all data.
+.PP
+The biggest mistake you can make is to use the collected data for
+something that it is not suitable for. You would be better off if
+you didn't have the graph at all.
+.Sh "Let's review what you now should know"
+.IX Subsection "Let's review what you now should know"
+You know how to create a database and can put data in it. You can get
+the numbers out again by creating an image, do math on the data from
+the database and view the resulte instead of the raw data.  You know
+about the difference between averages and maxima, and when to use
+which (or at least you should have an idea).
+.PP
+RRDtool can do more than what we have learned up to now. Before you
+continue with the rest of this doc, I recommend that you reread from
+the start and try some modifications on the examples. Make sure you
+fully understand everything. It will be worth the effort and helps
+you not only with the rest of this tutorial, but also in your day to day
+monitoring long after you read this introduction.
+.Sh "Data Source Types"
+.IX Subsection "Data Source Types"
+All right, you feel like continuing. Welcome back and get ready
+for an increased speed in the examples and explanations.
+.PP
+You know that in order to view a counter over time, you have to
+take two numbers and divide the difference of them between the
+time lapsed.  This makes sense for the examples I gave you but there
+are other possibilities.  For instance, I'm able to retrieve the
+temperature from my router in three places namely the inlet, the
+so called hot-spot and the exhaust.  These values are not counters.
+If I take the difference of the two samples and divide that by
+300 seconds I would be asking for the temperature change per second.
+Hopefully this is zero! If not, the computer room is probably on fire :)
+.PP
+So, what can we do?  We can tell RRDtool to store the values we measure
+directly as they are (this is not entirely true but close enough). The
+graphs we make will look much better, they will show a rather constant
+value. I know when the router is busy (it
+works \-> it uses more electricity \-> it generates more heat \-> the
+temperature rises). I know when the doors are left open (the room is
+air conditioned) \-> the warm air from the rest of the building flows into the
+computer room \-> the inlet temperature rises). Etc. The data type we
+use when creating the database before was counter, we now have a
+different data type and thus a different name for it. It is called
+\&\s-1GAUGE\s0. There are more such data types:
+.PP
+.Vb 4
+\& \- COUNTER   we already know this one
+\& \- GAUGE     we just learned this one
+\& \- DERIVE
+\& \- ABSOLUTE
+.Ve
+.PP
+The two additional types are \s-1DERIVE\s0 and \s-1ABSOLUTE\s0. Absolute can be used like
+counter with one difference: RRDtool assumes the counter is reset when
+it's read. That is: its delta is known without calculation by RRDtool
+whereas RRDtool needs to calculate it for the counter type.
+Example: our first example (12'345, 12'357, 12'363, 12'363) would read:
+unknown, 12, 6, 0. The rest of the calculations stay the same.
+The other one, derive, is like counter. Unlike counter, it can also
+decrease so it can have a negative delta. Again, the rest of the
+calculations stay the same.
+.PP
+Let's try them all:
+.PP
+.Vb 22
+\&   rrdtool create all.rrd \-\-start 978300900 \e
+\&            DS:a:COUNTER:600:U:U \e
+\&            DS:b:GAUGE:600:U:U \e
+\&            DS:c:DERIVE:600:U:U \e
+\&            DS:d:ABSOLUTE:600:U:U \e
+\&            RRA:AVERAGE:0.5:1:10
+\&   rrdtool update all.rrd \e
+\&            978301200:300:1:600:300    \e
+\&            978301500:600:3:1200:600   \e
+\&            978301800:900:5:1800:900   \e
+\&            978302100:1200:3:2400:1200 \e
+\&            978302400:1500:1:2400:1500 \e
+\&            978302700:1800:2:1800:1800 \e
+\&            978303000:2100:4:0:2100    \e
+\&            978303300:2400:6:600:2400  \e
+\&            978303600:2700:4:600:2700  \e
+\&            978303900:3000:2:1200:3000
+\&   rrdtool graph all1.png \-s 978300600 \-e 978304200 \-h 400 \e
+\&            DEF:linea=all.rrd:a:AVERAGE LINE3:linea#FF0000:"Line A" \e
+\&            DEF:lineb=all.rrd:b:AVERAGE LINE3:lineb#00FF00:"Line B" \e
+\&            DEF:linec=all.rrd:c:AVERAGE LINE3:linec#0000FF:"Line C" \e
+\&            DEF:lined=all.rrd:d:AVERAGE LINE3:lined#000000:"Line D"
+.Ve
+.Sh "RRDtool under the Microscope"
+.IX Subsection "RRDtool under the Microscope"
+.IP "\(bu" 2
+Line A is a \s-1COUNTER\s0 type, so it should continuously increment and RRDtool
+must calculate the differences. Also, RRDtool needs to divide the
+difference by the amount of time lapsed. This should end up as a
+straight line at 1 (the deltas are 300, the time is 300).
+.IP "\(bu" 2
+Line B is of type \s-1GAUGE\s0. These are \*(L"real\*(R" values so they should match
+what we put in: a sort of a wave.
+.IP "\(bu" 2
+Line C is of type \s-1DERIVE\s0. It should be a counter that can decrease. It does
+so between 2'400 and 0, with 1'800 in\-between.
+.IP "\(bu" 2
+Line D is of type \s-1ABSOLUTE\s0. This is like counter but it works on
+values without calculating the difference. The numbers are the same
+and as you can see (hopefully) this has a different result.
+.PP
+This translates in the following values, starting at 23:10 and ending
+at 00:10 the next day (where \*(L"u\*(R" means unknown/unplotted):
+.PP
+.Vb 4
+\& \- Line A:  u  u  1  1  1  1  1  1  1  1  1  u
+\& \- Line B:  u  1  3  5  3  1  2  4  6  4  2  u
+\& \- Line C:  u  u  2  2  2  0 \-2 \-6  2  0  2  u
+\& \- Line D:  u  1  2  3  4  5  6  7  8  9 10  u
+.Ve
+.PP
+If your \s-1PNG\s0 shows all this, you know you have entered the data correctly,
+the RRDtool executable is working properly, your viewer doesn't fool you,
+and you successfully entered the year 2000 :)
+.PP
+You could try the same example four times, each time with only one of
+the lines.
+.PP
+Let's go over the data again:
+.IP "\(bu" 2
+Line A: 300,600,900 and so on. The counter delta is a constant 300 and
+so is the time delta. A number divided by itself is always 1 (except
+when dividing by zero which is undefined/illegal).
+.Sp
+Why is it that the first point is unknown? We do know what we put into
+the database, right? True, But we didn't have a value to calculate the delta
+from, so we don't know where we started. It would be wrong to assume we
+started at zero so we don't!
+.IP "\(bu" 2
+Line B: There is nothing to calculate. The numbers are as they are.
+.IP "\(bu" 2
+Line C: Again, the start-out value is unknown. The same story is holds
+as for line A. In this case the deltas are not constant, therefore the line
+is not either. If we would put the same numbers in the database as we did for
+line A, we would have gotten the same line. Unlike type counter,
+this type can decrease and I hope to show you later on why
+this makes a difference.
+.IP "\(bu" 2
+Line D: Here the device calculates the deltas. Therefore we \s-1DO\s0 know the
+first delta and it is plotted. We had the same input as with line A, but
+the meaning of this input is different and thus the line is different.
+In this case the deltas increase each time with 300. The time delta
+stays at a constant 300 and therefore the division of the two gives
+increasing values.
+.Sh "Counter Wraps"
+.IX Subsection "Counter Wraps"
+There are a few more basics to show. Some important options are still to
+be covered and we haven't look at counter wraps yet. First the counter wrap:
+In our car we notice that the counter shows 999'987. We travel 20 \s-1KM\s0 and
+the counter should go to 1'000'007. Unfortunately, there are only six digits
+on our counter so it really shows 000'007. If we would plot that on a type
+\&\s-1DERIVE\s0, it would mean that the counter was set back 999'980 \s-1KM\s0. It wasn't,
+and there has to be some protection for this. This protection is only
+available for type \s-1COUNTER\s0 which should be used for this kind of counter
+anyways. How does it work? Type counter should never decrease and
+therefore RRDtool must assume it wrapped if it does decrease!
+If the delta is negative, this can be compensated for by adding the
+maximum value of the counter + 1. For our car this would be:
+.PP
+.Vb 1
+\& Delta = 7 \- 999'987 = \-999'980    (instead of 1'000'007\-999'987=20)
+.Ve
+.PP
+.Vb 1
+\& Real delta = \-999'980 + 999'999 + 1 = 20
+.Ve
+.PP
+At the time of writing this document, RRDtool knows of counters that
+are either 32 bits or 64 bits of size. These counters can handle the
+following different values:
+.PP
+.Vb 2
+\& \- 32 bits: 0 ..           4'294'967'295
+\& \- 64 bits: 0 .. 18'446'744'073'709'551'615
+.Ve
+.PP
+If these numbers look strange to you, you can view them in
+their hexadecimal form:
+.PP
+.Vb 2
+\& \- 32 bits: 0 ..         FFFFFFFF
+\& \- 64 bits: 0 .. FFFFFFFFFFFFFFFF
+.Ve
+.PP
+RRDtool handles both counters the same. If an overflow occurs and
+the delta would be negative, RRDtool first adds the maximum of a small
+counter + 1 to the delta. If the delta is still negative, it had to be
+the large counter that wrapped. Add the maximum possible value of the
+large counter + 1 and subtract the erroneously added small value.
+.PP
+There is a risk in this: suppose the large counter wrapped while adding
+a huge delta, it could happen, theoretically, that adding the smaller value
+would make the delta positive. In this unlikely case the results would
+not be correct. The increase should be nearly as high as the maximum
+counter value for that to happen, so chances are you would have several
+other problems as well and this particular problem would not even be
+worth thinking about. Even though, I did include an example, so you
+can judge for yourself.
+.PP
+The next section gives you some numerical examples for counter\-wraps.
+Try to do the calculations yourself or just believe me if your calculator
+can't handle the numbers :)
+.PP
+Correction numbers:
+.PP
+.Vb 3
+\& \- 32 bits: (4'294'967'295 + 1) =                                4'294'967'296
+\& \- 64 bits: (18'446'744'073'709'551'615 + 1)
+\&                                    \- correction1 = 18'446'744'069'414'584'320
+.Ve
+.PP
+.Vb 6
+\& Before:        4'294'967'200
+\& Increase:                100
+\& Should become: 4'294'967'300
+\& But really is:             4
+\& Delta:        \-4'294'967'196
+\& Correction1:  \-4'294'967'196 + 4'294'967'296 = 100
+.Ve
+.PP
+.Vb 9
+\& Before:        18'446'744'073'709'551'000
+\& Increase:                             800
+\& Should become: 18'446'744'073'709'551'800
+\& But really is:                        184
+\& Delta:        \-18'446'744'073'709'550'816
+\& Correction1:  \-18'446'744'073'709'550'816
+\&                                + 4'294'967'296 = \-18'446'744'069'414'583'520
+\& Correction2:  \-18'446'744'069'414'583'520
+\&                   + 18'446'744'069'414'584'320 = 800
+.Ve
+.PP
+.Vb 7
+\& Before:        18'446'744'073'709'551'615 ( maximum value )
+\& Increase:      18'446'744'069'414'584'320 ( absurd increase, minimum for
+\& Should become: 36'893'488'143'124'135'935             this example to work )
+\& But really is: 18'446'744'069'414'584'319
+\& Delta:                     \-4'294'967'296
+\& Correction1:  \-4'294'967'296 + 4'294'967'296 = 0
+\& (not negative \-> no correction2)
+.Ve
+.PP
+.Vb 7
+\& Before:        18'446'744'073'709'551'615 ( maximum value )
+\& Increase:      18'446'744'069'414'584'319 ( one less increase )
+\& Should become: 36'893'488'143'124'135'934
+\& But really is: 18'446'744'069'414'584'318
+\& Delta:                     \-4'294'967'297
+\& Correction1:  \-4'294'967'297 + 4'294'967'296 = \-1
+\& Correction2:  \-1 + 18'446'744'069'414'584'320 = 18'446'744'069'414'584'319
+.Ve
+.PP
+As you can see from the last two examples, you need strange numbers
+for RRDtool to fail (provided it's bug free of course), so this should
+not happen. However, \s-1SNMP\s0 or whatever method you choose to collect the
+data, might also report wrong numbers occasionally.  We can't prevent all
+errors, but there are some things we can do. The RRDtool \*(L"create\*(R" command
+takes two special parameters for this. They define
+the minimum and maximum allowed values. Until now, we used \*(L"U\*(R", meaning
+\&\*(L"unknown\*(R". If you provide values for one or both of them and if RRDtool
+receives data points that are outside these limits, it will ignore those
+values. For a thermometer in degrees Celsius, the absolute minimum is
+just under \-273. For my router, I can assume this minimum is much higher
+so I would set it to 10, where as the maximum temperature I would
+set to 80. Any higher and the device would be out of order.
+.PP
+For the speed of my car, I would never expect negative numbers and
+also I would not expect a speed  higher than 230. Anything else,
+and there must have been an error. Remember: the opposite is not true,
+if the numbers pass this check, it doesn't mean that they are
+correct. Always judge the graph with a healthy dose of suspicion if it
+seems weird to you.
+.Sh "Data Resampling"
+.IX Subsection "Data Resampling"
+One important feature of RRDtool has not been explained yet: it is
+virtually impossible to collect data and feed it into RRDtool on exact
+intervals. RRDtool therefore interpolates the data, so they are stored
+on exact intervals. If you do not know what this means or how it
+works, then here's the help you seek:
+.PP
+Suppose a counter increases by exactly one for every second. You want
+to measure it in 300 seconds intervals. You should retrieve values
+that are exactly 300 apart. However, due to various circumstances you
+are a few seconds late and the interval is 303. The delta will also be
+303 in that case. Obviously, RRDtool should not put 303 in the database
+and make you believe that the counter increased by 303 in 300 seconds.
+This is where RRDtool interpolates: it alters the 303 value as if it
+would have been stored earlier and it will be 300 in 300 seconds.
+Next time you are at exactly the right time. This means that the current
+interval is 297 seconds and also the counter increased by 297. Again,
+RRDtool interpolates and stores 300 as it should be.
+.PP
+.Vb 1
+\&      in the RRD                 in reality
+.Ve
+.PP
+.Vb 4
+\& time+000:   0 delta="U"   time+000:    0 delta="U"
+\& time+300: 300 delta=300   time+300:  300 delta=300
+\& time+600: 600 delta=300   time+603:  603 delta=303
+\& time+900: 900 delta=300   time+900:  900 delta=297
+.Ve
+.PP
+Let's create two identical databases. I've chosen the time range 920'805'000
+to 920'805'900 as this goes very well with the example numbers.
+.PP
+.Vb 4
+\&   rrdtool create seconds1.rrd   \e
+\&      \-\-start 920804700          \e
+\&      DS:seconds:COUNTER:600:U:U \e
+\&      RRA:AVERAGE:0.5:1:24
+.Ve
+.PP
+Make a copy
+.PP
+.Vb 3
+\&   for Unix: cp seconds1.rrd seconds2.rrd
+\&   for Dos:  copy seconds1.rrd seconds2.rrd
+\&   for vms:  how would I know :)
+.Ve
+.PP
+Put in some data
+.PP
+.Vb 4
+\&   rrdtool update seconds1.rrd \e
+\&      920805000:000 920805300:300 920805600:600 920805900:900
+\&   rrdtool update seconds2.rrd \e
+\&      920805000:000 920805300:300 920805603:603 920805900:900
+.Ve
+.PP
+Create output
+.PP
+.Vb 16
+\&   rrdtool graph seconds1.png                       \e
+\&      \-\-start 920804700 \-\-end 920806200             \e
+\&      \-\-height 200                                  \e
+\&      \-\-upper\-limit 1.05 \-\-lower\-limit 0.95 \-\-rigid \e
+\&      DEF:seconds=seconds1.rrd:seconds:AVERAGE      \e
+\&      CDEF:unknown=seconds,UN                       \e
+\&      LINE2:seconds#0000FF                          \e
+\&      AREA:unknown#FF0000
+\&   rrdtool graph seconds2.png                       \e
+\&      \-\-start 920804700 \-\-end 920806200             \e
+\&      \-\-height 200                                  \e
+\&      \-\-upper\-limit 1.05 \-\-lower\-limit 0.95 \-\-rigid \e
+\&      DEF:seconds=seconds2.rrd:seconds:AVERAGE      \e
+\&      CDEF:unknown=seconds,UN                       \e
+\&      LINE2:seconds#0000FF                          \e
+\&      AREA:unknown#FF0000
+.Ve
+.PP
+View both images together (add them to your index.html file)
+and compare. Both graphs should show the same, despite the
+input being different.
+.SH "WRAPUP"
+.IX Header "WRAPUP"
+It's time now to wrap up this tutorial. We covered all the basics for
+you to be able to work with RRDtool and to read the additional
+documentation available. There is plenty more to discover about
+RRDtool and you will find more and more uses for this package. You can
+easly create graphs using just the examples provided and using only
+RRDtool. You can also use one of the front ends to RRDtool that are
+available.
+.SH "MAILINGLIST"
+.IX Header "MAILINGLIST"
+Remember to subscribe to the RRDtool mailing list. Even if you are not
+answering to mails that come by, it helps both you and the rest of the
+users. A lot of the stuff that I know about \s-1MRTG\s0 (and therefore about
+RRDtool) I've learned while just reading the list without posting to
+it. I did not need to ask the basic questions as they are answered in
+the \s-1FAQ\s0 (read it!) and in various mails by other users. With
+thousands of users all over the world, there will always be people who
+ask questions that you can answer because you read this and other
+documentation and they didn't.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+The RRDtool manpages
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+I hope you enjoyed the examples and their descriptions. If you do, help
+other people by pointing them to this document when they are asking
+basic questions. They will not only get their answers, but at the same
+time learn a whole lot more.
+.PP
+Alex van den Bogaerdt
+<alex@ergens.op.het.net>
diff --git a/doc/rrdtutorial.html b/doc/rrdtutorial.html
new file mode 100644 (file)
index 0000000..86eb7db
--- /dev/null
@@ -0,0 +1,1101 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdtutorial</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#tutorial">TUTORIAL</a></li>
+       <ul>
+
+               <li><a href="#important">Important</a></li>
+               <li><a href="#what_is_rrdtool">What is RRDtool?</a></li>
+               <li><a href="#what_data_can_be_put_into_an_rrd">What data can be put into an RRD?</a></li>
+               <li><a href="#what_can_i_do_with_this_tool">What can I do with this tool?</a></li>
+               <li><a href="#what_if_i_still_have_problems_after_reading_this_document">What if I still have problems after reading this document?</a></li>
+               <li><a href="#how_will_you_help_me">How will you help me?</a></li>
+               <li><a href="#your_first_round_robin_database">Your first Round Robin Database</a></li>
+               <li><a href="#what_has_been_created">What has been created?</a></li>
+               <li><a href="#time_to_create_some_graphics">Time to create some graphics</a></li>
+               <li><a href="#graphics_with_some_math">Graphics with some math</a></li>
+               <li><a href="#graphics_magic">Graphics Magic</a></li>
+               <li><a href="#updates_in_reality">Updates in Reality</a></li>
+               <li><a href="#some_words_on_snmp">Some words on SNMP</a></li>
+               <li><a href="#a_real_world_example">A Real World Example</a></li>
+               <li><a href="#consolidation_functions">Consolidation Functions</a></li>
+               <li><a href="#let_s_review_what_you_now_should_know">Let's review what you now should know</a></li>
+               <li><a href="#data_source_types">Data Source Types</a></li>
+               <li><a href="#rrdtool_under_the_microscope">RRDtool under the Microscope</a></li>
+               <li><a href="#counter_wraps">Counter Wraps</a></li>
+               <li><a href="#data_resampling">Data Resampling</a></li>
+       </ul>
+
+       <li><a href="#wrapup">WRAPUP</a></li>
+       <li><a href="#mailinglist">MAILINGLIST</a></li>
+       <li><a href="#see_also">SEE ALSO</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdtutorial - Alex van den Bogaerdt's RRDtool tutorial</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>RRDtool is written by Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt; with
+contributions from many people all around the world. This document is
+written by Alex van den Bogaerdt &lt;<a href="mailto:alex@ergens.op.het.net">alex@ergens.op.het.net</a>&gt; to help you
+understand what RRDtool is and what it can do for you.</p>
+<p>The documentation provided with RRDtool can be too technical for some
+people. This tutorial is here to help you understand the basics of
+RRDtool. It should prepare you to read the documentation yourself.
+It also explains the general things about statistics with a focus on
+networking.</p>
+<p>
+</p>
+<hr />
+<h1><a name="tutorial">TUTORIAL</a></h1>
+<p>
+</p>
+<h2><a name="important">Important</a></h2>
+<p>Please don't skip ahead in this document!  The first part of this
+document explains the basics and may be boring.  But if you don't
+understand the basics, the examples will not be as meaningful to you.</p>
+<p>
+</p>
+<h2><a name="what_is_rrdtool">What is RRDtool?</a></h2>
+<p>RRDtool refers to Round Robin Database tool.
+Round robin is a technique that works with a fixed amount of data, and a
+pointer to the current element. Think of a circle with some dots plotted
+on the edge -- these dots are the places where data can be stored. Draw an
+arrow from the center of the circle to one of the dots -- this is the pointer.
+When the current data is read or written, the pointer moves to the next
+element. As we are on a circle there is neither a beginning nor an end, you can
+go on and on and on. After a while, all the available places will be used and
+the process automatically reuses old locations. This way, the dataset
+will not grow in size and therefore requires no maintenance.
+RRDtool works with with Round Robin Databases (RRDs). It stores and retrieves
+data from them.</p>
+<p>
+</p>
+<h2><a name="what_data_can_be_put_into_an_rrd">What data can be put into an RRD?</a></h2>
+<p>You name it, it will probably fit as long as it is some sort of time-series
+data. This means you have to be able to measure some value at several points in time and
+provide this information to RRDtool. If you can do this, RRDtool will be
+able to store it. The values must be numerical but don't have to be
+integers, as is the case with MRTG (the next section will give more details
+on this more specialized application).</p>
+<p>Many examples below talk about SNMP which is an acronym for Simple Network
+Management Protocol. ``Simple'' refers to the protocol -- it does not
+mean it is simple to manage or monitor a network. After working your
+way through this document, you should know enough to be able to
+understand what people are talking about. For now, just realize that
+SNMP can be used to query devices for the values of counters they keep. It
+is the value from those counters that we want to store in the RRD.</p>
+<p>
+</p>
+<h2><a name="what_can_i_do_with_this_tool">What can I do with this tool?</a></h2>
+<p>RRDtool originated from MRTG (Multi Router Traffic Grapher). MRTG
+started as a tiny little script for graphing the use of a university's
+connection to the Internet. MRTG was later (ab-)used as a tool for
+graphing other data sources including temperature, speed, voltage,
+number of printouts and the like.</p>
+<p>Most likely you will start to use RRDtool to store and process data
+collected via SNMP. The data will most likely be bytes (or bits)
+transfered from and to a network or a computer.  But it can also be
+used to display tidal waves, solar radiation, power consumption,
+number of visitors at an exhibition, noise levels near an airport,
+temperature on your favorite holiday location, temperature in the
+fridge and whatever you imagination can come up with.</p>
+<p>You only need a sensor to measure the data and be able to feed the
+numbers into RRDtool. RRDtool then lets you create a database, store
+data in it, retrieve that data and create graphs in PNG format for
+display on a web browser. Those PNG images are dependent on the data
+you collected and could be, for instance, an overview of the average
+network usage, or the peaks that occurred.</p>
+<p>
+</p>
+<h2><a name="what_if_i_still_have_problems_after_reading_this_document">What if I still have problems after reading this document?</a></h2>
+<p>First of all: read it again! You may have missed something.
+If you are unable to compile the sources and you have a fairly common
+OS, it will probably not be the fault of RRDtool. There may be pre-compiled
+versions around on the Internet. If they come from trusted sources, get
+one of those.</p>
+<p>If on the other hand the program works but does not give you the
+expected results, it will be a problem with configuring it. Review
+your configuration and compare it with the examples that follow.</p>
+<p>There is a mailing list and an archive of it. Read the list for a few
+weeks and search the archive. It is considered rude to just ask
+a question without searching the archives: your problem may already have been
+solved for somebody else!  This is true for most, if not all, mailing lists
+and not only for this particular one. Look in the documentation that
+came with RRDtool for the location and usage of the list.</p>
+<p>I suggest you take a moment to subscribe to the mailing list right now
+by sending an email to &lt;<a href="mailto:rrd-users-request@lists.oetiker.ch">rrd-users-request@lists.oetiker.ch</a>&gt; with a
+subject of ``subscribe''. If you ever want to leave this list, just write
+an email to the same address but now with a subject of ``unsubscribe''.</p>
+<p>
+</p>
+<h2><a name="how_will_you_help_me">How will you help me?</a></h2>
+<p>By giving you some detailed descriptions with detailed examples.
+I assume that following the instructions in the order presented
+will give you enough knowledge of RRDtool to experiment for yourself.
+If it doesn't work the first time, don't give up. Reread the stuff that
+you did understand, you may have missed something.</p>
+<p>By following the examples you get some hands-on experience and, even
+more important, some background information of how it works.</p>
+<p>You will need to know something about hexadecimal numbers. If you don't
+then start with reading <a href="././bin_dec_hex.html">the bin_dec_hex manpage</a> before you continue here.</p>
+<p>
+</p>
+<h2><a name="your_first_round_robin_database">Your first Round Robin Database</a></h2>
+<p>In my opinion the best way to learn something is to actually do it.
+Why not start right now?  We will create a database, put some values
+in it and extract this data again.  Your output should be the same
+as the output that is included in this document.</p>
+<p>We will start with some easy stuff and compare a car with a router,
+or compare kilometers (miles if you wish) with bits and bytes. It's
+all the same: some number over some time.</p>
+<p>Assume we have a device that transfers bytes to and from the Internet.
+This device keeps a counter that starts at zero when it is turned on,
+increasing with every byte that is transfered. This counter will probably have
+a maximum value. If this value is reached and an extra byte is counted,
+the counter starts over at zero. This is the same as many counters
+in the world such as the mileage counter in a car.</p>
+<p>Most discussions about networking talk about bits per second so lets
+get used to that right away. Assume a byte is eight bits and start to
+think in bits not bytes. The counter, however, still counts bytes!
+In the SNMP world most of the counters are 32 bits. That means they are
+counting from 0 to 4'294'967'295. We will use these values in the examples.
+The device, when asked, returns the current value of the counter. We
+know the time that has passes since we last asked so we now know how
+many bytes have been transfered ***on average*** per second. This is
+not very hard to calculate. First in words, then in calculations:</p>
+<ol>
+<li>
+<p>Take the current counter, subtract the previous value from it.</p>
+</li>
+<li>
+<p>Do the same with the current time and the previous time (in seconds).</p>
+</li>
+<li>
+<p>Divide the outcome of (1) by the outcome of (2), the result is
+the amount of bytes per second. Multiply by eight to get the
+number of bits per second (bps).</p>
+</li>
+</ol>
+<pre>
+  bps = (counter_now - counter_before) / (time_now - time_before) * 8</pre>
+<p>For some people it may help to translate this to an automobile example.
+Do not try this example, and if you do, don't blame me for the results!</p>
+<p>People who are not used to think in kilometers per hour can translate
+most into miles per hour by dividing km by 1.6 (close enough).
+I will use the following abbreviations:</p>
+<pre>
+ M:    meter
+ KM:   kilometer (= 1'000 meters).
+ H:    hour
+ S:    second
+ KM/H: kilometers per hour
+ M/S:  meters per second</pre>
+<p>You are driving a car. At 12:05 you read the counter in the dashboard
+and it tells you that the car has moved 12'345 KM until that moment.
+At 12:10 you look again, it reads 12'357 KM. This means you have
+traveled 12 KM in five minutes. A scientist would translate that
+into meters per second and this makes a nice comparison toward the
+problem of (bytes per five minutes) versus (bits per second).</p>
+<p>We traveled 12 kilometers which is 12'000 meters. We did that in five
+minutes or 300 seconds. Our speed is 12'000M / 300S or 40 M/S.</p>
+<p>We could also calculate the speed in KM/H: 12 times 5 minutes
+is an hour, so we have to multiply 12 KM by 12 to get 144 KM/H.
+For our native English speaking friends: that's 90 MPH so don't
+try this example at home or where I live :)</p>
+<p>Remember: these numbers are averages only.  There is no way to figure out
+from the numbers, if you drove at a constant speed.  There is an example
+later on in this tutorial that explains this.</p>
+<p>I hope you understand that there is no difference in calculating M/S or
+bps; only the way we collect the data is different. Even the K from kilo
+is the same as in networking terms k also means 1'000.</p>
+<p>We will now create a database where we can keep all these interesting
+numbers. The method used to start the program may differ slightly from
+OS to OS, but I assume you can figure it out if it works different on
+your's. Make sure you do not overwrite any file on your system when
+executing the following command and type the whole line as one long
+line (I had to split it for readability)
+and skip all of the '\' characters.</p>
+<pre>
+   rrdtool create test.rrd             \
+            --start 920804400          \
+            DS:speed:COUNTER:600:U:U   \
+            RRA:AVERAGE:0.5:1:24       \
+            RRA:AVERAGE:0.5:6:10</pre>
+<p>(So enter: <code>rrdtool create test.rrd --start 920804400 DS ...</code>)</p>
+<p>
+</p>
+<h2><a name="what_has_been_created">What has been created?</a></h2>
+<p>We created the round robin database called test (test.rrd) which starts at
+noon the day I started writing this document, 7th of March, 1999 (this date
+translates to 920'804'400 seconds as explained below). Our database holds
+one data source (DS) named ``speed'' that represents a counter. This counter
+is read every five minutes (this is the default therefore you don't have to
+put <code>--step=300</code>).  In the same database two round robin archives (RRAs)
+are kept, one averages the data every time it is read (e.g., there's nothing
+to average) and keeps 24 samples (24 times 5 minutes is 2 hours). The other
+averages 6 values (half hour) and contains 10 such averages (e.g. 5 hours).</p>
+<p>RRDtool works with special time stamps coming from the UNIX world.
+This time stamp is the number of seconds that passed since January
+1st 1970 UTC.  The time stamp value is translated into local time and
+it will therefore look different for different time zones.</p>
+<p>Chances are that you are not in the same part of the world as I am.
+This means your time zone is different. In all examples where I talk
+about time, the hours may be wrong for you. This has little effect on
+the results of the examples, just correct the hours while reading.
+As an example: where I will see ``12:05'' the UK folks will see ``11:05''.</p>
+<p>We now have to fill our database with some numbers. We'll pretend to
+have read the following numbers:</p>
+<pre>
+ 12:05  12345 KM
+ 12:10  12357 KM
+ 12:15  12363 KM
+ 12:20  12363 KM
+ 12:25  12363 KM
+ 12:30  12373 KM
+ 12:35  12383 KM
+ 12:40  12393 KM
+ 12:45  12399 KM
+ 12:50  12405 KM
+ 12:55  12411 KM
+ 13:00  12415 KM
+ 13:05  12420 KM
+ 13:10  12422 KM
+ 13:15  12423 KM</pre>
+<p>We fill the database as follows:</p>
+<pre>
+ rrdtool update test.rrd 920804700:12345 920805000:12357 920805300:12363
+ rrdtool update test.rrd 920805600:12363 920805900:12363 920806200:12373
+ rrdtool update test.rrd 920806500:12383 920806800:12393 920807100:12399
+ rrdtool update test.rrd 920807400:12405 920807700:12411 920808000:12415
+ rrdtool update test.rrd 920808300:12420 920808600:12422 920808900:12423</pre>
+<p>This reads: update our test database with the following numbers</p>
+<pre>
+ time 920804700, value 12345
+ time 920805000, value 12357</pre>
+<p>etcetera.</p>
+<p>As you can see, it is possible to feed more than one value into the
+database in one command. I had to stop at three for readability but
+the real maximum per line is OS dependent.</p>
+<p>We can now retrieve the data from our database using ``rrdtool fetch'':</p>
+<pre>
+ rrdtool fetch test.rrd AVERAGE --start 920804400 --end 920809200</pre>
+<p>It should return the following output:</p>
+<pre>
+                          speed</pre>
+<pre>
+ 920804700: nan
+ 920805000: 4.0000000000e-02
+ 920805300: 2.0000000000e-02
+ 920805600: 0.0000000000e+00
+ 920805900: 0.0000000000e+00
+ 920806200: 3.3333333333e-02
+ 920806500: 3.3333333333e-02
+ 920806800: 3.3333333333e-02
+ 920807100: 2.0000000000e-02
+ 920807400: 2.0000000000e-02
+ 920807700: 2.0000000000e-02
+ 920808000: 1.3333333333e-02
+ 920808300: 1.6666666667e-02
+ 920808600: 6.6666666667e-03
+ 920808900: 3.3333333333e-03
+ 920809200: nan</pre>
+<p>If it doesn't, something may be wrong.  Perhaps your OS will print
+``NaN'' in a different form. ``NaN'' stands for ``Not A Number''.  If your OS
+writes ``U'' or ``UNKN'' or something similar that's okay.  If something
+else is wrong, it will probably be due to an error you made (assuming
+that my tutorial is correct of course :-). In that case: delete the
+database and try again.  Sometimes things change.  This example used
+to provide numbers like ``0.04'' in stead of ``4.00000e-02''.  Those are
+really the same numbers, just written down differently.  Don't be
+alarmed if a future version of rrdtool displays a slightly different
+form of output. The examples in this document are correct for version
+1.2.0 of RRDtool.</p>
+<p>The meaning of the above output will become clear below.</p>
+<p>
+</p>
+<h2><a name="time_to_create_some_graphics">Time to create some graphics</a></h2>
+<p>Try the following command:</p>
+<pre>
+ rrdtool graph speed.png                                 \
+         --start 920804400 --end 920808000               \
+         DEF:myspeed=test.rrd:speed:AVERAGE              \
+         LINE2:myspeed#FF0000</pre>
+<p>This will create speed.png which starts at 12:00 and ends at 13:00.
+There is a definition of a variable called myspeed, using the data from RRA
+``speed'' out of database ``test.rrd''. The line drawn is 2 pixels high
+and represents the variable myspeed. The color is red (specified by
+its rgb-representation, see below).</p>
+<p>You'll notice that the start of the graph is not at 12:00 but at 12:05.
+This is because we have insufficient data to tell the average before
+that time. This will only happen when you miss some samples, this will
+not happen a lot, hopefully.</p>
+<p>If this has worked: congratulations! If not, check what went wrong.</p>
+<p>The colors are built up from red, green and blue. For each of the
+components, you specify how much to use in hexadecimal where 00 means
+not included and FF means fully included.
+The ``color'' white is a mixture of red, green and blue: FFFFFF
+The ``color'' black is all colors off: 000000</p>
+<pre>
+   red     #FF0000
+   green   #00FF00
+   blue    #0000FF
+   magenta #FF00FF     (mixed red with blue)
+   gray    #555555     (one third of all components)</pre>
+<p>Additionally you can add an alpha channel (transparency).  The default
+will be ``FF'' which means non-transparent.</p>
+<p>The PNG you just created can be displayed using your favorite image
+viewer.  Web browsers will display the PNG via the URL
+``file:///the/path/to/speed.png''</p>
+<p>
+</p>
+<h2><a name="graphics_with_some_math">Graphics with some math</a></h2>
+<p>When looking at the image, you notice that the horizontal axis is labeled
+12:10, 12:20, 12:30, 12:40 and 12:50. Sometimes a label doesn't fit (12:00
+and 13:00 would be candidates) so they are skipped.</p>
+<p>The vertical axis displays the range we entered. We provided
+kilometers and when divided by 300 seconds, we get very small
+numbers. To be exact, the first value was 12 (12'357-12'345) and divided
+by 300 this makes 0.04, which is displayed by RRDtool as ``40 m''
+meaning ``40/1'000''. The ``m'' (milli) has nothing to do with meters,
+kilometers or millimeters! RRDtool doesn't know about the physical
+units of our data, it just works with dimensionless numbers.</p>
+<p>If we had measured our distances in meters, this would have been
+(12'357'000-12'345'000)/300 = 12'000/300 = 40.</p>
+<p>As most people have a better feel for numbers in this range, we'll
+correct that. We could recreate our database and store the correct
+data, but there is a better way: we do some calculations while creating
+the png file!</p>
+<pre>
+   rrdtool graph speed2.png                           \
+      --start 920804400 --end 920808000               \
+      --vertical-label m/s                            \
+      DEF:myspeed=test.rrd:speed:AVERAGE              \
+      CDEF:realspeed=myspeed,1000,\*                  \
+      LINE2:realspeed#FF0000</pre>
+<p>Note: Make sure not to forget the backslash \ in front of the
+multiplication operator * above. The backslash is needed to ``escape''
+the * as some operating systems might interpret and expand * instead
+of passing it to the rrdtool command.</p>
+<p>After viewing this PNG, you notice the ``m'' (milli) has
+disappeared. This it what the correct result would be. Also, a label
+has been added to the image.  Apart from the things mentioned above,
+the PNG should look the same.</p>
+<p>The calculations are specified in the CDEF part above and are in
+Reverse Polish Notation (``RPN''). What we requested RRDtool to do is:
+``take the data source myspeed and the number 1000; multiply
+those''. Don't bother with RPN yet, it will be explained later on in
+more detail. Also, you may want to read my tutorial on CDEFs and Steve
+Rader's tutorial on RPN. But first finish this tutorial.</p>
+<p>Hang on! If we can multiply values with 1'000, it should also be possible
+to display kilometers per hour from the same data!</p>
+<p>To change a value that is measured in meters per second:</p>
+<pre>
+ Calculate meters per hour:     value * 3'600
+ Calculate kilometers per hour: value / 1'000
+ Together this makes:           value * (3'600/1'000) or value * 3.6</pre>
+<p>In our example database we made a mistake and we need to compensate for
+this by multiplying with 1'000. Applying that correction:</p>
+<pre>
+ value * 3.6  * 1'000 == value * 3'600</pre>
+<p>Now let's create this PNG, and add some more magic ...</p>
+<pre>
+ rrdtool graph speed3.png                             \
+      --start 920804400 --end 920808000               \
+      --vertical-label km/h                           \
+      DEF:myspeed=test.rrd:speed:AVERAGE              \
+      &quot;CDEF:kmh=myspeed,3600,*&quot;                       \
+      CDEF:fast=kmh,100,GT,kmh,0,IF                   \
+      CDEF:good=kmh,100,GT,0,kmh,IF                   \
+      HRULE:100#0000FF:&quot;Maximum allowed&quot;              \
+      AREA:good#00FF00:&quot;Good speed&quot;                   \
+      AREA:fast#FF0000:&quot;Too fast&quot;</pre>
+<p>Note: here we use another means to escape the * operator by enclosing
+the whole string in double quotes.</p>
+<p>This graph looks much better. Speed is shown in KM/H and there is even
+an extra line with the maximum allowed speed (on the road I travel
+on). I also changed the colors used to display speed and changed it
+from a line into an area.</p>
+<p>The calculations are more complex now. For speed measurements within
+the speed limit they are:</p>
+<pre>
+   Check if kmh is greater than 100    ( kmh,100 ) GT
+   If so, return 0, else kmh           ((( kmh,100 ) GT ), 0, kmh) IF</pre>
+<p>For values above the speed limit:</p>
+<pre>
+   Check if kmh is greater than 100    ( kmh,100 ) GT
+   If so, return kmh, else return 0    ((( kmh,100) GT ), kmh, 0) IF</pre>
+<p>
+</p>
+<h2><a name="graphics_magic">Graphics Magic</a></h2>
+<p>I like to believe there are virtually no limits to how RRDtool graph
+can manipulate data. I will not explain how it works, but look at the
+following PNG:</p>
+<pre>
+   rrdtool graph speed4.png                           \
+      --start 920804400 --end 920808000               \
+      --vertical-label km/h                           \
+      DEF:myspeed=test.rrd:speed:AVERAGE              \
+      &quot;CDEF:kmh=myspeed,3600,*&quot;                       \
+      CDEF:fast=kmh,100,GT,100,0,IF                   \
+      CDEF:over=kmh,100,GT,kmh,100,-,0,IF             \
+      CDEF:good=kmh,100,GT,0,kmh,IF                   \
+      HRULE:100#0000FF:&quot;Maximum allowed&quot;              \
+      AREA:good#00FF00:&quot;Good speed&quot;                   \
+      AREA:fast#550000:&quot;Too fast&quot;                     \
+      STACK:over#FF0000:&quot;Over speed&quot;</pre>
+<p>Let's create a quick and dirty HTML page to view the three PNGs:</p>
+<pre>
+   &lt;HTML&gt;&lt;HEAD&gt;&lt;TITLE&gt;Speed&lt;/TITLE&gt;&lt;/HEAD&gt;&lt;BODY&gt;
+   &lt;IMG src=&quot;speed2.png&quot; alt=&quot;Speed in meters per second&quot;&gt;
+   &lt;BR&gt;
+   &lt;IMG src=&quot;speed3.png&quot; alt=&quot;Speed in kilometers per hour&quot;&gt;
+   &lt;BR&gt;
+   &lt;IMG src=&quot;speed4.png&quot; alt=&quot;Traveled too fast?&quot;&gt;
+   &lt;/BODY&gt;&lt;/HTML&gt;</pre>
+<p>Name the file ``speed.html'' or similar, and look at it in your web browser.</p>
+<p>Now, all you have to do is measure the values regularly and update the
+database.  When you want to view the data, recreate the PNGs and make
+sure to refresh them in your browser. (Note: just clicking reload may
+not be enough, especially when proxies are involved.  Try shift-reload
+or ctrl-F5).</p>
+<p>
+</p>
+<h2><a name="updates_in_reality">Updates in Reality</a></h2>
+<p>We've already used the <code>update</code> command: it took one or more
+parameters in the form of ``&lt;time&gt;:&lt;value&gt;''. You'll be glad to know
+that you can specify the current time by filling in a ``N'' as the time.
+Or you could use the ``time'' function in Perl (the shortest example in
+this tutorial):</p>
+<pre>
+   perl -e 'print time, &quot;\n&quot; '</pre>
+<p>How to run a program on regular intervals is OS specific. But here is
+an example in pseudo code:</p>
+<pre>
+   - Get the value and put it in variable &quot;$speed&quot;
+   - rrdtool update speed.rrd N:$speed</pre>
+<p>(do not try this with our test database, we'll use it in further examples)</p>
+<p>This is all. Run the above script every five minutes. When you need to know
+what the graphs look like, run the examples above. You could put them
+in a script as well. After running that script, view the page
+index.html we created above.</p>
+<p>
+</p>
+<h2><a name="some_words_on_snmp">Some words on SNMP</a></h2>
+<p>I can imagine very few people that will be able to get real data from
+their car every five minutes. All other people will have to settle for
+some other kind of counter. You could measure the number of pages
+printed by a printer, for example, the cups of coffee made by the
+coffee machine, a device that counts the electricity used,
+whatever. Any incrementing counter can be monitored and graphed using
+the stuff you learned so far. Later on we will also be able to monitor
+other types of values like temperature.</p>
+<p>Most (?) people interested in RRDtool will use the counter that keeps track
+of octets (bytes) transfered by a network device. So let's do just
+that next. We will start with a description of how to collect data.</p>
+<p>Some people will make a remark that there are tools which can do this data
+collection for you. They are right! However, I feel it is important that
+you understand they are not necessary. When you have to determine why
+things went wrong you need to know how they work.</p>
+<p>One tool used in the example has been talked about very briefly in the
+beginning of this document, it is called SNMP. It is a way of talking
+to networked equipment. The tool I use below is called ``snmpget'' and
+this is how it works:</p>
+<pre>
+   snmpget device password OID</pre>
+<p>or</p>
+<pre>
+   snmpget -v[version] -c[password] device OID</pre>
+<p>For device you substitute the name, or the IP address, of your device.
+For password you use the ``community read string'' as it is called in the
+SNMP world.  For some devices the default of ``public'' might work, however
+this can be disabled, altered or protected for privacy and security
+reasons.  Read the documentation that comes with your device or program.</p>
+<p>Then there is this parameter, called OID, which means ``object identifier''.</p>
+<p>When you start to learn about SNMP it looks very confusing. It isn't
+all that difficult when you look at the Management Information Base
+(``MIB'').  It is an upside-down tree that describes data, with a single node
+as the root and from there a number of branches.  These branches end
+up in another node, they branch out, etc.  All the branches have a name
+and they form the path that we follow all the way down.  The branches
+that we follow are named: iso, org, dod, internet, mgmt and mib-2.
+These names can also be written down as numbers and are 1 3 6 1 2 1.</p>
+<pre>
+   iso.org.dod.internet.mgmt.mib-2 (1.3.6.1.2.1)</pre>
+<p>There is a lot of confusion about the leading dot that some programs
+use.  There is *no* leading dot in an OID.  However, some programs
+can use the above part of OIDs as a default.  To indicate the difference
+between abbreviated OIDs and full OIDs they need a leading dot when
+you specify the complete OID.  Often those programs will leave out
+the default portion when returning the data to you.  To make things
+worse, they have several default prefixes ...</p>
+<p>Ok, lets continue to the start of our OID: we had 1.3.6.1.2.1
+From there, we are especially interested in the branch ``interfaces''
+which has number 2 (e.g., 1.3.6.1.2.1.2 or 1.3.6.1.2.1.interfaces).</p>
+<p>First, we have to get some SNMP program. First look if there is a
+pre-compiled package available for your OS. This is the preferred way.
+If not, you will have to get the sources yourself and compile those.
+The Internet is full of sources, programs etc. Find information using
+a search engine or whatever you prefer.</p>
+<p>Assume you got the program. First try to collect some data that is
+available on most systems. Remember: there is a short name for the
+part of the tree that interests us most in the world we live in!</p>
+<p>I will give an example which can be used on Fedora Core 3.  If it
+doesn't work for you, work your way through the manual of snmp and
+adapt the example to make it work.</p>
+<pre>
+   snmpget -v2c -c public myrouter system.sysDescr.0</pre>
+<p>The device should answer with a description of itself, perhaps an
+empty one. Until you got a valid answer from a device, perhaps using a
+different ``password'', or a different device, there is no point in
+continuing.</p>
+<pre>
+   snmpget -v2c -c public myrouter interfaces.ifNumber.0</pre>
+<p>Hopefully you get a number as a result, the number of interfaces.
+If so, you can carry on and try a different program called ``snmpwalk''.</p>
+<pre>
+   snmpwalk -v2c -c public myrouter interfaces.ifTable.ifEntry.ifDescr</pre>
+<p>If it returns with a list of interfaces, you're almost there.
+Here's an example:
+   [user@host /home/alex]$ snmpwalk -v2c -c public cisco 2.2.1.2</p>
+<pre>
+   interfaces.ifTable.ifEntry.ifDescr.1 = &quot;BRI0: B-Channel 1&quot;
+   interfaces.ifTable.ifEntry.ifDescr.2 = &quot;BRI0: B-Channel 2&quot;
+   interfaces.ifTable.ifEntry.ifDescr.3 = &quot;BRI0&quot; Hex: 42 52 49 30
+   interfaces.ifTable.ifEntry.ifDescr.4 = &quot;Ethernet0&quot;
+   interfaces.ifTable.ifEntry.ifDescr.5 = &quot;Loopback0&quot;</pre>
+<p>On this cisco equipment, I would like to monitor the ``Ethernet0''
+interface and from the above output I see that it is number four. I try:</p>
+<pre>
+   [user@host /home/alex]$ snmpget -v2c -c public cisco 2.2.1.10.4 2.2.1.16.4</pre>
+<pre>
+   interfaces.ifTable.ifEntry.ifInOctets.4 = 2290729126
+   interfaces.ifTable.ifEntry.ifOutOctets.4 = 1256486519</pre>
+<p>So now I have two OIDs to monitor and they are (in full, this time):</p>
+<pre>
+   1.3.6.1.2.1.2.2.1.10</pre>
+<p>and</p>
+<pre>
+   1.3.6.1.2.1.2.2.1.16</pre>
+<p>both with an interface number of 4.</p>
+<p>Don't get fooled, this wasn't my first try. It took some time for me too
+to understand what all these numbers mean. It does help a lot when they
+get translated into descriptive text... At least, when people are talking
+about MIBs and OIDs you know what it's all about.
+Do not forget the interface number (0 if it is not interface dependent)
+and try snmpwalk if you don't get an answer from snmpget.</p>
+<p>If you understand the above section and get numbers from your device, continue
+on with this tutorial. If not, then go back and re-read this part.</p>
+<p>
+</p>
+<h2><a name="a_real_world_example">A Real World Example</a></h2>
+<p>Let the fun begin. First, create a new database. It contains data from
+two counters, called input and output. The data is put into archives
+that average it. They take 1, 6, 24 or 288 samples at a time.
+They also go into archives that keep the maximum numbers. This will be
+explained later on. The time in-between samples is 300 seconds, a good
+starting point, which is the same as five minutes.</p>
+<pre>
+ 1 sample &quot;averaged&quot; stays 1 period of 5 minutes
+ 6 samples averaged become one average on 30 minutes
+ 24 samples averaged become one average on 2 hours
+ 288 samples averaged become one average on 1 day</pre>
+<p>Lets try to be compatible with MRTG which stores about the following
+amount of data:</p>
+<pre>
+ 600 5-minute samples:    2   days and 2 hours
+ 600 30-minute samples:  12.5 days
+ 600 2-hour samples:     50   days
+ 732 1-day samples:     732   days</pre>
+<p>These ranges are appended, so the total amount of data stored in the
+database is approximately 797 days. RRDtool stores the data
+differently, it doesn't start the ``weekly'' archive where the ``daily''
+archive stopped. For both archives the most recent data will be near
+``now'' and therefore we will need to keep more data than MRTG does!</p>
+<p>We will need:</p>
+<pre>
+ 600 samples of 5 minutes  (2 days and 2 hours)
+ 700 samples of 30 minutes (2 days and 2 hours, plus 12.5 days)
+ 775 samples of 2 hours    (above + 50 days)
+ 797 samples of 1 day      (above + 732 days, rounded up to 797)</pre>
+<pre>
+   rrdtool create myrouter.rrd         \
+            DS:input:COUNTER:600:U:U   \
+            DS:output:COUNTER:600:U:U  \
+            RRA:AVERAGE:0.5:1:600      \
+            RRA:AVERAGE:0.5:6:700      \
+            RRA:AVERAGE:0.5:24:775     \
+            RRA:AVERAGE:0.5:288:797    \
+            RRA:MAX:0.5:1:600          \
+            RRA:MAX:0.5:6:700          \
+            RRA:MAX:0.5:24:775         \
+            RRA:MAX:0.5:288:797</pre>
+<p>Next thing to do is to collect data and store it. Here is an example.
+It is written partially in pseudo code,  you will have to find out what
+to do exactly on your OS to make it work.</p>
+<pre>
+   while not the end of the universe
+   do
+      get result of
+         snmpget router community 2.2.1.10.4
+      into variable $in
+      get result of
+         snmpget router community 2.2.1.16.4
+      into variable $out</pre>
+<pre>
+      rrdtool update myrouter.rrd N:$in:$out</pre>
+<pre>
+      wait for 5 minutes
+   done</pre>
+<p>Then, after collecting data for a day, try to create an image using:</p>
+<pre>
+   rrdtool graph myrouter-day.png --start -86400 \
+            DEF:inoctets=myrouter.rrd:input:AVERAGE \
+            DEF:outoctets=myrouter.rrd:output:AVERAGE \
+            AREA:inoctets#00FF00:&quot;In traffic&quot; \
+            LINE1:outoctets#0000FF:&quot;Out traffic&quot;</pre>
+<p>This should produce a picture with one day worth of traffic.
+One day is 24 hours of 60 minutes of 60 seconds: 24*60*60=86'400, we
+start at now minus 86'400 seconds. We define (with DEFs) inoctets and
+outoctets as the average values from the database myrouter.rrd and draw
+an area for the ``in'' traffic and a line for the ``out'' traffic.</p>
+<p>View the image and keep logging data for a few more days.
+If you like, you could try the examples from the test database and
+see if you can get various options and calculations to work.</p>
+<p>Suggestion: Display in bytes per second and in bits per second. Make
+the Ethernet graphics go red if they are over four megabits per
+second.</p>
+<p>
+</p>
+<h2><a name="consolidation_functions">Consolidation Functions</a></h2>
+<p>A few paragraphs back I mentioned the possibility of keeping
+the maximum values instead of the average values. Let's go
+into this a bit more.</p>
+<p>Recall all the stuff about the speed of the car. Suppose we drove at 144
+KM/H during 5 minutes and then were stopped by the police for 25 minutes.
+At the end of the lecture we would take our laptop and create and view the
+image taken from the database. If we look at the second RRA we did
+create, we would have the average from 6 samples. The samples measured
+would be 144+0+0+0+0+0=144, divided by 30 minutes, corrected for the
+error by 1000, translated into KM/H, with a result of 24 KM/H.
+I would still get a ticket but not for speeding anymore :)</p>
+<p>Obviously, in this case we shouldn't look at the averages. In some
+cases they are handy. If you want to know how many KM you had traveled,
+the averaged picture would be the right one to look at. On the other hand, for
+the speed that we traveled at, the maximum numbers seen is much more
+interesting. Later we will see more types.</p>
+<p>It is the same for data. If you want to know the amount, look at the
+averages. If you want to know the rate, look at the maximum.
+Over time, they will grow apart more and more. In the last database
+we have created, there are two archives that keep data per day. The
+archive that keeps averages will show low numbers, the archive that
+shows maxima will have higher numbers.</p>
+<p>For my car this would translate in averages per day of 96/24=4 KM/H
+(as I travel about 94 kilometers on a day) during working days, and
+maxima of 120 KM/H (my top speed that I reach every day).</p>
+<p>Big difference. Do not look at the second graph to estimate the
+distances that I travel and do not look at the first graph to
+estimate my speed. This will work if the samples are close together,
+as they are in five minutes, but not if you average.</p>
+<p>On some days, I go for a long ride. If I go across Europe and travel
+for 12 hours, the first graph will rise to about 60 KM/H. The second
+one will show 180 KM/H. This means that I traveled a distance of 60
+KM/H times 24 H = 1440 KM. I did this with a higher speed and a
+maximum around 180 KM/H. However, it probably doesn't mean that I
+traveled for 8 hours at a constant speed of 180 KM/H!</p>
+<p>This is a real example: go with the flow through Germany (fast!) and stop
+a few times for gas and coffee. Drive slowly through Austria and the
+Netherlands. Be careful in the mountains and villages. If you would
+look at the graphs created from the five-minute averages you would
+get a totally different picture. You would see the same values on the
+average and maximum graphs (provided I measured every 300 seconds).
+You would be able to see when I stopped, when I was in top gear, when
+I drove over fast highways etc. The granularity of the data is much
+higher, so you can see more. However, this takes 12 samples per hour,
+or 288 values per day, so it would be a lot of data over a longer
+period of time. Therefore we average it, eventually to one value per
+day. From this one value, we cannot see much detail, of course.</p>
+<p>Make sure you understand the last few paragraphs. There is no value
+in only a line and a few axis, you need to know what they mean and
+interpret the data in ana appropriate way. This is true for all data.</p>
+<p>The biggest mistake you can make is to use the collected data for
+something that it is not suitable for. You would be better off if
+you didn't have the graph at all.</p>
+<p>
+</p>
+<h2><a name="let_s_review_what_you_now_should_know">Let's review what you now should know</a></h2>
+<p>You know how to create a database and can put data in it. You can get
+the numbers out again by creating an image, do math on the data from
+the database and view the resulte instead of the raw data.  You know
+about the difference between averages and maxima, and when to use
+which (or at least you should have an idea).</p>
+<p>RRDtool can do more than what we have learned up to now. Before you
+continue with the rest of this doc, I recommend that you reread from
+the start and try some modifications on the examples. Make sure you
+fully understand everything. It will be worth the effort and helps
+you not only with the rest of this tutorial, but also in your day to day
+monitoring long after you read this introduction.</p>
+<p>
+</p>
+<h2><a name="data_source_types">Data Source Types</a></h2>
+<p>All right, you feel like continuing. Welcome back and get ready
+for an increased speed in the examples and explanations.</p>
+<p>You know that in order to view a counter over time, you have to
+take two numbers and divide the difference of them between the
+time lapsed.  This makes sense for the examples I gave you but there
+are other possibilities.  For instance, I'm able to retrieve the
+temperature from my router in three places namely the inlet, the
+so called hot-spot and the exhaust.  These values are not counters.
+If I take the difference of the two samples and divide that by
+300 seconds I would be asking for the temperature change per second.
+Hopefully this is zero! If not, the computer room is probably on fire :)</p>
+<p>So, what can we do?  We can tell RRDtool to store the values we measure
+directly as they are (this is not entirely true but close enough). The
+graphs we make will look much better, they will show a rather constant
+value. I know when the router is busy (it
+works -&gt; it uses more electricity -&gt; it generates more heat -&gt; the
+temperature rises). I know when the doors are left open (the room is
+air conditioned) -&gt; the warm air from the rest of the building flows into the
+computer room -&gt; the inlet temperature rises). Etc. The data type we
+use when creating the database before was counter, we now have a
+different data type and thus a different name for it. It is called
+GAUGE. There are more such data types:</p>
+<pre>
+ - COUNTER   we already know this one
+ - GAUGE     we just learned this one
+ - DERIVE
+ - ABSOLUTE</pre>
+<p>The two additional types are DERIVE and ABSOLUTE. Absolute can be used like
+counter with one difference: RRDtool assumes the counter is reset when
+it's read. That is: its delta is known without calculation by RRDtool
+whereas RRDtool needs to calculate it for the counter type.
+Example: our first example (12'345, 12'357, 12'363, 12'363) would read:
+unknown, 12, 6, 0. The rest of the calculations stay the same.
+The other one, derive, is like counter. Unlike counter, it can also
+decrease so it can have a negative delta. Again, the rest of the
+calculations stay the same.</p>
+<p>Let's try them all:</p>
+<pre>
+   rrdtool create all.rrd --start 978300900 \
+            DS:a:COUNTER:600:U:U \
+            DS:b:GAUGE:600:U:U \
+            DS:c:DERIVE:600:U:U \
+            DS:d:ABSOLUTE:600:U:U \
+            RRA:AVERAGE:0.5:1:10
+   rrdtool update all.rrd \
+            978301200:300:1:600:300    \
+            978301500:600:3:1200:600   \
+            978301800:900:5:1800:900   \
+            978302100:1200:3:2400:1200 \
+            978302400:1500:1:2400:1500 \
+            978302700:1800:2:1800:1800 \
+            978303000:2100:4:0:2100    \
+            978303300:2400:6:600:2400  \
+            978303600:2700:4:600:2700  \
+            978303900:3000:2:1200:3000
+   rrdtool graph all1.png -s 978300600 -e 978304200 -h 400 \
+            DEF:linea=all.rrd:a:AVERAGE LINE3:linea#FF0000:&quot;Line A&quot; \
+            DEF:lineb=all.rrd:b:AVERAGE LINE3:lineb#00FF00:&quot;Line B&quot; \
+            DEF:linec=all.rrd:c:AVERAGE LINE3:linec#0000FF:&quot;Line C&quot; \
+            DEF:lined=all.rrd:d:AVERAGE LINE3:lined#000000:&quot;Line D&quot;</pre>
+<p>
+</p>
+<h2><a name="rrdtool_under_the_microscope">RRDtool under the Microscope</a></h2>
+<ul>
+<li>
+<p>Line A is a COUNTER type, so it should continuously increment and RRDtool
+must calculate the differences. Also, RRDtool needs to divide the
+difference by the amount of time lapsed. This should end up as a
+straight line at 1 (the deltas are 300, the time is 300).</p>
+</li>
+<li>
+<p>Line B is of type GAUGE. These are ``real'' values so they should match
+what we put in: a sort of a wave.</p>
+</li>
+<li>
+<p>Line C is of type DERIVE. It should be a counter that can decrease. It does
+so between 2'400 and 0, with 1'800 in-between.</p>
+</li>
+<li>
+<p>Line D is of type ABSOLUTE. This is like counter but it works on
+values without calculating the difference. The numbers are the same
+and as you can see (hopefully) this has a different result.</p>
+</li>
+</ul>
+<p>This translates in the following values, starting at 23:10 and ending
+at 00:10 the next day (where ``u'' means unknown/unplotted):</p>
+<pre>
+ - Line A:  u  u  1  1  1  1  1  1  1  1  1  u
+ - Line B:  u  1  3  5  3  1  2  4  6  4  2  u
+ - Line C:  u  u  2  2  2  0 -2 -6  2  0  2  u
+ - Line D:  u  1  2  3  4  5  6  7  8  9 10  u</pre>
+<p>If your PNG shows all this, you know you have entered the data correctly,
+the RRDtool executable is working properly, your viewer doesn't fool you,
+and you successfully entered the year 2000 :)</p>
+<p>You could try the same example four times, each time with only one of
+the lines.</p>
+<p>Let's go over the data again:</p>
+<ul>
+<li>
+<p>Line A: 300,600,900 and so on. The counter delta is a constant 300 and
+so is the time delta. A number divided by itself is always 1 (except
+when dividing by zero which is undefined/illegal).</p>
+<p>Why is it that the first point is unknown? We do know what we put into
+the database, right? True, But we didn't have a value to calculate the delta
+from, so we don't know where we started. It would be wrong to assume we
+started at zero so we don't!</p>
+</li>
+<li>
+<p>Line B: There is nothing to calculate. The numbers are as they are.</p>
+</li>
+<li>
+<p>Line C: Again, the start-out value is unknown. The same story is holds
+as for line A. In this case the deltas are not constant, therefore the line
+is not either. If we would put the same numbers in the database as we did for
+line A, we would have gotten the same line. Unlike type counter,
+this type can decrease and I hope to show you later on why
+this makes a difference.</p>
+</li>
+<li>
+<p>Line D: Here the device calculates the deltas. Therefore we DO know the
+first delta and it is plotted. We had the same input as with line A, but
+the meaning of this input is different and thus the line is different.
+In this case the deltas increase each time with 300. The time delta
+stays at a constant 300 and therefore the division of the two gives
+increasing values.</p>
+</li>
+</ul>
+<p>
+</p>
+<h2><a name="counter_wraps">Counter Wraps</a></h2>
+<p>There are a few more basics to show. Some important options are still to
+be covered and we haven't look at counter wraps yet. First the counter wrap:
+In our car we notice that the counter shows 999'987. We travel 20 KM and
+the counter should go to 1'000'007. Unfortunately, there are only six digits
+on our counter so it really shows 000'007. If we would plot that on a type
+DERIVE, it would mean that the counter was set back 999'980 KM. It wasn't,
+and there has to be some protection for this. This protection is only
+available for type COUNTER which should be used for this kind of counter
+anyways. How does it work? Type counter should never decrease and
+therefore RRDtool must assume it wrapped if it does decrease!
+If the delta is negative, this can be compensated for by adding the
+maximum value of the counter + 1. For our car this would be:</p>
+<pre>
+ Delta = 7 - 999'987 = -999'980    (instead of 1'000'007-999'987=20)</pre>
+<pre>
+ Real delta = -999'980 + 999'999 + 1 = 20</pre>
+<p>At the time of writing this document, RRDtool knows of counters that
+are either 32 bits or 64 bits of size. These counters can handle the
+following different values:</p>
+<pre>
+ - 32 bits: 0 ..           4'294'967'295
+ - 64 bits: 0 .. 18'446'744'073'709'551'615</pre>
+<p>If these numbers look strange to you, you can view them in
+their hexadecimal form:</p>
+<pre>
+ - 32 bits: 0 ..         FFFFFFFF
+ - 64 bits: 0 .. FFFFFFFFFFFFFFFF</pre>
+<p>RRDtool handles both counters the same. If an overflow occurs and
+the delta would be negative, RRDtool first adds the maximum of a small
+counter + 1 to the delta. If the delta is still negative, it had to be
+the large counter that wrapped. Add the maximum possible value of the
+large counter + 1 and subtract the erroneously added small value.</p>
+<p>There is a risk in this: suppose the large counter wrapped while adding
+a huge delta, it could happen, theoretically, that adding the smaller value
+would make the delta positive. In this unlikely case the results would
+not be correct. The increase should be nearly as high as the maximum
+counter value for that to happen, so chances are you would have several
+other problems as well and this particular problem would not even be
+worth thinking about. Even though, I did include an example, so you
+can judge for yourself.</p>
+<p>The next section gives you some numerical examples for counter-wraps.
+Try to do the calculations yourself or just believe me if your calculator
+can't handle the numbers :)</p>
+<p>Correction numbers:</p>
+<pre>
+ - 32 bits: (4'294'967'295 + 1) =                                4'294'967'296
+ - 64 bits: (18'446'744'073'709'551'615 + 1)
+                                    - correction1 = 18'446'744'069'414'584'320</pre>
+<pre>
+ Before:        4'294'967'200
+ Increase:                100
+ Should become: 4'294'967'300
+ But really is:             4
+ Delta:        -4'294'967'196
+ Correction1:  -4'294'967'196 + 4'294'967'296 = 100</pre>
+<pre>
+ Before:        18'446'744'073'709'551'000
+ Increase:                             800
+ Should become: 18'446'744'073'709'551'800
+ But really is:                        184
+ Delta:        -18'446'744'073'709'550'816
+ Correction1:  -18'446'744'073'709'550'816
+                                + 4'294'967'296 = -18'446'744'069'414'583'520
+ Correction2:  -18'446'744'069'414'583'520
+                   + 18'446'744'069'414'584'320 = 800</pre>
+<pre>
+ Before:        18'446'744'073'709'551'615 ( maximum value )
+ Increase:      18'446'744'069'414'584'320 ( absurd increase, minimum for
+ Should become: 36'893'488'143'124'135'935             this example to work )
+ But really is: 18'446'744'069'414'584'319
+ Delta:                     -4'294'967'296
+ Correction1:  -4'294'967'296 + 4'294'967'296 = 0
+ (not negative -&gt; no correction2)</pre>
+<pre>
+ Before:        18'446'744'073'709'551'615 ( maximum value )
+ Increase:      18'446'744'069'414'584'319 ( one less increase )
+ Should become: 36'893'488'143'124'135'934
+ But really is: 18'446'744'069'414'584'318
+ Delta:                     -4'294'967'297
+ Correction1:  -4'294'967'297 + 4'294'967'296 = -1
+ Correction2:  -1 + 18'446'744'069'414'584'320 = 18'446'744'069'414'584'319</pre>
+<p>As you can see from the last two examples, you need strange numbers
+for RRDtool to fail (provided it's bug free of course), so this should
+not happen. However, SNMP or whatever method you choose to collect the
+data, might also report wrong numbers occasionally.  We can't prevent all
+errors, but there are some things we can do. The RRDtool ``create'' command
+takes two special parameters for this. They define
+the minimum and maximum allowed values. Until now, we used ``U'', meaning
+``unknown''. If you provide values for one or both of them and if RRDtool
+receives data points that are outside these limits, it will ignore those
+values. For a thermometer in degrees Celsius, the absolute minimum is
+just under -273. For my router, I can assume this minimum is much higher
+so I would set it to 10, where as the maximum temperature I would
+set to 80. Any higher and the device would be out of order.</p>
+<p>For the speed of my car, I would never expect negative numbers and
+also I would not expect a speed  higher than 230. Anything else,
+and there must have been an error. Remember: the opposite is not true,
+if the numbers pass this check, it doesn't mean that they are
+correct. Always judge the graph with a healthy dose of suspicion if it
+seems weird to you.</p>
+<p>
+</p>
+<h2><a name="data_resampling">Data Resampling</a></h2>
+<p>One important feature of RRDtool has not been explained yet: it is
+virtually impossible to collect data and feed it into RRDtool on exact
+intervals. RRDtool therefore interpolates the data, so they are stored
+on exact intervals. If you do not know what this means or how it
+works, then here's the help you seek:</p>
+<p>Suppose a counter increases by exactly one for every second. You want
+to measure it in 300 seconds intervals. You should retrieve values
+that are exactly 300 apart. However, due to various circumstances you
+are a few seconds late and the interval is 303. The delta will also be
+303 in that case. Obviously, RRDtool should not put 303 in the database
+and make you believe that the counter increased by 303 in 300 seconds.
+This is where RRDtool interpolates: it alters the 303 value as if it
+would have been stored earlier and it will be 300 in 300 seconds.
+Next time you are at exactly the right time. This means that the current
+interval is 297 seconds and also the counter increased by 297. Again,
+RRDtool interpolates and stores 300 as it should be.</p>
+<pre>
+      in the RRD                 in reality</pre>
+<pre>
+ time+000:   0 delta=&quot;U&quot;   time+000:    0 delta=&quot;U&quot;
+ time+300: 300 delta=300   time+300:  300 delta=300
+ time+600: 600 delta=300   time+603:  603 delta=303
+ time+900: 900 delta=300   time+900:  900 delta=297</pre>
+<p>Let's create two identical databases. I've chosen the time range 920'805'000
+to 920'805'900 as this goes very well with the example numbers.</p>
+<pre>
+   rrdtool create seconds1.rrd   \
+      --start 920804700          \
+      DS:seconds:COUNTER:600:U:U \
+      RRA:AVERAGE:0.5:1:24</pre>
+<p>Make a copy</p>
+<pre>
+   for Unix: cp seconds1.rrd seconds2.rrd
+   for Dos:  copy seconds1.rrd seconds2.rrd
+   for vms:  how would I know :)</pre>
+<p>Put in some data</p>
+<pre>
+   rrdtool update seconds1.rrd \
+      920805000:000 920805300:300 920805600:600 920805900:900
+   rrdtool update seconds2.rrd \
+      920805000:000 920805300:300 920805603:603 920805900:900</pre>
+<p>Create output</p>
+<pre>
+   rrdtool graph seconds1.png                       \
+      --start 920804700 --end 920806200             \
+      --height 200                                  \
+      --upper-limit 1.05 --lower-limit 0.95 --rigid \
+      DEF:seconds=seconds1.rrd:seconds:AVERAGE      \
+      CDEF:unknown=seconds,UN                       \
+      LINE2:seconds#0000FF                          \
+      AREA:unknown#FF0000
+   rrdtool graph seconds2.png                       \
+      --start 920804700 --end 920806200             \
+      --height 200                                  \
+      --upper-limit 1.05 --lower-limit 0.95 --rigid \
+      DEF:seconds=seconds2.rrd:seconds:AVERAGE      \
+      CDEF:unknown=seconds,UN                       \
+      LINE2:seconds#0000FF                          \
+      AREA:unknown#FF0000</pre>
+<p>View both images together (add them to your index.html file)
+and compare. Both graphs should show the same, despite the
+input being different.</p>
+<p>
+</p>
+<hr />
+<h1><a name="wrapup">WRAPUP</a></h1>
+<p>It's time now to wrap up this tutorial. We covered all the basics for
+you to be able to work with RRDtool and to read the additional
+documentation available. There is plenty more to discover about
+RRDtool and you will find more and more uses for this package. You can
+easly create graphs using just the examples provided and using only
+RRDtool. You can also use one of the front ends to RRDtool that are
+available.</p>
+<p>
+</p>
+<hr />
+<h1><a name="mailinglist">MAILINGLIST</a></h1>
+<p>Remember to subscribe to the RRDtool mailing list. Even if you are not
+answering to mails that come by, it helps both you and the rest of the
+users. A lot of the stuff that I know about MRTG (and therefore about
+RRDtool) I've learned while just reading the list without posting to
+it. I did not need to ask the basic questions as they are answered in
+the FAQ (read it!) and in various mails by other users. With
+thousands of users all over the world, there will always be people who
+ask questions that you can answer because you read this and other
+documentation and they didn't.</p>
+<p>
+</p>
+<hr />
+<h1><a name="see_also">SEE ALSO</a></h1>
+<p>The RRDtool manpages</p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>I hope you enjoyed the examples and their descriptions. If you do, help
+other people by pointing them to this document when they are asking
+basic questions. They will not only get their answers, but at the same
+time learn a whole lot more.</p>
+<p>Alex van den Bogaerdt
+&lt;<a href="mailto:alex@ergens.op.het.net">alex@ergens.op.het.net</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdtutorial.pod b/doc/rrdtutorial.pod
new file mode 100644 (file)
index 0000000..30a4868
--- /dev/null
@@ -0,0 +1,1177 @@
+=head1 NAME
+
+rrdtutorial - Alex van den Bogaerdt's RRDtool tutorial
+
+=head1 DESCRIPTION
+
+RRDtool is written by Tobias Oetiker E<lt>tobi@oetiker.chE<gt> with
+contributions from many people all around the world. This document is
+written by Alex van den Bogaerdt E<lt>alex@ergens.op.het.netE<gt> to help you
+understand what RRDtool is and what it can do for you.
+
+The documentation provided with RRDtool can be too technical for some
+people. This tutorial is here to help you understand the basics of
+RRDtool. It should prepare you to read the documentation yourself.
+It also explains the general things about statistics with a focus on
+networking.
+
+=head1 TUTORIAL
+
+=head2 Important
+
+Please don't skip ahead in this document!  The first part of this
+document explains the basics and may be boring.  But if you don't
+understand the basics, the examples will not be as meaningful to you.
+
+=head2 What is RRDtool?
+
+RRDtool refers to Round Robin Database tool.
+Round robin is a technique that works with a fixed amount of data, and a
+pointer to the current element. Think of a circle with some dots plotted
+on the edge -- these dots are the places where data can be stored. Draw an
+arrow from the center of the circle to one of the dots -- this is the pointer.
+When the current data is read or written, the pointer moves to the next
+element. As we are on a circle there is neither a beginning nor an end, you can
+go on and on and on. After a while, all the available places will be used and
+the process automatically reuses old locations. This way, the dataset
+will not grow in size and therefore requires no maintenance.
+RRDtool works with with Round Robin Databases (RRDs). It stores and retrieves
+data from them.
+
+=head2 What data can be put into an RRD?
+
+You name it, it will probably fit as long as it is some sort of time-series
+data. This means you have to be able to measure some value at several points in time and
+provide this information to RRDtool. If you can do this, RRDtool will be
+able to store it. The values must be numerical but don't have to be
+integers, as is the case with MRTG (the next section will give more details
+on this more specialized application).
+
+Many examples below talk about SNMP which is an acronym for Simple Network
+Management Protocol. "Simple" refers to the protocol -- it does not
+mean it is simple to manage or monitor a network. After working your
+way through this document, you should know enough to be able to
+understand what people are talking about. For now, just realize that
+SNMP can be used to query devices for the values of counters they keep. It
+is the value from those counters that we want to store in the RRD.
+
+=head2 What can I do with this tool?
+
+RRDtool originated from MRTG (Multi Router Traffic Grapher). MRTG
+started as a tiny little script for graphing the use of a university's
+connection to the Internet. MRTG was later (ab-)used as a tool for
+graphing other data sources including temperature, speed, voltage,
+number of printouts and the like.
+
+Most likely you will start to use RRDtool to store and process data
+collected via SNMP. The data will most likely be bytes (or bits)
+transfered from and to a network or a computer.  But it can also be
+used to display tidal waves, solar radiation, power consumption,
+number of visitors at an exhibition, noise levels near an airport,
+temperature on your favorite holiday location, temperature in the
+fridge and whatever you imagination can come up with.
+
+You only need a sensor to measure the data and be able to feed the
+numbers into RRDtool. RRDtool then lets you create a database, store
+data in it, retrieve that data and create graphs in PNG format for
+display on a web browser. Those PNG images are dependent on the data
+you collected and could be, for instance, an overview of the average
+network usage, or the peaks that occurred.
+
+=head2 What if I still have problems after reading this document?
+
+First of all: read it again! You may have missed something.
+If you are unable to compile the sources and you have a fairly common
+OS, it will probably not be the fault of RRDtool. There may be pre-compiled
+versions around on the Internet. If they come from trusted sources, get
+one of those.
+
+If on the other hand the program works but does not give you the
+expected results, it will be a problem with configuring it. Review
+your configuration and compare it with the examples that follow.
+
+There is a mailing list and an archive of it. Read the list for a few
+weeks and search the archive. It is considered rude to just ask
+a question without searching the archives: your problem may already have been
+solved for somebody else!  This is true for most, if not all, mailing lists
+and not only for this particular one. Look in the documentation that
+came with RRDtool for the location and usage of the list.
+
+I suggest you take a moment to subscribe to the mailing list right now
+by sending an email to E<lt>rrd-users-request@lists.oetiker.chE<gt> with a
+subject of "subscribe". If you ever want to leave this list, just write
+an email to the same address but now with a subject of "unsubscribe".
+
+=head2 How will you help me?
+
+By giving you some detailed descriptions with detailed examples.
+I assume that following the instructions in the order presented
+will give you enough knowledge of RRDtool to experiment for yourself.
+If it doesn't work the first time, don't give up. Reread the stuff that
+you did understand, you may have missed something.
+
+By following the examples you get some hands-on experience and, even
+more important, some background information of how it works.
+
+You will need to know something about hexadecimal numbers. If you don't
+then start with reading L<bin_dec_hex> before you continue here.
+
+=head2 Your first Round Robin Database
+
+In my opinion the best way to learn something is to actually do it.
+Why not start right now?  We will create a database, put some values
+in it and extract this data again.  Your output should be the same
+as the output that is included in this document.
+
+We will start with some easy stuff and compare a car with a router,
+or compare kilometers (miles if you wish) with bits and bytes. It's
+all the same: some number over some time.
+
+Assume we have a device that transfers bytes to and from the Internet.
+This device keeps a counter that starts at zero when it is turned on,
+increasing with every byte that is transfered. This counter will probably have
+a maximum value. If this value is reached and an extra byte is counted,
+the counter starts over at zero. This is the same as many counters
+in the world such as the mileage counter in a car.
+
+Most discussions about networking talk about bits per second so lets
+get used to that right away. Assume a byte is eight bits and start to
+think in bits not bytes. The counter, however, still counts bytes!
+In the SNMP world most of the counters are 32 bits. That means they are
+counting from 0 to 4'294'967'295. We will use these values in the examples.
+The device, when asked, returns the current value of the counter. We
+know the time that has passes since we last asked so we now know how
+many bytes have been transfered ***on average*** per second. This is
+not very hard to calculate. First in words, then in calculations:
+
+=over 3
+
+=item 1.
+
+Take the current counter, subtract the previous value from it.
+
+=item 2.
+
+Do the same with the current time and the previous time (in seconds).
+
+=item 3.
+
+Divide the outcome of (1) by the outcome of (2), the result is
+the amount of bytes per second. Multiply by eight to get the
+number of bits per second (bps).
+
+=back
+
+  bps = (counter_now - counter_before) / (time_now - time_before) * 8
+
+For some people it may help to translate this to an automobile example.
+Do not try this example, and if you do, don't blame me for the results!
+
+People who are not used to think in kilometers per hour can translate
+most into miles per hour by dividing km by 1.6 (close enough).
+I will use the following abbreviations:
+
+ M:    meter
+ KM:   kilometer (= 1'000 meters).
+ H:    hour
+ S:    second
+ KM/H: kilometers per hour
+ M/S:  meters per second
+
+You are driving a car. At 12:05 you read the counter in the dashboard
+and it tells you that the car has moved 12'345 KM until that moment.
+At 12:10 you look again, it reads 12'357 KM. This means you have
+traveled 12 KM in five minutes. A scientist would translate that
+into meters per second and this makes a nice comparison toward the
+problem of (bytes per five minutes) versus (bits per second).
+
+We traveled 12 kilometers which is 12'000 meters. We did that in five
+minutes or 300 seconds. Our speed is 12'000M / 300S or 40 M/S.
+
+We could also calculate the speed in KM/H: 12 times 5 minutes
+is an hour, so we have to multiply 12 KM by 12 to get 144 KM/H.
+For our native English speaking friends: that's 90 MPH so don't
+try this example at home or where I live :)
+
+Remember: these numbers are averages only.  There is no way to figure out
+from the numbers, if you drove at a constant speed.  There is an example
+later on in this tutorial that explains this.
+
+I hope you understand that there is no difference in calculating M/S or
+bps; only the way we collect the data is different. Even the K from kilo
+is the same as in networking terms k also means 1'000.
+
+We will now create a database where we can keep all these interesting
+numbers. The method used to start the program may differ slightly from
+OS to OS, but I assume you can figure it out if it works different on
+your's. Make sure you do not overwrite any file on your system when
+executing the following command and type the whole line as one long
+line (I had to split it for readability)
+and skip all of the '\' characters.
+
+   rrdtool create test.rrd             \
+            --start 920804400          \
+            DS:speed:COUNTER:600:U:U   \
+            RRA:AVERAGE:0.5:1:24       \
+            RRA:AVERAGE:0.5:6:10
+
+(So enter: C<rrdtool create test.rrd --start 920804400 DS ...>)
+
+=head2 What has been created?
+
+We created the round robin database called test (test.rrd) which starts at
+noon the day I started writing this document, 7th of March, 1999 (this date
+translates to 920'804'400 seconds as explained below). Our database holds
+one data source (DS) named "speed" that represents a counter. This counter
+is read every five minutes (this is the default therefore you don't have to
+put C<--step=300>).  In the same database two round robin archives (RRAs)
+are kept, one averages the data every time it is read (e.g., there's nothing
+to average) and keeps 24 samples (24 times 5 minutes is 2 hours). The other
+averages 6 values (half hour) and contains 10 such averages (e.g. 5 hours).
+
+RRDtool works with special time stamps coming from the UNIX world.
+This time stamp is the number of seconds that passed since January
+1st 1970 UTC.  The time stamp value is translated into local time and
+it will therefore look different for different time zones.
+
+Chances are that you are not in the same part of the world as I am.
+This means your time zone is different. In all examples where I talk
+about time, the hours may be wrong for you. This has little effect on
+the results of the examples, just correct the hours while reading.
+As an example: where I will see "12:05" the UK folks will see "11:05".
+
+We now have to fill our database with some numbers. We'll pretend to
+have read the following numbers:
+
+ 12:05 12345 KM
+ 12:10 12357 KM
+ 12:15 12363 KM
+ 12:20 12363 KM
+ 12:25 12363 KM
+ 12:30 12373 KM
+ 12:35 12383 KM
+ 12:40 12393 KM
+ 12:45 12399 KM
+ 12:50 12405 KM
+ 12:55 12411 KM
+ 13:00 12415 KM
+ 13:05 12420 KM
+ 13:10 12422 KM
+ 13:15 12423 KM
+
+We fill the database as follows:
+
+ rrdtool update test.rrd 920804700:12345 920805000:12357 920805300:12363
+ rrdtool update test.rrd 920805600:12363 920805900:12363 920806200:12373
+ rrdtool update test.rrd 920806500:12383 920806800:12393 920807100:12399
+ rrdtool update test.rrd 920807400:12405 920807700:12411 920808000:12415
+ rrdtool update test.rrd 920808300:12420 920808600:12422 920808900:12423
+
+This reads: update our test database with the following numbers
+
+ time 920804700, value 12345
+ time 920805000, value 12357
+
+etcetera.
+
+As you can see, it is possible to feed more than one value into the
+database in one command. I had to stop at three for readability but
+the real maximum per line is OS dependent.
+
+We can now retrieve the data from our database using "rrdtool fetch":
+
+ rrdtool fetch test.rrd AVERAGE --start 920804400 --end 920809200
+
+It should return the following output:
+
+                          speed
+
+ 920804700: nan
+ 920805000: 4.0000000000e-02
+ 920805300: 2.0000000000e-02
+ 920805600: 0.0000000000e+00
+ 920805900: 0.0000000000e+00
+ 920806200: 3.3333333333e-02
+ 920806500: 3.3333333333e-02
+ 920806800: 3.3333333333e-02
+ 920807100: 2.0000000000e-02
+ 920807400: 2.0000000000e-02
+ 920807700: 2.0000000000e-02
+ 920808000: 1.3333333333e-02
+ 920808300: 1.6666666667e-02
+ 920808600: 6.6666666667e-03
+ 920808900: 3.3333333333e-03
+ 920809200: nan
+
+If it doesn't, something may be wrong.  Perhaps your OS will print
+"NaN" in a different form. "NaN" stands for "Not A Number".  If your OS
+writes "U" or "UNKN" or something similar that's okay.  If something
+else is wrong, it will probably be due to an error you made (assuming
+that my tutorial is correct of course :-). In that case: delete the
+database and try again.  Sometimes things change.  This example used
+to provide numbers like "0.04" in stead of "4.00000e-02".  Those are
+really the same numbers, just written down differently.  Don't be
+alarmed if a future version of rrdtool displays a slightly different
+form of output. The examples in this document are correct for version
+1.2.0 of RRDtool.
+
+The meaning of the above output will become clear below.
+
+=head2 Time to create some graphics
+
+Try the following command:
+
+ rrdtool graph speed.png                                 \
+         --start 920804400 --end 920808000               \
+         DEF:myspeed=test.rrd:speed:AVERAGE              \
+         LINE2:myspeed#FF0000
+
+This will create speed.png which starts at 12:00 and ends at 13:00.
+There is a definition of a variable called myspeed, using the data from RRA
+"speed" out of database "test.rrd". The line drawn is 2 pixels high
+and represents the variable myspeed. The color is red (specified by
+its rgb-representation, see below).
+
+You'll notice that the start of the graph is not at 12:00 but at 12:05.
+This is because we have insufficient data to tell the average before
+that time. This will only happen when you miss some samples, this will
+not happen a lot, hopefully.
+
+If this has worked: congratulations! If not, check what went wrong.
+
+
+The colors are built up from red, green and blue. For each of the
+components, you specify how much to use in hexadecimal where 00 means
+not included and FF means fully included.
+The "color" white is a mixture of red, green and blue: FFFFFF
+The "color" black is all colors off: 000000
+
+   red     #FF0000
+   green   #00FF00
+   blue    #0000FF
+   magenta #FF00FF     (mixed red with blue)
+   gray    #555555     (one third of all components)
+
+Additionally you can add an alpha channel (transparency).  The default
+will be "FF" which means non-transparent.
+
+The PNG you just created can be displayed using your favorite image
+viewer.  Web browsers will display the PNG via the URL
+"file:///the/path/to/speed.png"
+
+=head2 Graphics with some math
+
+When looking at the image, you notice that the horizontal axis is labeled
+12:10, 12:20, 12:30, 12:40 and 12:50. Sometimes a label doesn't fit (12:00
+and 13:00 would be candidates) so they are skipped.
+
+The vertical axis displays the range we entered. We provided
+kilometers and when divided by 300 seconds, we get very small
+numbers. To be exact, the first value was 12 (12'357-12'345) and divided
+by 300 this makes 0.04, which is displayed by RRDtool as "40 m"
+meaning "40/1'000". The "m" (milli) has nothing to do with meters,
+kilometers or millimeters! RRDtool doesn't know about the physical
+units of our data, it just works with dimensionless numbers.
+
+If we had measured our distances in meters, this would have been
+(12'357'000-12'345'000)/300 = 12'000/300 = 40.
+
+As most people have a better feel for numbers in this range, we'll
+correct that. We could recreate our database and store the correct
+data, but there is a better way: we do some calculations while creating
+the png file!
+
+   rrdtool graph speed2.png                           \
+      --start 920804400 --end 920808000               \
+      --vertical-label m/s                            \
+      DEF:myspeed=test.rrd:speed:AVERAGE              \
+      CDEF:realspeed=myspeed,1000,\*                  \
+      LINE2:realspeed#FF0000
+
+Note: Make sure not to forget the backslash \ in front of the
+multiplication operator * above. The backslash is needed to "escape"
+the * as some operating systems might interpret and expand * instead
+of passing it to the rrdtool command.
+
+After viewing this PNG, you notice the "m" (milli) has
+disappeared. This it what the correct result would be. Also, a label
+has been added to the image.  Apart from the things mentioned above,
+the PNG should look the same.
+
+The calculations are specified in the CDEF part above and are in
+Reverse Polish Notation ("RPN"). What we requested RRDtool to do is:
+"take the data source myspeed and the number 1000; multiply
+those". Don't bother with RPN yet, it will be explained later on in
+more detail. Also, you may want to read my tutorial on CDEFs and Steve
+Rader's tutorial on RPN. But first finish this tutorial.
+
+Hang on! If we can multiply values with 1'000, it should also be possible
+to display kilometers per hour from the same data!
+
+To change a value that is measured in meters per second:
+
+ Calculate meters per hour:     value * 3'600
+ Calculate kilometers per hour: value / 1'000
+ Together this makes:           value * (3'600/1'000) or value * 3.6
+
+In our example database we made a mistake and we need to compensate for
+this by multiplying with 1'000. Applying that correction:
+
+ value * 3.6  * 1'000 == value * 3'600
+
+Now let's create this PNG, and add some more magic ...
+
+ rrdtool graph speed3.png                             \
+      --start 920804400 --end 920808000               \
+      --vertical-label km/h                           \
+      DEF:myspeed=test.rrd:speed:AVERAGE              \
+      "CDEF:kmh=myspeed,3600,*"                       \
+      CDEF:fast=kmh,100,GT,kmh,0,IF                   \
+      CDEF:good=kmh,100,GT,0,kmh,IF                   \
+      HRULE:100#0000FF:"Maximum allowed"              \
+      AREA:good#00FF00:"Good speed"                   \
+      AREA:fast#FF0000:"Too fast"
+
+Note: here we use another means to escape the * operator by enclosing
+the whole string in double quotes.
+
+This graph looks much better. Speed is shown in KM/H and there is even
+an extra line with the maximum allowed speed (on the road I travel
+on). I also changed the colors used to display speed and changed it
+from a line into an area.
+
+The calculations are more complex now. For speed measurements within
+the speed limit they are:
+
+   Check if kmh is greater than 100    ( kmh,100 ) GT
+   If so, return 0, else kmh           ((( kmh,100 ) GT ), 0, kmh) IF
+
+For values above the speed limit:
+
+   Check if kmh is greater than 100    ( kmh,100 ) GT
+   If so, return kmh, else return 0    ((( kmh,100) GT ), kmh, 0) IF
+
+=head2 Graphics Magic
+
+I like to believe there are virtually no limits to how RRDtool graph
+can manipulate data. I will not explain how it works, but look at the
+following PNG:
+
+   rrdtool graph speed4.png                           \
+      --start 920804400 --end 920808000               \
+      --vertical-label km/h                           \
+      DEF:myspeed=test.rrd:speed:AVERAGE              \
+      "CDEF:kmh=myspeed,3600,*"                       \
+      CDEF:fast=kmh,100,GT,100,0,IF                   \
+      CDEF:over=kmh,100,GT,kmh,100,-,0,IF             \
+      CDEF:good=kmh,100,GT,0,kmh,IF                   \
+      HRULE:100#0000FF:"Maximum allowed"              \
+      AREA:good#00FF00:"Good speed"                   \
+      AREA:fast#550000:"Too fast"                     \
+      STACK:over#FF0000:"Over speed"
+
+Let's create a quick and dirty HTML page to view the three PNGs:
+
+   <HTML><HEAD><TITLE>Speed</TITLE></HEAD><BODY>
+   <IMG src="speed2.png" alt="Speed in meters per second">
+   <BR>
+   <IMG src="speed3.png" alt="Speed in kilometers per hour">
+   <BR>
+   <IMG src="speed4.png" alt="Traveled too fast?">
+   </BODY></HTML>
+
+Name the file "speed.html" or similar, and look at it in your web browser.
+
+Now, all you have to do is measure the values regularly and update the
+database.  When you want to view the data, recreate the PNGs and make
+sure to refresh them in your browser. (Note: just clicking reload may
+not be enough, especially when proxies are involved.  Try shift-reload
+or ctrl-F5).
+
+=head2 Updates in Reality
+
+We've already used the C<update> command: it took one or more
+parameters in the form of "<time>:<value>". You'll be glad to know
+that you can specify the current time by filling in a "N" as the time.
+Or you could use the "time" function in Perl (the shortest example in
+this tutorial):
+
+   perl -e 'print time, "\n" '
+
+How to run a program on regular intervals is OS specific. But here is
+an example in pseudo code:
+
+   - Get the value and put it in variable "$speed"
+   - rrdtool update speed.rrd N:$speed
+
+(do not try this with our test database, we'll use it in further examples)
+
+This is all. Run the above script every five minutes. When you need to know
+what the graphs look like, run the examples above. You could put them
+in a script as well. After running that script, view the page
+index.html we created above.
+
+=head2 Some words on SNMP
+
+I can imagine very few people that will be able to get real data from
+their car every five minutes. All other people will have to settle for
+some other kind of counter. You could measure the number of pages
+printed by a printer, for example, the cups of coffee made by the
+coffee machine, a device that counts the electricity used,
+whatever. Any incrementing counter can be monitored and graphed using
+the stuff you learned so far. Later on we will also be able to monitor
+other types of values like temperature.
+
+Most (?) people interested in RRDtool will use the counter that keeps track
+of octets (bytes) transfered by a network device. So let's do just
+that next. We will start with a description of how to collect data.
+
+Some people will make a remark that there are tools which can do this data
+collection for you. They are right! However, I feel it is important that
+you understand they are not necessary. When you have to determine why
+things went wrong you need to know how they work.
+
+One tool used in the example has been talked about very briefly in the
+beginning of this document, it is called SNMP. It is a way of talking
+to networked equipment. The tool I use below is called "snmpget" and
+this is how it works:
+
+   snmpget device password OID
+
+or
+
+   snmpget -v[version] -c[password] device OID
+
+For device you substitute the name, or the IP address, of your device.
+For password you use the "community read string" as it is called in the
+SNMP world.  For some devices the default of "public" might work, however
+this can be disabled, altered or protected for privacy and security
+reasons.  Read the documentation that comes with your device or program.
+
+Then there is this parameter, called OID, which means "object identifier".
+
+When you start to learn about SNMP it looks very confusing. It isn't
+all that difficult when you look at the Management Information Base
+("MIB").  It is an upside-down tree that describes data, with a single node
+as the root and from there a number of branches.  These branches end
+up in another node, they branch out, etc.  All the branches have a name
+and they form the path that we follow all the way down.  The branches
+that we follow are named: iso, org, dod, internet, mgmt and mib-2.
+These names can also be written down as numbers and are 1 3 6 1 2 1.
+
+   iso.org.dod.internet.mgmt.mib-2 (1.3.6.1.2.1)
+
+There is a lot of confusion about the leading dot that some programs
+use.  There is *no* leading dot in an OID.  However, some programs
+can use the above part of OIDs as a default.  To indicate the difference
+between abbreviated OIDs and full OIDs they need a leading dot when
+you specify the complete OID.  Often those programs will leave out
+the default portion when returning the data to you.  To make things
+worse, they have several default prefixes ...
+
+Ok, lets continue to the start of our OID: we had 1.3.6.1.2.1
+From there, we are especially interested in the branch "interfaces"
+which has number 2 (e.g., 1.3.6.1.2.1.2 or 1.3.6.1.2.1.interfaces).
+
+First, we have to get some SNMP program. First look if there is a
+pre-compiled package available for your OS. This is the preferred way.
+If not, you will have to get the sources yourself and compile those.
+The Internet is full of sources, programs etc. Find information using
+a search engine or whatever you prefer.
+
+Assume you got the program. First try to collect some data that is
+available on most systems. Remember: there is a short name for the
+part of the tree that interests us most in the world we live in!
+
+I will give an example which can be used on Fedora Core 3.  If it
+doesn't work for you, work your way through the manual of snmp and
+adapt the example to make it work.
+
+   snmpget -v2c -c public myrouter system.sysDescr.0
+
+The device should answer with a description of itself, perhaps an
+empty one. Until you got a valid answer from a device, perhaps using a
+different "password", or a different device, there is no point in
+continuing.
+
+   snmpget -v2c -c public myrouter interfaces.ifNumber.0
+
+Hopefully you get a number as a result, the number of interfaces.
+If so, you can carry on and try a different program called "snmpwalk".
+
+   snmpwalk -v2c -c public myrouter interfaces.ifTable.ifEntry.ifDescr
+
+If it returns with a list of interfaces, you're almost there.
+Here's an example:
+   [user@host /home/alex]$ snmpwalk -v2c -c public cisco 2.2.1.2
+
+   interfaces.ifTable.ifEntry.ifDescr.1 = "BRI0: B-Channel 1"
+   interfaces.ifTable.ifEntry.ifDescr.2 = "BRI0: B-Channel 2"
+   interfaces.ifTable.ifEntry.ifDescr.3 = "BRI0" Hex: 42 52 49 30
+   interfaces.ifTable.ifEntry.ifDescr.4 = "Ethernet0"
+   interfaces.ifTable.ifEntry.ifDescr.5 = "Loopback0"
+
+On this cisco equipment, I would like to monitor the "Ethernet0"
+interface and from the above output I see that it is number four. I try:
+
+   [user@host /home/alex]$ snmpget -v2c -c public cisco 2.2.1.10.4 2.2.1.16.4
+
+   interfaces.ifTable.ifEntry.ifInOctets.4 = 2290729126
+   interfaces.ifTable.ifEntry.ifOutOctets.4 = 1256486519
+
+So now I have two OIDs to monitor and they are (in full, this time):
+
+   1.3.6.1.2.1.2.2.1.10
+
+and
+
+   1.3.6.1.2.1.2.2.1.16
+
+both with an interface number of 4.
+
+Don't get fooled, this wasn't my first try. It took some time for me too
+to understand what all these numbers mean. It does help a lot when they
+get translated into descriptive text... At least, when people are talking
+about MIBs and OIDs you know what it's all about.
+Do not forget the interface number (0 if it is not interface dependent)
+and try snmpwalk if you don't get an answer from snmpget.
+
+If you understand the above section and get numbers from your device, continue
+on with this tutorial. If not, then go back and re-read this part.
+
+=head2 A Real World Example
+
+Let the fun begin. First, create a new database. It contains data from
+two counters, called input and output. The data is put into archives
+that average it. They take 1, 6, 24 or 288 samples at a time.
+They also go into archives that keep the maximum numbers. This will be
+explained later on. The time in-between samples is 300 seconds, a good
+starting point, which is the same as five minutes.
+
+ 1 sample "averaged" stays 1 period of 5 minutes
+ 6 samples averaged become one average on 30 minutes
+ 24 samples averaged become one average on 2 hours
+ 288 samples averaged become one average on 1 day
+
+Lets try to be compatible with MRTG which stores about the following
+amount of data:
+
+ 600 5-minute samples:    2   days and 2 hours
+ 600 30-minute samples:  12.5 days
+ 600 2-hour samples:     50   days
+ 732 1-day samples:     732   days
+
+These ranges are appended, so the total amount of data stored in the
+database is approximately 797 days. RRDtool stores the data
+differently, it doesn't start the "weekly" archive where the "daily"
+archive stopped. For both archives the most recent data will be near
+"now" and therefore we will need to keep more data than MRTG does!
+
+We will need:
+
+ 600 samples of 5 minutes  (2 days and 2 hours)
+ 700 samples of 30 minutes (2 days and 2 hours, plus 12.5 days)
+ 775 samples of 2 hours    (above + 50 days)
+ 797 samples of 1 day      (above + 732 days, rounded up to 797)
+
+   rrdtool create myrouter.rrd         \
+            DS:input:COUNTER:600:U:U   \
+            DS:output:COUNTER:600:U:U  \
+            RRA:AVERAGE:0.5:1:600      \
+            RRA:AVERAGE:0.5:6:700      \
+            RRA:AVERAGE:0.5:24:775     \
+            RRA:AVERAGE:0.5:288:797    \
+            RRA:MAX:0.5:1:600          \
+            RRA:MAX:0.5:6:700          \
+            RRA:MAX:0.5:24:775         \
+            RRA:MAX:0.5:288:797
+
+Next thing to do is to collect data and store it. Here is an example.
+It is written partially in pseudo code,  you will have to find out what
+to do exactly on your OS to make it work.
+
+   while not the end of the universe
+   do
+      get result of
+         snmpget router community 2.2.1.10.4
+      into variable $in
+      get result of
+         snmpget router community 2.2.1.16.4
+      into variable $out
+
+      rrdtool update myrouter.rrd N:$in:$out
+
+      wait for 5 minutes
+   done
+
+Then, after collecting data for a day, try to create an image using:
+
+   rrdtool graph myrouter-day.png --start -86400 \
+            DEF:inoctets=myrouter.rrd:input:AVERAGE \
+            DEF:outoctets=myrouter.rrd:output:AVERAGE \
+            AREA:inoctets#00FF00:"In traffic" \
+            LINE1:outoctets#0000FF:"Out traffic"
+
+This should produce a picture with one day worth of traffic.
+One day is 24 hours of 60 minutes of 60 seconds: 24*60*60=86'400, we
+start at now minus 86'400 seconds. We define (with DEFs) inoctets and
+outoctets as the average values from the database myrouter.rrd and draw
+an area for the "in" traffic and a line for the "out" traffic.
+
+View the image and keep logging data for a few more days.
+If you like, you could try the examples from the test database and
+see if you can get various options and calculations to work.
+
+Suggestion: Display in bytes per second and in bits per second. Make
+the Ethernet graphics go red if they are over four megabits per
+second.
+
+=head2 Consolidation Functions
+
+A few paragraphs back I mentioned the possibility of keeping
+the maximum values instead of the average values. Let's go
+into this a bit more.
+
+Recall all the stuff about the speed of the car. Suppose we drove at 144
+KM/H during 5 minutes and then were stopped by the police for 25 minutes.
+At the end of the lecture we would take our laptop and create and view the
+image taken from the database. If we look at the second RRA we did
+create, we would have the average from 6 samples. The samples measured
+would be 144+0+0+0+0+0=144, divided by 30 minutes, corrected for the
+error by 1000, translated into KM/H, with a result of 24 KM/H.
+I would still get a ticket but not for speeding anymore :)
+
+Obviously, in this case we shouldn't look at the averages. In some
+cases they are handy. If you want to know how many KM you had traveled,
+the averaged picture would be the right one to look at. On the other hand, for
+the speed that we traveled at, the maximum numbers seen is much more
+interesting. Later we will see more types.
+
+It is the same for data. If you want to know the amount, look at the
+averages. If you want to know the rate, look at the maximum.
+Over time, they will grow apart more and more. In the last database
+we have created, there are two archives that keep data per day. The
+archive that keeps averages will show low numbers, the archive that
+shows maxima will have higher numbers.
+
+For my car this would translate in averages per day of 96/24=4 KM/H
+(as I travel about 94 kilometers on a day) during working days, and
+maxima of 120 KM/H (my top speed that I reach every day).
+
+Big difference. Do not look at the second graph to estimate the
+distances that I travel and do not look at the first graph to
+estimate my speed. This will work if the samples are close together,
+as they are in five minutes, but not if you average.
+
+On some days, I go for a long ride. If I go across Europe and travel
+for 12 hours, the first graph will rise to about 60 KM/H. The second
+one will show 180 KM/H. This means that I traveled a distance of 60
+KM/H times 24 H = 1440 KM. I did this with a higher speed and a
+maximum around 180 KM/H. However, it probably doesn't mean that I
+traveled for 8 hours at a constant speed of 180 KM/H!
+
+This is a real example: go with the flow through Germany (fast!) and stop
+a few times for gas and coffee. Drive slowly through Austria and the
+Netherlands. Be careful in the mountains and villages. If you would
+look at the graphs created from the five-minute averages you would
+get a totally different picture. You would see the same values on the
+average and maximum graphs (provided I measured every 300 seconds).
+You would be able to see when I stopped, when I was in top gear, when
+I drove over fast highways etc. The granularity of the data is much
+higher, so you can see more. However, this takes 12 samples per hour,
+or 288 values per day, so it would be a lot of data over a longer
+period of time. Therefore we average it, eventually to one value per
+day. From this one value, we cannot see much detail, of course.
+
+Make sure you understand the last few paragraphs. There is no value
+in only a line and a few axis, you need to know what they mean and
+interpret the data in ana appropriate way. This is true for all data.
+
+The biggest mistake you can make is to use the collected data for
+something that it is not suitable for. You would be better off if
+you didn't have the graph at all.
+
+
+=head2 Let's review what you now should know
+
+You know how to create a database and can put data in it. You can get
+the numbers out again by creating an image, do math on the data from
+the database and view the resulte instead of the raw data.  You know
+about the difference between averages and maxima, and when to use
+which (or at least you should have an idea).
+
+RRDtool can do more than what we have learned up to now. Before you
+continue with the rest of this doc, I recommend that you reread from
+the start and try some modifications on the examples. Make sure you
+fully understand everything. It will be worth the effort and helps
+you not only with the rest of this tutorial, but also in your day to day
+monitoring long after you read this introduction.
+
+=head2 Data Source Types
+
+All right, you feel like continuing. Welcome back and get ready
+for an increased speed in the examples and explanations.
+
+You know that in order to view a counter over time, you have to
+take two numbers and divide the difference of them between the
+time lapsed.  This makes sense for the examples I gave you but there
+are other possibilities.  For instance, I'm able to retrieve the
+temperature from my router in three places namely the inlet, the
+so called hot-spot and the exhaust.  These values are not counters.
+If I take the difference of the two samples and divide that by
+300 seconds I would be asking for the temperature change per second.
+Hopefully this is zero! If not, the computer room is probably on fire :)
+
+So, what can we do?  We can tell RRDtool to store the values we measure
+directly as they are (this is not entirely true but close enough). The
+graphs we make will look much better, they will show a rather constant
+value. I know when the router is busy (it
+works -> it uses more electricity -> it generates more heat -> the
+temperature rises). I know when the doors are left open (the room is
+air conditioned) -> the warm air from the rest of the building flows into the
+computer room -> the inlet temperature rises). Etc. The data type we
+use when creating the database before was counter, we now have a
+different data type and thus a different name for it. It is called
+GAUGE. There are more such data types:
+
+ - COUNTER   we already know this one
+ - GAUGE     we just learned this one
+ - DERIVE
+ - ABSOLUTE
+
+The two additional types are DERIVE and ABSOLUTE. Absolute can be used like
+counter with one difference: RRDtool assumes the counter is reset when
+it's read. That is: its delta is known without calculation by RRDtool
+whereas RRDtool needs to calculate it for the counter type.
+Example: our first example (12'345, 12'357, 12'363, 12'363) would read:
+unknown, 12, 6, 0. The rest of the calculations stay the same.
+The other one, derive, is like counter. Unlike counter, it can also
+decrease so it can have a negative delta. Again, the rest of the
+calculations stay the same.
+
+Let's try them all:
+
+   rrdtool create all.rrd --start 978300900 \
+            DS:a:COUNTER:600:U:U \
+            DS:b:GAUGE:600:U:U \
+            DS:c:DERIVE:600:U:U \
+            DS:d:ABSOLUTE:600:U:U \
+            RRA:AVERAGE:0.5:1:10
+   rrdtool update all.rrd \
+            978301200:300:1:600:300    \
+            978301500:600:3:1200:600   \
+            978301800:900:5:1800:900   \
+            978302100:1200:3:2400:1200 \
+            978302400:1500:1:2400:1500 \
+            978302700:1800:2:1800:1800 \
+            978303000:2100:4:0:2100    \
+            978303300:2400:6:600:2400  \
+            978303600:2700:4:600:2700  \
+            978303900:3000:2:1200:3000
+   rrdtool graph all1.png -s 978300600 -e 978304200 -h 400 \
+            DEF:linea=all.rrd:a:AVERAGE LINE3:linea#FF0000:"Line A" \
+            DEF:lineb=all.rrd:b:AVERAGE LINE3:lineb#00FF00:"Line B" \
+            DEF:linec=all.rrd:c:AVERAGE LINE3:linec#0000FF:"Line C" \
+            DEF:lined=all.rrd:d:AVERAGE LINE3:lined#000000:"Line D"
+
+=head2 RRDtool under the Microscope
+
+=over 2
+
+=item *
+
+Line A is a COUNTER type, so it should continuously increment and RRDtool
+must calculate the differences. Also, RRDtool needs to divide the
+difference by the amount of time lapsed. This should end up as a
+straight line at 1 (the deltas are 300, the time is 300).
+
+=item *
+
+Line B is of type GAUGE. These are "real" values so they should match
+what we put in: a sort of a wave.
+
+=item *
+
+Line C is of type DERIVE. It should be a counter that can decrease. It does
+so between 2'400 and 0, with 1'800 in-between.
+
+=item *
+
+Line D is of type ABSOLUTE. This is like counter but it works on
+values without calculating the difference. The numbers are the same
+and as you can see (hopefully) this has a different result.
+
+=back
+
+This translates in the following values, starting at 23:10 and ending
+at 00:10 the next day (where "u" means unknown/unplotted):
+
+ - Line A:  u  u  1  1  1  1  1  1  1  1  1  u
+ - Line B:  u  1  3  5  3  1  2  4  6  4  2  u
+ - Line C:  u  u  2  2  2  0 -2 -6  2  0  2  u
+ - Line D:  u  1  2  3  4  5  6  7  8  9 10  u
+
+If your PNG shows all this, you know you have entered the data correctly,
+the RRDtool executable is working properly, your viewer doesn't fool you,
+and you successfully entered the year 2000 :)
+
+You could try the same example four times, each time with only one of
+the lines.
+
+Let's go over the data again:
+
+=over 2
+
+=item *
+
+Line A: 300,600,900 and so on. The counter delta is a constant 300 and
+so is the time delta. A number divided by itself is always 1 (except
+when dividing by zero which is undefined/illegal).
+
+Why is it that the first point is unknown? We do know what we put into
+the database, right? True, But we didn't have a value to calculate the delta
+from, so we don't know where we started. It would be wrong to assume we
+started at zero so we don't!
+
+=item *
+
+Line B: There is nothing to calculate. The numbers are as they are.
+
+=item *
+
+Line C: Again, the start-out value is unknown. The same story is holds
+as for line A. In this case the deltas are not constant, therefore the line
+is not either. If we would put the same numbers in the database as we did for
+line A, we would have gotten the same line. Unlike type counter,
+this type can decrease and I hope to show you later on why
+this makes a difference.
+
+=item *
+
+Line D: Here the device calculates the deltas. Therefore we DO know the
+first delta and it is plotted. We had the same input as with line A, but
+the meaning of this input is different and thus the line is different.
+In this case the deltas increase each time with 300. The time delta
+stays at a constant 300 and therefore the division of the two gives
+increasing values.
+
+=back
+
+=head2 Counter Wraps
+
+There are a few more basics to show. Some important options are still to
+be covered and we haven't look at counter wraps yet. First the counter wrap:
+In our car we notice that the counter shows 999'987. We travel 20 KM and
+the counter should go to 1'000'007. Unfortunately, there are only six digits
+on our counter so it really shows 000'007. If we would plot that on a type
+DERIVE, it would mean that the counter was set back 999'980 KM. It wasn't,
+and there has to be some protection for this. This protection is only
+available for type COUNTER which should be used for this kind of counter
+anyways. How does it work? Type counter should never decrease and
+therefore RRDtool must assume it wrapped if it does decrease!
+If the delta is negative, this can be compensated for by adding the
+maximum value of the counter + 1. For our car this would be:
+
+ Delta = 7 - 999'987 = -999'980    (instead of 1'000'007-999'987=20)
+
+ Real delta = -999'980 + 999'999 + 1 = 20
+
+At the time of writing this document, RRDtool knows of counters that
+are either 32 bits or 64 bits of size. These counters can handle the
+following different values:
+
+ - 32 bits: 0 ..           4'294'967'295
+ - 64 bits: 0 .. 18'446'744'073'709'551'615
+
+If these numbers look strange to you, you can view them in
+their hexadecimal form:
+
+ - 32 bits: 0 ..         FFFFFFFF
+ - 64 bits: 0 .. FFFFFFFFFFFFFFFF
+
+RRDtool handles both counters the same. If an overflow occurs and
+the delta would be negative, RRDtool first adds the maximum of a small
+counter + 1 to the delta. If the delta is still negative, it had to be
+the large counter that wrapped. Add the maximum possible value of the
+large counter + 1 and subtract the erroneously added small value.
+
+There is a risk in this: suppose the large counter wrapped while adding
+a huge delta, it could happen, theoretically, that adding the smaller value
+would make the delta positive. In this unlikely case the results would
+not be correct. The increase should be nearly as high as the maximum
+counter value for that to happen, so chances are you would have several
+other problems as well and this particular problem would not even be
+worth thinking about. Even though, I did include an example, so you
+can judge for yourself.
+
+The next section gives you some numerical examples for counter-wraps.
+Try to do the calculations yourself or just believe me if your calculator
+can't handle the numbers :)
+
+Correction numbers:
+
+ - 32 bits: (4'294'967'295 + 1) =                                4'294'967'296
+ - 64 bits: (18'446'744'073'709'551'615 + 1)
+                                   - correction1 = 18'446'744'069'414'584'320
+
+ Before:        4'294'967'200
+ Increase:                100
+ Should become: 4'294'967'300
+ But really is:             4
+ Delta:        -4'294'967'196
+ Correction1:  -4'294'967'196 + 4'294'967'296 = 100
+
+ Before:        18'446'744'073'709'551'000
+ Increase:                             800
+ Should become: 18'446'744'073'709'551'800
+ But really is:                        184
+ Delta:        -18'446'744'073'709'550'816
+ Correction1:  -18'446'744'073'709'550'816
+                               + 4'294'967'296 = -18'446'744'069'414'583'520
+ Correction2:  -18'446'744'069'414'583'520
+                  + 18'446'744'069'414'584'320 = 800
+
+ Before:        18'446'744'073'709'551'615 ( maximum value )
+ Increase:      18'446'744'069'414'584'320 ( absurd increase, minimum for
+ Should become: 36'893'488'143'124'135'935             this example to work )
+ But really is: 18'446'744'069'414'584'319
+ Delta:                     -4'294'967'296
+ Correction1:  -4'294'967'296 + 4'294'967'296 = 0
+ (not negative -> no correction2)
+
+ Before:        18'446'744'073'709'551'615 ( maximum value )
+ Increase:      18'446'744'069'414'584'319 ( one less increase )
+ Should become: 36'893'488'143'124'135'934
+ But really is: 18'446'744'069'414'584'318
+ Delta:                     -4'294'967'297
+ Correction1:  -4'294'967'297 + 4'294'967'296 = -1
+ Correction2:  -1 + 18'446'744'069'414'584'320 = 18'446'744'069'414'584'319
+
+As you can see from the last two examples, you need strange numbers
+for RRDtool to fail (provided it's bug free of course), so this should
+not happen. However, SNMP or whatever method you choose to collect the
+data, might also report wrong numbers occasionally.  We can't prevent all
+errors, but there are some things we can do. The RRDtool "create" command
+takes two special parameters for this. They define
+the minimum and maximum allowed values. Until now, we used "U", meaning
+"unknown". If you provide values for one or both of them and if RRDtool
+receives data points that are outside these limits, it will ignore those
+values. For a thermometer in degrees Celsius, the absolute minimum is
+just under -273. For my router, I can assume this minimum is much higher
+so I would set it to 10, where as the maximum temperature I would
+set to 80. Any higher and the device would be out of order.
+
+For the speed of my car, I would never expect negative numbers and
+also I would not expect a speed  higher than 230. Anything else,
+and there must have been an error. Remember: the opposite is not true,
+if the numbers pass this check, it doesn't mean that they are
+correct. Always judge the graph with a healthy dose of suspicion if it
+seems weird to you.
+
+=head2 Data Resampling
+
+One important feature of RRDtool has not been explained yet: it is
+virtually impossible to collect data and feed it into RRDtool on exact
+intervals. RRDtool therefore interpolates the data, so they are stored
+on exact intervals. If you do not know what this means or how it
+works, then here's the help you seek:
+
+Suppose a counter increases by exactly one for every second. You want
+to measure it in 300 seconds intervals. You should retrieve values
+that are exactly 300 apart. However, due to various circumstances you
+are a few seconds late and the interval is 303. The delta will also be
+303 in that case. Obviously, RRDtool should not put 303 in the database
+and make you believe that the counter increased by 303 in 300 seconds.
+This is where RRDtool interpolates: it alters the 303 value as if it
+would have been stored earlier and it will be 300 in 300 seconds.
+Next time you are at exactly the right time. This means that the current
+interval is 297 seconds and also the counter increased by 297. Again,
+RRDtool interpolates and stores 300 as it should be.
+
+      in the RRD                 in reality
+
+ time+000:   0 delta="U"   time+000:    0 delta="U"
+ time+300: 300 delta=300   time+300:  300 delta=300
+ time+600: 600 delta=300   time+603:  603 delta=303
+ time+900: 900 delta=300   time+900:  900 delta=297
+
+Let's create two identical databases. I've chosen the time range 920'805'000
+to 920'805'900 as this goes very well with the example numbers.
+
+   rrdtool create seconds1.rrd   \
+      --start 920804700          \
+      DS:seconds:COUNTER:600:U:U \
+      RRA:AVERAGE:0.5:1:24
+
+Make a copy
+
+   for Unix: cp seconds1.rrd seconds2.rrd
+   for Dos:  copy seconds1.rrd seconds2.rrd
+   for vms:  how would I know :)
+
+Put in some data
+
+   rrdtool update seconds1.rrd \
+      920805000:000 920805300:300 920805600:600 920805900:900
+   rrdtool update seconds2.rrd \
+      920805000:000 920805300:300 920805603:603 920805900:900
+
+Create output
+
+   rrdtool graph seconds1.png                       \
+      --start 920804700 --end 920806200             \
+      --height 200                                  \
+      --upper-limit 1.05 --lower-limit 0.95 --rigid \
+      DEF:seconds=seconds1.rrd:seconds:AVERAGE      \
+      CDEF:unknown=seconds,UN                       \
+      LINE2:seconds#0000FF                          \
+      AREA:unknown#FF0000
+   rrdtool graph seconds2.png                       \
+      --start 920804700 --end 920806200             \
+      --height 200                                  \
+      --upper-limit 1.05 --lower-limit 0.95 --rigid \
+      DEF:seconds=seconds2.rrd:seconds:AVERAGE      \
+      CDEF:unknown=seconds,UN                       \
+      LINE2:seconds#0000FF                          \
+      AREA:unknown#FF0000
+
+View both images together (add them to your index.html file)
+and compare. Both graphs should show the same, despite the
+input being different.
+
+=head1 WRAPUP
+
+It's time now to wrap up this tutorial. We covered all the basics for
+you to be able to work with RRDtool and to read the additional
+documentation available. There is plenty more to discover about
+RRDtool and you will find more and more uses for this package. You can
+easly create graphs using just the examples provided and using only
+RRDtool. You can also use one of the front ends to RRDtool that are
+available.
+
+=head1 MAILINGLIST
+
+Remember to subscribe to the RRDtool mailing list. Even if you are not
+answering to mails that come by, it helps both you and the rest of the
+users. A lot of the stuff that I know about MRTG (and therefore about
+RRDtool) I've learned while just reading the list without posting to
+it. I did not need to ask the basic questions as they are answered in
+the FAQ (read it!) and in various mails by other users. With
+thousands of users all over the world, there will always be people who
+ask questions that you can answer because you read this and other
+documentation and they didn't.
+
+=head1 SEE ALSO
+
+The RRDtool manpages
+
+=head1 AUTHOR
+
+I hope you enjoyed the examples and their descriptions. If you do, help
+other people by pointing them to this document when they are asking
+basic questions. They will not only get their answers, but at the same
+time learn a whole lot more.
+
+Alex van den Bogaerdt
+E<lt>alex@ergens.op.het.netE<gt>
+
diff --git a/doc/rrdtutorial.txt b/doc/rrdtutorial.txt
new file mode 100644 (file)
index 0000000..3e64a16
--- /dev/null
@@ -0,0 +1,1152 @@
+RRDTUTORIAL(1)                      rrdtool                     RRDTUTORIAL(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdtutorial - Alex van den Bogaerdt's RRDtool tutorial
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       RRDtool is written by Tobias Oetiker <tobi@oetiker.ch> with contribu-
+       tions from many people all around the world. This document is written
+       by Alex van den Bogaerdt <alex@ergens.op.het.net> to help you under-
+       stand what RRDtool is and what it can do for you.
+
+       The documentation provided with RRDtool can be too technical for some
+       people. This tutorial is here to help you understand the basics of RRD-
+       tool. It should prepare you to read the documentation yourself.  It
+       also explains the general things about statistics with a focus on net-
+       working.
+
+T\bTU\bUT\bTO\bOR\bRI\bIA\bAL\bL
+       I\bIm\bmp\bpo\bor\brt\bta\ban\bnt\bt
+
+       Please don't skip ahead in this document!  The first part of this docu-
+       ment explains the basics and may be boring.  But if you don't under-
+       stand the basics, the examples will not be as meaningful to you.
+
+       W\bWh\bha\bat\bt i\bis\bs R\bRR\bRD\bDt\bto\boo\bol\bl?\b?
+
+       RRDtool refers to Round Robin Database tool.  Round robin is a tech-
+       nique that works with a fixed amount of data, and a pointer to the cur-
+       rent element. Think of a circle with some dots plotted on the edge --
+       these dots are the places where data can be stored. Draw an arrow from
+       the center of the circle to one of the dots -- this is the pointer.
+       When the current data is read or written, the pointer moves to the next
+       element. As we are on a circle there is neither a beginning nor an end,
+       you can go on and on and on. After a while, all the available places
+       will be used and the process automatically reuses old locations. This
+       way, the dataset will not grow in size and therefore requires no main-
+       tenance.  RRDtool works with with Round Robin Databases (RRDs). It
+       stores and retrieves data from them.
+
+       W\bWh\bha\bat\bt d\bda\bat\bta\ba c\bca\ban\bn b\bbe\be p\bpu\but\bt i\bin\bnt\bto\bo a\ban\bn R\bRR\bRD\bD?\b?
+
+       You name it, it will probably fit as long as it is some sort of time-
+       series data. This means you have to be able to measure some value at
+       several points in time and provide this information to RRDtool. If you
+       can do this, RRDtool will be able to store it. The values must be
+       numerical but don't have to be integers, as is the case with MRTG (the
+       next section will give more details on this more specialized applica-
+       tion).
+
+       Many examples below talk about SNMP which is an acronym for Simple Net-
+       work Management Protocol. "Simple" refers to the protocol -- it does
+       not mean it is simple to manage or monitor a network. After working
+       your way through this document, you should know enough to be able to
+       understand what people are talking about. For now, just realize that
+       SNMP can be used to query devices for the values of counters they keep.
+       It is the value from those counters that we want to store in the RRD.
+
+       W\bWh\bha\bat\bt c\bca\ban\bn I\bI d\bdo\bo w\bwi\bit\bth\bh t\bth\bhi\bis\bs t\bto\boo\bol\bl?\b?
+
+       RRDtool originated from MRTG (Multi Router Traffic Grapher). MRTG
+       started as a tiny little script for graphing the use of a university's
+       connection to the Internet. MRTG was later (ab-)used as a tool for
+       graphing other data sources including temperature, speed, voltage, num-
+       ber of printouts and the like.
+
+       Most likely you will start to use RRDtool to store and process data
+       collected via SNMP. The data will most likely be bytes (or bits) trans-
+       fered from and to a network or a computer.  But it can also be used to
+       display tidal waves, solar radiation, power consumption, number of vis-
+       itors at an exhibition, noise levels near an airport, temperature on
+       your favorite holiday location, temperature in the fridge and whatever
+       you imagination can come up with.
+
+       You only need a sensor to measure the data and be able to feed the num-
+       bers into RRDtool. RRDtool then lets you create a database, store data
+       in it, retrieve that data and create graphs in PNG format for display
+       on a web browser. Those PNG images are dependent on the data you col-
+       lected and could be, for instance, an overview of the average network
+       usage, or the peaks that occurred.
+
+       W\bWh\bha\bat\bt i\bif\bf I\bI s\bst\bti\bil\bll\bl h\bha\bav\bve\be p\bpr\bro\bob\bbl\ble\bem\bms\bs a\baf\bft\bte\ber\br r\bre\bea\bad\bdi\bin\bng\bg t\bth\bhi\bis\bs d\bdo\boc\bcu\bum\bme\ben\bnt\bt?\b?
+
+       First of all: read it again! You may have missed something.  If you are
+       unable to compile the sources and you have a fairly common OS, it will
+       probably not be the fault of RRDtool. There may be pre-compiled ver-
+       sions around on the Internet. If they come from trusted sources, get
+       one of those.
+
+       If on the other hand the program works but does not give you the
+       expected results, it will be a problem with configuring it. Review your
+       configuration and compare it with the examples that follow.
+
+       There is a mailing list and an archive of it. Read the list for a few
+       weeks and search the archive. It is considered rude to just ask a ques-
+       tion without searching the archives: your problem may already have been
+       solved for somebody else!  This is true for most, if not all, mailing
+       lists and not only for this particular one. Look in the documentation
+       that came with RRDtool for the location and usage of the list.
+
+       I suggest you take a moment to subscribe to the mailing list right now
+       by sending an email to <rrd-users-request@lists.oetiker.ch> with a sub-
+       ject of "subscribe". If you ever want to leave this list, just write an
+       email to the same address but now with a subject of "unsubscribe".
+
+       H\bHo\bow\bw w\bwi\bil\bll\bl y\byo\bou\bu h\bhe\bel\blp\bp m\bme\be?\b?
+
+       By giving you some detailed descriptions with detailed examples.  I
+       assume that following the instructions in the order presented will give
+       you enough knowledge of RRDtool to experiment for yourself.  If it
+       doesn't work the first time, don't give up. Reread the stuff that you
+       did understand, you may have missed something.
+
+       By following the examples you get some hands-on experience and, even
+       more important, some background information of how it works.
+
+       You will need to know something about hexadecimal numbers. If you don't
+       then start with reading bin_dec_hex before you continue here.
+
+       Y\bYo\bou\bur\br f\bfi\bir\brs\bst\bt R\bRo\bou\bun\bnd\bd R\bRo\bob\bbi\bin\bn D\bDa\bat\bta\bab\bba\bas\bse\be
+
+       In my opinion the best way to learn something is to actually do it.
+       Why not start right now?  We will create a database, put some values in
+       it and extract this data again.  Your output should be the same as the
+       output that is included in this document.
+
+       We will start with some easy stuff and compare a car with a router, or
+       compare kilometers (miles if you wish) with bits and bytes. It's all
+       the same: some number over some time.
+
+       Assume we have a device that transfers bytes to and from the Internet.
+       This device keeps a counter that starts at zero when it is turned on,
+       increasing with every byte that is transfered. This counter will proba-
+       bly have a maximum value. If this value is reached and an extra byte is
+       counted, the counter starts over at zero. This is the same as many
+       counters in the world such as the mileage counter in a car.
+
+       Most discussions about networking talk about bits per second so lets
+       get used to that right away. Assume a byte is eight bits and start to
+       think in bits not bytes. The counter, however, still counts bytes!  In
+       the SNMP world most of the counters are 32 bits. That means they are
+       counting from 0 to 4'294'967'295. We will use these values in the exam-
+       ples.  The device, when asked, returns the current value of the
+       counter. We know the time that has passes since we last asked so we now
+       know how many bytes have been transfered ***on average*** per second.
+       This is not very hard to calculate. First in words, then in calcula-
+       tions:
+
+       1. Take the current counter, subtract the previous value from it.
+
+       2. Do the same with the current time and the previous time (in sec-
+          onds).
+
+       3. Divide the outcome of (1) by the outcome of (2), the result is the
+          amount of bytes per second. Multiply by eight to get the number of
+          bits per second (bps).
+
+         bps = (counter_now - counter_before) / (time_now - time_before) * 8
+
+       For some people it may help to translate this to an automobile example.
+       Do not try this example, and if you do, don't blame me for the results!
+
+       People who are not used to think in kilometers per hour can translate
+       most into miles per hour by dividing km by 1.6 (close enough).  I will
+       use the following abbreviations:
+
+        M:    meter
+        KM:   kilometer (= 1'000 meters).
+        H:    hour
+        S:    second
+        KM/H: kilometers per hour
+        M/S:  meters per second
+
+       You are driving a car. At 12:05 you read the counter in the dashboard
+       and it tells you that the car has moved 12'345 KM until that moment.
+       At 12:10 you look again, it reads 12'357 KM. This means you have trav-
+       eled 12 KM in five minutes. A scientist would translate that into
+       meters per second and this makes a nice comparison toward the problem
+       of (bytes per five minutes) versus (bits per second).
+
+       We traveled 12 kilometers which is 12'000 meters. We did that in five
+       minutes or 300 seconds. Our speed is 12'000M / 300S or 40 M/S.
+
+       We could also calculate the speed in KM/H: 12 times 5 minutes is an
+       hour, so we have to multiply 12 KM by 12 to get 144 KM/H.  For our
+       native English speaking friends: that's 90 MPH so don't try this exam-
+       ple at home or where I live :)
+
+       Remember: these numbers are averages only.  There is no way to figure
+       out from the numbers, if you drove at a constant speed.  There is an
+       example later on in this tutorial that explains this.
+
+       I hope you understand that there is no difference in calculating M/S or
+       bps; only the way we collect the data is different. Even the K from
+       kilo is the same as in networking terms k also means 1'000.
+
+       We will now create a database where we can keep all these interesting
+       numbers. The method used to start the program may differ slightly from
+       OS to OS, but I assume you can figure it out if it works different on
+       your's. Make sure you do not overwrite any file on your system when
+       executing the following command and type the whole line as one long
+       line (I had to split it for readability) and skip all of the '\' char-
+       acters.
+
+          rrdtool create test.rrd             \
+                   --start 920804400          \
+                   DS:speed:COUNTER:600:U:U   \
+                   RRA:AVERAGE:0.5:1:24       \
+                   RRA:AVERAGE:0.5:6:10
+
+       (So enter: "rrdtool create test.rrd --start 920804400 DS ...")
+
+       W\bWh\bha\bat\bt h\bha\bas\bs b\bbe\bee\ben\bn c\bcr\bre\bea\bat\bte\bed\bd?\b?
+
+       We created the round robin database called test (test.rrd) which starts
+       at noon the day I started writing this document, 7th of March, 1999
+       (this date translates to 920'804'400 seconds as explained below). Our
+       database holds one data source (DS) named "speed" that represents a
+       counter. This counter is read every five minutes (this is the default
+       therefore you don't have to put "--step=300").  In the same database
+       two round robin archives (RRAs) are kept, one averages the data every
+       time it is read (e.g., there's nothing to average) and keeps 24 samples
+       (24 times 5 minutes is 2 hours). The other averages 6 values (half
+       hour) and contains 10 such averages (e.g. 5 hours).
+
+       RRDtool works with special time stamps coming from the UNIX world.
+       This time stamp is the number of seconds that passed since January 1st
+       1970 UTC.  The time stamp value is translated into local time and it
+       will therefore look different for different time zones.
+
+       Chances are that you are not in the same part of the world as I am.
+       This means your time zone is different. In all examples where I talk
+       about time, the hours may be wrong for you. This has little effect on
+       the results of the examples, just correct the hours while reading.  As
+       an example: where I will see "12:05" the UK folks will see "11:05".
+
+       We now have to fill our database with some numbers. We'll pretend to
+       have read the following numbers:
+
+        12:05  12345 KM
+        12:10  12357 KM
+        12:15  12363 KM
+        12:20  12363 KM
+        12:25  12363 KM
+        12:30  12373 KM
+        12:35  12383 KM
+        12:40  12393 KM
+        12:45  12399 KM
+        12:50  12405 KM
+        12:55  12411 KM
+        13:00  12415 KM
+        13:05  12420 KM
+        13:10  12422 KM
+        13:15  12423 KM
+
+       We fill the database as follows:
+
+        rrdtool update test.rrd 920804700:12345 920805000:12357 920805300:12363
+        rrdtool update test.rrd 920805600:12363 920805900:12363 920806200:12373
+        rrdtool update test.rrd 920806500:12383 920806800:12393 920807100:12399
+        rrdtool update test.rrd 920807400:12405 920807700:12411 920808000:12415
+        rrdtool update test.rrd 920808300:12420 920808600:12422 920808900:12423
+
+       This reads: update our test database with the following numbers
+
+        time 920804700, value 12345
+        time 920805000, value 12357
+
+       etcetera.
+
+       As you can see, it is possible to feed more than one value into the
+       database in one command. I had to stop at three for readability but the
+       real maximum per line is OS dependent.
+
+       We can now retrieve the data from our database using "rrdtool fetch":
+
+        rrdtool fetch test.rrd AVERAGE --start 920804400 --end 920809200
+
+       It should return the following output:
+
+                                 speed
+
+        920804700: nan
+        920805000: 4.0000000000e-02
+        920805300: 2.0000000000e-02
+        920805600: 0.0000000000e+00
+        920805900: 0.0000000000e+00
+        920806200: 3.3333333333e-02
+        920806500: 3.3333333333e-02
+        920806800: 3.3333333333e-02
+        920807100: 2.0000000000e-02
+        920807400: 2.0000000000e-02
+        920807700: 2.0000000000e-02
+        920808000: 1.3333333333e-02
+        920808300: 1.6666666667e-02
+        920808600: 6.6666666667e-03
+        920808900: 3.3333333333e-03
+        920809200: nan
+
+       If it doesn't, something may be wrong.  Perhaps your OS will print
+       "NaN" in a different form. "NaN" stands for "Not A Number".  If your OS
+       writes "U" or "UNKN" or something similar that's okay.  If something
+       else is wrong, it will probably be due to an error you made (assuming
+       that my tutorial is correct of course :-). In that case: delete the
+       database and try again.  Sometimes things change.  This example used to
+       provide numbers like "0.04" in stead of "4.00000e-02".  Those are
+       really the same numbers, just written down differently.  Don't be
+       alarmed if a future version of rrdtool displays a slightly different
+       form of output. The examples in this document are correct for version
+       1.2.0 of RRDtool.
+
+       The meaning of the above output will become clear below.
+
+       T\bTi\bim\bme\be t\bto\bo c\bcr\bre\bea\bat\bte\be s\bso\bom\bme\be g\bgr\bra\bap\bph\bhi\bic\bcs\bs
+
+       Try the following command:
+
+        rrdtool graph speed.png                                 \
+                --start 920804400 --end 920808000               \
+                DEF:myspeed=test.rrd:speed:AVERAGE              \
+                LINE2:myspeed#FF0000
+
+       This will create speed.png which starts at 12:00 and ends at 13:00.
+       There is a definition of a variable called myspeed, using the data from
+       RRA "speed" out of database "test.rrd". The line drawn is 2 pixels high
+       and represents the variable myspeed. The color is red (specified by its
+       rgb-representation, see below).
+
+       You'll notice that the start of the graph is not at 12:00 but at 12:05.
+       This is because we have insufficient data to tell the average before
+       that time. This will only happen when you miss some samples, this will
+       not happen a lot, hopefully.
+
+       If this has worked: congratulations! If not, check what went wrong.
+
+       The colors are built up from red, green and blue. For each of the com-
+       ponents, you specify how much to use in hexadecimal where 00 means not
+       included and FF means fully included.  The "color" white is a mixture
+       of red, green and blue: FFFFFF The "color" black is all colors off:
+       000000
+
+          red     #FF0000
+          green   #00FF00
+          blue    #0000FF
+          magenta #FF00FF     (mixed red with blue)
+          gray    #555555     (one third of all components)
+
+       Additionally you can add an alpha channel (transparency).  The default
+       will be "FF" which means non-transparent.
+
+       The PNG you just created can be displayed using your favorite image
+       viewer.  Web browsers will display the PNG via the URL
+       "file:///the/path/to/speed.png"
+
+       G\bGr\bra\bap\bph\bhi\bic\bcs\bs w\bwi\bit\bth\bh s\bso\bom\bme\be m\bma\bat\bth\bh
+
+       When looking at the image, you notice that the horizontal axis is
+       labeled 12:10, 12:20, 12:30, 12:40 and 12:50. Sometimes a label doesn't
+       fit (12:00 and 13:00 would be candidates) so they are skipped.
+
+       The vertical axis displays the range we entered. We provided kilometers
+       and when divided by 300 seconds, we get very small numbers. To be
+       exact, the first value was 12 (12'357-12'345) and divided by 300 this
+       makes 0.04, which is displayed by RRDtool as "40 m" meaning "40/1'000".
+       The "m" (milli) has nothing to do with meters, kilometers or millime-
+       ters! RRDtool doesn't know about the physical units of our data, it
+       just works with dimensionless numbers.
+
+       If we had measured our distances in meters, this would have been
+       (12'357'000-12'345'000)/300 = 12'000/300 = 40.
+
+       As most people have a better feel for numbers in this range, we'll cor-
+       rect that. We could recreate our database and store the correct data,
+       but there is a better way: we do some calculations while creating the
+       png file!
+
+          rrdtool graph speed2.png                           \
+             --start 920804400 --end 920808000               \
+             --vertical-label m/s                            \
+             DEF:myspeed=test.rrd:speed:AVERAGE              \
+             CDEF:realspeed=myspeed,1000,\*                  \
+             LINE2:realspeed#FF0000
+
+       Note: Make sure not to forget the backslash \ in front of the multipli-
+       cation operator * above. The backslash is needed to "escape" the * as
+       some operating systems might interpret and expand * instead of passing
+       it to the rrdtool command.
+
+       After viewing this PNG, you notice the "m" (milli) has disappeared.
+       This it what the correct result would be. Also, a label has been added
+       to the image.  Apart from the things mentioned above, the PNG should
+       look the same.
+
+       The calculations are specified in the CDEF part above and are in
+       Reverse Polish Notation ("RPN"). What we requested RRDtool to do is:
+       "take the data source myspeed and the number 1000; multiply those".
+       Don't bother with RPN yet, it will be explained later on in more
+       detail. Also, you may want to read my tutorial on CDEFs and Steve
+       Rader's tutorial on RPN. But first finish this tutorial.
+
+       Hang on! If we can multiply values with 1'000, it should also be possi-
+       ble to display kilometers per hour from the same data!
+
+       To change a value that is measured in meters per second:
+
+        Calculate meters per hour:     value * 3'600
+        Calculate kilometers per hour: value / 1'000
+        Together this makes:           value * (3'600/1'000) or value * 3.6
+
+       In our example database we made a mistake and we need to compensate for
+       this by multiplying with 1'000. Applying that correction:
+
+        value * 3.6  * 1'000 == value * 3'600
+
+       Now let's create this PNG, and add some more magic ...
+
+        rrdtool graph speed3.png                             \
+             --start 920804400 --end 920808000               \
+             --vertical-label km/h                           \
+             DEF:myspeed=test.rrd:speed:AVERAGE              \
+             "CDEF:kmh=myspeed,3600,*"                       \
+             CDEF:fast=kmh,100,GT,kmh,0,IF                   \
+             CDEF:good=kmh,100,GT,0,kmh,IF                   \
+             HRULE:100#0000FF:"Maximum allowed"              \
+             AREA:good#00FF00:"Good speed"                   \
+             AREA:fast#FF0000:"Too fast"
+
+       Note: here we use another means to escape the * operator by enclosing
+       the whole string in double quotes.
+
+       This graph looks much better. Speed is shown in KM/H and there is even
+       an extra line with the maximum allowed speed (on the road I travel on).
+       I also changed the colors used to display speed and changed it from a
+       line into an area.
+
+       The calculations are more complex now. For speed measurements within
+       the speed limit they are:
+
+          Check if kmh is greater than 100    ( kmh,100 ) GT
+          If so, return 0, else kmh           ((( kmh,100 ) GT ), 0, kmh) IF
+
+       For values above the speed limit:
+
+          Check if kmh is greater than 100    ( kmh,100 ) GT
+          If so, return kmh, else return 0    ((( kmh,100) GT ), kmh, 0) IF
+
+       G\bGr\bra\bap\bph\bhi\bic\bcs\bs M\bMa\bag\bgi\bic\bc
+
+       I like to believe there are virtually no limits to how RRDtool graph
+       can manipulate data. I will not explain how it works, but look at the
+       following PNG:
+
+          rrdtool graph speed4.png                           \
+             --start 920804400 --end 920808000               \
+             --vertical-label km/h                           \
+             DEF:myspeed=test.rrd:speed:AVERAGE              \
+             "CDEF:kmh=myspeed,3600,*"                       \
+             CDEF:fast=kmh,100,GT,100,0,IF                   \
+             CDEF:over=kmh,100,GT,kmh,100,-,0,IF             \
+             CDEF:good=kmh,100,GT,0,kmh,IF                   \
+             HRULE:100#0000FF:"Maximum allowed"              \
+             AREA:good#00FF00:"Good speed"                   \
+             AREA:fast#550000:"Too fast"                     \
+             STACK:over#FF0000:"Over speed"
+
+       Let's create a quick and dirty HTML page to view the three PNGs:
+
+          <HTML><HEAD><TITLE>Speed</TITLE></HEAD><BODY>
+          <IMG src="speed2.png" alt="Speed in meters per second">
+          <BR>
+          <IMG src="speed3.png" alt="Speed in kilometers per hour">
+          <BR>
+          <IMG src="speed4.png" alt="Traveled too fast?">
+          </BODY></HTML>
+
+       Name the file "speed.html" or similar, and look at it in your web
+       browser.
+
+       Now, all you have to do is measure the values regularly and update the
+       database.  When you want to view the data, recreate the PNGs and make
+       sure to refresh them in your browser. (Note: just clicking reload may
+       not be enough, especially when proxies are involved.  Try shift-reload
+       or ctrl-F5).
+
+       U\bUp\bpd\bda\bat\bte\bes\bs i\bin\bn R\bRe\bea\bal\bli\bit\bty\by
+
+       We've already used the "update" command: it took one or more parameters
+       in the form of "<time>:<value>". You'll be glad to know that you can
+       specify the current time by filling in a "N" as the time.  Or you could
+       use the "time" function in Perl (the shortest example in this tuto-
+       rial):
+
+          perl -e 'print time, "\n" '
+
+       How to run a program on regular intervals is OS specific. But here is
+       an example in pseudo code:
+
+          - Get the value and put it in variable "$speed"
+          - rrdtool update speed.rrd N:$speed
+
+       (do not try this with our test database, we'll use it in further exam-
+       ples)
+
+       This is all. Run the above script every five minutes. When you need to
+       know what the graphs look like, run the examples above. You could put
+       them in a script as well. After running that script, view the page
+       index.html we created above.
+
+       S\bSo\bom\bme\be w\bwo\bor\brd\bds\bs o\bon\bn S\bSN\bNM\bMP\bP
+
+       I can imagine very few people that will be able to get real data from
+       their car every five minutes. All other people will have to settle for
+       some other kind of counter. You could measure the number of pages
+       printed by a printer, for example, the cups of coffee made by the cof-
+       fee machine, a device that counts the electricity used, whatever. Any
+       incrementing counter can be monitored and graphed using the stuff you
+       learned so far. Later on we will also be able to monitor other types of
+       values like temperature.
+
+       Most (?) people interested in RRDtool will use the counter that keeps
+       track of octets (bytes) transfered by a network device. So let's do
+       just that next. We will start with a description of how to collect
+       data.
+
+       Some people will make a remark that there are tools which can do this
+       data collection for you. They are right! However, I feel it is impor-
+       tant that you understand they are not necessary. When you have to
+       determine why things went wrong you need to know how they work.
+
+       One tool used in the example has been talked about very briefly in the
+       beginning of this document, it is called SNMP. It is a way of talking
+       to networked equipment. The tool I use below is called "snmpget" and
+       this is how it works:
+
+          snmpget device password OID
+
+       or
+
+          snmpget -v[version] -c[password] device OID
+
+       For device you substitute the name, or the IP address, of your device.
+       For password you use the "community read string" as it is called in the
+       SNMP world.  For some devices the default of "public" might work, how-
+       ever this can be disabled, altered or protected for privacy and secu-
+       rity reasons.  Read the documentation that comes with your device or
+       program.
+
+       Then there is this parameter, called OID, which means "object identi-
+       fier".
+
+       When you start to learn about SNMP it looks very confusing. It isn't
+       all that difficult when you look at the Management Information Base
+       ("MIB").  It is an upside-down tree that describes data, with a single
+       node as the root and from there a number of branches.  These branches
+       end up in another node, they branch out, etc.  All the branches have a
+       name and they form the path that we follow all the way down.  The
+       branches that we follow are named: iso, org, dod, internet, mgmt and
+       mib-2.  These names can also be written down as numbers and are 1 3 6 1
+       2 1.
+
+          iso.org.dod.internet.mgmt.mib-2 (1.3.6.1.2.1)
+
+       There is a lot of confusion about the leading dot that some programs
+       use.  There is *no* leading dot in an OID.  However, some programs can
+       use the above part of OIDs as a default.  To indicate the difference
+       between abbreviated OIDs and full OIDs they need a leading dot when you
+       specify the complete OID.  Often those programs will leave out the
+       default portion when returning the data to you.  To make things worse,
+       they have several default prefixes ...
+
+       Ok, lets continue to the start of our OID: we had 1.3.6.1.2.1 From
+       there, we are especially interested in the branch "interfaces" which
+       has number 2 (e.g., 1.3.6.1.2.1.2 or 1.3.6.1.2.1.interfaces).
+
+       First, we have to get some SNMP program. First look if there is a pre-
+       compiled package available for your OS. This is the preferred way.  If
+       not, you will have to get the sources yourself and compile those.  The
+       Internet is full of sources, programs etc. Find information using a
+       search engine or whatever you prefer.
+
+       Assume you got the program. First try to collect some data that is
+       available on most systems. Remember: there is a short name for the part
+       of the tree that interests us most in the world we live in!
+
+       I will give an example which can be used on Fedora Core 3.  If it
+       doesn't work for you, work your way through the manual of snmp and
+       adapt the example to make it work.
+
+          snmpget -v2c -c public myrouter system.sysDescr.0
+
+       The device should answer with a description of itself, perhaps an empty
+       one. Until you got a valid answer from a device, perhaps using a dif-
+       ferent "password", or a different device, there is no point in
+       continuing.
+
+          snmpget -v2c -c public myrouter interfaces.ifNumber.0
+
+       Hopefully you get a number as a result, the number of interfaces.  If
+       so, you can carry on and try a different program called "snmpwalk".
+
+          snmpwalk -v2c -c public myrouter interfaces.ifTable.ifEntry.ifDescr
+
+       If it returns with a list of interfaces, you're almost there.  Here's
+       an example:
+          [user@host /home/alex]$ snmpwalk -v2c -c public cisco 2.2.1.2
+
+          interfaces.ifTable.ifEntry.ifDescr.1 = "BRI0: B-Channel 1"
+          interfaces.ifTable.ifEntry.ifDescr.2 = "BRI0: B-Channel 2"
+          interfaces.ifTable.ifEntry.ifDescr.3 = "BRI0" Hex: 42 52 49 30
+          interfaces.ifTable.ifEntry.ifDescr.4 = "Ethernet0"
+          interfaces.ifTable.ifEntry.ifDescr.5 = "Loopback0"
+
+       On this cisco equipment, I would like to monitor the "Ethernet0" inter-
+       face and from the above output I see that it is number four. I try:
+
+          [user@host /home/alex]$ snmpget -v2c -c public cisco 2.2.1.10.4 2.2.1.16.4
+
+          interfaces.ifTable.ifEntry.ifInOctets.4 = 2290729126
+          interfaces.ifTable.ifEntry.ifOutOctets.4 = 1256486519
+
+       So now I have two OIDs to monitor and they are (in full, this time):
+
+          1.3.6.1.2.1.2.2.1.10
+
+       and
+
+          1.3.6.1.2.1.2.2.1.16
+
+       both with an interface number of 4.
+
+       Don't get fooled, this wasn't my first try. It took some time for me
+       too to understand what all these numbers mean. It does help a lot when
+       they get translated into descriptive text... At least, when people are
+       talking about MIBs and OIDs you know what it's all about.  Do not for-
+       get the interface number (0 if it is not interface dependent) and try
+       snmpwalk if you don't get an answer from snmpget.
+
+       If you understand the above section and get numbers from your device,
+       continue on with this tutorial. If not, then go back and re-read this
+       part.
+
+       A\bA R\bRe\bea\bal\bl W\bWo\bor\brl\bld\bd E\bEx\bxa\bam\bmp\bpl\ble\be
+
+       Let the fun begin. First, create a new database. It contains data from
+       two counters, called input and output. The data is put into archives
+       that average it. They take 1, 6, 24 or 288 samples at a time.  They
+       also go into archives that keep the maximum numbers. This will be
+       explained later on. The time in-between samples is 300 seconds, a good
+       starting point, which is the same as five minutes.
+
+        1 sample "averaged" stays 1 period of 5 minutes
+        6 samples averaged become one average on 30 minutes
+        24 samples averaged become one average on 2 hours
+        288 samples averaged become one average on 1 day
+
+       Lets try to be compatible with MRTG which stores about the following
+       amount of data:
+
+        600 5-minute samples:    2   days and 2 hours
+        600 30-minute samples:  12.5 days
+        600 2-hour samples:     50   days
+        732 1-day samples:     732   days
+
+       These ranges are appended, so the total amount of data stored in the
+       database is approximately 797 days. RRDtool stores the data differ-
+       ently, it doesn't start the "weekly" archive where the "daily" archive
+       stopped. For both archives the most recent data will be near "now" and
+       therefore we will need to keep more data than MRTG does!
+
+       We will need:
+
+        600 samples of 5 minutes  (2 days and 2 hours)
+        700 samples of 30 minutes (2 days and 2 hours, plus 12.5 days)
+        775 samples of 2 hours    (above + 50 days)
+        797 samples of 1 day      (above + 732 days, rounded up to 797)
+
+          rrdtool create myrouter.rrd         \
+                   DS:input:COUNTER:600:U:U   \
+                   DS:output:COUNTER:600:U:U  \
+                   RRA:AVERAGE:0.5:1:600      \
+                   RRA:AVERAGE:0.5:6:700      \
+                   RRA:AVERAGE:0.5:24:775     \
+                   RRA:AVERAGE:0.5:288:797    \
+                   RRA:MAX:0.5:1:600          \
+                   RRA:MAX:0.5:6:700          \
+                   RRA:MAX:0.5:24:775         \
+                   RRA:MAX:0.5:288:797
+
+       Next thing to do is to collect data and store it. Here is an example.
+       It is written partially in pseudo code,  you will have to find out what
+       to do exactly on your OS to make it work.
+
+          while not the end of the universe
+          do
+             get result of
+                snmpget router community 2.2.1.10.4
+             into variable $in
+             get result of
+                snmpget router community 2.2.1.16.4
+             into variable $out
+
+             rrdtool update myrouter.rrd N:$in:$out
+
+             wait for 5 minutes
+          done
+
+       Then, after collecting data for a day, try to create an image using:
+
+          rrdtool graph myrouter-day.png --start -86400 \
+                   DEF:inoctets=myrouter.rrd:input:AVERAGE \
+                   DEF:outoctets=myrouter.rrd:output:AVERAGE \
+                   AREA:inoctets#00FF00:"In traffic" \
+                   LINE1:outoctets#0000FF:"Out traffic"
+
+       This should produce a picture with one day worth of traffic.  One day
+       is 24 hours of 60 minutes of 60 seconds: 24*60*60=86'400, we start at
+       now minus 86'400 seconds. We define (with DEFs) inoctets and outoctets
+       as the average values from the database myrouter.rrd and draw an area
+       for the "in" traffic and a line for the "out" traffic.
+
+       View the image and keep logging data for a few more days.  If you like,
+       you could try the examples from the test database and see if you can
+       get various options and calculations to work.
+
+       Suggestion: Display in bytes per second and in bits per second. Make
+       the Ethernet graphics go red if they are over four megabits per second.
+
+       C\bCo\bon\bns\bso\bol\bli\bid\bda\bat\bti\bio\bon\bn F\bFu\bun\bnc\bct\bti\bio\bon\bns\bs
+
+       A few paragraphs back I mentioned the possibility of keeping the maxi-
+       mum values instead of the average values. Let's go into this a bit
+       more.
+
+       Recall all the stuff about the speed of the car. Suppose we drove at
+       144 KM/H during 5 minutes and then were stopped by the police for 25
+       minutes.  At the end of the lecture we would take our laptop and create
+       and view the image taken from the database. If we look at the second
+       RRA we did create, we would have the average from 6 samples. The sam-
+       ples measured would be 144+0+0+0+0+0=144, divided by 30 minutes, cor-
+       rected for the error by 1000, translated into KM/H, with a result of 24
+       KM/H.  I would still get a ticket but not for speeding anymore :)
+
+       Obviously, in this case we shouldn't look at the averages. In some
+       cases they are handy. If you want to know how many KM you had traveled,
+       the averaged picture would be the right one to look at. On the other
+       hand, for the speed that we traveled at, the maximum numbers seen is
+       much more interesting. Later we will see more types.
+
+       It is the same for data. If you want to know the amount, look at the
+       averages. If you want to know the rate, look at the maximum.  Over
+       time, they will grow apart more and more. In the last database we have
+       created, there are two archives that keep data per day. The archive
+       that keeps averages will show low numbers, the archive that shows max-
+       ima will have higher numbers.
+
+       For my car this would translate in averages per day of 96/24=4 KM/H (as
+       I travel about 94 kilometers on a day) during working days, and maxima
+       of 120 KM/H (my top speed that I reach every day).
+
+       Big difference. Do not look at the second graph to estimate the dis-
+       tances that I travel and do not look at the first graph to estimate my
+       speed. This will work if the samples are close together, as they are in
+       five minutes, but not if you average.
+
+       On some days, I go for a long ride. If I go across Europe and travel
+       for 12 hours, the first graph will rise to about 60 KM/H. The second
+       one will show 180 KM/H. This means that I traveled a distance of 60
+       KM/H times 24 H = 1440 KM. I did this with a higher speed and a maximum
+       around 180 KM/H. However, it probably doesn't mean that I traveled for
+       8 hours at a constant speed of 180 KM/H!
+
+       This is a real example: go with the flow through Germany (fast!) and
+       stop a few times for gas and coffee. Drive slowly through Austria and
+       the Netherlands. Be careful in the mountains and villages. If you would
+       look at the graphs created from the five-minute averages you would get
+       a totally different picture. You would see the same values on the aver-
+       age and maximum graphs (provided I measured every 300 seconds).  You
+       would be able to see when I stopped, when I was in top gear, when I
+       drove over fast highways etc. The granularity of the data is much
+       higher, so you can see more. However, this takes 12 samples per hour,
+       or 288 values per day, so it would be a lot of data over a longer
+       period of time. Therefore we average it, eventually to one value per
+       day. From this one value, we cannot see much detail, of course.
+
+       Make sure you understand the last few paragraphs. There is no value in
+       only a line and a few axis, you need to know what they mean and inter-
+       pret the data in ana appropriate way. This is true for all data.
+
+       The biggest mistake you can make is to use the collected data for some-
+       thing that it is not suitable for. You would be better off if you
+       didn't have the graph at all.
+
+       L\bLe\bet\bt'\b's\bs r\bre\bev\bvi\bie\bew\bw w\bwh\bha\bat\bt y\byo\bou\bu n\bno\bow\bw s\bsh\bho\bou\bul\bld\bd k\bkn\bno\bow\bw
+
+       You know how to create a database and can put data in it. You can get
+       the numbers out again by creating an image, do math on the data from
+       the database and view the resulte instead of the raw data.  You know
+       about the difference between averages and maxima, and when to use which
+       (or at least you should have an idea).
+
+       RRDtool can do more than what we have learned up to now. Before you
+       continue with the rest of this doc, I recommend that you reread from
+       the start and try some modifications on the examples. Make sure you
+       fully understand everything. It will be worth the effort and helps you
+       not only with the rest of this tutorial, but also in your day to day
+       monitoring long after you read this introduction.
+
+       D\bDa\bat\bta\ba S\bSo\bou\bur\brc\bce\be T\bTy\byp\bpe\bes\bs
+
+       All right, you feel like continuing. Welcome back and get ready for an
+       increased speed in the examples and explanations.
+
+       You know that in order to view a counter over time, you have to take
+       two numbers and divide the difference of them between the time lapsed.
+       This makes sense for the examples I gave you but there are other possi-
+       bilities.  For instance, I'm able to retrieve the temperature from my
+       router in three places namely the inlet, the so called hot-spot and the
+       exhaust.  These values are not counters.  If I take the difference of
+       the two samples and divide that by 300 seconds I would be asking for
+       the temperature change per second.  Hopefully this is zero! If not, the
+       computer room is probably on fire :)
+
+       So, what can we do?  We can tell RRDtool to store the values we measure
+       directly as they are (this is not entirely true but close enough). The
+       graphs we make will look much better, they will show a rather constant
+       value. I know when the router is busy (it works -> it uses more elec-
+       tricity -> it generates more heat -> the temperature rises). I know
+       when the doors are left open (the room is air conditioned) -> the warm
+       air from the rest of the building flows into the computer room -> the
+       inlet temperature rises). Etc. The data type we use when creating the
+       database before was counter, we now have a different data type and thus
+       a different name for it. It is called GAUGE. There are more such data
+       types:
+
+        - COUNTER   we already know this one
+        - GAUGE     we just learned this one
+        - DERIVE
+        - ABSOLUTE
+
+       The two additional types are DERIVE and ABSOLUTE. Absolute can be used
+       like counter with one difference: RRDtool assumes the counter is reset
+       when it's read. That is: its delta is known without calculation by RRD-
+       tool whereas RRDtool needs to calculate it for the counter type.  Exam-
+       ple: our first example (12'345, 12'357, 12'363, 12'363) would read:
+       unknown, 12, 6, 0. The rest of the calculations stay the same.  The
+       other one, derive, is like counter. Unlike counter, it can also
+       decrease so it can have a negative delta. Again, the rest of the calcu-
+       lations stay the same.
+
+       Let's try them all:
+
+          rrdtool create all.rrd --start 978300900 \
+                   DS:a:COUNTER:600:U:U \
+                   DS:b:GAUGE:600:U:U \
+                   DS:c:DERIVE:600:U:U \
+                   DS:d:ABSOLUTE:600:U:U \
+                   RRA:AVERAGE:0.5:1:10
+          rrdtool update all.rrd \
+                   978301200:300:1:600:300    \
+                   978301500:600:3:1200:600   \
+                   978301800:900:5:1800:900   \
+                   978302100:1200:3:2400:1200 \
+                   978302400:1500:1:2400:1500 \
+                   978302700:1800:2:1800:1800 \
+                   978303000:2100:4:0:2100    \
+                   978303300:2400:6:600:2400  \
+                   978303600:2700:4:600:2700  \
+                   978303900:3000:2:1200:3000
+          rrdtool graph all1.png -s 978300600 -e 978304200 -h 400 \
+                   DEF:linea=all.rrd:a:AVERAGE LINE3:linea#FF0000:"Line A" \
+                   DEF:lineb=all.rrd:b:AVERAGE LINE3:lineb#00FF00:"Line B" \
+                   DEF:linec=all.rrd:c:AVERAGE LINE3:linec#0000FF:"Line C" \
+                   DEF:lined=all.rrd:d:AVERAGE LINE3:lined#000000:"Line D"
+
+       R\bRR\bRD\bDt\bto\boo\bol\bl u\bun\bnd\bde\ber\br t\bth\bhe\be M\bMi\bic\bcr\bro\bos\bsc\bco\bop\bpe\be
+
+
+       Â· Line A is a COUNTER type, so it should continuously increment and
+         RRDtool must calculate the differences. Also, RRDtool needs to divide
+         the difference by the amount of time lapsed. This should end up as a
+         straight line at 1 (the deltas are 300, the time is 300).
+
+       Â· Line B is of type GAUGE. These are "real" values so they should match
+         what we put in: a sort of a wave.
+
+       Â· Line C is of type DERIVE. It should be a counter that can decrease.
+         It does so between 2'400 and 0, with 1'800 in-between.
+
+       Â· Line D is of type ABSOLUTE. This is like counter but it works on val-
+         ues without calculating the difference. The numbers are the same and
+         as you can see (hopefully) this has a different result.
+
+       This translates in the following values, starting at 23:10 and ending
+       at 00:10 the next day (where "u" means unknown/unplotted):
+
+        - Line A:  u  u  1  1  1  1  1  1  1  1  1  u
+        - Line B:  u  1  3  5  3  1  2  4  6  4  2  u
+        - Line C:  u  u  2  2  2  0 -2 -6  2  0  2  u
+        - Line D:  u  1  2  3  4  5  6  7  8  9 10  u
+
+       If your PNG shows all this, you know you have entered the data cor-
+       rectly, the RRDtool executable is working properly, your viewer doesn't
+       fool you, and you successfully entered the year 2000 :)
+
+       You could try the same example four times, each time with only one of
+       the lines.
+
+       Let's go over the data again:
+
+       Â· Line A: 300,600,900 and so on. The counter delta is a constant 300
+         and so is the time delta. A number divided by itself is always 1
+         (except when dividing by zero which is undefined/illegal).
+
+         Why is it that the first point is unknown? We do know what we put
+         into the database, right? True, But we didn't have a value to calcu-
+         late the delta from, so we don't know where we started. It would be
+         wrong to assume we started at zero so we don't!
+
+       Â· Line B: There is nothing to calculate. The numbers are as they are.
+
+       Â· Line C: Again, the start-out value is unknown. The same story is
+         holds as for line A. In this case the deltas are not constant, there-
+         fore the line is not either. If we would put the same numbers in the
+         database as we did for line A, we would have gotten the same line.
+         Unlike type counter, this type can decrease and I hope to show you
+         later on why this makes a difference.
+
+       Â· Line D: Here the device calculates the deltas. Therefore we DO know
+         the first delta and it is plotted. We had the same input as with line
+         A, but the meaning of this input is different and thus the line is
+         different.  In this case the deltas increase each time with 300. The
+         time delta stays at a constant 300 and therefore the division of the
+         two gives increasing values.
+
+       C\bCo\bou\bun\bnt\bte\ber\br W\bWr\bra\bap\bps\bs
+
+       There are a few more basics to show. Some important options are still
+       to be covered and we haven't look at counter wraps yet. First the
+       counter wrap: In our car we notice that the counter shows 999'987. We
+       travel 20 KM and the counter should go to 1'000'007. Unfortunately,
+       there are only six digits on our counter so it really shows 000'007. If
+       we would plot that on a type DERIVE, it would mean that the counter was
+       set back 999'980 KM. It wasn't, and there has to be some protection for
+       this. This protection is only available for type COUNTER which should
+       be used for this kind of counter anyways. How does it work? Type
+       counter should never decrease and therefore RRDtool must assume it
+       wrapped if it does decrease!  If the delta is negative, this can be
+       compensated for by adding the maximum value of the counter + 1. For our
+       car this would be:
+
+        Delta = 7 - 999'987 = -999'980    (instead of 1'000'007-999'987=20)
+
+        Real delta = -999'980 + 999'999 + 1 = 20
+
+       At the time of writing this document, RRDtool knows of counters that
+       are either 32 bits or 64 bits of size. These counters can handle the
+       following different values:
+
+        - 32 bits: 0 ..           4'294'967'295
+        - 64 bits: 0 .. 18'446'744'073'709'551'615
+
+       If these numbers look strange to you, you can view them in their hex-
+       adecimal form:
+
+        - 32 bits: 0 ..         FFFFFFFF
+        - 64 bits: 0 .. FFFFFFFFFFFFFFFF
+
+       RRDtool handles both counters the same. If an overflow occurs and the
+       delta would be negative, RRDtool first adds the maximum of a small
+       counter + 1 to the delta. If the delta is still negative, it had to be
+       the large counter that wrapped. Add the maximum possible value of the
+       large counter + 1 and subtract the erroneously added small value.
+
+       There is a risk in this: suppose the large counter wrapped while adding
+       a huge delta, it could happen, theoretically, that adding the smaller
+       value would make the delta positive. In this unlikely case the results
+       would not be correct. The increase should be nearly as high as the max-
+       imum counter value for that to happen, so chances are you would have
+       several other problems as well and this particular problem would not
+       even be worth thinking about. Even though, I did include an example, so
+       you can judge for yourself.
+
+       The next section gives you some numerical examples for counter-wraps.
+       Try to do the calculations yourself or just believe me if your calcula-
+       tor can't handle the numbers :)
+
+       Correction numbers:
+
+        - 32 bits: (4'294'967'295 + 1) =                                4'294'967'296
+        - 64 bits: (18'446'744'073'709'551'615 + 1)
+                                           - correction1 = 18'446'744'069'414'584'320
+
+        Before:        4'294'967'200
+        Increase:                100
+        Should become: 4'294'967'300
+        But really is:             4
+        Delta:        -4'294'967'196
+        Correction1:  -4'294'967'196 + 4'294'967'296 = 100
+
+        Before:        18'446'744'073'709'551'000
+        Increase:                             800
+        Should become: 18'446'744'073'709'551'800
+        But really is:                        184
+        Delta:        -18'446'744'073'709'550'816
+        Correction1:  -18'446'744'073'709'550'816
+                                       + 4'294'967'296 = -18'446'744'069'414'583'520
+        Correction2:  -18'446'744'069'414'583'520
+                          + 18'446'744'069'414'584'320 = 800
+
+        Before:        18'446'744'073'709'551'615 ( maximum value )
+        Increase:      18'446'744'069'414'584'320 ( absurd increase, minimum for
+        Should become: 36'893'488'143'124'135'935             this example to work )
+        But really is: 18'446'744'069'414'584'319
+        Delta:                     -4'294'967'296
+        Correction1:  -4'294'967'296 + 4'294'967'296 = 0
+        (not negative -> no correction2)
+
+        Before:        18'446'744'073'709'551'615 ( maximum value )
+        Increase:      18'446'744'069'414'584'319 ( one less increase )
+        Should become: 36'893'488'143'124'135'934
+        But really is: 18'446'744'069'414'584'318
+        Delta:                     -4'294'967'297
+        Correction1:  -4'294'967'297 + 4'294'967'296 = -1
+        Correction2:  -1 + 18'446'744'069'414'584'320 = 18'446'744'069'414'584'319
+
+       As you can see from the last two examples, you need strange numbers for
+       RRDtool to fail (provided it's bug free of course), so this should not
+       happen. However, SNMP or whatever method you choose to collect the
+       data, might also report wrong numbers occasionally.  We can't prevent
+       all errors, but there are some things we can do. The RRDtool "create"
+       command takes two special parameters for this. They define the minimum
+       and maximum allowed values. Until now, we used "U", meaning "unknown".
+       If you provide values for one or both of them and if RRDtool receives
+       data points that are outside these limits, it will ignore those values.
+       For a thermometer in degrees Celsius, the absolute minimum is just
+       under -273. For my router, I can assume this minimum is much higher so
+       I would set it to 10, where as the maximum temperature I would set to
+       80. Any higher and the device would be out of order.
+
+       For the speed of my car, I would never expect negative numbers and also
+       I would not expect a speed  higher than 230. Anything else, and there
+       must have been an error. Remember: the opposite is not true, if the
+       numbers pass this check, it doesn't mean that they are correct. Always
+       judge the graph with a healthy dose of suspicion if it seems weird to
+       you.
+
+       D\bDa\bat\bta\ba R\bRe\bes\bsa\bam\bmp\bpl\bli\bin\bng\bg
+
+       One important feature of RRDtool has not been explained yet: it is vir-
+       tually impossible to collect data and feed it into RRDtool on exact
+       intervals. RRDtool therefore interpolates the data, so they are stored
+       on exact intervals. If you do not know what this means or how it works,
+       then here's the help you seek:
+
+       Suppose a counter increases by exactly one for every second. You want
+       to measure it in 300 seconds intervals. You should retrieve values that
+       are exactly 300 apart. However, due to various circumstances you are a
+       few seconds late and the interval is 303. The delta will also be 303 in
+       that case. Obviously, RRDtool should not put 303 in the database and
+       make you believe that the counter increased by 303 in 300 seconds.
+       This is where RRDtool interpolates: it alters the 303 value as if it
+       would have been stored earlier and it will be 300 in 300 seconds.  Next
+       time you are at exactly the right time. This means that the current
+       interval is 297 seconds and also the counter increased by 297. Again,
+       RRDtool interpolates and stores 300 as it should be.
+
+             in the RRD                 in reality
+
+        time+000:   0 delta="U"   time+000:    0 delta="U"
+        time+300: 300 delta=300   time+300:  300 delta=300
+        time+600: 600 delta=300   time+603:  603 delta=303
+        time+900: 900 delta=300   time+900:  900 delta=297
+
+       Let's create two identical databases. I've chosen the time range
+       920'805'000 to 920'805'900 as this goes very well with the example num-
+       bers.
+
+          rrdtool create seconds1.rrd   \
+             --start 920804700          \
+             DS:seconds:COUNTER:600:U:U \
+             RRA:AVERAGE:0.5:1:24
+
+       Make a copy
+
+          for Unix: cp seconds1.rrd seconds2.rrd
+          for Dos:  copy seconds1.rrd seconds2.rrd
+          for vms:  how would I know :)
+
+       Put in some data
+
+          rrdtool update seconds1.rrd \
+             920805000:000 920805300:300 920805600:600 920805900:900
+          rrdtool update seconds2.rrd \
+             920805000:000 920805300:300 920805603:603 920805900:900
+
+       Create output
+
+          rrdtool graph seconds1.png                       \
+             --start 920804700 --end 920806200             \
+             --height 200                                  \
+             --upper-limit 1.05 --lower-limit 0.95 --rigid \
+             DEF:seconds=seconds1.rrd:seconds:AVERAGE      \
+             CDEF:unknown=seconds,UN                       \
+             LINE2:seconds#0000FF                          \
+             AREA:unknown#FF0000
+          rrdtool graph seconds2.png                       \
+             --start 920804700 --end 920806200             \
+             --height 200                                  \
+             --upper-limit 1.05 --lower-limit 0.95 --rigid \
+             DEF:seconds=seconds2.rrd:seconds:AVERAGE      \
+             CDEF:unknown=seconds,UN                       \
+             LINE2:seconds#0000FF                          \
+             AREA:unknown#FF0000
+
+       View both images together (add them to your index.html file) and com-
+       pare. Both graphs should show the same, despite the input being differ-
+       ent.
+
+W\bWR\bRA\bAP\bPU\bUP\bP
+       It's time now to wrap up this tutorial. We covered all the basics for
+       you to be able to work with RRDtool and to read the additional
+       documentation available. There is plenty more to discover about RRDtool
+       and you will find more and more uses for this package. You can easly
+       create graphs using just the examples provided and using only RRDtool.
+       You can also use one of the front ends to RRDtool that are available.
+
+M\bMA\bAI\bIL\bLI\bIN\bNG\bGL\bLI\bIS\bST\bT
+       Remember to subscribe to the RRDtool mailing list. Even if you are not
+       answering to mails that come by, it helps both you and the rest of the
+       users. A lot of the stuff that I know about MRTG (and therefore about
+       RRDtool) I've learned while just reading the list without posting to
+       it. I did not need to ask the basic questions as they are answered in
+       the FAQ (read it!) and in various mails by other users. With thousands
+       of users all over the world, there will always be people who ask ques-
+       tions that you can answer because you read this and other documentation
+       and they didn't.
+
+S\bSE\bEE\bE A\bAL\bLS\bSO\bO
+       The RRDtool manpages
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       I hope you enjoyed the examples and their descriptions. If you do, help
+       other people by pointing them to this document when they are asking
+       basic questions. They will not only get their answers, but at the same
+       time learn a whole lot more.
+
+       Alex van den Bogaerdt <alex@ergens.op.het.net>
+
+
+
+1.2.26                            2007-11-20                    RRDTUTORIAL(1)
diff --git a/doc/rrdupdate.1 b/doc/rrdupdate.1
new file mode 100644 (file)
index 0000000..326b82a
--- /dev/null
@@ -0,0 +1,219 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDUPDATE 1"
+.TH RRDUPDATE 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdupdate \- Store a new set of values into the RRD
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBrrdtool\fR {\fBupdate\fR | \fBupdatev\fR} \fIfilename\fR
+[\fB\-\-template\fR|\fB\-t\fR\ \fIds-name\fR[\fB:\fR\fIds-name\fR]...]
+\&\fBN\fR|\fItimestamp\fR\fB:\fR\fIvalue\fR[\fB:\fR\fIvalue\fR...]
+\&\fIat-timestamp\fR\fB@\fR\fIvalue\fR[\fB:\fR\fIvalue\fR...]
+[\fItimestamp\fR\fB:\fR\fIvalue\fR[\fB:\fR\fIvalue\fR...]\ ...]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fBupdate\fR function feeds new data values into an \fB\s-1RRD\s0\fR. The data
+is time aligned (interpolated) according to the properties of the
+\&\fB\s-1RRD\s0\fR to which the data is written.
+.IP "\fBupdatev\fR" 8
+.IX Item "updatev"
+This alternate version of \fBupdate\fR takes the same arguments and
+performs the same function. The \fIv\fR stands for \fIverbose\fR, which
+describes the output returned. \fBupdatev\fR returns a list of any and all
+consolidated data points (CDPs) written to disk as a result of the
+invocation of update. The values are indexed by timestamp (time_t),
+\&\s-1RRA\s0 (consolidation function and PDPs per \s-1CDP\s0), and data source (name).
+Note that depending on the arguments of the current and previous call to
+update, the list may have no entries or a large number of entries.
+.IP "\fIfilename\fR" 8
+.IX Item "filename"
+The name of the \fB\s-1RRD\s0\fR you want to update.
+.IP "\fB\-\-template\fR|\fB\-t\fR \fIds-name\fR[\fB:\fR\fIds-name\fR]..." 8
+.IX Item "--template|-t ds-name[:ds-name]..."
+By default, the \fBupdate\fR function expects its data input in the order
+the data sources are defined in the \s-1RRD\s0, excluding any \s-1COMPUTE\s0 data
+sources (i.e. if the third data source \fB\s-1DST\s0\fR is \s-1COMPUTE\s0, the third
+input value will be mapped to the fourth data source in the \fB\s-1RRD\s0\fR and
+so on). This is not very error resistant, as you might be sending the
+wrong data into an \s-1RRD\s0.
+.Sp
+The template switch allows you to specify which data sources you are
+going to update and in which order. If the data sources specified in
+the template are not available in the \s-1RRD\s0 file, the update process
+will abort with an error message.
+.Sp
+While it appears possible with the template switch to update data sources
+asynchronously, \fBRRDtool\fR implicitly assigns non-COMPUTE data sources missing
+from the template the \fI*UNKNOWN*\fR value.
+.Sp
+Do not specify a value for a \s-1COMPUTE\s0 \fB\s-1DST\s0\fR in the \fBupdate\fR
+function. If this is done accidentally (and this can only be done
+using the template switch), \fBRRDtool\fR will ignore the value specified
+for the \s-1COMPUTE\s0 \fB\s-1DST\s0\fR.
+.IP "\fBN\fR|\fItimestamp\fR\fB:\fR\fIvalue\fR[\fB:\fR\fIvalue\fR...]" 8
+.IX Item "N|timestamp:value[:value...]"
+The data used for updating the \s-1RRD\s0 was acquired at a certain
+time. This time can either be defined in seconds since 1970\-01\-01 or
+by using the letter 'N', in which case the update time is set to be
+the current time. Negative time values are subtracted from the current
+time. An \s-1AT_STYLE\s0 \s-1TIME\s0 \s-1SPECIFICATION\s0 (see the \fIrrdfetch\fR
+documentation) may also be used by delimiting the end of the time
+specification with the '@' character instead of a ':'. Getting the
+timing right to the second is especially important when you are
+working with data-sources of type \fB\s-1COUNTER\s0\fR, \fB\s-1DERIVE\s0\fR or
+\&\fB\s-1ABSOLUTE\s0\fR.
+.Sp
+The remaining elements of the argument are \s-1DS\s0 updates. The order of
+this list is the same as the order the data sources were defined in
+the \s-1RRA\s0. If there is no data for a certain data\-source, the letter
+\&\fBU\fR (e.g., N:0.1:U:1) can be specified.
+.Sp
+The format of the value acquired from the data source is dependent on
+the data source type chosen. Normally it will be numeric, but the data
+acquisition modules may impose their very own parsing of this
+parameter as long as the colon (\fB:\fR) remains the data source value
+separator.
+.SH "EXAMPLE"
+.IX Header "EXAMPLE"
+\&\f(CW\*(C`rrdtool update demo1.rrd N:3.44:3.15:U:23\*(C'\fR
+.PP
+Update the database file demo1.rrd with 3 known and one \fI*UNKNOWN*\fR
+value. Use the current time as the update time.
+.PP
+\&\f(CW\*(C`rrdtool update demo2.rrd 887457267:U 887457521:22 887457903:2.7\*(C'\fR
+.PP
+Update the database file demo2.rrd which expects data from a single
+data\-source, three times. First with an \fI*UNKNOWN*\fR value then with two
+regular readings. The update interval seems to be around 300 seconds.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Tobias Oetiker <tobi@oetiker.ch>
diff --git a/doc/rrdupdate.html b/doc/rrdupdate.html
new file mode 100644 (file)
index 0000000..26f979e
--- /dev/null
@@ -0,0 +1,143 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdupdate</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#example">EXAMPLE</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdupdate - Store a new set of values into the RRD</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p><strong>rrdtool</strong> {<strong>update</strong> | <strong>updatev</strong>} <em>filename</em>
+[<strong>--template</strong>|<strong>-t</strong>&nbsp;<em>ds-name</em>[<strong>:</strong><em>ds-name</em>]...]
+<strong>N</strong>|<em>timestamp</em><strong>:</strong><em>value</em>[<strong>:</strong><em>value</em>...]
+<em>at-timestamp</em><strong>@</strong><em>value</em>[<strong>:</strong><em>value</em>...]
+[<em>timestamp</em><strong>:</strong><em>value</em>[<strong>:</strong><em>value</em>...]&nbsp;...]</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>The <strong>update</strong> function feeds new data values into an <strong>RRD</strong>. The data
+is time aligned (interpolated) according to the properties of the
+<strong>RRD</strong> to which the data is written.</p>
+<dl>
+<dt><strong><a name="item_updatev"><strong>updatev</strong></a></strong>
+
+<dd>
+<p>This alternate version of <strong>update</strong> takes the same arguments and
+performs the same function. The <em>v</em> stands for <em>verbose</em>, which
+describes the output returned. <strong>updatev</strong> returns a list of any and all
+consolidated data points (CDPs) written to disk as a result of the
+invocation of update. The values are indexed by timestamp (time_t),
+RRA (consolidation function and PDPs per CDP), and data source (name).
+Note that depending on the arguments of the current and previous call to
+update, the list may have no entries or a large number of entries.</p>
+</dd>
+</li>
+<dt><strong><a name="item_filename"><em>filename</em></a></strong>
+
+<dd>
+<p>The name of the <strong>RRD</strong> you want to update.</p>
+</dd>
+</li>
+<dt><strong><a name="item__2d_2dtemplate_7c_2dt_ds_2dname_5b_3ads_2dname_5d_"><strong>--template</strong>|<strong>-t</strong> <em>ds-name</em>[<strong>:</strong><em>ds-name</em>]...</a></strong>
+
+<dd>
+<p>By default, the <strong>update</strong> function expects its data input in the order
+the data sources are defined in the RRD, excluding any COMPUTE data
+sources (i.e. if the third data source <strong>DST</strong> is COMPUTE, the third
+input value will be mapped to the fourth data source in the <strong>RRD</strong> and
+so on). This is not very error resistant, as you might be sending the
+wrong data into an RRD.</p>
+</dd>
+<dd>
+<p>The template switch allows you to specify which data sources you are
+going to update and in which order. If the data sources specified in
+the template are not available in the RRD file, the update process
+will abort with an error message.</p>
+</dd>
+<dd>
+<p>While it appears possible with the template switch to update data sources
+asynchronously, <strong>RRDtool</strong> implicitly assigns non-COMPUTE data sources missing
+from the template the <em>*UNKNOWN*</em> value.</p>
+</dd>
+<dd>
+<p>Do not specify a value for a COMPUTE <strong>DST</strong> in the <strong>update</strong>
+function. If this is done accidentally (and this can only be done
+using the template switch), <strong>RRDtool</strong> will ignore the value specified
+for the COMPUTE <strong>DST</strong>.</p>
+</dd>
+</li>
+<dt><strong><a name="item_n_7ctimestamp_3avalue_5b_3avalue_2e_2e_2e_5d"><strong>N</strong>|<em>timestamp</em><strong>:</strong><em>value</em>[<strong>:</strong><em>value</em>...]</a></strong>
+
+<dd>
+<p>The data used for updating the RRD was acquired at a certain
+time. This time can either be defined in seconds since 1970-01-01 or
+by using the letter 'N', in which case the update time is set to be
+the current time. Negative time values are subtracted from the current
+time. An AT_STYLE TIME SPECIFICATION (see the <em>rrdfetch</em>
+documentation) may also be used by delimiting the end of the time
+specification with the '@' character instead of a ':'. Getting the
+timing right to the second is especially important when you are
+working with data-sources of type <strong>COUNTER</strong>, <strong>DERIVE</strong> or
+<strong>ABSOLUTE</strong>.</p>
+</dd>
+<dd>
+<p>The remaining elements of the argument are DS updates. The order of
+this list is the same as the order the data sources were defined in
+the RRA. If there is no data for a certain data-source, the letter
+<strong>U</strong> (e.g., N:0.1:U:1) can be specified.</p>
+</dd>
+<dd>
+<p>The format of the value acquired from the data source is dependent on
+the data source type chosen. Normally it will be numeric, but the data
+acquisition modules may impose their very own parsing of this
+parameter as long as the colon (<strong>:</strong>) remains the data source value
+separator.</p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<hr />
+<h1><a name="example">EXAMPLE</a></h1>
+<p><code>rrdtool update demo1.rrd N:3.44:3.15:U:23</code></p>
+<p>Update the database file demo1.rrd with 3 known and one <em>*UNKNOWN*</em>
+value. Use the current time as the update time.</p>
+<p><code>rrdtool update demo2.rrd 887457267:U 887457521:22 887457903:2.7</code></p>
+<p>Update the database file demo2.rrd which expects data from a single
+data-source, three times. First with an <em>*UNKNOWN*</em> value then with two
+regular readings. The update interval seems to be around 300 seconds.</p>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdupdate.pod b/doc/rrdupdate.pod
new file mode 100644 (file)
index 0000000..cc0b452
--- /dev/null
@@ -0,0 +1,101 @@
+=head1 NAME
+
+rrdupdate - Store a new set of values into the RRD
+
+=head1 SYNOPSIS
+
+B<rrdtool> {B<update> | B<updatev>} I<filename>
+S<[B<--template>|B<-t> I<ds-name>[B<:>I<ds-name>]...]>
+S<B<N>|I<timestamp>B<:>I<value>[B<:>I<value>...]>
+S<I<at-timestamp>B<@>I<value>[B<:>I<value>...]>
+S<[I<timestamp>B<:>I<value>[B<:>I<value>...] ...]>
+
+=head1 DESCRIPTION
+
+The B<update> function feeds new data values into an B<RRD>. The data
+is time aligned (interpolated) according to the properties of the
+B<RRD> to which the data is written.
+
+=over 8
+
+=item B<updatev>
+
+This alternate version of B<update> takes the same arguments and
+performs the same function. The I<v> stands for I<verbose>, which
+describes the output returned. B<updatev> returns a list of any and all
+consolidated data points (CDPs) written to disk as a result of the
+invocation of update. The values are indexed by timestamp (time_t),
+RRA (consolidation function and PDPs per CDP), and data source (name).
+Note that depending on the arguments of the current and previous call to
+update, the list may have no entries or a large number of entries.
+
+=item I<filename>
+
+The name of the B<RRD> you want to update.
+
+=item B<--template>|B<-t> I<ds-name>[B<:>I<ds-name>]...
+
+By default, the B<update> function expects its data input in the order
+the data sources are defined in the RRD, excluding any COMPUTE data
+sources (i.e. if the third data source B<DST> is COMPUTE, the third
+input value will be mapped to the fourth data source in the B<RRD> and
+so on). This is not very error resistant, as you might be sending the
+wrong data into an RRD.
+
+The template switch allows you to specify which data sources you are
+going to update and in which order. If the data sources specified in
+the template are not available in the RRD file, the update process
+will abort with an error message.
+
+While it appears possible with the template switch to update data sources
+asynchronously, B<RRDtool> implicitly assigns non-COMPUTE data sources missing
+from the template the I<*UNKNOWN*> value.
+
+Do not specify a value for a COMPUTE B<DST> in the B<update>
+function. If this is done accidentally (and this can only be done
+using the template switch), B<RRDtool> will ignore the value specified
+for the COMPUTE B<DST>.
+
+=item B<N>|I<timestamp>B<:>I<value>[B<:>I<value>...]
+
+The data used for updating the RRD was acquired at a certain
+time. This time can either be defined in seconds since 1970-01-01 or
+by using the letter 'N', in which case the update time is set to be
+the current time. Negative time values are subtracted from the current
+time. An AT_STYLE TIME SPECIFICATION (see the I<rrdfetch>
+documentation) may also be used by delimiting the end of the time
+specification with the '@' character instead of a ':'. Getting the
+timing right to the second is especially important when you are
+working with data-sources of type B<COUNTER>, B<DERIVE> or
+B<ABSOLUTE>.
+
+The remaining elements of the argument are DS updates. The order of
+this list is the same as the order the data sources were defined in
+the RRA. If there is no data for a certain data-source, the letter
+B<U> (e.g., N:0.1:U:1) can be specified.
+
+The format of the value acquired from the data source is dependent on
+the data source type chosen. Normally it will be numeric, but the data
+acquisition modules may impose their very own parsing of this
+parameter as long as the colon (B<:>) remains the data source value
+separator.
+
+=back
+
+=head1 EXAMPLE
+
+C<rrdtool update demo1.rrd N:3.44:3.15:U:23>
+
+Update the database file demo1.rrd with 3 known and one I<*UNKNOWN*>
+value. Use the current time as the update time.
+
+C<rrdtool update demo2.rrd 887457267:U 887457521:22 887457903:2.7>
+
+Update the database file demo2.rrd which expects data from a single
+data-source, three times. First with an I<*UNKNOWN*> value then with two
+regular readings. The update interval seems to be around 300 seconds.
+
+=head1 AUTHOR
+
+Tobias Oetiker <tobi@oetiker.ch>
+
diff --git a/doc/rrdupdate.txt b/doc/rrdupdate.txt
new file mode 100644 (file)
index 0000000..63b032a
--- /dev/null
@@ -0,0 +1,94 @@
+RRDUPDATE(1)                        rrdtool                       RRDUPDATE(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdupdate - Store a new set of values into the RRD
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       r\brr\brd\bdt\bto\boo\bol\bl {u\bup\bpd\bda\bat\bte\be | u\bup\bpd\bda\bat\bte\bev\bv} _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be [-\b--\b-t\bte\bem\bmp\bpl\bla\bat\bte\be|-\b-t\bt _\bd_\bs_\b-_\bn_\ba_\bm_\be[:\b:_\bd_\bs_\b-
+       _\bn_\ba_\bm_\be]...]  N\bN|_\bt_\bi_\bm_\be_\bs_\bt_\ba_\bm_\bp:\b:_\bv_\ba_\bl_\bu_\be[:\b:_\bv_\ba_\bl_\bu_\be...]  _\ba_\bt_\b-_\bt_\bi_\bm_\be_\bs_\bt_\ba_\bm_\bp@\b@_\bv_\ba_\bl_\bu_\be[:\b:_\bv_\ba_\bl_\bu_\be...]
+       [_\bt_\bi_\bm_\be_\bs_\bt_\ba_\bm_\bp:\b:_\bv_\ba_\bl_\bu_\be[:\b:_\bv_\ba_\bl_\bu_\be...] ...]
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       The u\bup\bpd\bda\bat\bte\be function feeds new data values into an R\bRR\bRD\bD. The data is time
+       aligned (interpolated) according to the properties of the R\bRR\bRD\bD to which
+       the data is written.
+
+       u\bup\bpd\bda\bat\bte\bev\bv This alternate version of u\bup\bpd\bda\bat\bte\be takes the same arguments and
+               performs the same function. The _\bv stands for _\bv_\be_\br_\bb_\bo_\bs_\be, which
+               describes the output returned. u\bup\bpd\bda\bat\bte\bev\bv returns a list of any
+               and all consolidated data points (CDPs) written to disk as a
+               result of the invocation of update. The values are indexed by
+               timestamp (time_t), RRA (consolidation function and PDPs per
+               CDP), and data source (name).  Note that depending on the argu-
+               ments of the current and previous call to update, the list may
+               have no entries or a large number of entries.
+
+       _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be
+               The name of the R\bRR\bRD\bD you want to update.
+
+       -\b--\b-t\bte\bem\bmp\bpl\bla\bat\bte\be|-\b-t\bt _\bd_\bs_\b-_\bn_\ba_\bm_\be[:\b:_\bd_\bs_\b-_\bn_\ba_\bm_\be]...
+               By default, the u\bup\bpd\bda\bat\bte\be function expects its data input in the
+               order the data sources are defined in the RRD, excluding any
+               COMPUTE data sources (i.e. if the third data source D\bDS\bST\bT is COM-
+               PUTE, the third input value will be mapped to the fourth data
+               source in the R\bRR\bRD\bD and so on). This is not very error resistant,
+               as you might be sending the wrong data into an RRD.
+
+               The template switch allows you to specify which data sources
+               you are going to update and in which order. If the data sources
+               specified in the template are not available in the RRD file,
+               the update process will abort with an error message.
+
+               While it appears possible with the template switch to update
+               data sources asynchronously, R\bRR\bRD\bDt\bto\boo\bol\bl implicitly assigns non-
+               COMPUTE data sources missing from the template the _\b*_\bU_\bN_\bK_\bN_\bO_\bW_\bN_\b*
+               value.
+
+               Do not specify a value for a COMPUTE D\bDS\bST\bT in the u\bup\bpd\bda\bat\bte\be func-
+               tion. If this is done accidentally (and this can only be done
+               using the template switch), R\bRR\bRD\bDt\bto\boo\bol\bl will ignore the value spec-
+               ified for the COMPUTE D\bDS\bST\bT.
+
+       N\bN|_\bt_\bi_\bm_\be_\bs_\bt_\ba_\bm_\bp:\b:_\bv_\ba_\bl_\bu_\be[:\b:_\bv_\ba_\bl_\bu_\be...]
+               The data used for updating the RRD was acquired at a certain
+               time. This time can either be defined in seconds since
+               1970-01-01 or by using the letter 'N', in which case the update
+               time is set to be the current time. Negative time values are
+               subtracted from the current time. An AT_STYLE TIME SPECIFICA-
+               TION (see the _\br_\br_\bd_\bf_\be_\bt_\bc_\bh documentation) may also be used by
+               delimiting the end of the time specification with the '@' char-
+               acter instead of a ':'. Getting the timing right to the second
+               is especially important when you are working with data-sources
+               of type C\bCO\bOU\bUN\bNT\bTE\bER\bR, D\bDE\bER\bRI\bIV\bVE\bE or A\bAB\bBS\bSO\bOL\bLU\bUT\bTE\bE.
+
+               The remaining elements of the argument are DS updates. The
+               order of this list is the same as the order the data sources
+               were defined in the RRA. If there is no data for a certain
+               data-source, the letter U\bU (e.g., N:0.1:U:1) can be specified.
+
+               The format of the value acquired from the data source is depen-
+               dent on the data source type chosen. Normally it will be
+               numeric, but the data acquisition modules may impose their very
+               own parsing of this parameter as long as the colon (:\b:) remains
+               the data source value separator.
+
+E\bEX\bXA\bAM\bMP\bPL\bLE\bE
+       "rrdtool update demo1.rrd N:3.44:3.15:U:23"
+
+       Update the database file demo1.rrd with 3 known and one _\b*_\bU_\bN_\bK_\bN_\bO_\bW_\bN_\b*
+       value. Use the current time as the update time.
+
+       "rrdtool update demo2.rrd 887457267:U 887457521:22 887457903:2.7"
+
+       Update the database file demo2.rrd which expects data from a single
+       data-source, three times. First with an _\b*_\bU_\bN_\bK_\bN_\bO_\bW_\bN_\b* value then with two
+       regular readings. The update interval seems to be around 300 seconds.
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Tobias Oetiker <tobi@oetiker.ch>
+
+
+
+1.2.26                            2007-11-20                      RRDUPDATE(1)
diff --git a/doc/rrdxport.1 b/doc/rrdxport.1
new file mode 100644 (file)
index 0000000..88d57e2
--- /dev/null
@@ -0,0 +1,266 @@
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "RRDXPORT 1"
+.TH RRDXPORT 1 "2007-11-20" "1.2.26" "rrdtool"
+.SH "NAME"
+rrdxport \- Export data in XML format based on data from one or several RRD
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBrrdtool\fR \fBxport\fR
+[\fB\-s\fR|\fB\-\-start\fR\ \fIseconds\fR]
+[\fB\-e\fR|\fB\-\-end\fR\ \fIseconds\fR]
+[\fB\-m\fR|\fB\-\-maxrows\fR\ \fIrows\fR]
+[\fB\-\-step\fR\ \fIvalue\fR]
+[\fB\s-1DEF:\s0\fR\fIvname\fR\fB=\fR\fIrrd\fR\fB:\fR\fIds-name\fR\fB:\fR\fI\s-1CF\s0\fR]
+[\fB\s-1CDEF:\s0\fR\fIvname\fR\fB=\fR\fIrpn-expression\fR]
+[\fB\s-1XPORT\s0\fR\fB:\fR\fIvname\fR[\fB:\fR\fIlegend\fR]]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+The \fBxport\fR function's main purpose is to write an \s-1XML\s0 formatted
+representation of the data stored in one or several \fB\s-1RRD\s0\fRs. It
+can also extract numerical reports.
+.PP
+If no \fI\s-1XPORT\s0\fR statements are found, there will be no output.
+.IP "\fB\-s\fR|\fB\-\-start\fR \fIseconds\fR (default end\-1day)" 4
+.IX Item "-s|--start seconds (default end-1day)"
+The time when the exported range should begin. Time in seconds since
+epoch (1970\-01\-01) is required. Negative numbers are relative to the
+current time. By default one day worth of data will be printed.
+See also AT-STYLE \s-1TIME\s0 \s-1SPECIFICATION\s0 section in the \fIrrdfetch\fR
+documentation for a detailed explanation on how to specify time.
+.IP "\fB\-e\fR|\fB\-\-end\fR \fIseconds\fR (default now)" 4
+.IX Item "-e|--end seconds (default now)"
+The time when the exported range should end. Time in seconds since epoch.
+See also AT-STYLE \s-1TIME\s0 \s-1SPECIFICATION\s0 section in the \fIrrdfetch\fR
+documentation for a detailed explanation of ways to specify time.
+.IP "\fB\-m\fR|\fB\-\-maxrows\fR \fIrows\fR (default 400 rows)" 4
+.IX Item "-m|--maxrows rows (default 400 rows)"
+This works like the \fB\-w\fR|\fB\-\-width\fR parameter of \fIrrdgraph\fR.
+In fact it is exactly the same, but the parameter was renamed to
+describe its purpose in this module. See \fIrrdgraph\fR documentation
+for details.
+.IP "\fB\-\-step\fR \fIvalue\fR (default automatic)" 4
+.IX Item "--step value (default automatic)"
+See rrdgraph documentation.
+.IP "\fB\-\-enumds\fR" 4
+.IX Item "--enumds"
+The generated xml should contain the data values in enumerated tags.
+.Sp
+.Vb 1
+\& <v0>val</v0><v1>val</v1>
+.Ve
+.IP "\fB\s-1DEF:\s0\fR\fIvname\fR\fB=\fR\fIrrd\fR\fB:\fR\fIds-name\fR\fB:\fR\fI\s-1CF\s0\fR" 4
+.IX Item "DEF:vname=rrd:ds-name:CF"
+See \fIrrdgraph\fR documentation.
+.IP "\fB\s-1CDEF:\s0\fR\fIvname\fR\fB=\fR\fIrpn-expression\fR" 4
+.IX Item "CDEF:vname=rpn-expression"
+See \fIrrdgraph\fR documentation.
+.IP "\fB\s-1XPORT:\s0\fR\fIvname\fR\fB:\fR\fB:\fR\fIlegend\fR" 4
+.IX Item "XPORT:vname::legend"
+At least one \fI\s-1XPORT\s0\fR statement should be present. The values
+referenced by \fIvname\fR are printed. Optionally add a legend.
+.SH "Output format"
+.IX Header "Output format"
+The output is enclosed in an \fBxport\fR element and contains two
+blocks. The first block is enclosed by a \fBmeta\fR element and
+contains some meta data. The second block is enclosed by a
+\&\fBdata\fR element and contains the data rows.
+.PP
+Let's assume that the \fIxport\fR command looks like this:
+.PP
+.Vb 7
+\&  rrdtool xport \e
+\&          \-\-start now\-1h \-\-end now \e
+\&          DEF:xx=host\-inout.lo.rrd:output:AVERAGE \e
+\&          DEF:yy=host\-inout.lo.rrd:input:AVERAGE \e
+\&          CDEF:aa=xx,yy,+,8,* \e
+\&          XPORT:xx:"out bytes" \e
+\&          XPORT:aa:"in and out bits"
+.Ve
+.PP
+The resulting meta data section is (the values will depend on the
+\&\s-1RRD\s0 characteristics):
+.PP
+.Vb 11
+\&  <meta>
+\&    <start>1020611700</start>
+\&    <step>300</step>
+\&    <end>1020615600</end>
+\&    <rows>14</rows>
+\&    <columns>2</columns>
+\&    <legend>
+\&      <entry>out bytes</entry>
+\&      <entry>in and out bits</entry>
+\&    </legend>
+\&  </meta>
+.Ve
+.PP
+The resulting data section is:
+.PP
+.Vb 16
+\&  <data>
+\&    <row><t>1020611700</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+\&    <row><t>1020612000</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+\&    <row><t>1020612300</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+\&    <row><t>1020612600</t><v>3.4113333333e+00</v><v>5.4581333333e+01</v></row>
+\&    <row><t>1020612900</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+\&    <row><t>1020613200</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+\&    <row><t>1020613500</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+\&    <row><t>1020613800</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+\&    <row><t>1020614100</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+\&    <row><t>1020614400</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+\&    <row><t>1020614700</t><v>3.7333333333e+00</v><v>5.9733333333e+01</v></row>
+\&    <row><t>1020615000</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+\&    <row><t>1020615300</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+\&    <row><t>1020615600</t><v>NaN</v><v>NaN</v></row>
+\&  </data>
+.Ve
+.SH "EXAMPLE 1"
+.IX Header "EXAMPLE 1"
+.Vb 3
+\&  rrdtool xport \e
+\&          DEF:out=if1\-inouts.rrd:outoctets:AVERAGE \e
+\&          XPORT:out:"out bytes"
+.Ve
+.SH "EXAMPLE 2"
+.IX Header "EXAMPLE 2"
+.Vb 7
+\&  rrdtool xport \e
+\&          DEF:out1=if1\-inouts.rrd:outoctets:AVERAGE \e
+\&          DEF:out2=if2\-inouts.rrd:outoctets:AVERAGE \e
+\&          CDEF:sum=out1,out2,+ \e
+\&          XPORT:out1:"if1 out bytes" \e
+\&          XPORT:out2:"if2 out bytes" \e
+\&          XPORT:sum:"output sum"
+.Ve
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Tobias Oetiker <tobi@oetiker.ch>
diff --git a/doc/rrdxport.html b/doc/rrdxport.html
new file mode 100644 (file)
index 0000000..105baff
--- /dev/null
@@ -0,0 +1,194 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>rrdxport</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+<p><a name="__index__"></a></p>
+<!-- INDEX BEGIN -->
+<!--
+
+<ul>
+
+       <li><a href="#name">NAME</a></li>
+       <li><a href="#synopsis">SYNOPSIS</a></li>
+       <li><a href="#description">DESCRIPTION</a></li>
+       <li><a href="#output_format">Output format</a></li>
+       <li><a href="#example_1">EXAMPLE 1</a></li>
+       <li><a href="#example_2">EXAMPLE 2</a></li>
+       <li><a href="#author">AUTHOR</a></li>
+</ul>
+-->
+<!-- INDEX END -->
+
+<p>
+</p>
+<h1><a name="name">NAME</a></h1>
+<p>rrdxport - Export data in XML format based on data from one or several RRD</p>
+<p>
+</p>
+<hr />
+<h1><a name="synopsis">SYNOPSIS</a></h1>
+<p><strong>rrdtool</strong> <strong>xport</strong>
+[<strong>-s</strong>|<strong>--start</strong>&nbsp;<em>seconds</em>]
+[<strong>-e</strong>|<strong>--end</strong>&nbsp;<em>seconds</em>]
+[<strong>-m</strong>|<strong>--maxrows</strong>&nbsp;<em>rows</em>]
+[<strong>--step</strong>&nbsp;<em>value</em>]
+[<strong>DEF:</strong><em>vname</em><strong>=</strong><em>rrd</em><strong>:</strong><em>ds-name</em><strong>:</strong><em>CF</em>]
+[<strong>CDEF:</strong><em>vname</em><strong>=</strong><em>rpn-expression</em>]
+[<strong>XPORT</strong><strong>:</strong><em>vname</em>[<strong>:</strong><em>legend</em>]]</p>
+<p>
+</p>
+<hr />
+<h1><a name="description">DESCRIPTION</a></h1>
+<p>The <strong>xport</strong> function's main purpose is to write an XML formatted
+representation of the data stored in one or several <strong>RRD</strong>s. It
+can also extract numerical reports.</p>
+<p>If no <em>XPORT</em> statements are found, there will be no output.</p>
+<dl>
+<dt><strong><a name="item_seconds"><strong>-s</strong>|<strong>--start</strong> <em>seconds</em> (default end-1day)</a></strong>
+
+<dd>
+<p>The time when the exported range should begin. Time in seconds since
+epoch (1970-01-01) is required. Negative numbers are relative to the
+current time. By default one day worth of data will be printed.
+See also AT-STYLE TIME SPECIFICATION section in the <em>rrdfetch</em>
+documentation for a detailed explanation on how to specify time.</p>
+</dd>
+</li>
+<dt><strong><strong>-e</strong>|<strong>--end</strong> <em>seconds</em> (default now)</strong>
+
+<dd>
+<p>The time when the exported range should end. Time in seconds since epoch.
+See also AT-STYLE TIME SPECIFICATION section in the <em>rrdfetch</em>
+documentation for a detailed explanation of ways to specify time.</p>
+</dd>
+</li>
+<dt><strong><a name="item_rows"><strong>-m</strong>|<strong>--maxrows</strong> <em>rows</em> (default 400 rows)</a></strong>
+
+<dd>
+<p>This works like the <strong>-w</strong>|<strong>--width</strong> parameter of <em>rrdgraph</em>.
+In fact it is exactly the same, but the parameter was renamed to
+describe its purpose in this module. See <em>rrdgraph</em> documentation
+for details.</p>
+</dd>
+</li>
+<dt><strong><a name="item_value"><strong>--step</strong> <em>value</em> (default automatic)</a></strong>
+
+<dd>
+<p>See <a href="././rrdgraph.html">the rrdgraph manpage</a> documentation.</p>
+</dd>
+</li>
+<dt><strong><a name="item__2d_2denumds"><strong>--enumds</strong></a></strong>
+
+<dd>
+<p>The generated xml should contain the data values in enumerated tags.</p>
+</dd>
+<dd>
+<pre>
+ &lt;v0&gt;val&lt;/v0&gt;&lt;v1&gt;val&lt;/v1&gt;</pre>
+</dd>
+</li>
+<dt><strong><a name="item_def_3avname_3drrd_3ads_2dname_3acf"><strong>DEF:</strong><em>vname</em><strong>=</strong><em>rrd</em><strong>:</strong><em>ds-name</em><strong>:</strong><em>CF</em></a></strong>
+
+<dd>
+<p>See <em>rrdgraph</em> documentation.</p>
+</dd>
+</li>
+<dt><strong><a name="item_cdef_3avname_3drpn_2dexpression"><strong>CDEF:</strong><em>vname</em><strong>=</strong><em>rpn-expression</em></a></strong>
+
+<dd>
+<p>See <em>rrdgraph</em> documentation.</p>
+</dd>
+</li>
+<dt><strong><a name="item_xport_3avname_3a_3alegend"><strong>XPORT:</strong><em>vname</em><strong>:</strong><strong>:</strong><em>legend</em></a></strong>
+
+<dd>
+<p>At least one <em>XPORT</em> statement should be present. The values
+referenced by <em>vname</em> are printed. Optionally add a legend.</p>
+</dd>
+</li>
+</dl>
+<p>
+</p>
+<hr />
+<h1><a name="output_format">Output format</a></h1>
+<p>The output is enclosed in an <strong>xport</strong> element and contains two
+blocks. The first block is enclosed by a <strong>meta</strong> element and
+contains some meta data. The second block is enclosed by a
+<strong>data</strong> element and contains the data rows.</p>
+<p>Let's assume that the <em>xport</em> command looks like this:</p>
+<pre>
+  rrdtool xport \
+          --start now-1h --end now \
+          DEF:xx=host-inout.lo.rrd:output:AVERAGE \
+          DEF:yy=host-inout.lo.rrd:input:AVERAGE \
+          CDEF:aa=xx,yy,+,8,* \
+          XPORT:xx:&quot;out bytes&quot; \
+          XPORT:aa:&quot;in and out bits&quot;</pre>
+<p>The resulting meta data section is (the values will depend on the
+RRD characteristics):</p>
+<pre>
+  &lt;meta&gt;
+    &lt;start&gt;1020611700&lt;/start&gt;
+    &lt;step&gt;300&lt;/step&gt;
+    &lt;end&gt;1020615600&lt;/end&gt;
+    &lt;rows&gt;14&lt;/rows&gt;
+    &lt;columns&gt;2&lt;/columns&gt;
+    &lt;legend&gt;
+      &lt;entry&gt;out bytes&lt;/entry&gt;
+      &lt;entry&gt;in and out bits&lt;/entry&gt;
+    &lt;/legend&gt;
+  &lt;/meta&gt;</pre>
+<p>The resulting data section is:</p>
+<pre>
+  &lt;data&gt;
+    &lt;row&gt;&lt;t&gt;1020611700&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
+    &lt;row&gt;&lt;t&gt;1020612000&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
+    &lt;row&gt;&lt;t&gt;1020612300&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
+    &lt;row&gt;&lt;t&gt;1020612600&lt;/t&gt;&lt;v&gt;3.4113333333e+00&lt;/v&gt;&lt;v&gt;5.4581333333e+01&lt;/v&gt;&lt;/row&gt;
+    &lt;row&gt;&lt;t&gt;1020612900&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
+    &lt;row&gt;&lt;t&gt;1020613200&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
+    &lt;row&gt;&lt;t&gt;1020613500&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
+    &lt;row&gt;&lt;t&gt;1020613800&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
+    &lt;row&gt;&lt;t&gt;1020614100&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
+    &lt;row&gt;&lt;t&gt;1020614400&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
+    &lt;row&gt;&lt;t&gt;1020614700&lt;/t&gt;&lt;v&gt;3.7333333333e+00&lt;/v&gt;&lt;v&gt;5.9733333333e+01&lt;/v&gt;&lt;/row&gt;
+    &lt;row&gt;&lt;t&gt;1020615000&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
+    &lt;row&gt;&lt;t&gt;1020615300&lt;/t&gt;&lt;v&gt;3.4000000000e+00&lt;/v&gt;&lt;v&gt;5.4400000000e+01&lt;/v&gt;&lt;/row&gt;
+    &lt;row&gt;&lt;t&gt;1020615600&lt;/t&gt;&lt;v&gt;NaN&lt;/v&gt;&lt;v&gt;NaN&lt;/v&gt;&lt;/row&gt;
+  &lt;/data&gt;</pre>
+<p>
+</p>
+<hr />
+<h1><a name="example_1">EXAMPLE 1</a></h1>
+<pre>
+  rrdtool xport \
+          DEF:out=if1-inouts.rrd:outoctets:AVERAGE \
+          XPORT:out:&quot;out bytes&quot;</pre>
+<p>
+</p>
+<hr />
+<h1><a name="example_2">EXAMPLE 2</a></h1>
+<pre>
+  rrdtool xport \
+          DEF:out1=if1-inouts.rrd:outoctets:AVERAGE \
+          DEF:out2=if2-inouts.rrd:outoctets:AVERAGE \
+          CDEF:sum=out1,out2,+ \
+          XPORT:out1:&quot;if1 out bytes&quot; \
+          XPORT:out2:&quot;if2 out bytes&quot; \
+          XPORT:sum:&quot;output sum&quot;</pre>
+<p>
+</p>
+<hr />
+<h1><a name="author">AUTHOR</a></h1>
+<p>Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
+
+</body>
+
+</html>
diff --git a/doc/rrdxport.pod b/doc/rrdxport.pod
new file mode 100644 (file)
index 0000000..a668a20
--- /dev/null
@@ -0,0 +1,144 @@
+=head1 NAME
+
+rrdxport - Export data in XML format based on data from one or several RRD
+
+=head1 SYNOPSIS
+
+B<rrdtool> B<xport>
+S<[B<-s>|B<--start> I<seconds>]>
+S<[B<-e>|B<--end> I<seconds>]>
+S<[B<-m>|B<--maxrows> I<rows>]>
+S<[B<--step> I<value>]>
+S<[B<DEF:>I<vname>B<=>I<rrd>B<:>I<ds-name>B<:>I<CF>]>
+S<[B<CDEF:>I<vname>B<=>I<rpn-expression>]>
+S<[B<XPORT>B<:>I<vname>[B<:>I<legend>]]>
+
+=head1 DESCRIPTION
+
+The B<xport> function's main purpose is to write an XML formatted
+representation of the data stored in one or several B<RRD>s. It
+can also extract numerical reports.
+
+If no I<XPORT> statements are found, there will be no output.
+
+=over
+
+=item B<-s>|B<--start> I<seconds> (default end-1day)
+
+The time when the exported range should begin. Time in seconds since
+epoch (1970-01-01) is required. Negative numbers are relative to the
+current time. By default one day worth of data will be printed.
+See also AT-STYLE TIME SPECIFICATION section in the I<rrdfetch>
+documentation for a detailed explanation on how to specify time.
+
+=item B<-e>|B<--end> I<seconds> (default now)
+
+The time when the exported range should end. Time in seconds since epoch.
+See also AT-STYLE TIME SPECIFICATION section in the I<rrdfetch>
+documentation for a detailed explanation of ways to specify time.
+
+=item B<-m>|B<--maxrows> I<rows> (default 400 rows)
+
+This works like the B<-w>|B<--width> parameter of I<rrdgraph>.
+In fact it is exactly the same, but the parameter was renamed to
+describe its purpose in this module. See I<rrdgraph> documentation
+for details.
+
+=item B<--step> I<value> (default automatic)
+
+See L<rrdgraph> documentation.
+
+=item B<--enumds> 
+
+The generated xml should contain the data values in enumerated tags.
+
+ <v0>val</v0><v1>val</v1>
+
+=item B<DEF:>I<vname>B<=>I<rrd>B<:>I<ds-name>B<:>I<CF>
+
+See I<rrdgraph> documentation.
+
+=item B<CDEF:>I<vname>B<=>I<rpn-expression>
+
+See I<rrdgraph> documentation.
+
+=item B<XPORT:>I<vname>B<:>B<:>I<legend>
+
+At least one I<XPORT> statement should be present. The values
+referenced by I<vname> are printed. Optionally add a legend.
+
+=back
+
+=head1 Output format
+
+The output is enclosed in an B<xport> element and contains two
+blocks. The first block is enclosed by a B<meta> element and
+contains some meta data. The second block is enclosed by a
+B<data> element and contains the data rows.
+
+Let's assume that the I<xport> command looks like this:
+
+  rrdtool xport \
+          --start now-1h --end now \
+          DEF:xx=host-inout.lo.rrd:output:AVERAGE \
+         DEF:yy=host-inout.lo.rrd:input:AVERAGE \
+          CDEF:aa=xx,yy,+,8,* \
+          XPORT:xx:"out bytes" \
+          XPORT:aa:"in and out bits"
+
+The resulting meta data section is (the values will depend on the
+RRD characteristics):
+
+  <meta>
+    <start>1020611700</start>
+    <step>300</step>
+    <end>1020615600</end>
+    <rows>14</rows>
+    <columns>2</columns>
+    <legend>
+      <entry>out bytes</entry>
+      <entry>in and out bits</entry>
+    </legend>
+  </meta>
+
+The resulting data section is:
+
+  <data>
+    <row><t>1020611700</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+    <row><t>1020612000</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+    <row><t>1020612300</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+    <row><t>1020612600</t><v>3.4113333333e+00</v><v>5.4581333333e+01</v></row>
+    <row><t>1020612900</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+    <row><t>1020613200</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+    <row><t>1020613500</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+    <row><t>1020613800</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+    <row><t>1020614100</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+    <row><t>1020614400</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+    <row><t>1020614700</t><v>3.7333333333e+00</v><v>5.9733333333e+01</v></row>
+    <row><t>1020615000</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+    <row><t>1020615300</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+    <row><t>1020615600</t><v>NaN</v><v>NaN</v></row>
+  </data>
+
+
+=head1 EXAMPLE 1
+
+  rrdtool xport \
+          DEF:out=if1-inouts.rrd:outoctets:AVERAGE \
+          XPORT:out:"out bytes"
+
+=head1 EXAMPLE 2
+
+  rrdtool xport \
+          DEF:out1=if1-inouts.rrd:outoctets:AVERAGE \
+          DEF:out2=if2-inouts.rrd:outoctets:AVERAGE \
+         CDEF:sum=out1,out2,+ \
+          XPORT:out1:"if1 out bytes" \
+          XPORT:out2:"if2 out bytes" \
+         XPORT:sum:"output sum"
+
+
+=head1 AUTHOR
+
+Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
+
diff --git a/doc/rrdxport.txt b/doc/rrdxport.txt
new file mode 100644 (file)
index 0000000..120ec80
--- /dev/null
@@ -0,0 +1,128 @@
+RRDXPORT(1)                         rrdtool                        RRDXPORT(1)
+
+
+
+N\bNA\bAM\bME\bE
+       rrdxport - Export data in XML format based on data from one or several
+       RRD
+
+S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
+       r\brr\brd\bdt\bto\boo\bol\bl x\bxp\bpo\bor\brt\bt [-\b-s\bs|-\b--\b-s\bst\bta\bar\brt\bt _\bs_\be_\bc_\bo_\bn_\bd_\bs] [-\b-e\be|-\b--\b-e\ben\bnd\bd _\bs_\be_\bc_\bo_\bn_\bd_\bs]
+       [-\b-m\bm|-\b--\b-m\bma\bax\bxr\bro\bow\bws\bs _\br_\bo_\bw_\bs] [-\b--\b-s\bst\bte\bep\bp _\bv_\ba_\bl_\bu_\be] [D\bDE\bEF\bF:\b:_\bv_\bn_\ba_\bm_\be=\b=_\br_\br_\bd:\b:_\bd_\bs_\b-_\bn_\ba_\bm_\be:\b:_\bC_\bF]
+       [C\bCD\bDE\bEF\bF:\b:_\bv_\bn_\ba_\bm_\be=\b=_\br_\bp_\bn_\b-_\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn] [X\bXP\bPO\bOR\bRT\bT:\b:_\bv_\bn_\ba_\bm_\be[:\b:_\bl_\be_\bg_\be_\bn_\bd]]
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+       The x\bxp\bpo\bor\brt\bt function's main purpose is to write an XML formatted repre-
+       sentation of the data stored in one or several R\bRR\bRD\bDs. It can also
+       extract numerical reports.
+
+       If no _\bX_\bP_\bO_\bR_\bT statements are found, there will be no output.
+
+       -\b-s\bs|-\b--\b-s\bst\bta\bar\brt\bt _\bs_\be_\bc_\bo_\bn_\bd_\bs (default end-1day)
+           The time when the exported range should begin. Time in seconds
+           since epoch (1970-01-01) is required. Negative numbers are relative
+           to the current time. By default one day worth of data will be
+           printed.  See also AT-STYLE TIME SPECIFICATION section in the _\br_\br_\bd_\b-
+           _\bf_\be_\bt_\bc_\bh documentation for a detailed explanation on how to specify
+           time.
+
+       -\b-e\be|-\b--\b-e\ben\bnd\bd _\bs_\be_\bc_\bo_\bn_\bd_\bs (default now)
+           The time when the exported range should end. Time in seconds since
+           epoch.  See also AT-STYLE TIME SPECIFICATION section in the _\br_\br_\bd_\b-
+           _\bf_\be_\bt_\bc_\bh documentation for a detailed explanation of ways to specify
+           time.
+
+       -\b-m\bm|-\b--\b-m\bma\bax\bxr\bro\bow\bws\bs _\br_\bo_\bw_\bs (default 400 rows)
+           This works like the -\b-w\bw|-\b--\b-w\bwi\bid\bdt\bth\bh parameter of _\br_\br_\bd_\bg_\br_\ba_\bp_\bh.  In fact it
+           is exactly the same, but the parameter was renamed to describe its
+           purpose in this module. See _\br_\br_\bd_\bg_\br_\ba_\bp_\bh documentation for details.
+
+       -\b--\b-s\bst\bte\bep\bp _\bv_\ba_\bl_\bu_\be (default automatic)
+           See rrdgraph documentation.
+
+       -\b--\b-e\ben\bnu\bum\bmd\bds\bs
+           The generated xml should contain the data values in enumerated
+           tags.
+
+            <v0>val</v0><v1>val</v1>
+
+       D\bDE\bEF\bF:\b:_\bv_\bn_\ba_\bm_\be=\b=_\br_\br_\bd:\b:_\bd_\bs_\b-_\bn_\ba_\bm_\be:\b:_\bC_\bF
+           See _\br_\br_\bd_\bg_\br_\ba_\bp_\bh documentation.
+
+       C\bCD\bDE\bEF\bF:\b:_\bv_\bn_\ba_\bm_\be=\b=_\br_\bp_\bn_\b-_\be_\bx_\bp_\br_\be_\bs_\bs_\bi_\bo_\bn
+           See _\br_\br_\bd_\bg_\br_\ba_\bp_\bh documentation.
+
+       X\bXP\bPO\bOR\bRT\bT:\b:_\bv_\bn_\ba_\bm_\be:\b::\b:_\bl_\be_\bg_\be_\bn_\bd
+           At least one _\bX_\bP_\bO_\bR_\bT statement should be present. The values refer-
+           enced by _\bv_\bn_\ba_\bm_\be are printed. Optionally add a legend.
+
+O\bOu\but\btp\bpu\but\bt f\bfo\bor\brm\bma\bat\bt
+       The output is enclosed in an x\bxp\bpo\bor\brt\bt element and contains two blocks. The
+       first block is enclosed by a m\bme\bet\bta\ba element and contains some meta data.
+       The second block is enclosed by a d\bda\bat\bta\ba element and contains the data
+       rows.
+
+       Let's assume that the _\bx_\bp_\bo_\br_\bt command looks like this:
+
+         rrdtool xport \
+                 --start now-1h --end now \
+                 DEF:xx=host-inout.lo.rrd:output:AVERAGE \
+                 DEF:yy=host-inout.lo.rrd:input:AVERAGE \
+                 CDEF:aa=xx,yy,+,8,* \
+                 XPORT:xx:"out bytes" \
+                 XPORT:aa:"in and out bits"
+
+       The resulting meta data section is (the values will depend on the RRD
+       characteristics):
+
+         <meta>
+           <start>1020611700</start>
+           <step>300</step>
+           <end>1020615600</end>
+           <rows>14</rows>
+           <columns>2</columns>
+           <legend>
+             <entry>out bytes</entry>
+             <entry>in and out bits</entry>
+           </legend>
+         </meta>
+
+       The resulting data section is:
+
+         <data>
+           <row><t>1020611700</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+           <row><t>1020612000</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+           <row><t>1020612300</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+           <row><t>1020612600</t><v>3.4113333333e+00</v><v>5.4581333333e+01</v></row>
+           <row><t>1020612900</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+           <row><t>1020613200</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+           <row><t>1020613500</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+           <row><t>1020613800</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+           <row><t>1020614100</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+           <row><t>1020614400</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+           <row><t>1020614700</t><v>3.7333333333e+00</v><v>5.9733333333e+01</v></row>
+           <row><t>1020615000</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+           <row><t>1020615300</t><v>3.4000000000e+00</v><v>5.4400000000e+01</v></row>
+           <row><t>1020615600</t><v>NaN</v><v>NaN</v></row>
+         </data>
+
+E\bEX\bXA\bAM\bMP\bPL\bLE\bE 1\b1
+         rrdtool xport \
+                 DEF:out=if1-inouts.rrd:outoctets:AVERAGE \
+                 XPORT:out:"out bytes"
+
+E\bEX\bXA\bAM\bMP\bPL\bLE\bE 2\b2
+         rrdtool xport \
+                 DEF:out1=if1-inouts.rrd:outoctets:AVERAGE \
+                 DEF:out2=if2-inouts.rrd:outoctets:AVERAGE \
+                 CDEF:sum=out1,out2,+ \
+                 XPORT:out1:"if1 out bytes" \
+                 XPORT:out2:"if2 out bytes" \
+                 XPORT:sum:"output sum"
+
+A\bAU\bUT\bTH\bHO\bOR\bR
+       Tobias Oetiker <tobi@oetiker.ch>
+
+
+
+1.2.26                            2007-11-20                       RRDXPORT(1)
diff --git a/examples/4charts.pl.in b/examples/4charts.pl.in
new file mode 100755 (executable)
index 0000000..a11b944
--- /dev/null
@@ -0,0 +1,124 @@
+#! @PERL@
+
+#makes things work when run without install
+use lib qw( @prefix@/lib/perl );
+
+use RRDs;
+
+my $start=time;
+my $rrd="randome.rrd";
+my $name = $0;
+$name =~ s/.*\///g;
+$name =~ s/\.pl.*//g;
+
+RRDs::create ($rrd, "--start",$start-1, "--step",300,
+             "DS:a:GAUGE:600:U:U",
+             "DS:b:GAUGE:600:U:U",
+             "RRA:AVERAGE:0.5:1:300",
+             "RRA:MIN:0.5:12:300",
+             "RRA:MAX:0.5:12:300",
+);
+
+my $ERROR = RRDs::error;
+die "$0: unable to create `$rrd': $ERROR\n" if $ERROR;
+
+# dropt some data into the rrd
+my $t;
+for ($t=$start; $t<$start+300*300; $t+=300){
+  RRDs::update $rrd, "$t:".(sin($t/3000)*50+50).":".(sin($t/2500)*50+50);
+  if ($ERROR = RRDs::error) {
+    die "$0: unable to update `$rrd': $ERROR\n";
+  }
+}
+
+my $c1="f57912a0";
+my $c2="2a79e9a0";
+my $w=300;
+my $h=140;
+
+RRDs::graph "$name-L.png",
+  "--title", "2 LINES", 
+  "--start", "now",
+  "--end", "start+15h",
+  "--lower-limit=0",
+  "--interlace", 
+  "--imgformat","PNG",
+  "--width=$w",
+  "--height=$h",
+  "DEF:a=$rrd:a:AVERAGE",
+  "DEF:b=$rrd:b:AVERAGE",
+  "LINE1:a#$c1:Value A",
+  "LINE3:b#$c2:Value B",
+;
+
+RRDs::graph "$name-A.png",
+  "--title", "LINE and AREA", 
+  "--start", "now",
+  "--end", "start+15h",
+  "--lower-limit=0",
+  "--interlace", 
+  "--imgformat","PNG",
+  "--width=$w",
+  "--height=$h",
+  "DEF:a=$rrd:a:AVERAGE",
+  "DEF:b=$rrd:b:AVERAGE",
+  "AREA:a#$c1:Value A",
+  "LINE2:b#$c2:Value B",
+;
+
+RRDs::graph "$name-S.png",
+  "--title", "STACKED AREAS", 
+  "--start", "now",
+  "--end", "start+15h",
+  "--lower-limit=0",
+  "--interlace", 
+  "--imgformat","PNG",
+  "--width=$w",
+  "--height=$h",
+  "DEF:a=$rrd:a:AVERAGE",
+  "DEF:b=$rrd:b:AVERAGE",
+  "AREA:a#$c1:Value A",
+  "STACK:b#$c2:Value B",
+;
+
+
+RRDs::graph "$name-M.png",
+  "--title", "RPN Magic", 
+  "--start", "now",
+  "--end", "start+15h",
+  "--lower-limit=0",
+  "--interlace", 
+  "--imgformat","PNG",
+  "--width=$w",
+  "--height=$h",
+  "DEF:a=$rrd:a:AVERAGE",
+  "DEF:b=$rrd:b:AVERAGE",
+  "CDEF:alpha=TIME,3600,%,1800,LT,a,UNKN,IF",
+  "CDEF:beta=TIME,3600,%,1800,GE,b,UNKN,IF",
+  "AREA:alpha#$c1:Value A",
+  "LINE1:a#$c1",
+  "AREA:beta#$c2:Value B",
+  "LINE1:b#$c2",
+;
+
+RRDs::graph "$name-sample.png",
+  "--title", "Sample", 
+  "--start", "now",
+  "--end", "start+15h",
+  "--lower-limit=0",
+  "--interlace", 
+  "--imgformat","PNG",
+  "--width=600",
+  "--height=50",
+  "DEF:a=$rrd:a:AVERAGE",
+  "DEF:b=$rrd:a:MAX",
+  "AREA:a#00ff00:Incoming",
+  "LINE1:b#ff0000:Max Incoming",
+;
+
+if ($ERROR = RRDs::error) {
+  die "ERROR: $ERROR\n";
+};
+
+print "This script has created $name.png in the current directory\n";
+print "This demonstrates the use of the TIME and % RPN operators\n";
diff --git a/examples/Makefile.am b/examples/Makefile.am
new file mode 100644 (file)
index 0000000..9e7dc84
--- /dev/null
@@ -0,0 +1,16 @@
+## Process this file with automake to produce Makefile.in
+
+#AUTOMAKE_OPTIONS        =  foreign
+
+#ACLOCAL_M4 = $(top_srcdir)/config/aclocal.m4
+
+EXTRA_DIST = cgi-demo.cgi.in
+
+examplesdir = $(pkgdatadir)/examples
+examples_SCRIPTS = cgi-demo.cgi piped-demo.pl shared-demo.pl \
+       stripes.pl bigtops.pl minmax.pl 4charts.pl perftest.pl
+
+cgi-demo.cgi: cgi-demo.cgi.in $(top_builddir)/config.status
+       sed 's,@''exec_prefix@,$(exec_prefix),' cgi-demo.cgi.in > $@
+       chmod a+x $@
+
diff --git a/examples/Makefile.in b/examples/Makefile.in
new file mode 100644 (file)
index 0000000..40a8525
--- /dev/null
@@ -0,0 +1,434 @@
+# Makefile.in generated by automake 1.9.6 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@
+
+#AUTOMAKE_OPTIONS        =  foreign
+
+#ACLOCAL_M4 = $(top_srcdir)/config/aclocal.m4
+
+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 = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = examples
+DIST_COMMON = $(srcdir)/4charts.pl.in $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in $(srcdir)/bigtops.pl.in \
+       $(srcdir)/minmax.pl.in $(srcdir)/perftest.pl.in \
+       $(srcdir)/piped-demo.pl.in $(srcdir)/shared-demo.pl.in \
+       $(srcdir)/stripes.pl.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+       $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/rrd_config.h
+CONFIG_CLEAN_FILES = shared-demo.pl piped-demo.pl stripes.pl \
+       bigtops.pl minmax.pl 4charts.pl perftest.pl
+am__installdirs = "$(DESTDIR)$(examplesdir)"
+examplesSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+SCRIPTS = $(examples_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALL_LIBS = @ALL_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_MULTITHREAD_FALSE = @BUILD_MULTITHREAD_FALSE@
+BUILD_MULTITHREAD_TRUE = @BUILD_MULTITHREAD_TRUE@
+BUILD_RRDCGI_FALSE = @BUILD_RRDCGI_FALSE@
+BUILD_RRDCGI_TRUE = @BUILD_RRDCGI_TRUE@
+BUILD_TCL_FALSE = @BUILD_TCL_FALSE@
+BUILD_TCL_SITE_FALSE = @BUILD_TCL_SITE_FALSE@
+BUILD_TCL_SITE_TRUE = @BUILD_TCL_SITE_TRUE@
+BUILD_TCL_TRUE = @BUILD_TCL_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMP_PERL = @COMP_PERL@
+COMP_PYTHON = @COMP_PYTHON@
+COMP_RUBY = @COMP_RUBY@
+CORE_LIBS = @CORE_LIBS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MULTITHREAD_CFLAGS = @MULTITHREAD_CFLAGS@
+MULTITHREAD_LDFLAGS = @MULTITHREAD_LDFLAGS@
+NROFF = @NROFF@
+NUMVERS = @NUMVERS@
+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@
+PERL = @PERL@
+PERLCC = @PERLCC@
+PERLCCFLAGS = @PERLCCFLAGS@
+PERLFLAGS = @PERLFLAGS@
+PERLLD = @PERLLD@
+PERLLDFLAGS = @PERLLDFLAGS@
+PERL_CC = @PERL_CC@
+PERL_MAKE_OPTIONS = @PERL_MAKE_OPTIONS@
+PERL_VERSION = @PERL_VERSION@
+PKGCONFIG = @PKGCONFIG@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+RRDDOCDIR = @RRDDOCDIR@
+RRDGRAPH_YLEGEND_ANGLE = @RRDGRAPH_YLEGEND_ANGLE@
+RRD_DEFAULT_FONT = @RRD_DEFAULT_FONT@
+RUBY = @RUBY@
+RUBY_MAKE_OPTIONS = @RUBY_MAKE_OPTIONS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@
+TCL_PACKAGE_DIR = @TCL_PACKAGE_DIR@
+TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@
+TCL_PREFIX = @TCL_PREFIX@
+TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@
+TCL_SHLIB_LD = @TCL_SHLIB_LD@
+TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@
+TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
+TCL_VERSION = @TCL_VERSION@
+TROFF = @TROFF@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_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 = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+EXTRA_DIST = cgi-demo.cgi.in
+examplesdir = $(pkgdatadir)/examples
+examples_SCRIPTS = cgi-demo.cgi piped-demo.pl shared-demo.pl \
+       stripes.pl bigtops.pl minmax.pl 4charts.pl perftest.pl
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  examples/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --foreign  examples/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+shared-demo.pl: $(top_builddir)/config.status $(srcdir)/shared-demo.pl.in
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+piped-demo.pl: $(top_builddir)/config.status $(srcdir)/piped-demo.pl.in
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+stripes.pl: $(top_builddir)/config.status $(srcdir)/stripes.pl.in
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+bigtops.pl: $(top_builddir)/config.status $(srcdir)/bigtops.pl.in
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+minmax.pl: $(top_builddir)/config.status $(srcdir)/minmax.pl.in
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+4charts.pl: $(top_builddir)/config.status $(srcdir)/4charts.pl.in
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+perftest.pl: $(top_builddir)/config.status $(srcdir)/perftest.pl.in
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-examplesSCRIPTS: $(examples_SCRIPTS)
+       @$(NORMAL_INSTALL)
+       test -z "$(examplesdir)" || $(mkdir_p) "$(DESTDIR)$(examplesdir)"
+       @list='$(examples_SCRIPTS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         if test -f $$d$$p; then \
+           f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+           echo " $(examplesSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(examplesdir)/$$f'"; \
+           $(examplesSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(examplesdir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-examplesSCRIPTS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(examples_SCRIPTS)'; for p in $$list; do \
+         f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+         echo " rm -f '$(DESTDIR)$(examplesdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(examplesdir)/$$f"; \
+       done
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+distclean-libtool:
+       -rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+       @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
+check-am: all-am
+check: check-am
+all-am: Makefile $(SCRIPTS)
+installdirs:
+       for dir in "$(DESTDIR)$(examplesdir)"; 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-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-examplesSCRIPTS
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-examplesSCRIPTS uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+       distclean distclean-generic distclean-libtool distdir dvi \
+       dvi-am html html-am info info-am install install-am \
+       install-data install-data-am install-examplesSCRIPTS \
+       install-exec install-exec-am install-info install-info-am \
+       install-man install-strip installcheck installcheck-am \
+       installdirs maintainer-clean maintainer-clean-generic \
+       mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+       ps ps-am uninstall uninstall-am uninstall-examplesSCRIPTS \
+       uninstall-info-am
+
+
+cgi-demo.cgi: cgi-demo.cgi.in $(top_builddir)/config.status
+       sed 's,@''exec_prefix@,$(exec_prefix),' cgi-demo.cgi.in > $@
+       chmod a+x $@
+# 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/examples/bigtops.pl.in b/examples/bigtops.pl.in
new file mode 100755 (executable)
index 0000000..997386c
--- /dev/null
@@ -0,0 +1,50 @@
+#! @PERL@
+# this is for after install
+use lib qw( @prefix@/lib/perl );
+
+use RRDs;
+my $start=time;
+my $rrd="randome.rrd";
+my $name = $0;
+$name =~ s/.*\///g;
+$name =~ s/\.pl.*//g;
+
+RRDs::create ($rrd, "--start",$start-1, "--step",300,
+             "DS:a:GAUGE:600:U:U",
+             "DS:b:GAUGE:600:U:U",
+             "RRA:AVERAGE:0.5:1:300");
+my $ERROR = RRDs::error;
+die "$0: unable to create `$rrd': $ERROR\n" if $ERROR;
+
+# dropt some data into the rrd
+my $t;
+for ($t=$start; $t<$start+300*300; $t+=300){
+  RRDs::update $rrd, "$t:".rand(100).":".(sin($t/800)*50+50);
+  if ($ERROR = RRDs::error) {
+    die "$0: unable to update `$rrd': $ERROR\n";
+  }
+}
+
+RRDs::graph "$name.png",
+  "--title", uc($name)." Demo", 
+  "--start", "$start + 1 h",
+  "--end", "start + 1000 min",
+  "--interlace", 
+  "--imgformat","PNG",
+  "--width=450",
+  "DEF:a=$rrd:a:AVERAGE",
+  "DEF:b=$rrd:b:AVERAGE",
+  "CDEF:line=TIME,2400,%,300,LT,a,UNKN,IF",
+  "AREA:b#00b6e4:beta",
+  "AREA:line#0022e9:alpha",
+  "LINE3:line#ff0000",
+
+;
+
+if ($ERROR = RRDs::error) {
+  die "ERROR: $ERROR\n";
+};
+
+
+print "This script has created $name.png in the current directory\n";
+print "This demonstrates the use of the TIME and % RPN operators\n";
diff --git a/examples/cgi-demo.cgi.in b/examples/cgi-demo.cgi.in
new file mode 100755 (executable)
index 0000000..c5c5a11
--- /dev/null
@@ -0,0 +1,40 @@
+#! @exec_prefix@/bin/rrdcgi 
+
+<HTML>
+<HEAD>
+<TITLE>RRDCGI Demo</TITLE>
+</HEAD>
+<BODY>
+Note: This Demo will only work if have previously run
+the <TT>shared-demo.pl</TT>.
+
+<H1>This is NOT traffic</H1>
+
+
+<P><RRD::GRAPH cgi-demo1.png 
+           --lower-limit 0
+           --start 'end-10h'
+           --title "Graph in Localtime <RRD::TIME::NOW %c>"
+            DEF:alpha=shared-demo.rrd:a:AVERAGE
+            DEF:beta=shared-demo.rrd:b:AVERAGE
+            AREA:alpha#0022e9:"Trees on Mars"
+            STACK:beta#00b871:"Elchs in Norway">
+</P>
+
+<P><RRD::SETENV TZ UTC>
+   <RRD::GRAPH cgi-demo2.png 
+           --lower-limit 0
+           --start 'end-10h'
+           --title "Graph in UTC"
+            DEF:alpha=shared-demo.rrd:a:AVERAGE
+            DEF:beta=shared-demo.rrd:b:AVERAGE
+            AREA:alpha#0022e9:"Trees on Mars"
+            STACK:beta#00b871:"Elchs in Norway">
+</P>
+
+</BODY>
+</HTML>
+
+
+
+
diff --git a/examples/minmax.pl.in b/examples/minmax.pl.in
new file mode 100755 (executable)
index 0000000..3fd0e65
--- /dev/null
@@ -0,0 +1,52 @@
+#! @PERL@
+
+use lib qw( @prefix@/lib/perl );
+
+use RRDs;
+my $start=time;
+my $rrd="randome.rrd";
+my $name = $0;
+$name =~ s/.*\///g;
+$name =~ s/\.pl.*//g;
+
+RRDs::create ($rrd, "--start",$start-1, "--step",300,
+             "DS:a:GAUGE:600:U:U",
+             "RRA:AVERAGE:0.5:1:300",
+             "RRA:MIN:0.5:12:300",
+             "RRA:MAX:0.5:12:300",
+);
+my $ERROR = RRDs::error;
+die "$0: unable to create `$rrd': $ERROR\n" if $ERROR;
+
+# dropt some data into the rrd
+my $t;
+for ($t=$start; $t<$start+300*300; $t+=300){
+  RRDs::update $rrd, "$t:".(sin($t/3000)*50+50);
+  if ($ERROR = RRDs::error) {
+    die "$0: unable to update `$rrd': $ERROR\n";
+  }
+}
+
+RRDs::graph "$name.png",
+  "--title", uc($name)." Demo", 
+  "--start", "now",
+  "--end", "start+1d",
+  "--lower-limit=0",
+  "--interlace", 
+  "--imgformat","PNG",
+  "--width=450",
+  "DEF:a=$rrd:a:AVERAGE",
+  "DEF:b=$rrd:a:MIN",
+  "DEF:c=$rrd:a:MAX",
+  "AREA:a#00b6e4:real",
+  "LINE1:b#0022e9:min",
+  "LINE1:c#00ee22:max",
+;
+
+if ($ERROR = RRDs::error) {
+  die "ERROR: $ERROR\n";
+};
+
+
+print "This script has created $name.png in the current directory\n";
+print "This demonstrates the use of MIN and MAX archives\n";
diff --git a/examples/perftest.pl.in b/examples/perftest.pl.in
new file mode 100755 (executable)
index 0000000..b10f59f
--- /dev/null
@@ -0,0 +1,193 @@
+#! @PERL@
+#
+# $Id:$
+#
+# Created By Tobi Oetiker <tobi@oetiker.ch>
+# Date 2006-10-27
+#
+#makes programm work AFTER install
+
+use lib qw( @prefix@/lib/perl );
+
+print <<NOTE;
+
+RRDtool Performance Tester
+--------------------------
+Runnion on $RRDs::VERSION;
+
+RRDtool update performance is ultimately disk-bound. Since very little data
+does actually get written to disk in a single update, the performance
+is highly dependent on the cache situation in your machine.
+
+This test tries to cater for this. It works like this:
+
+1) Create 100 RRD files (and sync them to disk)
+
+2) Update the 100 RRD file three times in a row.
+   We run the Update several times to see the difference
+   it makes in the cache.
+
+3) Go back to 1)
+
+NOTE
+
+use strict;
+use Time::HiRes qw(time);
+use RRDs;
+use IO::File;
+use Time::HiRes qw( usleep );
+
+sub create($$){
+  my $file = shift;
+  my $time = shift;
+  my $start = time; #since we loaded HiRes
+  RRDs::create  ( $file.".rrd", "-b$time", qw(
+                       -s300                        
+                       DS:in:GAUGE:400:U:U
+                       DS:out:GAUGE:400:U:U
+                       RRA:AVERAGE:0.5:1:600
+                       RRA:AVERAGE:0.5:6:600
+                       RRA:MAX:0.5:6:600
+                       RRA:AVERAGE:0.5:24:600
+                       RRA:MAX:0.5:24:600
+                       RRA:AVERAGE:0.5:144:600
+                       RRA:MAX:0.5:144:600
+               ));
+   my $total = time - $start;
+   my $error =  RRDs::error;
+   die $error if $error;
+   return $total;
+}
+
+sub update($$){
+  my $file = shift;
+  my $time = shift;
+  my $in = rand(1000);
+  my $out = rand(1000);
+  my $start = time;
+  my $ret = RRDs::updatev($file.".rrd", $time.":$in:$out");
+#  print join("",map {"  $_ " . $ret->{$_}."\n" } grep /AVERAGE.\[1\]/, sort keys %$ret)."\n** $time\n\n";
+  # sync updates to disk immediately  
+#  usleep(1) if (rand(3) <1 );
+  my $total = time - $start;
+  my $error =  RRDs::error;
+  die $error if $error;
+  return $total;
+}
+
+sub tune($){
+  my $file = shift;
+  my $start = time;
+  RRDs::tune ($file.".rrd", "-a","in:U","-a","out:U","-d","in:GAUGE","-d","out:GAUGE");
+  my $total = time - $start;
+  my $error =  RRDs::error;
+  die $error if $error;
+  return $total;
+}
+
+sub infofetch($){
+  my $file = shift;
+  my $start = time;
+  my $info = RRDs::info ($file.".rrd");
+  my $error =  RRDs::error;
+  die $error if $error;
+  my $lasttime =  $info->{last_update} - $info->{last_update} % $info->{step};           
+  my $fetch = RRDs::fetch ($file.".rrd",'AVERAGE','-s',$lasttime-1,'-e',$lasttime);
+  my $total = time - $start;
+  my $error =  RRDs::error;
+  die $error if $error;
+  return $total;
+}
+
+sub stddev ($$$){ #http://en.wikipedia.org/wiki/Standard_deviation
+  my $sum = shift;
+  my $squaresum = shift;
+  my $count = shift;
+  return sqrt( 1 / $count * ( $squaresum - $sum*$sum / $count ))
+}
+
+sub makerrds($$$$){
+    my $count = shift;
+    my $total = shift;
+    my $list = shift;
+    my $time = shift;
+    my @files;
+    for (1..$count){
+        my $id = sprintf ("%07d",$total);
+        $id =~ s/^(.)(.)(.)(.)(.)//;
+        push @$list, "$1/$2/$3/$4/$5/$id";    
+        -d "$1" or mkdir "$1";
+        -d "$1/$2" or mkdir "$1/$2";
+        -d "$1/$2/$3" or mkdir "$1/$2/$3";
+        -d "$1/$2/$3/$4" or mkdir "$1/$2/$3/$4";
+        -d "$1/$2/$3/$4/$5" or mkdir "$1/$2/$3/$4/$5";
+       push @files, $list->[$total];
+        create $list->[$total++],$time-2;
+       print STDERR ".";
+    }
+   for (@files){ 
+       my $fd = new IO::File("$_.rrd","r");
+       if (defined $fd) {
+           $fd->sync;
+           $fd->close;
+        } else {
+            warn "failed to sync $_\n";
+        }        
+    }
+    return $count;
+}
+    
+    
+sub main (){
+    mkdir "db-$$" or die $!;
+    chdir "db-$$";
+
+    my $step = 100000; # number of rrds to creat for every round
+    
+    my @path;
+    my $time=int(time);
+
+    my $tracksize = 0;
+    my $uppntr = 0;
+
+    
+    my %squaresum = ( cr => 0, up => 0 );
+    my %sum = ( cr => 0, up => 0 );
+    my %count =( cr => 0, up => 0 );
+
+    my $printtime = time;
+    while (1) {
+        # enhance the track
+           $time += 300;
+        $tracksize += makerrds $step,$tracksize,\@path,$time;            
+        # run benchmark
+        for (0..10){
+           $time += 300;
+            my $count = 0;
+            my $sum = 0;
+            my $squaresum = 0;
+            for (my $i = 0; $i<$tracksize;$i ++){
+               my $elapsed = update($path[$i],$time); 
+               $sum += $elapsed;
+               $squaresum += $elapsed**2;
+               $count++;
+            };
+#            for (my $i = 0; $i<$tracksize;$i ++){
+#             my $fh = new IO::File "$path[$i].rrd","r";
+#             if (defined $fh) {
+#                 $fh->sync;
+#                 $fh->close;
+#                } else {
+#                 warn "failed to sync $path[$i]\n";
+#              }       
+#            }
+            my $ups = $count/$sum;
+            my $sdv = stddev($sum,$squaresum,$count);
+            printf STDERR "%4d %6.0f Up/s (%6.5f sdv)\n",$count,$ups,$sdv;
+        }
+       print STDERR "\n";
+       exit ;
+    }
+}
+
+main;
diff --git a/examples/piped-demo.pl.in b/examples/piped-demo.pl.in
new file mode 100755 (executable)
index 0000000..cafb0f5
--- /dev/null
@@ -0,0 +1,148 @@
+#! @PERL@ 
+
+use lib qw( @prefix@/lib/perl );
+
+use RRDp;
+
+# this simpulates a standard mrtg-2.x setup ... we can use this to
+# compare performance ...
+
+$main::DEBUG=0;
+$STEP = 300;
+$RUNS = 12*24*30*6;
+$GRUNS = 20;
+$RRD = "piped-demo.rrd";
+$SVG = "piped-demo.svg";
+$PNG = "piped-demo.png";
+
+# some magic to find the correct rrdtol executable
+$prefix="@prefix@";
+
+if ( -x "@exec_prefix@/bin/rrdtool") {
+   RRDp::start "@exec_prefix@/bin/rrdtool";
+} elsif ( -x "../../../bin/rrdtool") {
+   RRDp::start "../../../bin/rrdtool";
+} else {
+   RRDp::start "../src/rrdtool";
+}
+
+print "* Creating RRD with properties equivalent to mrtg-2.x logfile\n\n";
+
+$START = time()-$RUNS*$STEP;
+
+RRDp::cmd "create $RRD -b $START -s $STEP 
+       DS:in:GAUGE:400:U:U
+       DS:out:GAUGE:400:U:U
+       RRA:AVERAGE:0.5:1:600
+       RRA:AVERAGE:0.5:6:600
+       RRA:MAX:0.5:6:600
+       RRA:AVERAGE:0.5:24:600
+       RRA:MAX:0.5:24:600
+       RRA:AVERAGE:0.5:144:600
+       RRA:MAX:0.5:144:600";
+
+$answer = RRDp::read;
+($user,$sys,$real) =  ($RRDp::user,$RRDp::sys,$RRDp::real);
+    
+print "* Filling RRD with $RUNS Values. One moment please ...\n";
+print "  If you are running over NFS this will take *MUCH* longer\n\n"; 
+
+for ($i=$START+1;
+     $i<$START+$STEP*$RUNS;
+     $i+=$STEP+int((rand()-0.5)*7)){
+
+  $line = "update $RRD $i:".int(rand(100000)).":".int(rand(100000));
+  RRDp::cmd $line;
+  $answer = RRDp::read;
+}
+
+($user1,$sys1,$real1) =  ($RRDp::user,$RRDp::sys,$RRDp::real);
+
+printf "-- performance analysis Update test\n".
+       "   usr/upd: %1.5fs sys/upd: %1.5fs real/upd: %1.5fs upd/sec: %1.0f\n",
+  ($user1-$user)/($RUNS), ($sys1-$sys)/($RUNS), 
+  ($real1-$real)/($RUNS), ($RUNS)/($real1-$real);
+print "\n";
+# creating some graphs
+
+print "* Creating $GRUNS SVG graphs: $SVG\n\n";
+$now = time;
+$localtime = scalar localtime(time);
+$localtime = s/:/\\:/g;
+for ($i=0;$i<$GRUNS;$i++) {
+RRDp::cmd "graph $SVG ", "--title 'Test GRAPH' ",
+       "--imgformat SVG --height 150 --vertical-label 'Dummy Units' ".
+       "--start now".(-$RUNS*$STEP),
+       "--color ARROW#bfbfbf",
+        "DEF:alpha=$RRD:in:AVERAGE",
+        "DEF:beta=$RRD:out:AVERAGE",
+        "CDEF:calc=alpha,beta,+,1.5,/",
+        "AREA:alpha#0022e9:Alpha",
+        "STACK:beta#00b871:Beta",
+        "STACK:calc#ff0091:Calc\\j",
+       "PRINT:alpha:AVERAGE:'Average Alpha\\: %1.2lf %S'",
+       "PRINT:alpha:MIN:'Min Alpha\\: %1.2lf %S'",
+       "PRINT:alpha:MAX:'Max Alpha\\: %1.2lf %S'",
+       "GPRINT:calc:AVERAGE:'Average calc\\: %1.2lf %S\\r'",
+       "GPRINT:calc:MIN:'Min calc\\: %1.2lf %S'",
+       "GPRINT:calc:MAX:'Max calc\\: %1.2lf %S'",
+        "VRULE:".($now-3600)."#008877:'60 Minutes ago'",
+        "COMMENT:'\\s'",
+        "COMMENT:'Graph created on\\: ".$localtime."\\c'";
+
+$answer = RRDp::read;
+}
+($user2,$sys2,$real2) =  ($RRDp::user,$RRDp::sys,$RRDp::real);
+
+print "ANSWER:\n$$answer";
+
+printf "\n-- average Time for one Graph\n".
+       "   usr/grf: %1.5fs sys/grf: %1.5fs real/grf: %1.5fs   graphs/sec: %1.2f\n",
+  ($user2-$user1)/$GRUNS, 
+  ($sys2-$sys1)/$GRUNS, 
+  ($real2-$real1)/$GRUNS, 
+  $GRUNS/($real2-$real1);
+
+print "\n\n* Creating $GRUNS PNG graphs: $PNG\n\n";
+
+$now = time;
+($user1,$sys1,$real1) =  ($RRDp::user,$RRDp::sys,$RRDp::real);
+my $local = "".localtime(time());
+$local =~ s/:/\\:/g;
+
+for ($i=0;$i<$GRUNS;$i++) {
+RRDp::cmd "graph $PNG ", "--title 'Test GRAPH' ",
+       "--imgformat PNG --height 150 --vertical-label 'Dummy Units' ".
+       "--start now".(-$RUNS*$STEP),
+       "--color ARROW#bfbfbf",
+        "DEF:alpha=$RRD:in:AVERAGE",
+        "DEF:beta=$RRD:out:AVERAGE",
+        "CDEF:calc=alpha,beta,+,1.5,/",
+        "AREA:alpha#0022e9:Alpha",
+        "STACK:beta#00b871:Beta",
+        "STACK:calc#ff0091:Calc\\j",
+       "PRINT:alpha:AVERAGE:'Average Alpha\\: %1.2lf %S'",
+       "PRINT:alpha:MIN:'Min Alpha\\: %1.2lf %S'",
+       "PRINT:alpha:MAX:'Max Alpha\\: %1.2lf %S'",
+       "GPRINT:calc:AVERAGE:'Average calc\\: %1.2lf %S\\r'",
+       "GPRINT:calc:MIN:'Min calc\\: %1.2lf %S'",
+       "GPRINT:calc:MAX:'Max calc\\: %1.2lf %S'",
+        "VRULE:".($now-3600)."#008877:'60 Minutes ago'",
+        "COMMENT:'\\s'",
+        "COMMENT:'Graph created on\\: $local\\c'";
+
+$answer = RRDp::read;
+}
+($user2,$sys2,$real2) =  ($RRDp::user,$RRDp::sys,$RRDp::real);
+
+print "ANSWER:\n$$answer";
+
+printf "\n-- average Time for one PNG Graph\n".
+       "   usr/grf: %1.5fs sys/grf: %1.5fs real/grf: %1.5fs".
+       "  graphs/sec: %1.2f\n\n",
+  ($user2-$user1)/$GRUNS, 
+  ($sys2-$sys1)/$GRUNS, 
+  ($real2-$real1)/$GRUNS, 
+  $GRUNS/($real2-$real1);
+
+RRDp::end;
diff --git a/examples/shared-demo.pl.in b/examples/shared-demo.pl.in
new file mode 100755 (executable)
index 0000000..f01c1ae
--- /dev/null
@@ -0,0 +1,215 @@
+#! @PERL@ 
+
+
+END {
+  print "not ok 1\n" unless $loaded;
+  unlink "demo.rrd";
+}
+
+sub ok
+{
+    my($what, $result) = @_ ;
+    $ok_count++;
+    print "not " unless $result;
+    print "ok $ok_count $what\n";
+}
+
+#makes programm work AFTER install
+use lib qw( @prefix@/lib/perl );
+
+use strict;
+use vars qw(@ISA $loaded);
+
+use RRDs;
+$loaded = 1;
+my $ok_count = 1;
+
+ok("loading",1);
+
+######################### End of black magic.
+
+my $STEP  = 100;
+my $RUNS  = 500;
+my $GRUNS = 4;
+my $RRD1  = "shared-demo.rrd";
+my $RRD2  = "shared-demob.rrd";
+my $PNG1  = "shared-demo1.png";
+my $PNG2  = "shared-demo2.png";
+my $time  = 30*int(time/30);
+my $START = $time-$RUNS*$STEP;
+
+my @options = ("-b", $START, "-s", $STEP,
+ "DS:a:GAUGE:2000:U:U",
+ "DS:b:GAUGE:200:U:U",
+ "DS:c:GAUGE:200:U:U",
+ "DS:d:GAUGE:200:U:U",
+ "DS:e:DERIVE:200:U:U",
+ "RRA:AVERAGE:0.5:1:5000",
+ "RRA:AVERAGE:0.5:10:500");
+
+print "* Creating RRD $RRD1 starting at $time.\n\n";
+RRDs::create $RRD1, @options;
+
+my $ERROR = RRDs::error;
+ok("create A", !$ERROR);                                                               #  2
+if ($ERROR) {
+  die "$0: unable to create `$RRD1': $ERROR\n";
+}
+
+print "* Creating RRD $RRD2 starting at $time.\n\n";
+RRDs::create $RRD2, @options;
+
+$ERROR= RRDs::error;
+ok("create B",!$ERROR);                                                                #  3
+if ($ERROR) {
+  die "$0: unable to create `$RRD2': $ERROR\n";
+}
+
+my $last = RRDs::last $RRD1;
+if ($ERROR = RRDs::error) {
+  die "$0: unable to get last `$RRD1': $ERROR\n";
+}
+ok("last A", $last == $START);                                                 #  4
+
+$last = RRDs::last $RRD2;
+if ($ERROR = RRDs::error) {
+  die "$0: unable to get last `$RRD2': $ERROR\n";
+}
+ok("last B", $last == $START);                                                 #  5
+
+print "* Filling $RRD1 and $RRD2 with $RUNS*5 values. One moment please ...\n";
+print "* If you are running over NFS this will take *MUCH* longer\n\n";
+
+srand(int($time / 100));
+
+@options = ();
+
+my $counter = 1e7;
+for (my $t=$START+1;
+     $t<$START+$STEP*$RUNS;
+     $t+=$STEP+int((rand()-0.5)*7)){
+  $counter += int(2500*sin($t/2000)*$STEP);
+  my $data = (1000+500*sin($t/1000)).":".
+      (1000+900*sin($t/2330)).":".
+      (2000*cos($t/1550)).":".
+      (3220*sin($t/3420)).":$counter";
+  push(@options, "$t:$data");
+  RRDs::update $RRD1, "$t:$data";
+  if ($ERROR = RRDs::error) {
+    die "$0: unable to update `$RRD1': $ERROR\n";
+  }
+}
+
+RRDs::update $RRD2, @options;
+
+if ($ERROR = RRDs::error) {
+  die "$0: unable to update `$RRD2': $ERROR\n";
+}
+
+print "* Creating $GRUNS graphs: $PNG1 & $PNG2\n\n";
+my $now = $time;
+for (my $i=0;$i<$GRUNS;$i++) {
+  my @rrd_pngs = ($RRD1, $PNG1, $RRD2, $PNG2);
+  while (@rrd_pngs) {
+    my $RRD = shift(@rrd_pngs);
+    my $PNG = shift(@rrd_pngs);
+    my ($graphret,$xs,$ys) = RRDs::graph $PNG, "--title", 'Test GRAPH', 
+    '--base', '1024',
+          "--vertical-label", 'Dummy Units', "--start", (-$RUNS*$STEP),
+          "--end", $time,
+         "--interlace", "--imgformat","PNG",
+          "DEF:alpha=$RRD:a:AVERAGE",
+          "DEF:beta=$RRD:b:AVERAGE",
+          "DEF:gamma=$RRD:c:AVERAGE",
+          "DEF:delta=$RRD:d:AVERAGE",
+          "DEF:epsilon=$RRD:e:AVERAGE",
+          "CDEF:calc=alpha,beta,+,2,/,100,*,102,/",
+          "AREA:alpha#0022e9:Short",
+          "GPRINT:calc:MAX:Max calc %1.2lf",
+          "STACK:beta#00b871:Demo Text",
+          "GPRINT:calc:AVERAGE:Average calc %1.2lf",
+          "STACK:beta#0ad871:Demo Text 2",
+          "LINE1:gamma#ff0000:Line 1",
+          "LINE2:delta#888800:Line 2",
+          "LINE3:calc#00ff44:Line 3",
+          "LINE3:epsilon#000000:Line 4",
+          "HRULE:1500#ff8800:Horizontal Line at 1500",
+          "PRINT:alpha:AVERAGE:Average Alpha %1.2lf",
+          "PRINT:alpha:MIN:Min Alpha %1.2lf",
+          "PRINT:alpha:MAX:Max Alpha %1.2lf",
+          "GPRINT:calc:MIN:Min calc %1.2lf",
+          "VRULE:".($now-3600)."#008877:60 Minutes ago",
+          "VRULE:".($now-7200)."#008877:120 Minutes ago";
+
+    if ($ERROR = RRDs::error) {
+      die "ERROR: $ERROR\n";
+    } else {
+      print "Image Size: ${xs}x${ys}\n";
+      print "Graph Return:\n",(join "\n", @$graphret),"\n\n";
+    }
+  }
+}
+
+
+
+my ($start,$step,$names,$array) = RRDs::fetch $RRD1, "AVERAGE";
+$ERROR = RRDs::error;
+die "ERROR: $ERROR\n" if $ERROR ;
+print "start=$start, step=$step\n";
+print "                    "; 
+map {printf("%12s",$_)} @$names ;
+print "\n";
+foreach my $line (@$array){
+  print "".localtime($start),"   ";
+  $start += $step; 
+  foreach my $val (@$line) {           
+    printf "%12.1f", $val;
+  }
+  print "\n";
+}
+
+
+
+my ($start,$end,$step,$col_cnt,$legend,$data) = 
+  RRDs::xport ("-m", 400,
+              "--start", "now-1day",
+              "--end", "now",
+              "DEF:alpha=$RRD1:a:AVERAGE",
+              "DEF:beta=$RRD1:d:AVERAGE",
+              "CDEF:calc=alpha,beta,+,2,/,100,*,102,/",
+              "XPORT:alpha:original ds",
+              "XPORT:calc:calculated values",
+              );
+
+my $ERROR = RRDs::error;
+die "$0: unable to xport: $ERROR\n" if $ERROR;
+
+print "\nrrdxport test:\n\n";
+print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n";
+print "<xport>\n";
+print "  <meta>\n";
+print "    <start>$start</start>\n";
+print "    <step>$step</step>\n";
+print "    <end>$end</end>\n";
+print "    <rows>", $#$data + 1, "</rows>\n";
+print "    <columns>$col_cnt</columns>\n";
+print "    <legend>\n";
+foreach my $entry (@$legend) {
+    print "      <entry>$entry</entry>\n";
+}
+print "    </legend>\n";
+print "  </meta>\n";
+print "  <data>\n";
+my $row_counter = 0;
+foreach my $row (@$data) {
+    $row_counter++;
+    print "    <row id=\"$row_counter\"><t is=\"", scalar localtime($start), "\">$start</t>";
+    $start += $step;
+    foreach my $val (@$row) {
+       printf ("<v>%1.10e</v>",$val) if $val ne '';
+       print "<v>NaN</v>" if  $val eq '';
+    }
+    print "</row>\n";
+}
+print "  </data>\n";
+print "</xport>\n";
diff --git a/examples/stripes.pl.in b/examples/stripes.pl.in
new file mode 100755 (executable)
index 0000000..362f499
--- /dev/null
@@ -0,0 +1,46 @@
+#! @PERL@
+use lib qw( @prefix@/lib/perl );
+
+use strict;
+use vars qw(@ISA $loaded);
+
+use RRDs;
+my $start=time;
+my $rrd="random.rrd";
+RRDs::create ($rrd, "--start",$start-1, "--step",300,
+             "DS:a:GAUGE:600:U:U",
+             "DS:b:GAUGE:600:U:U",
+             "RRA:AVERAGE:0.5:1:200");
+my $ERROR = RRDs::error;
+die "$0: unable to create `$rrd': $ERROR\n" if $ERROR;
+my $t;
+for ($t=$start; $t<$start+200*300; $t+=300){
+  RRDs::update $rrd, "$t:".rand(100).":".(sin($t/800)*50+50);
+  if ($ERROR = RRDs::error) {
+    die "$0: unable to update `$rrd': $ERROR\n";
+  }
+}
+RRDs::graph "stripes.png",
+  "--title", "Stripes Demo", 
+  "--start", $start,
+  "--end", "start + 400 min",
+  "--interlace", 
+  "--imgformat","PNG",
+  "--width=450",
+  "DEF:a=$rrd:a:AVERAGE",
+  "DEF:b=$rrd:b:AVERAGE",
+  "CDEF:alpha=TIME,1200,%,600,LT,a,UNKN,IF",
+  "CDEF:beta=TIME,1200,%,600,GE,b,UNKN,IF",
+  "AREA:alpha#0022e9:alpha",
+  "AREA:beta#00b674:beta",
+  "LINE1:b#ff4400:beta envelope\\c",
+  "COMMENT:\\s",
+  "COMMENT:alpha=TIME,1200,%,600,LT,a,UNKN,IF",
+  "COMMENT:beta=TIME,1200,%,600,GE,b,UNKN,IF\\j";
+if ($ERROR = RRDs::error) {
+  die "ERROR: $ERROR\n";
+};
+
+
+print "This script has created stripes.png in the current directory\n";
+print "This demonstrates the use of the TIME and % RPN operators\n";
diff --git a/favicon.ico b/favicon.ico
new file mode 100644 (file)
index 0000000..7d08dd4
Binary files /dev/null and b/favicon.ico differ
diff --git a/install-sh b/install-sh
new file mode 100755 (executable)
index 0000000..4d4a951
--- /dev/null
@@ -0,0 +1,323 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2005-05-14.22
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# 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}"
+
+chmodcmd="$chmodprog 0755"
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c         (ignored)
+-d         create directories instead of installing files.
+-g GROUP   $chgrpprog installed files to GROUP.
+-m MODE    $chmodprog installed files to MODE.
+-o USER    $chownprog installed files to USER.
+-s         $stripprog installed files.
+-t DIRECTORY  install into DIRECTORY.
+-T         report an error if DSTFILE is a directory.
+--help     display this help and exit.
+--version  display version info and exit.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+  case $1 in
+    -c) shift
+        continue;;
+
+    -d) dir_arg=true
+        shift
+        continue;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift
+        shift
+        continue;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) chmodcmd="$chmodprog $2"
+        shift
+        shift
+        continue;;
+
+    -o) chowncmd="$chownprog $2"
+        shift
+        shift
+        continue;;
+
+    -s) stripcmd=$stripprog
+        shift
+        continue;;
+
+    -t) dstarg=$2
+       shift
+       shift
+       continue;;
+
+    -T) no_target_directory=true
+       shift
+       continue;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    *)  # When -d is used, all remaining arguments are directories to create.
+       # When -t is used, the destination is already specified.
+       test -n "$dir_arg$dstarg" && break
+        # Otherwise, the last argument is the destination.  Remove it from $@.
+       for arg
+       do
+          if test -n "$dstarg"; then
+           # $@ is not empty: it contains at least $arg.
+           set fnord "$@" "$dstarg"
+           shift # fnord
+         fi
+         shift # arg
+         dstarg=$arg
+       done
+       break;;
+  esac
+done
+
+if test -z "$1"; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src ;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    src=
+
+    if test -d "$dst"; then
+      mkdircmd=:
+      chmodcmd=
+    else
+      mkdircmd=$mkdirprog
+    fi
+  else
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dstarg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dstarg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst ;;
+    esac
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+       echo "$0: $dstarg: Is a directory" >&2
+       exit 1
+      fi
+      dst=$dst/`basename "$src"`
+    fi
+  fi
+
+  # This sed command emulates the dirname command.
+  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
+
+  # Make sure that the destination directory exists.
+
+  # Skip lots of stat calls in the usual case.
+  if test ! -d "$dstdir"; then
+    defaultIFS='
+        '
+    IFS="${IFS-$defaultIFS}"
+
+    oIFS=$IFS
+    # Some sh's can't handle IFS=/ for some reason.
+    IFS='%'
+    set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    shift
+    IFS=$oIFS
+
+    pathcomp=
+
+    while test $# -ne 0 ; do
+      pathcomp=$pathcomp$1
+      shift
+      if test ! -d "$pathcomp"; then
+        $mkdirprog "$pathcomp"
+       # mkdir can fail with a `File exist' error in case several
+       # install-sh are creating the directory concurrently.  This
+       # is OK.
+       test -d "$pathcomp" || exit
+      fi
+      pathcomp=$pathcomp/
+    done
+  fi
+
+  if test -n "$dir_arg"; then
+    $doit $mkdircmd "$dst" \
+      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+  else
+    dstfile=`basename "$dst"`
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+    trap '(exit $?); exit' 1 2 13 15
+
+    # Copy the file name to the temp name.
+    $doit $cpprog "$src" "$dsttmp" &&
+
+    # 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 $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+    # Now rename the file to the real destination.
+    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+      || {
+          # The rename failed, perhaps because mv can't rename something else
+          # to itself, or perhaps because mv is so ancient that it does not
+          # support -f.
+
+          # Now remove or move aside any old file at destination location.
+          # We try this two ways since rm can't unlink itself on some
+          # systems and the destination file might be busy for other
+          # reasons.  In this case, the final cleanup might fail but the new
+          # file should still install successfully.
+          {
+            if test -f "$dstdir/$dstfile"; then
+              $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+              || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+              || {
+                echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+                (exit 1); exit 1
+              }
+            else
+              :
+            fi
+          } &&
+
+          # Now rename the file to the real destination.
+          $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+        }
+    }
+  fi || { (exit 1); exit 1; }
+done
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+  (exit 0); exit 0
+}
+
+# Local variables:
+# 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/ltmain.sh b/ltmain.sh
new file mode 100644 (file)
index 0000000..06823e0
--- /dev/null
+++ b/ltmain.sh
@@ -0,0 +1,6863 @@
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun configure.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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.
+
+basename="s,^.*/,,g"
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+# The name of this program:
+progname=`echo "$progpath" | $SED $basename`
+modename="$progname"
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.5.22
+TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes.
+if test -n "${ZSH_VERSION+set}" ; then
+  setopt NO_GLOB_SUBST
+fi
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+  # Yippee, $echo works!
+  :
+else
+  # Restart under the correct shell, and then maybe $echo will work.
+  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit $EXIT_SUCCESS
+fi
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  SP2NL='tr \040 \012'
+  NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  SP2NL='tr \100 \n'
+  NL2SP='tr \r\n \100\100'
+  ;;
+esac
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+if test "${LC_ALL+set}" = set; then
+  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
+fi
+if test "${LANG+set}" = set; then
+  save_LANG="$LANG"; LANG=C; export LANG
+fi
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS="  $lt_nl"
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+  $echo "$modename: not configured to build any kind of library" 1>&2
+  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+  exit $EXIT_FAILURE
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+duplicate_deps=no
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+
+#####################################
+# Shell function definitions:
+# This seems to be the best place for them
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible.  If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+    my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+    if test "$run" = ":"; then
+      # Return a directory name, but don't create it in dry-run mode
+      my_tmpdir="${my_template}-$$"
+    else
+
+      # If mktemp works, use that first and foremost
+      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+      if test ! -d "$my_tmpdir"; then
+       # Failing that, at least try and use $RANDOM to avoid a race
+       my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+       save_mktempdir_umask=`umask`
+       umask 0077
+       $mkdir "$my_tmpdir"
+       umask $save_mktempdir_umask
+      fi
+
+      # If we're not in dry-run mode, bomb out on failure
+      test -d "$my_tmpdir" || {
+        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
+       exit $EXIT_FAILURE
+      }
+    fi
+
+    $echo "X$my_tmpdir" | $Xsed
+}
+
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+func_win32_libid ()
+{
+  win32_libid_type="unknown"
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
+      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+      win32_nmres=`eval $NM -f posix -A $1 | \
+       $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
+      case $win32_nmres in
+      import*)  win32_libid_type="x86 archive import";;
+      *)        win32_libid_type="x86 archive static";;
+      esac
+    fi
+    ;;
+  *DLL*)
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
+  $echo $win32_libid_type
+}
+
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+    if test -n "$available_tags" && test -z "$tagname"; then
+      CC_quoted=
+      for arg in $CC; do
+       case $arg in
+         *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+         arg="\"$arg\""
+         ;;
+       esac
+       CC_quoted="$CC_quoted $arg"
+      done
+      case $@ in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+       for z in $available_tags; do
+         if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+           # Evaluate the configuration.
+           eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+           CC_quoted=
+           for arg in $CC; do
+           # Double-quote args containing other shell metacharacters.
+           case $arg in
+             *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
+             arg="\"$arg\""
+             ;;
+           esac
+           CC_quoted="$CC_quoted $arg"
+         done
+           case "$@ " in
+             " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
+             # The compiler in the base compile command matches
+             # the one in the tagged configuration.
+             # Assume this is the tagged configuration we want.
+             tagname=$z
+             break
+             ;;
+           esac
+         fi
+       done
+       # If $tagname still isn't set, then no tagged configuration
+       # was found and let the user know that the "--tag" command
+       # line option must be used.
+       if test -z "$tagname"; then
+         $echo "$modename: unable to infer tagged configuration"
+         $echo "$modename: specify a tag with \`--tag'" 1>&2
+         exit $EXIT_FAILURE
+#        else
+#          $echo "$modename: using $tagname tagged configuration"
+       fi
+       ;;
+      esac
+    fi
+}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+    f_ex_an_ar_dir="$1"; shift
+    f_ex_an_ar_oldlib="$1"
+
+    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
+    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
+    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+     :
+    else
+      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
+      exit $EXIT_FAILURE
+    fi
+}
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+    my_gentop="$1"; shift
+    my_oldlibs=${1+"$@"}
+    my_oldobjs=""
+    my_xlib=""
+    my_xabs=""
+    my_xdir=""
+    my_status=""
+
+    $show "${rm}r $my_gentop"
+    $run ${rm}r "$my_gentop"
+    $show "$mkdir $my_gentop"
+    $run $mkdir "$my_gentop"
+    my_status=$?
+    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
+      exit $my_status
+    fi
+
+    for my_xlib in $my_oldlibs; do
+      # Extract the objects.
+      case $my_xlib in
+       [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+       *) my_xabs=`pwd`"/$my_xlib" ;;
+      esac
+      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
+      my_xdir="$my_gentop/$my_xlib"
+
+      $show "${rm}r $my_xdir"
+      $run ${rm}r "$my_xdir"
+      $show "$mkdir $my_xdir"
+      $run $mkdir "$my_xdir"
+      exit_status=$?
+      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
+       exit $exit_status
+      fi
+      case $host in
+      *-darwin*)
+       $show "Extracting $my_xabs"
+       # Do not bother doing anything if just a dry run
+       if test -z "$run"; then
+         darwin_orig_dir=`pwd`
+         cd $my_xdir || exit $?
+         darwin_archive=$my_xabs
+         darwin_curdir=`pwd`
+         darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
+         darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
+         if test -n "$darwin_arches"; then 
+           darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
+           darwin_arch=
+           $show "$darwin_base_archive has multiple architectures $darwin_arches"
+           for darwin_arch in  $darwin_arches ; do
+             mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+             lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+             cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+             func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+             cd "$darwin_curdir"
+             $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+           done # $darwin_arches
+      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
+           darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
+           darwin_file=
+           darwin_files=
+           for darwin_file in $darwin_filelist; do
+             darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+             lipo -create -output "$darwin_file" $darwin_files
+           done # $darwin_filelist
+           ${rm}r unfat-$$
+           cd "$darwin_orig_dir"
+         else
+           cd "$darwin_orig_dir"
+           func_extract_an_archive "$my_xdir" "$my_xabs"
+         fi # $darwin_arches
+       fi # $run
+       ;;
+      *)
+        func_extract_an_archive "$my_xdir" "$my_xabs"
+        ;;
+      esac
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+    done
+    func_extract_archives_result="$my_oldobjs"
+}
+# End of Shell function definitions
+#####################################
+
+# Darwin sucks
+eval std_shrext=\"$shrext_cmds\"
+
+disable_libs=no
+
+# Parse our command line options once, thoroughly.
+while test "$#" -gt 0
+do
+  arg="$1"
+  shift
+
+  case $arg in
+  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) optarg= ;;
+  esac
+
+  # If the previous option needs an argument, assign it.
+  if test -n "$prev"; then
+    case $prev in
+    execute_dlfiles)
+      execute_dlfiles="$execute_dlfiles $arg"
+      ;;
+    tag)
+      tagname="$arg"
+      preserve_args="${preserve_args}=$arg"
+
+      # Check whether tagname contains only valid characters
+      case $tagname in
+      *[!-_A-Za-z0-9,/]*)
+       $echo "$progname: invalid tag name: $tagname" 1>&2
+       exit $EXIT_FAILURE
+       ;;
+      esac
+
+      case $tagname in
+      CC)
+       # Don't test for the "default" C tag, as we know, it's there, but
+       # not specially marked.
+       ;;
+      *)
+       if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
+         taglist="$taglist $tagname"
+         # Evaluate the configuration.
+         eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
+       else
+         $echo "$progname: ignoring unknown tag $tagname" 1>&2
+       fi
+       ;;
+      esac
+      ;;
+    *)
+      eval "$prev=\$arg"
+      ;;
+    esac
+
+    prev=
+    prevopt=
+    continue
+  fi
+
+  # Have we seen a non-optional argument yet?
+  case $arg in
+  --help)
+    show_help=yes
+    ;;
+
+  --version)
+    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+    $echo
+    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
+    $echo "This is free software; see the source for copying conditions.  There is NO"
+    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+    exit $?
+    ;;
+
+  --config)
+    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
+    # Now print the configurations for the tags.
+    for tagname in $taglist; do
+      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
+    done
+    exit $?
+    ;;
+
+  --debug)
+    $echo "$progname: enabling shell trace mode"
+    set -x
+    preserve_args="$preserve_args $arg"
+    ;;
+
+  --dry-run | -n)
+    run=:
+    ;;
+
+  --features)
+    $echo "host: $host"
+    if test "$build_libtool_libs" = yes; then
+      $echo "enable shared libraries"
+    else
+      $echo "disable shared libraries"
+    fi
+    if test "$build_old_libs" = yes; then
+      $echo "enable static libraries"
+    else
+      $echo "disable static libraries"
+    fi
+    exit $?
+    ;;
+
+  --finish) mode="finish" ;;
+
+  --mode) prevopt="--mode" prev=mode ;;
+  --mode=*) mode="$optarg" ;;
+
+  --preserve-dup-deps) duplicate_deps="yes" ;;
+
+  --quiet | --silent)
+    show=:
+    preserve_args="$preserve_args $arg"
+    ;;
+
+  --tag)
+    prevopt="--tag"
+    prev=tag
+    preserve_args="$preserve_args --tag"
+    ;;
+  --tag=*)
+    set tag "$optarg" ${1+"$@"}
+    shift
+    prev=tag
+    preserve_args="$preserve_args --tag"
+    ;;
+
+  -dlopen)
+    prevopt="-dlopen"
+    prev=execute_dlfiles
+    ;;
+
+  -*)
+    $echo "$modename: unrecognized option \`$arg'" 1>&2
+    $echo "$help" 1>&2
+    exit $EXIT_FAILURE
+    ;;
+
+  *)
+    nonopt="$arg"
+    break
+    ;;
+  esac
+done
+
+if test -n "$prevopt"; then
+  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+  $echo "$help" 1>&2
+  exit $EXIT_FAILURE
+fi
+
+case $disable_libs in
+no) 
+  ;;
+shared)
+  build_libtool_libs=no
+  build_old_libs=yes
+  ;;
+static)
+  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+  ;;
+esac
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+if test -z "$show_help"; then
+
+  # Infer the operation mode.
+  if test -z "$mode"; then
+    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
+    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
+    case $nonopt in
+    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
+      mode=link
+      for arg
+      do
+       case $arg in
+       -c)
+          mode=compile
+          break
+          ;;
+       esac
+      done
+      ;;
+    *db | *dbx | *strace | *truss)
+      mode=execute
+      ;;
+    *install*|cp|mv)
+      mode=install
+      ;;
+    *rm)
+      mode=uninstall
+      ;;
+    *)
+      # If we have no mode, but dlfiles were specified, then do execute mode.
+      test -n "$execute_dlfiles" && mode=execute
+
+      # Just use the default operation mode.
+      if test -z "$mode"; then
+       if test -n "$nonopt"; then
+         $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+       else
+         $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+       fi
+      fi
+      ;;
+    esac
+  fi
+
+  # Only execute mode is allowed to have -dlopen flags.
+  if test -n "$execute_dlfiles" && test "$mode" != execute; then
+    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+    $echo "$help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+
+  # Change the help message to a mode-specific one.
+  generic_help="$help"
+  help="Try \`$modename --help --mode=$mode' for more information."
+
+  # These modes are in order of execution frequency so that they run quickly.
+  case $mode in
+  # libtool compile mode
+  compile)
+    modename="$modename: compile"
+    # Get the compilation command and the source file.
+    base_compile=
+    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
+    suppress_opt=yes
+    suppress_output=
+    arg_mode=normal
+    libobj=
+    later=
+
+    for arg
+    do
+      case $arg_mode in
+      arg  )
+       # do not "continue".  Instead, add this to base_compile
+       lastarg="$arg"
+       arg_mode=normal
+       ;;
+
+      target )
+       libobj="$arg"
+       arg_mode=normal
+       continue
+       ;;
+
+      normal )
+       # Accept any command-line options.
+       case $arg in
+       -o)
+         if test -n "$libobj" ; then
+           $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+           exit $EXIT_FAILURE
+         fi
+         arg_mode=target
+         continue
+         ;;
+
+       -static | -prefer-pic | -prefer-non-pic)
+         later="$later $arg"
+         continue
+         ;;
+
+       -no-suppress)
+         suppress_opt=no
+         continue
+         ;;
+
+       -Xcompiler)
+         arg_mode=arg  #  the next one goes into the "base_compile" arg list
+         continue      #  The current "srcfile" will either be retained or
+         ;;            #  replaced later.  I would guess that would be a bug.
+
+       -Wc,*)
+         args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+         lastarg=
+         save_ifs="$IFS"; IFS=','
+         for arg in $args; do
+           IFS="$save_ifs"
+
+           # Double-quote args containing other shell metacharacters.
+           # Many Bourne shells cannot handle close brackets correctly
+           # in scan sets, so we specify it separately.
+           case $arg in
+             *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
+             arg="\"$arg\""
+             ;;
+           esac
+           lastarg="$lastarg $arg"
+         done
+         IFS="$save_ifs"
+         lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+
+         # Add the arguments to base_compile.
+         base_compile="$base_compile $lastarg"
+         continue
+         ;;
+
+       * )
+         # Accept the current argument as the source file.
+         # The previous "srcfile" becomes the current argument.
+         #
+         lastarg="$srcfile"
+         srcfile="$arg"
+         ;;
+       esac  #  case $arg
+       ;;
+      esac    #  case $arg_mode
+
+      # Aesthetically quote the previous argument.
+      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+      case $lastarg in
+      # Double-quote args containing other shell metacharacters.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, and some SunOS ksh mistreat backslash-escaping
+      # in scan sets (worked around with variable expansion),
+      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
+      # at all, so we specify them separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+       lastarg="\"$lastarg\""
+       ;;
+      esac
+
+      base_compile="$base_compile $lastarg"
+    done # for arg
+
+    case $arg_mode in
+    arg)
+      $echo "$modename: you must specify an argument for -Xcompile"
+      exit $EXIT_FAILURE
+      ;;
+    target)
+      $echo "$modename: you must specify a target with \`-o'" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    *)
+      # Get the name of the library object.
+      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+      ;;
+    esac
+
+    # Recognize several different file suffixes.
+    # If the user specifies -o file.o, it is replaced with file.lo
+    xform='[cCFSifmso]'
+    case $libobj in
+    *.ada) xform=ada ;;
+    *.adb) xform=adb ;;
+    *.ads) xform=ads ;;
+    *.asm) xform=asm ;;
+    *.c++) xform=c++ ;;
+    *.cc) xform=cc ;;
+    *.ii) xform=ii ;;
+    *.class) xform=class ;;
+    *.cpp) xform=cpp ;;
+    *.cxx) xform=cxx ;;
+    *.f90) xform=f90 ;;
+    *.for) xform=for ;;
+    *.java) xform=java ;;
+    esac
+
+    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+    case $libobj in
+    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+    *)
+      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    esac
+
+    func_infer_tag $base_compile
+
+    for arg in $later; do
+      case $arg in
+      -static)
+       build_old_libs=yes
+       continue
+       ;;
+
+      -prefer-pic)
+       pic_mode=yes
+       continue
+       ;;
+
+      -prefer-non-pic)
+       pic_mode=no
+       continue
+       ;;
+      esac
+    done
+
+    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
+    case $qlibobj in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+       qlibobj="\"$qlibobj\"" ;;
+    esac
+    test "X$libobj" != "X$qlibobj" \
+       && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"'  &()|`$[]' \
+       && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
+    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$xdir" = "X$obj"; then
+      xdir=
+    else
+      xdir=$xdir/
+    fi
+    lobj=${xdir}$objdir/$objname
+
+    if test -z "$base_compile"; then
+      $echo "$modename: you must specify a compilation command" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Delete any leftover library objects.
+    if test "$build_old_libs" = yes; then
+      removelist="$obj $lobj $libobj ${libobj}T"
+    else
+      removelist="$lobj $libobj ${libobj}T"
+    fi
+
+    $run $rm $removelist
+    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case $host_os in
+    cygwin* | mingw* | pw32* | os2*)
+      pic_mode=default
+      ;;
+    esac
+    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
+    # Calculate the filename of the output object if compiler does
+    # not support -o with -c
+    if test "$compiler_c_o" = no; then
+      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+      lockfile="$output_obj.lock"
+      removelist="$removelist $output_obj $lockfile"
+      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+    else
+      output_obj=
+      need_locks=no
+      lockfile=
+    fi
+
+    # Lock this critical section if it is needed
+    # We use this script file to make the link, it avoids creating a new file
+    if test "$need_locks" = yes; then
+      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
+       $show "Waiting for $lockfile to be removed"
+       sleep 2
+      done
+    elif test "$need_locks" = warn; then
+      if test -f "$lockfile"; then
+       $echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+       $run $rm $removelist
+       exit $EXIT_FAILURE
+      fi
+      $echo "$srcfile" > "$lockfile"
+    fi
+
+    if test -n "$fix_srcfile_path"; then
+      eval srcfile=\"$fix_srcfile_path\"
+    fi
+    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
+    case $qsrcfile in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+      qsrcfile="\"$qsrcfile\"" ;;
+    esac
+
+    $run $rm "$libobj" "${libobj}T"
+
+    # Create a libtool object file (analogous to a ".la" file),
+    # but don't create it if we're doing a dry run.
+    test -z "$run" && cat > ${libobj}T <<EOF
+# $libobj - a libtool object file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+EOF
+
+    # Only build a PIC object if we are building libtool libraries.
+    if test "$build_libtool_libs" = yes; then
+      # Without this assignment, base_compile gets emptied.
+      fbsd_hideous_sh_bug=$base_compile
+
+      if test "$pic_mode" != no; then
+       command="$base_compile $qsrcfile $pic_flag"
+      else
+       # Don't build PIC code
+       command="$base_compile $qsrcfile"
+      fi
+
+      if test ! -d "${xdir}$objdir"; then
+       $show "$mkdir ${xdir}$objdir"
+       $run $mkdir ${xdir}$objdir
+       exit_status=$?
+       if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
+         exit $exit_status
+       fi
+      fi
+
+      if test -z "$output_obj"; then
+       # Place PIC objects in $objdir
+       command="$command -o $lobj"
+      fi
+
+      $run $rm "$lobj" "$output_obj"
+
+      $show "$command"
+      if $run eval "$command"; then :
+      else
+       test -n "$output_obj" && $run $rm $removelist
+       exit $EXIT_FAILURE
+      fi
+
+      if test "$need_locks" = warn &&
+        test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+       $echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+       $run $rm $removelist
+       exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed, then go on to compile the next one
+      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+       $show "$mv $output_obj $lobj"
+       if $run $mv $output_obj $lobj; then :
+       else
+         error=$?
+         $run $rm $removelist
+         exit $error
+       fi
+      fi
+
+      # Append the name of the PIC object to the libtool object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object='$objdir/$objname'
+
+EOF
+
+      # Allow error messages only from the first compilation.
+      if test "$suppress_opt" = yes; then
+        suppress_output=' >/dev/null 2>&1'
+      fi
+    else
+      # No PIC object so indicate it doesn't exist in the libtool
+      # object file.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object=none
+
+EOF
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test "$build_old_libs" = yes; then
+      if test "$pic_mode" != yes; then
+       # Don't build PIC code
+       command="$base_compile $qsrcfile"
+      else
+       command="$base_compile $qsrcfile $pic_flag"
+      fi
+      if test "$compiler_c_o" = yes; then
+       command="$command -o $obj"
+      fi
+
+      # Suppress compiler output if we already did a PIC compilation.
+      command="$command$suppress_output"
+      $run $rm "$obj" "$output_obj"
+      $show "$command"
+      if $run eval "$command"; then :
+      else
+       $run $rm $removelist
+       exit $EXIT_FAILURE
+      fi
+
+      if test "$need_locks" = warn &&
+        test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+       $echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+       $run $rm $removelist
+       exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed
+      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+       $show "$mv $output_obj $obj"
+       if $run $mv $output_obj $obj; then :
+       else
+         error=$?
+         $run $rm $removelist
+         exit $error
+       fi
+      fi
+
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object='$objname'
+
+EOF
+    else
+      # Append the name of the non-PIC object the libtool object file.
+      # Only append if the libtool object file exists.
+      test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object=none
+
+EOF
+    fi
+
+    $run $mv "${libobj}T" "${libobj}"
+
+    # Unlock the critical section if it was locked
+    if test "$need_locks" != no; then
+      $run $rm "$lockfile"
+    fi
+
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool link mode
+  link | relink)
+    modename="$modename: link"
+    case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+      # It is impossible to link a dll without this setting, and
+      # we shouldn't force the makefile maintainer to figure out
+      # which system we are compiling for in order to pass an extra
+      # flag for every libtool invocation.
+      # allow_undefined=no
+
+      # FIXME: Unfortunately, there are problems with the above when trying
+      # to make a dll which has undefined symbols, in which case not
+      # even a static library is built.  For now, we need to specify
+      # -no-undefined on the libtool link line when we can be certain
+      # that all symbols are satisfied, otherwise we get a static library.
+      allow_undefined=yes
+      ;;
+    *)
+      allow_undefined=yes
+      ;;
+    esac
+    libtool_args="$nonopt"
+    base_compile="$nonopt $@"
+    compile_command="$nonopt"
+    finalize_command="$nonopt"
+
+    compile_rpath=
+    finalize_rpath=
+    compile_shlibpath=
+    finalize_shlibpath=
+    convenience=
+    old_convenience=
+    deplibs=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
+    inst_prefix_dir=
+
+    avoid_version=no
+    dlfiles=
+    dlprefiles=
+    dlself=no
+    export_dynamic=no
+    export_symbols=
+    export_symbols_regex=
+    generated=
+    libobjs=
+    ltlibs=
+    module=no
+    no_install=no
+    objs=
+    non_pic_objects=
+    notinst_path= # paths that contain not-installed libtool libraries
+    precious_files_regex=
+    prefer_static_libs=no
+    preload=no
+    prev=
+    prevarg=
+    release=
+    rpath=
+    xrpath=
+    perm_rpath=
+    temp_rpath=
+    thread_safe=no
+    vinfo=
+    vinfo_number=no
+
+    func_infer_tag $base_compile
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case $arg in
+      -all-static | -static)
+       if test "X$arg" = "X-all-static"; then
+         if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+           $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+         fi
+         if test -n "$link_static_flag"; then
+           dlopen_self=$dlopen_self_static
+         fi
+         prefer_static_libs=yes
+       else
+         if test -z "$pic_flag" && test -n "$link_static_flag"; then
+           dlopen_self=$dlopen_self_static
+         fi
+         prefer_static_libs=built
+       fi
+       build_libtool_libs=no
+       build_old_libs=yes
+       break
+       ;;
+      esac
+    done
+
+    # See if our shared archives depend on static archives.
+    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+    # Go through the arguments, transforming them on the way.
+    while test "$#" -gt 0; do
+      arg="$1"
+      shift
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+       qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
+       ;;
+      *) qarg=$arg ;;
+      esac
+      libtool_args="$libtool_args $qarg"
+
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+       case $prev in
+       output)
+         compile_command="$compile_command @OUTPUT@"
+         finalize_command="$finalize_command @OUTPUT@"
+         ;;
+       esac
+
+       case $prev in
+       dlfiles|dlprefiles)
+         if test "$preload" = no; then
+           # Add the symbol object into the linking commands.
+           compile_command="$compile_command @SYMFILE@"
+           finalize_command="$finalize_command @SYMFILE@"
+           preload=yes
+         fi
+         case $arg in
+         *.la | *.lo) ;;  # We handle these cases below.
+         force)
+           if test "$dlself" = no; then
+             dlself=needless
+             export_dynamic=yes
+           fi
+           prev=
+           continue
+           ;;
+         self)
+           if test "$prev" = dlprefiles; then
+             dlself=yes
+           elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+             dlself=yes
+           else
+             dlself=needless
+             export_dynamic=yes
+           fi
+           prev=
+           continue
+           ;;
+         *)
+           if test "$prev" = dlfiles; then
+             dlfiles="$dlfiles $arg"
+           else
+             dlprefiles="$dlprefiles $arg"
+           fi
+           prev=
+           continue
+           ;;
+         esac
+         ;;
+       expsyms)
+         export_symbols="$arg"
+         if test ! -f "$arg"; then
+           $echo "$modename: symbol file \`$arg' does not exist"
+           exit $EXIT_FAILURE
+         fi
+         prev=
+         continue
+         ;;
+       expsyms_regex)
+         export_symbols_regex="$arg"
+         prev=
+         continue
+         ;;
+       inst_prefix)
+         inst_prefix_dir="$arg"
+         prev=
+         continue
+         ;;
+       precious_regex)
+         precious_files_regex="$arg"
+         prev=
+         continue
+         ;;
+       release)
+         release="-$arg"
+         prev=
+         continue
+         ;;
+       objectlist)
+         if test -f "$arg"; then
+           save_arg=$arg
+           moreargs=
+           for fil in `cat $save_arg`
+           do
+#            moreargs="$moreargs $fil"
+             arg=$fil
+             # A libtool-controlled object.
+
+             # Check to see that this really is a libtool object.
+             if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+               pic_object=
+               non_pic_object=
+
+               # Read the .lo file
+               # If there is no directory component, then add one.
+               case $arg in
+               */* | *\\*) . $arg ;;
+               *) . ./$arg ;;
+               esac
+
+               if test -z "$pic_object" || \
+                  test -z "$non_pic_object" ||
+                  test "$pic_object" = none && \
+                  test "$non_pic_object" = none; then
+                 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+                 exit $EXIT_FAILURE
+               fi
+
+               # Extract subdirectory from the argument.
+               xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+               if test "X$xdir" = "X$arg"; then
+                 xdir=
+               else
+                 xdir="$xdir/"
+               fi
+
+               if test "$pic_object" != none; then
+                 # Prepend the subdirectory the object is found in.
+                 pic_object="$xdir$pic_object"
+
+                 if test "$prev" = dlfiles; then
+                   if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+                     dlfiles="$dlfiles $pic_object"
+                     prev=
+                     continue
+                   else
+                     # If libtool objects are unsupported, then we need to preload.
+                     prev=dlprefiles
+                   fi
+                 fi
+
+                 # CHECK ME:  I think I busted this.  -Ossama
+                 if test "$prev" = dlprefiles; then
+                   # Preload the old-style object.
+                   dlprefiles="$dlprefiles $pic_object"
+                   prev=
+                 fi
+
+                 # A PIC object.
+                 libobjs="$libobjs $pic_object"
+                 arg="$pic_object"
+               fi
+
+               # Non-PIC object.
+               if test "$non_pic_object" != none; then
+                 # Prepend the subdirectory the object is found in.
+                 non_pic_object="$xdir$non_pic_object"
+
+                 # A standard non-PIC object
+                 non_pic_objects="$non_pic_objects $non_pic_object"
+                 if test -z "$pic_object" || test "$pic_object" = none ; then
+                   arg="$non_pic_object"
+                 fi
+               else
+                 # If the PIC object exists, use it instead.
+                 # $xdir was prepended to $pic_object above.
+                 non_pic_object="$pic_object"
+                 non_pic_objects="$non_pic_objects $non_pic_object"
+               fi
+             else
+               # Only an error if not doing a dry-run.
+               if test -z "$run"; then
+                 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+                 exit $EXIT_FAILURE
+               else
+                 # Dry-run case.
+
+                 # Extract subdirectory from the argument.
+                 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+                 if test "X$xdir" = "X$arg"; then
+                   xdir=
+                 else
+                   xdir="$xdir/"
+                 fi
+
+                 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+                 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+                 libobjs="$libobjs $pic_object"
+                 non_pic_objects="$non_pic_objects $non_pic_object"
+               fi
+             fi
+           done
+         else
+           $echo "$modename: link input file \`$save_arg' does not exist"
+           exit $EXIT_FAILURE
+         fi
+         arg=$save_arg
+         prev=
+         continue
+         ;;
+       rpath | xrpath)
+         # We need an absolute path.
+         case $arg in
+         [\\/]* | [A-Za-z]:[\\/]*) ;;
+         *)
+           $echo "$modename: only absolute run-paths are allowed" 1>&2
+           exit $EXIT_FAILURE
+           ;;
+         esac
+         if test "$prev" = rpath; then
+           case "$rpath " in
+           *" $arg "*) ;;
+           *) rpath="$rpath $arg" ;;
+           esac
+         else
+           case "$xrpath " in
+           *" $arg "*) ;;
+           *) xrpath="$xrpath $arg" ;;
+           esac
+         fi
+         prev=
+         continue
+         ;;
+       xcompiler)
+         compiler_flags="$compiler_flags $qarg"
+         prev=
+         compile_command="$compile_command $qarg"
+         finalize_command="$finalize_command $qarg"
+         continue
+         ;;
+       xlinker)
+         linker_flags="$linker_flags $qarg"
+         compiler_flags="$compiler_flags $wl$qarg"
+         prev=
+         compile_command="$compile_command $wl$qarg"
+         finalize_command="$finalize_command $wl$qarg"
+         continue
+         ;;
+       xcclinker)
+         linker_flags="$linker_flags $qarg"
+         compiler_flags="$compiler_flags $qarg"
+         prev=
+         compile_command="$compile_command $qarg"
+         finalize_command="$finalize_command $qarg"
+         continue
+         ;;
+       shrext)
+         shrext_cmds="$arg"
+         prev=
+         continue
+         ;;
+       darwin_framework|darwin_framework_skip)
+         test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
+         compile_command="$compile_command $arg"
+         finalize_command="$finalize_command $arg"
+         prev=
+         continue
+         ;;
+       *)
+         eval "$prev=\"\$arg\""
+         prev=
+         continue
+         ;;
+       esac
+      fi # test -n "$prev"
+
+      prevarg="$arg"
+
+      case $arg in
+      -all-static)
+       if test -n "$link_static_flag"; then
+         compile_command="$compile_command $link_static_flag"
+         finalize_command="$finalize_command $link_static_flag"
+       fi
+       continue
+       ;;
+
+      -allow-undefined)
+       # FIXME: remove this flag sometime in the future.
+       $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+       continue
+       ;;
+
+      -avoid-version)
+       avoid_version=yes
+       continue
+       ;;
+
+      -dlopen)
+       prev=dlfiles
+       continue
+       ;;
+
+      -dlpreopen)
+       prev=dlprefiles
+       continue
+       ;;
+
+      -export-dynamic)
+       export_dynamic=yes
+       continue
+       ;;
+
+      -export-symbols | -export-symbols-regex)
+       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+         $echo "$modename: more than one -exported-symbols argument is not allowed"
+         exit $EXIT_FAILURE
+       fi
+       if test "X$arg" = "X-export-symbols"; then
+         prev=expsyms
+       else
+         prev=expsyms_regex
+       fi
+       continue
+       ;;
+
+      -framework|-arch|-isysroot)
+       case " $CC " in
+         *" ${arg} ${1} "* | *" ${arg} ${1} "*) 
+               prev=darwin_framework_skip ;;
+         *) compiler_flags="$compiler_flags $arg"
+            prev=darwin_framework ;;
+       esac
+       compile_command="$compile_command $arg"
+       finalize_command="$finalize_command $arg"
+       continue
+       ;;
+
+      -inst-prefix-dir)
+       prev=inst_prefix
+       continue
+       ;;
+
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+       case $with_gcc/$host in
+       no/*-*-irix* | /*-*-irix*)
+         compile_command="$compile_command $arg"
+         finalize_command="$finalize_command $arg"
+         ;;
+       esac
+       continue
+       ;;
+
+      -L*)
+       dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+       # We need an absolute path.
+       case $dir in
+       [\\/]* | [A-Za-z]:[\\/]*) ;;
+       *)
+         absdir=`cd "$dir" && pwd`
+         if test -z "$absdir"; then
+           $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+           absdir="$dir"
+           notinst_path="$notinst_path $dir"
+         fi
+         dir="$absdir"
+         ;;
+       esac
+       case "$deplibs " in
+       *" -L$dir "*) ;;
+       *)
+         deplibs="$deplibs -L$dir"
+         lib_search_path="$lib_search_path $dir"
+         ;;
+       esac
+       case $host in
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+         testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
+         case :$dllsearchpath: in
+         *":$dir:"*) ;;
+         *) dllsearchpath="$dllsearchpath:$dir";;
+         esac
+         case :$dllsearchpath: in
+         *":$testbindir:"*) ;;
+         *) dllsearchpath="$dllsearchpath:$testbindir";;
+         esac
+         ;;
+       esac
+       continue
+       ;;
+
+      -l*)
+       if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+         case $host in
+         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
+           # These systems don't actually have a C or math library (as such)
+           continue
+           ;;
+         *-*-os2*)
+           # These systems don't actually have a C library (as such)
+           test "X$arg" = "X-lc" && continue
+           ;;
+         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+           # Do not include libc due to us having libc/libc_r.
+           test "X$arg" = "X-lc" && continue
+           ;;
+         *-*-rhapsody* | *-*-darwin1.[012])
+           # Rhapsody C and math libraries are in the System framework
+           deplibs="$deplibs -framework System"
+           continue
+           ;;
+         *-*-sco3.2v5* | *-*-sco5v6*)
+           # Causes problems with __ctype
+           test "X$arg" = "X-lc" && continue
+           ;;
+         *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+           # Compiler inserts libc in the correct place for threads to work
+           test "X$arg" = "X-lc" && continue
+           ;;
+         esac
+       elif test "X$arg" = "X-lc_r"; then
+        case $host in
+        *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+          # Do not include libc_r directly, use -pthread flag.
+          continue
+          ;;
+        esac
+       fi
+       deplibs="$deplibs $arg"
+       continue
+       ;;
+
+      # Tru64 UNIX uses -model [arg] to determine the layout of C++
+      # classes, name mangling, and exception handling.
+      -model)
+       compile_command="$compile_command $arg"
+       compiler_flags="$compiler_flags $arg"
+       finalize_command="$finalize_command $arg"
+       prev=xcompiler
+       continue
+       ;;
+
+     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+       compiler_flags="$compiler_flags $arg"
+       compile_command="$compile_command $arg"
+       finalize_command="$finalize_command $arg"
+       continue
+       ;;
+
+      -module)
+       module=yes
+       continue
+       ;;
+
+      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+      # -r[0-9][0-9]* specifies the processor on the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+      # +DA*, +DD* enable 64-bit mode on the HP compiler
+      # -q* pass through compiler args for the IBM compiler
+      # -m* pass through architecture-specific compiler args for GCC
+      # -m*, -t[45]*, -txscale* pass through architecture-specific
+      # compiler args for GCC
+      # -pg pass through profiling flag for GCC
+      # @file GCC response files
+      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
+      -t[45]*|-txscale*|@*)
+
+       # Unknown arguments in both finalize_command and compile_command need
+       # to be aesthetically quoted because they are evaled later.
+       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+       case $arg in
+       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
+         arg="\"$arg\""
+         ;;
+       esac
+        compile_command="$compile_command $arg"
+        finalize_command="$finalize_command $arg"
+        compiler_flags="$compiler_flags $arg"
+        continue
+        ;;
+
+      -shrext)
+       prev=shrext
+       continue
+       ;;
+
+      -no-fast-install)
+       fast_install=no
+       continue
+       ;;
+
+      -no-install)
+       case $host in
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+         # The PATH hackery in wrapper scripts is required on Windows
+         # in order for the loader to find any dlls it needs.
+         $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
+         $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
+         fast_install=no
+         ;;
+       *) no_install=yes ;;
+       esac
+       continue
+       ;;
+
+      -no-undefined)
+       allow_undefined=no
+       continue
+       ;;
+
+      -objectlist)
+       prev=objectlist
+       continue
+       ;;
+
+      -o) prev=output ;;
+
+      -precious-files-regex)
+       prev=precious_regex
+       continue
+       ;;
+
+      -release)
+       prev=release
+       continue
+       ;;
+
+      -rpath)
+       prev=rpath
+       continue
+       ;;
+
+      -R)
+       prev=xrpath
+       continue
+       ;;
+
+      -R*)
+       dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+       # We need an absolute path.
+       case $dir in
+       [\\/]* | [A-Za-z]:[\\/]*) ;;
+       *)
+         $echo "$modename: only absolute run-paths are allowed" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+       case "$xrpath " in
+       *" $dir "*) ;;
+       *) xrpath="$xrpath $dir" ;;
+       esac
+       continue
+       ;;
+
+      -static)
+       # The effects of -static are defined in a previous loop.
+       # We used to do the same as -all-static on platforms that
+       # didn't have a PIC flag, but the assumption that the effects
+       # would be equivalent was wrong.  It would break on at least
+       # Digital Unix and AIX.
+       continue
+       ;;
+
+      -thread-safe)
+       thread_safe=yes
+       continue
+       ;;
+
+      -version-info)
+       prev=vinfo
+       continue
+       ;;
+      -version-number)
+       prev=vinfo
+       vinfo_number=yes
+       continue
+       ;;
+
+      -Wc,*)
+       args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+       arg=
+       save_ifs="$IFS"; IFS=','
+       for flag in $args; do
+         IFS="$save_ifs"
+         case $flag in
+           *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
+           flag="\"$flag\""
+           ;;
+         esac
+         arg="$arg $wl$flag"
+         compiler_flags="$compiler_flags $flag"
+       done
+       IFS="$save_ifs"
+       arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+       ;;
+
+      -Wl,*)
+       args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+       arg=
+       save_ifs="$IFS"; IFS=','
+       for flag in $args; do
+         IFS="$save_ifs"
+         case $flag in
+           *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
+           flag="\"$flag\""
+           ;;
+         esac
+         arg="$arg $wl$flag"
+         compiler_flags="$compiler_flags $wl$flag"
+         linker_flags="$linker_flags $flag"
+       done
+       IFS="$save_ifs"
+       arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+       ;;
+
+      -Xcompiler)
+       prev=xcompiler
+       continue
+       ;;
+
+      -Xlinker)
+       prev=xlinker
+       continue
+       ;;
+
+      -XCClinker)
+       prev=xcclinker
+       continue
+       ;;
+
+      # Some other compiler flag.
+      -* | +*)
+       # Unknown arguments in both finalize_command and compile_command need
+       # to be aesthetically quoted because they are evaled later.
+       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+       case $arg in
+       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
+         arg="\"$arg\""
+         ;;
+       esac
+       ;;
+
+      *.$objext)
+       # A standard object.
+       objs="$objs $arg"
+       ;;
+
+      *.lo)
+       # A libtool-controlled object.
+
+       # Check to see that this really is a libtool object.
+       if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+         pic_object=
+         non_pic_object=
+
+         # Read the .lo file
+         # If there is no directory component, then add one.
+         case $arg in
+         */* | *\\*) . $arg ;;
+         *) . ./$arg ;;
+         esac
+
+         if test -z "$pic_object" || \
+            test -z "$non_pic_object" ||
+            test "$pic_object" = none && \
+            test "$non_pic_object" = none; then
+           $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+           exit $EXIT_FAILURE
+         fi
+
+         # Extract subdirectory from the argument.
+         xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+         if test "X$xdir" = "X$arg"; then
+           xdir=
+         else
+           xdir="$xdir/"
+         fi
+
+         if test "$pic_object" != none; then
+           # Prepend the subdirectory the object is found in.
+           pic_object="$xdir$pic_object"
+
+           if test "$prev" = dlfiles; then
+             if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+               dlfiles="$dlfiles $pic_object"
+               prev=
+               continue
+             else
+               # If libtool objects are unsupported, then we need to preload.
+               prev=dlprefiles
+             fi
+           fi
+
+           # CHECK ME:  I think I busted this.  -Ossama
+           if test "$prev" = dlprefiles; then
+             # Preload the old-style object.
+             dlprefiles="$dlprefiles $pic_object"
+             prev=
+           fi
+
+           # A PIC object.
+           libobjs="$libobjs $pic_object"
+           arg="$pic_object"
+         fi
+
+         # Non-PIC object.
+         if test "$non_pic_object" != none; then
+           # Prepend the subdirectory the object is found in.
+           non_pic_object="$xdir$non_pic_object"
+
+           # A standard non-PIC object
+           non_pic_objects="$non_pic_objects $non_pic_object"
+           if test -z "$pic_object" || test "$pic_object" = none ; then
+             arg="$non_pic_object"
+           fi
+         else
+           # If the PIC object exists, use it instead.
+           # $xdir was prepended to $pic_object above.
+           non_pic_object="$pic_object"
+           non_pic_objects="$non_pic_objects $non_pic_object"
+         fi
+       else
+         # Only an error if not doing a dry-run.
+         if test -z "$run"; then
+           $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+           exit $EXIT_FAILURE
+         else
+           # Dry-run case.
+
+           # Extract subdirectory from the argument.
+           xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+           if test "X$xdir" = "X$arg"; then
+             xdir=
+           else
+             xdir="$xdir/"
+           fi
+
+           pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+           non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+           libobjs="$libobjs $pic_object"
+           non_pic_objects="$non_pic_objects $non_pic_object"
+         fi
+       fi
+       ;;
+
+      *.$libext)
+       # An archive.
+       deplibs="$deplibs $arg"
+       old_deplibs="$old_deplibs $arg"
+       continue
+       ;;
+
+      *.la)
+       # A libtool-controlled library.
+
+       if test "$prev" = dlfiles; then
+         # This library was specified with -dlopen.
+         dlfiles="$dlfiles $arg"
+         prev=
+       elif test "$prev" = dlprefiles; then
+         # The library was specified with -dlpreopen.
+         dlprefiles="$dlprefiles $arg"
+         prev=
+       else
+         deplibs="$deplibs $arg"
+       fi
+       continue
+       ;;
+
+      # Some other compiler argument.
+      *)
+       # Unknown arguments in both finalize_command and compile_command need
+       # to be aesthetically quoted because they are evaled later.
+       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+       case $arg in
+       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
+         arg="\"$arg\""
+         ;;
+       esac
+       ;;
+      esac # arg
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+       compile_command="$compile_command $arg"
+       finalize_command="$finalize_command $arg"
+      fi
+    done # argument parsing loop
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+      eval arg=\"$export_dynamic_flag_spec\"
+      compile_command="$compile_command $arg"
+      finalize_command="$finalize_command $arg"
+    fi
+
+    oldlibs=
+    # calculate the name of the file, without its directory
+    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+    libobjs_save="$libobjs"
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+    if test "X$output_objdir" = "X$output"; then
+      output_objdir="$objdir"
+    else
+      output_objdir="$output_objdir/$objdir"
+    fi
+    # Create the object directory.
+    if test ! -d "$output_objdir"; then
+      $show "$mkdir $output_objdir"
+      $run $mkdir $output_objdir
+      exit_status=$?
+      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
+       exit $exit_status
+      fi
+    fi
+
+    # Determine the type of output
+    case $output in
+    "")
+      $echo "$modename: you must specify an output file" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+      ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
+
+    case $host in
+    *cygwin* | *mingw* | *pw32*)
+      # don't eliminate duplications in $postdeps and $predeps
+      duplicate_compiler_generated_deps=yes
+      ;;
+    *)
+      duplicate_compiler_generated_deps=$duplicate_deps
+      ;;
+    esac
+    specialdeplibs=
+
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      if test "X$duplicate_deps" = "Xyes" ; then
+       case "$libs " in
+       *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+       esac
+      fi
+      libs="$libs $deplib"
+    done
+
+    if test "$linkmode" = lib; then
+      libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+      # Compute libraries that are listed more than once in $predeps
+      # $postdeps and mark them as special (i.e., whose duplicates are
+      # not to be eliminated).
+      pre_post_deps=
+      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
+       for pre_post_dep in $predeps $postdeps; do
+         case "$pre_post_deps " in
+         *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+         esac
+         pre_post_deps="$pre_post_deps $pre_post_dep"
+       done
+      fi
+      pre_post_deps=
+    fi
+
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    notinst_deplibs= # not-installed libtool libraries
+    case $linkmode in
+    lib)
+       passes="conv link"
+       for file in $dlfiles $dlprefiles; do
+         case $file in
+         *.la) ;;
+         *)
+           $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
+           exit $EXIT_FAILURE
+           ;;
+         esac
+       done
+       ;;
+    prog)
+       compile_deplibs=
+       finalize_deplibs=
+       alldeplibs=no
+       newdlfiles=
+       newdlprefiles=
+       passes="conv scan dlopen dlpreopen link"
+       ;;
+    *)  passes="conv"
+       ;;
+    esac
+    for pass in $passes; do
+      if test "$linkmode,$pass" = "lib,link" ||
+        test "$linkmode,$pass" = "prog,scan"; then
+       libs="$deplibs"
+       deplibs=
+      fi
+      if test "$linkmode" = prog; then
+       case $pass in
+       dlopen) libs="$dlfiles" ;;
+       dlpreopen) libs="$dlprefiles" ;;
+       link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+       esac
+      fi
+      if test "$pass" = dlopen; then
+       # Collect dlpreopened libraries
+       save_deplibs="$deplibs"
+       deplibs=
+      fi
+      for deplib in $libs; do
+       lib=
+       found=no
+       case $deplib in
+       -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+         if test "$linkmode,$pass" = "prog,link"; then
+           compile_deplibs="$deplib $compile_deplibs"
+           finalize_deplibs="$deplib $finalize_deplibs"
+         else
+           compiler_flags="$compiler_flags $deplib"
+         fi
+         continue
+         ;;
+       -l*)
+         if test "$linkmode" != lib && test "$linkmode" != prog; then
+           $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
+           continue
+         fi
+         name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+         for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
+           for search_ext in .la $std_shrext .so .a; do
+             # Search the libtool library
+             lib="$searchdir/lib${name}${search_ext}"
+             if test -f "$lib"; then
+               if test "$search_ext" = ".la"; then
+                 found=yes
+               else
+                 found=no
+               fi
+               break 2
+             fi
+           done
+         done
+         if test "$found" != yes; then
+           # deplib doesn't seem to be a libtool library
+           if test "$linkmode,$pass" = "prog,link"; then
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           else
+             deplibs="$deplib $deplibs"
+             test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+           fi
+           continue
+         else # deplib is a libtool library
+           # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+           # We need to do some special things here, and not later.
+           if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+             case " $predeps $postdeps " in
+             *" $deplib "*)
+               if (${SED} -e '2q' $lib |
+                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+                 library_names=
+                 old_library=
+                 case $lib in
+                 */* | *\\*) . $lib ;;
+                 *) . ./$lib ;;
+                 esac
+                 for l in $old_library $library_names; do
+                   ll="$l"
+                 done
+                 if test "X$ll" = "X$old_library" ; then # only static version available
+                   found=no
+                   ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+                   test "X$ladir" = "X$lib" && ladir="."
+                   lib=$ladir/$old_library
+                   if test "$linkmode,$pass" = "prog,link"; then
+                     compile_deplibs="$deplib $compile_deplibs"
+                     finalize_deplibs="$deplib $finalize_deplibs"
+                   else
+                     deplibs="$deplib $deplibs"
+                     test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+                   fi
+                   continue
+                 fi
+               fi
+               ;;
+             *) ;;
+             esac
+           fi
+         fi
+         ;; # -l
+       -L*)
+         case $linkmode in
+         lib)
+           deplibs="$deplib $deplibs"
+           test "$pass" = conv && continue
+           newdependency_libs="$deplib $newdependency_libs"
+           newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+           ;;
+         prog)
+           if test "$pass" = conv; then
+             deplibs="$deplib $deplibs"
+             continue
+           fi
+           if test "$pass" = scan; then
+             deplibs="$deplib $deplibs"
+           else
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           fi
+           newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+           ;;
+         *)
+           $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
+           ;;
+         esac # linkmode
+         continue
+         ;; # -L
+       -R*)
+         if test "$pass" = link; then
+           dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+           # Make sure the xrpath contains only unique directories.
+           case "$xrpath " in
+           *" $dir "*) ;;
+           *) xrpath="$xrpath $dir" ;;
+           esac
+         fi
+         deplibs="$deplib $deplibs"
+         continue
+         ;;
+       *.la) lib="$deplib" ;;
+       *.$libext)
+         if test "$pass" = conv; then
+           deplibs="$deplib $deplibs"
+           continue
+         fi
+         case $linkmode in
+         lib)
+           valid_a_lib=no
+           case $deplibs_check_method in
+             match_pattern*)
+               set dummy $deplibs_check_method
+               match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+               if eval $echo \"$deplib\" 2>/dev/null \
+                   | $SED 10q \
+                   | $EGREP "$match_pattern_regex" > /dev/null; then
+                 valid_a_lib=yes
+               fi
+               ;;
+             pass_all)
+               valid_a_lib=yes
+               ;;
+            esac
+           if test "$valid_a_lib" != yes; then
+             $echo
+             $echo "*** Warning: Trying to link with static lib archive $deplib."
+             $echo "*** I have the capability to make that library automatically link in when"
+             $echo "*** you link to this library.  But I can only do this if you have a"
+             $echo "*** shared version of the library, which you do not appear to have"
+             $echo "*** because the file extensions .$libext of this argument makes me believe"
+             $echo "*** that it is just a static archive that I should not used here."
+           else
+             $echo
+             $echo "*** Warning: Linking the shared library $output against the"
+             $echo "*** static library $deplib is not portable!"
+             deplibs="$deplib $deplibs"
+           fi
+           continue
+           ;;
+         prog)
+           if test "$pass" != link; then
+             deplibs="$deplib $deplibs"
+           else
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           fi
+           continue
+           ;;
+         esac # linkmode
+         ;; # *.$libext
+       *.lo | *.$objext)
+         if test "$pass" = conv; then
+           deplibs="$deplib $deplibs"
+         elif test "$linkmode" = prog; then
+           if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+             # If there is no dlopen support or we're linking statically,
+             # we need to preload.
+             newdlprefiles="$newdlprefiles $deplib"
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           else
+             newdlfiles="$newdlfiles $deplib"
+           fi
+         fi
+         continue
+         ;;
+       %DEPLIBS%)
+         alldeplibs=yes
+         continue
+         ;;
+       esac # case $deplib
+       if test "$found" = yes || test -f "$lib"; then :
+       else
+         $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       # Check to see that this really is a libtool archive.
+       if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+       else
+         $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+       test "X$ladir" = "X$lib" && ladir="."
+
+       dlname=
+       dlopen=
+       dlpreopen=
+       libdir=
+       library_names=
+       old_library=
+       # If the library was installed with an old release of libtool,
+       # it will not redefine variables installed, or shouldnotlink
+       installed=yes
+       shouldnotlink=no
+       avoidtemprpath=
+
+
+       # Read the .la file
+       case $lib in
+       */* | *\\*) . $lib ;;
+       *) . ./$lib ;;
+       esac
+
+       if test "$linkmode,$pass" = "lib,link" ||
+          test "$linkmode,$pass" = "prog,scan" ||
+          { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+         test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+         test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+       fi
+
+       if test "$pass" = conv; then
+         # Only check for convenience libraries
+         deplibs="$lib $deplibs"
+         if test -z "$libdir"; then
+           if test -z "$old_library"; then
+             $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+             exit $EXIT_FAILURE
+           fi
+           # It is a libtool convenience library, so add in its objects.
+           convenience="$convenience $ladir/$objdir/$old_library"
+           old_convenience="$old_convenience $ladir/$objdir/$old_library"
+           tmp_libs=
+           for deplib in $dependency_libs; do
+             deplibs="$deplib $deplibs"
+              if test "X$duplicate_deps" = "Xyes" ; then
+               case "$tmp_libs " in
+               *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+               esac
+              fi
+             tmp_libs="$tmp_libs $deplib"
+           done
+         elif test "$linkmode" != prog && test "$linkmode" != lib; then
+           $echo "$modename: \`$lib' is not a convenience library" 1>&2
+           exit $EXIT_FAILURE
+         fi
+         continue
+       fi # $pass = conv
+
+
+       # Get the name of the library we link against.
+       linklib=
+       for l in $old_library $library_names; do
+         linklib="$l"
+       done
+       if test -z "$linklib"; then
+         $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       # This library was specified with -dlopen.
+       if test "$pass" = dlopen; then
+         if test -z "$libdir"; then
+           $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+           exit $EXIT_FAILURE
+         fi
+         if test -z "$dlname" ||
+            test "$dlopen_support" != yes ||
+            test "$build_libtool_libs" = no; then
+           # If there is no dlname, no dlopen support or we're linking
+           # statically, we need to preload.  We also need to preload any
+           # dependent libraries so libltdl's deplib preloader doesn't
+           # bomb out in the load deplibs phase.
+           dlprefiles="$dlprefiles $lib $dependency_libs"
+         else
+           newdlfiles="$newdlfiles $lib"
+         fi
+         continue
+       fi # $pass = dlopen
+
+       # We need an absolute path.
+       case $ladir in
+       [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+       *)
+         abs_ladir=`cd "$ladir" && pwd`
+         if test -z "$abs_ladir"; then
+           $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
+           $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+           abs_ladir="$ladir"
+         fi
+         ;;
+       esac
+       laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+
+       # Find the relevant object directory and library name.
+       if test "X$installed" = Xyes; then
+         if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+           $echo "$modename: warning: library \`$lib' was moved." 1>&2
+           dir="$ladir"
+           absdir="$abs_ladir"
+           libdir="$abs_ladir"
+         else
+           dir="$libdir"
+           absdir="$libdir"
+         fi
+         test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+       else
+         if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+           dir="$ladir"
+           absdir="$abs_ladir"
+           # Remove this search path later
+           notinst_path="$notinst_path $abs_ladir"
+         else
+           dir="$ladir/$objdir"
+           absdir="$abs_ladir/$objdir"
+           # Remove this search path later
+           notinst_path="$notinst_path $abs_ladir"
+         fi
+       fi # $installed = yes
+       name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+       # This library was specified with -dlpreopen.
+       if test "$pass" = dlpreopen; then
+         if test -z "$libdir"; then
+           $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+           exit $EXIT_FAILURE
+         fi
+         # Prefer using a static library (so that no silly _DYNAMIC symbols
+         # are required to link).
+         if test -n "$old_library"; then
+           newdlprefiles="$newdlprefiles $dir/$old_library"
+         # Otherwise, use the dlname, so that lt_dlopen finds it.
+         elif test -n "$dlname"; then
+           newdlprefiles="$newdlprefiles $dir/$dlname"
+         else
+           newdlprefiles="$newdlprefiles $dir/$linklib"
+         fi
+       fi # $pass = dlpreopen
+
+       if test -z "$libdir"; then
+         # Link the convenience library
+         if test "$linkmode" = lib; then
+           deplibs="$dir/$old_library $deplibs"
+         elif test "$linkmode,$pass" = "prog,link"; then
+           compile_deplibs="$dir/$old_library $compile_deplibs"
+           finalize_deplibs="$dir/$old_library $finalize_deplibs"
+         else
+           deplibs="$lib $deplibs" # used for prog,scan pass
+         fi
+         continue
+       fi
+
+
+       if test "$linkmode" = prog && test "$pass" != link; then
+         newlib_search_path="$newlib_search_path $ladir"
+         deplibs="$lib $deplibs"
+
+         linkalldeplibs=no
+         if test "$link_all_deplibs" != no || test -z "$library_names" ||
+            test "$build_libtool_libs" = no; then
+           linkalldeplibs=yes
+         fi
+
+         tmp_libs=
+         for deplib in $dependency_libs; do
+           case $deplib in
+           -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+           esac
+           # Need to link against all dependency_libs?
+           if test "$linkalldeplibs" = yes; then
+             deplibs="$deplib $deplibs"
+           else
+             # Need to hardcode shared library paths
+             # or/and link against static libraries
+             newdependency_libs="$deplib $newdependency_libs"
+           fi
+           if test "X$duplicate_deps" = "Xyes" ; then
+             case "$tmp_libs " in
+             *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+             esac
+           fi
+           tmp_libs="$tmp_libs $deplib"
+         done # for deplib
+         continue
+       fi # $linkmode = prog...
+
+       if test "$linkmode,$pass" = "prog,link"; then
+         if test -n "$library_names" &&
+            { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+           # We need to hardcode the library path
+           if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+             # Make sure the rpath contains only unique directories.
+             case "$temp_rpath " in
+             *" $dir "*) ;;
+             *" $absdir "*) ;;
+             *) temp_rpath="$temp_rpath $absdir" ;;
+             esac
+           fi
+
+           # Hardcode the library path.
+           # Skip directories that are in the system default run-time
+           # search path.
+           case " $sys_lib_dlsearch_path " in
+           *" $absdir "*) ;;
+           *)
+             case "$compile_rpath " in
+             *" $absdir "*) ;;
+             *) compile_rpath="$compile_rpath $absdir"
+             esac
+             ;;
+           esac
+           case " $sys_lib_dlsearch_path " in
+           *" $libdir "*) ;;
+           *)
+             case "$finalize_rpath " in
+             *" $libdir "*) ;;
+             *) finalize_rpath="$finalize_rpath $libdir"
+             esac
+             ;;
+           esac
+         fi # $linkmode,$pass = prog,link...
+
+         if test "$alldeplibs" = yes &&
+            { test "$deplibs_check_method" = pass_all ||
+              { test "$build_libtool_libs" = yes &&
+                test -n "$library_names"; }; }; then
+           # We only need to search for static libraries
+           continue
+         fi
+       fi
+
+       link_static=no # Whether the deplib will be linked statically
+       use_static_libs=$prefer_static_libs
+       if test "$use_static_libs" = built && test "$installed" = yes ; then
+         use_static_libs=no
+       fi
+       if test -n "$library_names" &&
+          { test "$use_static_libs" = no || test -z "$old_library"; }; then
+         if test "$installed" = no; then
+           notinst_deplibs="$notinst_deplibs $lib"
+           need_relink=yes
+         fi
+         # This is a shared library
+
+         # Warn about portability, can't link against -module's on
+         # some systems (darwin)
+         if test "$shouldnotlink" = yes && test "$pass" = link ; then
+           $echo
+           if test "$linkmode" = prog; then
+             $echo "*** Warning: Linking the executable $output against the loadable module"
+           else
+             $echo "*** Warning: Linking the shared library $output against the loadable module"
+           fi
+           $echo "*** $linklib is not portable!"
+         fi
+         if test "$linkmode" = lib &&
+            test "$hardcode_into_libs" = yes; then
+           # Hardcode the library path.
+           # Skip directories that are in the system default run-time
+           # search path.
+           case " $sys_lib_dlsearch_path " in
+           *" $absdir "*) ;;
+           *)
+             case "$compile_rpath " in
+             *" $absdir "*) ;;
+             *) compile_rpath="$compile_rpath $absdir"
+             esac
+             ;;
+           esac
+           case " $sys_lib_dlsearch_path " in
+           *" $libdir "*) ;;
+           *)
+             case "$finalize_rpath " in
+             *" $libdir "*) ;;
+             *) finalize_rpath="$finalize_rpath $libdir"
+             esac
+             ;;
+           esac
+         fi
+
+         if test -n "$old_archive_from_expsyms_cmds"; then
+           # figure out the soname
+           set dummy $library_names
+           realname="$2"
+           shift; shift
+           libname=`eval \\$echo \"$libname_spec\"`
+           # use dlname if we got it. it's perfectly good, no?
+           if test -n "$dlname"; then
+             soname="$dlname"
+           elif test -n "$soname_spec"; then
+             # bleh windows
+             case $host in
+             *cygwin* | mingw*)
+               major=`expr $current - $age`
+               versuffix="-$major"
+               ;;
+             esac
+             eval soname=\"$soname_spec\"
+           else
+             soname="$realname"
+           fi
+
+           # Make a new name for the extract_expsyms_cmds to use
+           soroot="$soname"
+           soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
+           newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
+
+           # If the library has no export list, then create one now
+           if test -f "$output_objdir/$soname-def"; then :
+           else
+             $show "extracting exported symbol list from \`$soname'"
+             save_ifs="$IFS"; IFS='~'
+             cmds=$extract_expsyms_cmds
+             for cmd in $cmds; do
+               IFS="$save_ifs"
+               eval cmd=\"$cmd\"
+               $show "$cmd"
+               $run eval "$cmd" || exit $?
+             done
+             IFS="$save_ifs"
+           fi
+
+           # Create $newlib
+           if test -f "$output_objdir/$newlib"; then :; else
+             $show "generating import library for \`$soname'"
+             save_ifs="$IFS"; IFS='~'
+             cmds=$old_archive_from_expsyms_cmds
+             for cmd in $cmds; do
+               IFS="$save_ifs"
+               eval cmd=\"$cmd\"
+               $show "$cmd"
+               $run eval "$cmd" || exit $?
+             done
+             IFS="$save_ifs"
+           fi
+           # make sure the library variables are pointing to the new library
+           dir=$output_objdir
+           linklib=$newlib
+         fi # test -n "$old_archive_from_expsyms_cmds"
+
+         if test "$linkmode" = prog || test "$mode" != relink; then
+           add_shlibpath=
+           add_dir=
+           add=
+           lib_linked=yes
+           case $hardcode_action in
+           immediate | unsupported)
+             if test "$hardcode_direct" = no; then
+               add="$dir/$linklib"
+               case $host in
+                 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+                 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+                 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+                   *-*-unixware7*) add_dir="-L$dir" ;;
+                 *-*-darwin* )
+                   # if the lib is a module then we can not link against
+                   # it, someone is ignoring the new warnings I added
+                   if /usr/bin/file -L $add 2> /dev/null |
+                      $EGREP ": [^:]* bundle" >/dev/null ; then
+                     $echo "** Warning, lib $linklib is a module, not a shared library"
+                     if test -z "$old_library" ; then
+                       $echo
+                       $echo "** And there doesn't seem to be a static archive available"
+                       $echo "** The link will probably fail, sorry"
+                     else
+                       add="$dir/$old_library"
+                     fi
+                   fi
+               esac
+             elif test "$hardcode_minus_L" = no; then
+               case $host in
+               *-*-sunos*) add_shlibpath="$dir" ;;
+               esac
+               add_dir="-L$dir"
+               add="-l$name"
+             elif test "$hardcode_shlibpath_var" = no; then
+               add_shlibpath="$dir"
+               add="-l$name"
+             else
+               lib_linked=no
+             fi
+             ;;
+           relink)
+             if test "$hardcode_direct" = yes; then
+               add="$dir/$linklib"
+             elif test "$hardcode_minus_L" = yes; then
+               add_dir="-L$dir"
+               # Try looking first in the location we're being installed to.
+               if test -n "$inst_prefix_dir"; then
+                 case $libdir in
+                   [\\/]*)
+                     add_dir="$add_dir -L$inst_prefix_dir$libdir"
+                     ;;
+                 esac
+               fi
+               add="-l$name"
+             elif test "$hardcode_shlibpath_var" = yes; then
+               add_shlibpath="$dir"
+               add="-l$name"
+             else
+               lib_linked=no
+             fi
+             ;;
+           *) lib_linked=no ;;
+           esac
+
+           if test "$lib_linked" != yes; then
+             $echo "$modename: configuration error: unsupported hardcode properties"
+             exit $EXIT_FAILURE
+           fi
+
+           if test -n "$add_shlibpath"; then
+             case :$compile_shlibpath: in
+             *":$add_shlibpath:"*) ;;
+             *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+             esac
+           fi
+           if test "$linkmode" = prog; then
+             test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+             test -n "$add" && compile_deplibs="$add $compile_deplibs"
+           else
+             test -n "$add_dir" && deplibs="$add_dir $deplibs"
+             test -n "$add" && deplibs="$add $deplibs"
+             if test "$hardcode_direct" != yes && \
+                test "$hardcode_minus_L" != yes && \
+                test "$hardcode_shlibpath_var" = yes; then
+               case :$finalize_shlibpath: in
+               *":$libdir:"*) ;;
+               *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+               esac
+             fi
+           fi
+         fi
+
+         if test "$linkmode" = prog || test "$mode" = relink; then
+           add_shlibpath=
+           add_dir=
+           add=
+           # Finalize command for both is simple: just hardcode it.
+           if test "$hardcode_direct" = yes; then
+             add="$libdir/$linklib"
+           elif test "$hardcode_minus_L" = yes; then
+             add_dir="-L$libdir"
+             add="-l$name"
+           elif test "$hardcode_shlibpath_var" = yes; then
+             case :$finalize_shlibpath: in
+             *":$libdir:"*) ;;
+             *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+             esac
+             add="-l$name"
+           elif test "$hardcode_automatic" = yes; then
+             if test -n "$inst_prefix_dir" &&
+                test -f "$inst_prefix_dir$libdir/$linklib" ; then
+               add="$inst_prefix_dir$libdir/$linklib"
+             else
+               add="$libdir/$linklib"
+             fi
+           else
+             # We cannot seem to hardcode it, guess we'll fake it.
+             add_dir="-L$libdir"
+             # Try looking first in the location we're being installed to.
+             if test -n "$inst_prefix_dir"; then
+               case $libdir in
+                 [\\/]*)
+                   add_dir="$add_dir -L$inst_prefix_dir$libdir"
+                   ;;
+               esac
+             fi
+             add="-l$name"
+           fi
+
+           if test "$linkmode" = prog; then
+             test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+             test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+           else
+             test -n "$add_dir" && deplibs="$add_dir $deplibs"
+             test -n "$add" && deplibs="$add $deplibs"
+           fi
+         fi
+       elif test "$linkmode" = prog; then
+         # Here we assume that one of hardcode_direct or hardcode_minus_L
+         # is not unsupported.  This is valid on all known static and
+         # shared platforms.
+         if test "$hardcode_direct" != unsupported; then
+           test -n "$old_library" && linklib="$old_library"
+           compile_deplibs="$dir/$linklib $compile_deplibs"
+           finalize_deplibs="$dir/$linklib $finalize_deplibs"
+         else
+           compile_deplibs="-l$name -L$dir $compile_deplibs"
+           finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+         fi
+       elif test "$build_libtool_libs" = yes; then
+         # Not a shared library
+         if test "$deplibs_check_method" != pass_all; then
+           # We're trying link a shared library against a static one
+           # but the system doesn't support it.
+
+           # Just print a warning and add the library to dependency_libs so
+           # that the program can be linked against the static library.
+           $echo
+           $echo "*** Warning: This system can not link to static lib archive $lib."
+           $echo "*** I have the capability to make that library automatically link in when"
+           $echo "*** you link to this library.  But I can only do this if you have a"
+           $echo "*** shared version of the library, which you do not appear to have."
+           if test "$module" = yes; then
+             $echo "*** But as you try to build a module library, libtool will still create "
+             $echo "*** a static module, that should work as long as the dlopening application"
+             $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+             if test -z "$global_symbol_pipe"; then
+               $echo
+               $echo "*** However, this would only work if libtool was able to extract symbol"
+               $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+               $echo "*** not find such a program.  So, this module is probably useless."
+               $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+             fi
+             if test "$build_old_libs" = no; then
+               build_libtool_libs=module
+               build_old_libs=yes
+             else
+               build_libtool_libs=no
+             fi
+           fi
+         else
+           deplibs="$dir/$old_library $deplibs"
+           link_static=yes
+         fi
+       fi # link shared/static library?
+
+       if test "$linkmode" = lib; then
+         if test -n "$dependency_libs" &&
+            { test "$hardcode_into_libs" != yes ||
+              test "$build_old_libs" = yes ||
+              test "$link_static" = yes; }; then
+           # Extract -R from dependency_libs
+           temp_deplibs=
+           for libdir in $dependency_libs; do
+             case $libdir in
+             -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+                  case " $xrpath " in
+                  *" $temp_xrpath "*) ;;
+                  *) xrpath="$xrpath $temp_xrpath";;
+                  esac;;
+             *) temp_deplibs="$temp_deplibs $libdir";;
+             esac
+           done
+           dependency_libs="$temp_deplibs"
+         fi
+
+         newlib_search_path="$newlib_search_path $absdir"
+         # Link against this library
+         test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+         # ... and its dependency_libs
+         tmp_libs=
+         for deplib in $dependency_libs; do
+           newdependency_libs="$deplib $newdependency_libs"
+           if test "X$duplicate_deps" = "Xyes" ; then
+             case "$tmp_libs " in
+             *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+             esac
+           fi
+           tmp_libs="$tmp_libs $deplib"
+         done
+
+         if test "$link_all_deplibs" != no; then
+           # Add the search paths of all dependency libraries
+           for deplib in $dependency_libs; do
+             case $deplib in
+             -L*) path="$deplib" ;;
+             *.la)
+               dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+               test "X$dir" = "X$deplib" && dir="."
+               # We need an absolute path.
+               case $dir in
+               [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+               *)
+                 absdir=`cd "$dir" && pwd`
+                 if test -z "$absdir"; then
+                   $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+                   absdir="$dir"
+                 fi
+                 ;;
+               esac
+               if grep "^installed=no" $deplib > /dev/null; then
+                 path="$absdir/$objdir"
+               else
+                 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+                 if test -z "$libdir"; then
+                   $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+                   exit $EXIT_FAILURE
+                 fi
+                 if test "$absdir" != "$libdir"; then
+                   $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
+                 fi
+                 path="$absdir"
+               fi
+               depdepl=
+               case $host in
+               *-*-darwin*)
+                 # we do not want to link against static libs,
+                 # but need to link against shared
+                 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+                 if test -n "$deplibrary_names" ; then
+                   for tmp in $deplibrary_names ; do
+                     depdepl=$tmp
+                   done
+                   if test -f "$path/$depdepl" ; then
+                     depdepl="$path/$depdepl"
+                   fi
+                   # do not add paths which are already there
+                   case " $newlib_search_path " in
+                   *" $path "*) ;;
+                   *) newlib_search_path="$newlib_search_path $path";;
+                   esac
+                 fi
+                 path=""
+                 ;;
+               *)
+                 path="-L$path"
+                 ;;
+               esac
+               ;;
+             -l*)
+               case $host in
+               *-*-darwin*)
+                 # Again, we only want to link against shared libraries
+                 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
+                 for tmp in $newlib_search_path ; do
+                   if test -f "$tmp/lib$tmp_libs.dylib" ; then
+                     eval depdepl="$tmp/lib$tmp_libs.dylib"
+                     break
+                   fi
+                 done
+                 path=""
+                 ;;
+               *) continue ;;
+               esac
+               ;;
+             *) continue ;;
+             esac
+             case " $deplibs " in
+             *" $path "*) ;;
+             *) deplibs="$path $deplibs" ;;
+             esac
+             case " $deplibs " in
+             *" $depdepl "*) ;;
+             *) deplibs="$depdepl $deplibs" ;;
+             esac
+           done
+         fi # link_all_deplibs != no
+       fi # linkmode = lib
+      done # for deplib in $libs
+      dependency_libs="$newdependency_libs"
+      if test "$pass" = dlpreopen; then
+       # Link the dlpreopened libraries before other libraries
+       for deplib in $save_deplibs; do
+         deplibs="$deplib $deplibs"
+       done
+      fi
+      if test "$pass" != dlopen; then
+       if test "$pass" != conv; then
+         # Make sure lib_search_path contains only unique directories.
+         lib_search_path=
+         for dir in $newlib_search_path; do
+           case "$lib_search_path " in
+           *" $dir "*) ;;
+           *) lib_search_path="$lib_search_path $dir" ;;
+           esac
+         done
+         newlib_search_path=
+       fi
+
+       if test "$linkmode,$pass" != "prog,link"; then
+         vars="deplibs"
+       else
+         vars="compile_deplibs finalize_deplibs"
+       fi
+       for var in $vars dependency_libs; do
+         # Add libraries to $var in reverse order
+         eval tmp_libs=\"\$$var\"
+         new_libs=
+         for deplib in $tmp_libs; do
+           # FIXME: Pedantically, this is the right thing to do, so
+           #        that some nasty dependency loop isn't accidentally
+           #        broken:
+           #new_libs="$deplib $new_libs"
+           # Pragmatically, this seems to cause very few problems in
+           # practice:
+           case $deplib in
+           -L*) new_libs="$deplib $new_libs" ;;
+           -R*) ;;
+           *)
+             # And here is the reason: when a library appears more
+             # than once as an explicit dependence of a library, or
+             # is implicitly linked in more than once by the
+             # compiler, it is considered special, and multiple
+             # occurrences thereof are not removed.  Compare this
+             # with having the same library being listed as a
+             # dependency of multiple other libraries: in this case,
+             # we know (pedantically, we assume) the library does not
+             # need to be listed more than once, so we keep only the
+             # last copy.  This is not always right, but it is rare
+             # enough that we require users that really mean to play
+             # such unportable linking tricks to link the library
+             # using -Wl,-lname, so that libtool does not consider it
+             # for duplicate removal.
+             case " $specialdeplibs " in
+             *" $deplib "*) new_libs="$deplib $new_libs" ;;
+             *)
+               case " $new_libs " in
+               *" $deplib "*) ;;
+               *) new_libs="$deplib $new_libs" ;;
+               esac
+               ;;
+             esac
+             ;;
+           esac
+         done
+         tmp_libs=
+         for deplib in $new_libs; do
+           case $deplib in
+           -L*)
+             case " $tmp_libs " in
+             *" $deplib "*) ;;
+             *) tmp_libs="$tmp_libs $deplib" ;;
+             esac
+             ;;
+           *) tmp_libs="$tmp_libs $deplib" ;;
+           esac
+         done
+         eval $var=\"$tmp_libs\"
+       done # for var
+      fi
+      # Last step: remove runtime libs from dependency_libs
+      # (they stay in deplibs)
+      tmp_libs=
+      for i in $dependency_libs ; do
+       case " $predeps $postdeps $compiler_lib_search_path " in
+       *" $i "*)
+         i=""
+         ;;
+       esac
+       if test -n "$i" ; then
+         tmp_libs="$tmp_libs $i"
+       fi
+      done
+      dependency_libs=$tmp_libs
+    done # for pass
+    if test "$linkmode" = prog; then
+      dlfiles="$newdlfiles"
+      dlprefiles="$newdlprefiles"
+    fi
+
+    case $linkmode in
+    oldlib)
+      if test -n "$deplibs"; then
+       $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
+      fi
+
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+       $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+       $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+       $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+       $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$release"; then
+       $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+      fi
+
+      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+       $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+      fi
+
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      oldlibs="$output"
+      objs="$objs$old_deplibs"
+      ;;
+
+    lib)
+      # Make sure we only generate libraries of the form `libNAME.la'.
+      case $outputname in
+      lib*)
+       name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+       eval shared_ext=\"$shrext_cmds\"
+       eval libname=\"$libname_spec\"
+       ;;
+      *)
+       if test "$module" = no; then
+         $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+         $echo "$help" 1>&2
+         exit $EXIT_FAILURE
+       fi
+       if test "$need_lib_prefix" != no; then
+         # Add the "lib" prefix for modules if required
+         name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+         eval shared_ext=\"$shrext_cmds\"
+         eval libname=\"$libname_spec\"
+       else
+         libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+       fi
+       ;;
+      esac
+
+      if test -n "$objs"; then
+       if test "$deplibs_check_method" != pass_all; then
+         $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
+         exit $EXIT_FAILURE
+       else
+         $echo
+         $echo "*** Warning: Linking the shared library $output against the non-libtool"
+         $echo "*** objects $objs is not portable!"
+         libobjs="$libobjs $objs"
+       fi
+      fi
+
+      if test "$dlself" != no; then
+       $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
+      fi
+
+      set dummy $rpath
+      if test "$#" -gt 2; then
+       $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+      fi
+      install_libdir="$2"
+
+      oldlibs=
+      if test -z "$rpath"; then
+       if test "$build_libtool_libs" = yes; then
+         # Building a libtool convenience library.
+         # Some compilers have problems with a `.al' extension so
+         # convenience libraries should have the same extension an
+         # archive normally would.
+         oldlibs="$output_objdir/$libname.$libext $oldlibs"
+         build_libtool_libs=convenience
+         build_old_libs=yes
+       fi
+
+       if test -n "$vinfo"; then
+         $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
+       fi
+
+       if test -n "$release"; then
+         $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+       fi
+      else
+
+       # Parse the version information argument.
+       save_ifs="$IFS"; IFS=':'
+       set dummy $vinfo 0 0 0
+       IFS="$save_ifs"
+
+       if test -n "$8"; then
+         $echo "$modename: too many parameters to \`-version-info'" 1>&2
+         $echo "$help" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       # convert absolute version numbers to libtool ages
+       # this retains compatibility with .la files and attempts
+       # to make the code below a bit more comprehensible
+
+       case $vinfo_number in
+       yes)
+         number_major="$2"
+         number_minor="$3"
+         number_revision="$4"
+         #
+         # There are really only two kinds -- those that
+         # use the current revision as the major version
+         # and those that subtract age and use age as
+         # a minor version.  But, then there is irix
+         # which has an extra 1 added just for fun
+         #
+         case $version_type in
+         darwin|linux|osf|windows)
+           current=`expr $number_major + $number_minor`
+           age="$number_minor"
+           revision="$number_revision"
+           ;;
+         freebsd-aout|freebsd-elf|sunos)
+           current="$number_major"
+           revision="$number_minor"
+           age="0"
+           ;;
+         irix|nonstopux)
+           current=`expr $number_major + $number_minor - 1`
+           age="$number_minor"
+           revision="$number_minor"
+           ;;
+         esac
+         ;;
+       no)
+         current="$2"
+         revision="$3"
+         age="$4"
+         ;;
+       esac
+
+       # Check that each of the things are valid numbers.
+       case $current in
+       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+       *)
+         $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
+         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+
+       case $revision in
+       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+       *)
+         $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
+         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+
+       case $age in
+       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+       *)
+         $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
+         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+
+       if test "$age" -gt "$current"; then
+         $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       # Calculate the version variables.
+       major=
+       versuffix=
+       verstring=
+       case $version_type in
+       none) ;;
+
+       darwin)
+         # Like Linux, but with the current version available in
+         # verstring for coding it into the library header
+         major=.`expr $current - $age`
+         versuffix="$major.$age.$revision"
+         # Darwin ld doesn't like 0 for these options...
+         minor_current=`expr $current + 1`
+         verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+         ;;
+
+       freebsd-aout)
+         major=".$current"
+         versuffix=".$current.$revision";
+         ;;
+
+       freebsd-elf)
+         major=".$current"
+         versuffix=".$current";
+         ;;
+
+       irix | nonstopux)
+         major=`expr $current - $age + 1`
+
+         case $version_type in
+           nonstopux) verstring_prefix=nonstopux ;;
+           *)         verstring_prefix=sgi ;;
+         esac
+         verstring="$verstring_prefix$major.$revision"
+
+         # Add in all the interfaces that we are compatible with.
+         loop=$revision
+         while test "$loop" -ne 0; do
+           iface=`expr $revision - $loop`
+           loop=`expr $loop - 1`
+           verstring="$verstring_prefix$major.$iface:$verstring"
+         done
+
+         # Before this point, $major must not contain `.'.
+         major=.$major
+         versuffix="$major.$revision"
+         ;;
+
+       linux)
+         major=.`expr $current - $age`
+         versuffix="$major.$age.$revision"
+         ;;
+
+       osf)
+         major=.`expr $current - $age`
+         versuffix=".$current.$age.$revision"
+         verstring="$current.$age.$revision"
+
+         # Add in all the interfaces that we are compatible with.
+         loop=$age
+         while test "$loop" -ne 0; do
+           iface=`expr $current - $loop`
+           loop=`expr $loop - 1`
+           verstring="$verstring:${iface}.0"
+         done
+
+         # Make executables depend on our current version.
+         verstring="$verstring:${current}.0"
+         ;;
+
+       sunos)
+         major=".$current"
+         versuffix=".$current.$revision"
+         ;;
+
+       windows)
+         # Use '-' rather than '.', since we only want one
+         # extension on DOS 8.3 filesystems.
+         major=`expr $current - $age`
+         versuffix="-$major"
+         ;;
+
+       *)
+         $echo "$modename: unknown library version type \`$version_type'" 1>&2
+         $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+
+       # Clear the version info if we defaulted, and they specified a release.
+       if test -z "$vinfo" && test -n "$release"; then
+         major=
+         case $version_type in
+         darwin)
+           # we can't check for "0.0" in archive_cmds due to quoting
+           # problems, so we reset it completely
+           verstring=
+           ;;
+         *)
+           verstring="0.0"
+           ;;
+         esac
+         if test "$need_version" = no; then
+           versuffix=
+         else
+           versuffix=".0.0"
+         fi
+       fi
+
+       # Remove version info from name if versioning should be avoided
+       if test "$avoid_version" = yes && test "$need_version" = no; then
+         major=
+         versuffix=
+         verstring=""
+       fi
+
+       # Check to see if the archive will have undefined symbols.
+       if test "$allow_undefined" = yes; then
+         if test "$allow_undefined_flag" = unsupported; then
+           $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+           build_libtool_libs=no
+           build_old_libs=yes
+         fi
+       else
+         # Don't allow undefined symbols.
+         allow_undefined_flag="$no_undefined_flag"
+       fi
+      fi
+
+      if test "$mode" != relink; then
+       # Remove our outputs, but don't remove object files since they
+       # may have been created when compiling PIC objects.
+       removelist=
+       tempremovelist=`$echo "$output_objdir/*"`
+       for p in $tempremovelist; do
+         case $p in
+           *.$objext)
+              ;;
+           $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+              if test "X$precious_files_regex" != "X"; then
+                if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+                then
+                  continue
+                fi
+              fi
+              removelist="$removelist $p"
+              ;;
+           *) ;;
+         esac
+       done
+       if test -n "$removelist"; then
+         $show "${rm}r $removelist"
+         $run ${rm}r $removelist
+       fi
+      fi
+
+      # Now set the variables for building old libraries.
+      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+       oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+       # Transform .lo files to .o files.
+       oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+      fi
+
+      # Eliminate all temporary directories.
+      for path in $notinst_path; do
+       lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
+       deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
+       dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
+      done
+
+      if test -n "$xrpath"; then
+       # If the user specified any rpath flags, then add them.
+       temp_xrpath=
+       for libdir in $xrpath; do
+         temp_xrpath="$temp_xrpath -R$libdir"
+         case "$finalize_rpath " in
+         *" $libdir "*) ;;
+         *) finalize_rpath="$finalize_rpath $libdir" ;;
+         esac
+       done
+       if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+         dependency_libs="$temp_xrpath $dependency_libs"
+       fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles="$dlfiles"
+      dlfiles=
+      for lib in $old_dlfiles; do
+       case " $dlprefiles $dlfiles " in
+       *" $lib "*) ;;
+       *) dlfiles="$dlfiles $lib" ;;
+       esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles="$dlprefiles"
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+       case "$dlprefiles " in
+       *" $lib "*) ;;
+       *) dlprefiles="$dlprefiles $lib" ;;
+       esac
+      done
+
+      if test "$build_libtool_libs" = yes; then
+       if test -n "$rpath"; then
+         case $host in
+         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+           # these systems don't actually have a c library (as such)!
+           ;;
+         *-*-rhapsody* | *-*-darwin1.[012])
+           # Rhapsody C library is in the System framework
+           deplibs="$deplibs -framework System"
+           ;;
+         *-*-netbsd*)
+           # Don't link with libc until the a.out ld.so is fixed.
+           ;;
+         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+           # Do not include libc due to us having libc/libc_r.
+           ;;
+         *-*-sco3.2v5* | *-*-sco5v6*)
+           # Causes problems with __ctype
+           ;;
+         *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+           # Compiler inserts libc in the correct place for threads to work
+           ;;
+         *)
+           # Add libc to deplibs on all other systems if necessary.
+           if test "$build_libtool_need_lc" = "yes"; then
+             deplibs="$deplibs -lc"
+           fi
+           ;;
+         esac
+       fi
+
+       # Transform deplibs into only deplibs that can be linked in shared.
+       name_save=$name
+       libname_save=$libname
+       release_save=$release
+       versuffix_save=$versuffix
+       major_save=$major
+       # I'm not sure if I'm treating the release correctly.  I think
+       # release should show up in the -l (ie -lgmp5) so we don't want to
+       # add it in twice.  Is that correct?
+       release=""
+       versuffix=""
+       major=""
+       newdeplibs=
+       droppeddeps=no
+       case $deplibs_check_method in
+       pass_all)
+         # Don't check for shared/static.  Everything works.
+         # This might be a little naive.  We might want to check
+         # whether the library exists or not.  But this is on
+         # osf3 & osf4 and I'm not really sure... Just
+         # implementing what was already the behavior.
+         newdeplibs=$deplibs
+         ;;
+       test_compile)
+         # This code stresses the "libraries are programs" paradigm to its
+         # limits. Maybe even breaks it.  We compile a program, linking it
+         # against the deplibs as a proxy for the library.  Then we can check
+         # whether they linked in statically or dynamically with ldd.
+         $rm conftest.c
+         cat > conftest.c <<EOF
+         int main() { return 0; }
+EOF
+         $rm conftest
+         $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
+         if test "$?" -eq 0 ; then
+           ldd_output=`ldd conftest`
+           for i in $deplibs; do
+             name=`expr $i : '-l\(.*\)'`
+             # If $name is empty we are operating on a -L argument.
+              if test "$name" != "" && test "$name" -ne "0"; then
+               if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+                 case " $predeps $postdeps " in
+                 *" $i "*)
+                   newdeplibs="$newdeplibs $i"
+                   i=""
+                   ;;
+                 esac
+               fi
+               if test -n "$i" ; then
+                 libname=`eval \\$echo \"$libname_spec\"`
+                 deplib_matches=`eval \\$echo \"$library_names_spec\"`
+                 set dummy $deplib_matches
+                 deplib_match=$2
+                 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+                   newdeplibs="$newdeplibs $i"
+                 else
+                   droppeddeps=yes
+                   $echo
+                   $echo "*** Warning: dynamic linker does not accept needed library $i."
+                   $echo "*** I have the capability to make that library automatically link in when"
+                   $echo "*** you link to this library.  But I can only do this if you have a"
+                   $echo "*** shared version of the library, which I believe you do not have"
+                   $echo "*** because a test_compile did reveal that the linker did not use it for"
+                   $echo "*** its dynamic dependency list that programs get resolved with at runtime."
+                 fi
+               fi
+             else
+               newdeplibs="$newdeplibs $i"
+             fi
+           done
+         else
+           # Error occurred in the first compile.  Let's try to salvage
+           # the situation: Compile a separate program for each library.
+           for i in $deplibs; do
+             name=`expr $i : '-l\(.*\)'`
+             # If $name is empty we are operating on a -L argument.
+              if test "$name" != "" && test "$name" != "0"; then
+               $rm conftest
+               $LTCC $LTCFLAGS -o conftest conftest.c $i
+               # Did it work?
+               if test "$?" -eq 0 ; then
+                 ldd_output=`ldd conftest`
+                 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+                   case " $predeps $postdeps " in
+                   *" $i "*)
+                     newdeplibs="$newdeplibs $i"
+                     i=""
+                     ;;
+                   esac
+                 fi
+                 if test -n "$i" ; then
+                   libname=`eval \\$echo \"$libname_spec\"`
+                   deplib_matches=`eval \\$echo \"$library_names_spec\"`
+                   set dummy $deplib_matches
+                   deplib_match=$2
+                   if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+                     newdeplibs="$newdeplibs $i"
+                   else
+                     droppeddeps=yes
+                     $echo
+                     $echo "*** Warning: dynamic linker does not accept needed library $i."
+                     $echo "*** I have the capability to make that library automatically link in when"
+                     $echo "*** you link to this library.  But I can only do this if you have a"
+                     $echo "*** shared version of the library, which you do not appear to have"
+                     $echo "*** because a test_compile did reveal that the linker did not use this one"
+                     $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+                   fi
+                 fi
+               else
+                 droppeddeps=yes
+                 $echo
+                 $echo "*** Warning!  Library $i is needed by this library but I was not able to"
+                 $echo "***  make it link in!  You will probably need to install it or some"
+                 $echo "*** library that it depends on before this library will be fully"
+                 $echo "*** functional.  Installing it before continuing would be even better."
+               fi
+             else
+               newdeplibs="$newdeplibs $i"
+             fi
+           done
+         fi
+         ;;
+       file_magic*)
+         set dummy $deplibs_check_method
+         file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+         for a_deplib in $deplibs; do
+           name=`expr $a_deplib : '-l\(.*\)'`
+           # If $name is empty we are operating on a -L argument.
+            if test "$name" != "" && test  "$name" != "0"; then
+             if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+               case " $predeps $postdeps " in
+               *" $a_deplib "*)
+                 newdeplibs="$newdeplibs $a_deplib"
+                 a_deplib=""
+                 ;;
+               esac
+             fi
+             if test -n "$a_deplib" ; then
+               libname=`eval \\$echo \"$libname_spec\"`
+               for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+                 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+                 for potent_lib in $potential_libs; do
+                     # Follow soft links.
+                     if ls -lLd "$potent_lib" 2>/dev/null \
+                        | grep " -> " >/dev/null; then
+                       continue
+                     fi
+                     # The statement above tries to avoid entering an
+                     # endless loop below, in case of cyclic links.
+                     # We might still enter an endless loop, since a link
+                     # loop can be closed while we follow links,
+                     # but so what?
+                     potlib="$potent_lib"
+                     while test -h "$potlib" 2>/dev/null; do
+                       potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+                       case $potliblink in
+                       [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+                       *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+                       esac
+                     done
+                     if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+                        | ${SED} 10q \
+                        | $EGREP "$file_magic_regex" > /dev/null; then
+                       newdeplibs="$newdeplibs $a_deplib"
+                       a_deplib=""
+                       break 2
+                     fi
+                 done
+               done
+             fi
+             if test -n "$a_deplib" ; then
+               droppeddeps=yes
+               $echo
+               $echo "*** Warning: linker path does not have real file for library $a_deplib."
+               $echo "*** I have the capability to make that library automatically link in when"
+               $echo "*** you link to this library.  But I can only do this if you have a"
+               $echo "*** shared version of the library, which you do not appear to have"
+               $echo "*** because I did check the linker path looking for a file starting"
+               if test -z "$potlib" ; then
+                 $echo "*** with $libname but no candidates were found. (...for file magic test)"
+               else
+                 $echo "*** with $libname and none of the candidates passed a file format test"
+                 $echo "*** using a file magic. Last file checked: $potlib"
+               fi
+             fi
+           else
+             # Add a -L argument.
+             newdeplibs="$newdeplibs $a_deplib"
+           fi
+         done # Gone through all deplibs.
+         ;;
+       match_pattern*)
+         set dummy $deplibs_check_method
+         match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+         for a_deplib in $deplibs; do
+           name=`expr $a_deplib : '-l\(.*\)'`
+           # If $name is empty we are operating on a -L argument.
+           if test -n "$name" && test "$name" != "0"; then
+             if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+               case " $predeps $postdeps " in
+               *" $a_deplib "*)
+                 newdeplibs="$newdeplibs $a_deplib"
+                 a_deplib=""
+                 ;;
+               esac
+             fi
+             if test -n "$a_deplib" ; then
+               libname=`eval \\$echo \"$libname_spec\"`
+               for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+                 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+                 for potent_lib in $potential_libs; do
+                   potlib="$potent_lib" # see symlink-check above in file_magic test
+                   if eval $echo \"$potent_lib\" 2>/dev/null \
+                       | ${SED} 10q \
+                       | $EGREP "$match_pattern_regex" > /dev/null; then
+                     newdeplibs="$newdeplibs $a_deplib"
+                     a_deplib=""
+                     break 2
+                   fi
+                 done
+               done
+             fi
+             if test -n "$a_deplib" ; then
+               droppeddeps=yes
+               $echo
+               $echo "*** Warning: linker path does not have real file for library $a_deplib."
+               $echo "*** I have the capability to make that library automatically link in when"
+               $echo "*** you link to this library.  But I can only do this if you have a"
+               $echo "*** shared version of the library, which you do not appear to have"
+               $echo "*** because I did check the linker path looking for a file starting"
+               if test -z "$potlib" ; then
+                 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
+               else
+                 $echo "*** with $libname and none of the candidates passed a file format test"
+                 $echo "*** using a regex pattern. Last file checked: $potlib"
+               fi
+             fi
+           else
+             # Add a -L argument.
+             newdeplibs="$newdeplibs $a_deplib"
+           fi
+         done # Gone through all deplibs.
+         ;;
+       none | unknown | *)
+         newdeplibs=""
+         tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+           -e 's/ -[LR][^ ]*//g'`
+         if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+           for i in $predeps $postdeps ; do
+             # can't use Xsed below, because $i might contain '/'
+             tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
+           done
+         fi
+         if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
+           | grep . >/dev/null; then
+           $echo
+           if test "X$deplibs_check_method" = "Xnone"; then
+             $echo "*** Warning: inter-library dependencies are not supported in this platform."
+           else
+             $echo "*** Warning: inter-library dependencies are not known to be supported."
+           fi
+           $echo "*** All declared inter-library dependencies are being dropped."
+           droppeddeps=yes
+         fi
+         ;;
+       esac
+       versuffix=$versuffix_save
+       major=$major_save
+       release=$release_save
+       libname=$libname_save
+       name=$name_save
+
+       case $host in
+       *-*-rhapsody* | *-*-darwin1.[012])
+         # On Rhapsody replace the C library is the System framework
+         newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
+         ;;
+       esac
+
+       if test "$droppeddeps" = yes; then
+         if test "$module" = yes; then
+           $echo
+           $echo "*** Warning: libtool could not satisfy all declared inter-library"
+           $echo "*** dependencies of module $libname.  Therefore, libtool will create"
+           $echo "*** a static module, that should work as long as the dlopening"
+           $echo "*** application is linked with the -dlopen flag."
+           if test -z "$global_symbol_pipe"; then
+             $echo
+             $echo "*** However, this would only work if libtool was able to extract symbol"
+             $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+             $echo "*** not find such a program.  So, this module is probably useless."
+             $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+           fi
+           if test "$build_old_libs" = no; then
+             oldlibs="$output_objdir/$libname.$libext"
+             build_libtool_libs=module
+             build_old_libs=yes
+           else
+             build_libtool_libs=no
+           fi
+         else
+           $echo "*** The inter-library dependencies that have been dropped here will be"
+           $echo "*** automatically added whenever a program is linked with this library"
+           $echo "*** or is declared to -dlopen it."
+
+           if test "$allow_undefined" = no; then
+             $echo
+             $echo "*** Since this library must not contain undefined symbols,"
+             $echo "*** because either the platform does not support them or"
+             $echo "*** it was explicitly requested with -no-undefined,"
+             $echo "*** libtool will only create a static version of it."
+             if test "$build_old_libs" = no; then
+               oldlibs="$output_objdir/$libname.$libext"
+               build_libtool_libs=module
+               build_old_libs=yes
+             else
+               build_libtool_libs=no
+             fi
+           fi
+         fi
+       fi
+       # Done checking deplibs!
+       deplibs=$newdeplibs
+      fi
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+       case " $new_libs " in
+       *" -L$path/$objdir "*) ;;
+       *)
+         case " $deplibs " in
+         *" -L$path/$objdir "*)
+           new_libs="$new_libs -L$path/$objdir" ;;
+         esac
+         ;;
+       esac
+      done
+      for deplib in $deplibs; do
+       case $deplib in
+       -L*)
+         case " $new_libs " in
+         *" $deplib "*) ;;
+         *) new_libs="$new_libs $deplib" ;;
+         esac
+         ;;
+       *) new_libs="$new_libs $deplib" ;;
+       esac
+      done
+      deplibs="$new_libs"
+
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+
+      # Test again, we may have decided not to build it any more
+      if test "$build_libtool_libs" = yes; then
+       if test "$hardcode_into_libs" = yes; then
+         # Hardcode the library paths
+         hardcode_libdirs=
+         dep_rpath=
+         rpath="$finalize_rpath"
+         test "$mode" != relink && rpath="$compile_rpath$rpath"
+         for libdir in $rpath; do
+           if test -n "$hardcode_libdir_flag_spec"; then
+             if test -n "$hardcode_libdir_separator"; then
+               if test -z "$hardcode_libdirs"; then
+                 hardcode_libdirs="$libdir"
+               else
+                 # Just accumulate the unique libdirs.
+                 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+                 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+                   ;;
+                 *)
+                   hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+                   ;;
+                 esac
+               fi
+             else
+               eval flag=\"$hardcode_libdir_flag_spec\"
+               dep_rpath="$dep_rpath $flag"
+             fi
+           elif test -n "$runpath_var"; then
+             case "$perm_rpath " in
+             *" $libdir "*) ;;
+             *) perm_rpath="$perm_rpath $libdir" ;;
+             esac
+           fi
+         done
+         # Substitute the hardcoded libdirs into the rpath.
+         if test -n "$hardcode_libdir_separator" &&
+            test -n "$hardcode_libdirs"; then
+           libdir="$hardcode_libdirs"
+           if test -n "$hardcode_libdir_flag_spec_ld"; then
+             eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
+           else
+             eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+           fi
+         fi
+         if test -n "$runpath_var" && test -n "$perm_rpath"; then
+           # We should set the runpath_var.
+           rpath=
+           for dir in $perm_rpath; do
+             rpath="$rpath$dir:"
+           done
+           eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+         fi
+         test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+       fi
+
+       shlibpath="$finalize_shlibpath"
+       test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+       if test -n "$shlibpath"; then
+         eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+       fi
+
+       # Get the real and link names of the library.
+       eval shared_ext=\"$shrext_cmds\"
+       eval library_names=\"$library_names_spec\"
+       set dummy $library_names
+       realname="$2"
+       shift; shift
+
+       if test -n "$soname_spec"; then
+         eval soname=\"$soname_spec\"
+       else
+         soname="$realname"
+       fi
+       if test -z "$dlname"; then
+         dlname=$soname
+       fi
+
+       lib="$output_objdir/$realname"
+       linknames=
+       for link
+       do
+         linknames="$linknames $link"
+       done
+
+       # Use standard objects if they are pic
+       test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+       # Prepare the list of exported symbols
+       if test -z "$export_symbols"; then
+         if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+           $show "generating symbol list for \`$libname.la'"
+           export_symbols="$output_objdir/$libname.exp"
+           $run $rm $export_symbols
+           cmds=$export_symbols_cmds
+           save_ifs="$IFS"; IFS='~'
+           for cmd in $cmds; do
+             IFS="$save_ifs"
+             eval cmd=\"$cmd\"
+             if len=`expr "X$cmd" : ".*"` &&
+              test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+               $show "$cmd"
+               $run eval "$cmd" || exit $?
+               skipped_export=false
+             else
+               # The command line is too long to execute in one step.
+               $show "using reloadable object file for export list..."
+               skipped_export=:
+               # Break out early, otherwise skipped_export may be
+               # set to false by a later but shorter cmd.
+               break
+             fi
+           done
+           IFS="$save_ifs"
+           if test -n "$export_symbols_regex"; then
+             $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+             $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+             $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+             $run eval '$mv "${export_symbols}T" "$export_symbols"'
+           fi
+         fi
+       fi
+
+       if test -n "$export_symbols" && test -n "$include_expsyms"; then
+         $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+       fi
+
+       tmp_deplibs=
+       for test_deplib in $deplibs; do
+               case " $convenience " in
+               *" $test_deplib "*) ;;
+               *)
+                       tmp_deplibs="$tmp_deplibs $test_deplib"
+                       ;;
+               esac
+       done
+       deplibs="$tmp_deplibs"
+
+       if test -n "$convenience"; then
+         if test -n "$whole_archive_flag_spec"; then
+           save_libobjs=$libobjs
+           eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+         else
+           gentop="$output_objdir/${outputname}x"
+           generated="$generated $gentop"
+
+           func_extract_archives $gentop $convenience
+           libobjs="$libobjs $func_extract_archives_result"
+         fi
+       fi
+       
+       if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+         eval flag=\"$thread_safe_flag_spec\"
+         linker_flags="$linker_flags $flag"
+       fi
+
+       # Make a backup of the uninstalled library when relinking
+       if test "$mode" = relink; then
+         $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
+       fi
+
+       # Do each of the archive commands.
+       if test "$module" = yes && test -n "$module_cmds" ; then
+         if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+           eval test_cmds=\"$module_expsym_cmds\"
+           cmds=$module_expsym_cmds
+         else
+           eval test_cmds=\"$module_cmds\"
+           cmds=$module_cmds
+         fi
+       else
+       if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+         eval test_cmds=\"$archive_expsym_cmds\"
+         cmds=$archive_expsym_cmds
+       else
+         eval test_cmds=\"$archive_cmds\"
+         cmds=$archive_cmds
+         fi
+       fi
+
+       if test "X$skipped_export" != "X:" &&
+          len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+          test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+         :
+       else
+         # The command line is too long to link in one step, link piecewise.
+         $echo "creating reloadable object files..."
+
+         # Save the value of $output and $libobjs because we want to
+         # use them later.  If we have whole_archive_flag_spec, we
+         # want to use save_libobjs as it was before
+         # whole_archive_flag_spec was expanded, because we can't
+         # assume the linker understands whole_archive_flag_spec.
+         # This may have to be revisited, in case too many
+         # convenience libraries get linked in and end up exceeding
+         # the spec.
+         if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+           save_libobjs=$libobjs
+         fi
+         save_output=$output
+         output_la=`$echo "X$output" | $Xsed -e "$basename"`
+
+         # Clear the reloadable object creation command queue and
+         # initialize k to one.
+         test_cmds=
+         concat_cmds=
+         objlist=
+         delfiles=
+         last_robj=
+         k=1
+         output=$output_objdir/$output_la-${k}.$objext
+         # Loop over the list of objects to be linked.
+         for obj in $save_libobjs
+         do
+           eval test_cmds=\"$reload_cmds $objlist $last_robj\"
+           if test "X$objlist" = X ||
+              { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+                test "$len" -le "$max_cmd_len"; }; then
+             objlist="$objlist $obj"
+           else
+             # The command $test_cmds is almost too long, add a
+             # command to the queue.
+             if test "$k" -eq 1 ; then
+               # The first file doesn't have a previous command to add.
+               eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+             else
+               # All subsequent reloadable object files will link in
+               # the last one created.
+               eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
+             fi
+             last_robj=$output_objdir/$output_la-${k}.$objext
+             k=`expr $k + 1`
+             output=$output_objdir/$output_la-${k}.$objext
+             objlist=$obj
+             len=1
+           fi
+         done
+         # Handle the remaining objects by creating one last
+         # reloadable object file.  All subsequent reloadable object
+         # files will link in the last one created.
+         test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+         eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+
+         if ${skipped_export-false}; then
+           $show "generating symbol list for \`$libname.la'"
+           export_symbols="$output_objdir/$libname.exp"
+           $run $rm $export_symbols
+           libobjs=$output
+           # Append the command to create the export file.
+           eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
+          fi
+
+         # Set up a command to remove the reloadable object files
+         # after they are used.
+         i=0
+         while test "$i" -lt "$k"
+         do
+           i=`expr $i + 1`
+           delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
+         done
+
+         $echo "creating a temporary reloadable object file: $output"
+
+         # Loop through the commands generated above and execute them.
+         save_ifs="$IFS"; IFS='~'
+         for cmd in $concat_cmds; do
+           IFS="$save_ifs"
+           $show "$cmd"
+           $run eval "$cmd" || exit $?
+         done
+         IFS="$save_ifs"
+
+         libobjs=$output
+         # Restore the value of output.
+         output=$save_output
+
+         if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+           eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+         fi
+         # Expand the library linking commands again to reset the
+         # value of $libobjs for piecewise linking.
+
+         # Do each of the archive commands.
+         if test "$module" = yes && test -n "$module_cmds" ; then
+           if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+             cmds=$module_expsym_cmds
+           else
+             cmds=$module_cmds
+           fi
+         else
+         if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+           cmds=$archive_expsym_cmds
+         else
+           cmds=$archive_cmds
+           fi
+         fi
+
+         # Append the command to remove the reloadable object files
+         # to the just-reset $cmds.
+         eval cmds=\"\$cmds~\$rm $delfiles\"
+       fi
+       save_ifs="$IFS"; IFS='~'
+       for cmd in $cmds; do
+         IFS="$save_ifs"
+         eval cmd=\"$cmd\"
+         $show "$cmd"
+         $run eval "$cmd" || {
+           lt_exit=$?
+
+           # Restore the uninstalled library and exit
+           if test "$mode" = relink; then
+             $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+           fi
+
+           exit $lt_exit
+         }
+       done
+       IFS="$save_ifs"
+
+       # Restore the uninstalled library and exit
+       if test "$mode" = relink; then
+         $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+
+         if test -n "$convenience"; then
+           if test -z "$whole_archive_flag_spec"; then
+             $show "${rm}r $gentop"
+             $run ${rm}r "$gentop"
+           fi
+         fi
+
+         exit $EXIT_SUCCESS
+       fi
+
+       # Create links to the real library.
+       for linkname in $linknames; do
+         if test "$realname" != "$linkname"; then
+           $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+           $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+         fi
+       done
+
+       # If -module or -export-dynamic was specified, set the dlname.
+       if test "$module" = yes || test "$export_dynamic" = yes; then
+         # On all known operating systems, these are identical.
+         dlname="$soname"
+       fi
+      fi
+      ;;
+
+    obj)
+      if test -n "$deplibs"; then
+       $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+      fi
+
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+       $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$rpath"; then
+       $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$xrpath"; then
+       $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$vinfo"; then
+       $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+      fi
+
+      if test -n "$release"; then
+       $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+      fi
+
+      case $output in
+      *.lo)
+       if test -n "$objs$old_deplibs"; then
+         $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+         exit $EXIT_FAILURE
+       fi
+       libobj="$output"
+       obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+       ;;
+      *)
+       libobj=
+       obj="$output"
+       ;;
+      esac
+
+      # Delete the old objects.
+      $run $rm $obj $libobj
+
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # reload_cmds runs $LD directly, so let us get rid of
+      # -Wl from whole_archive_flag_spec
+      wl=
+
+      if test -n "$convenience"; then
+       if test -n "$whole_archive_flag_spec"; then
+         eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+       else
+         gentop="$output_objdir/${obj}x"
+         generated="$generated $gentop"
+
+         func_extract_archives $gentop $convenience
+         reload_conv_objs="$reload_objs $func_extract_archives_result"
+       fi
+      fi
+
+      # Create the old-style object.
+      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+      output="$obj"
+      cmds=$reload_cmds
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+       IFS="$save_ifs"
+       eval cmd=\"$cmd\"
+       $show "$cmd"
+       $run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+
+      # Exit if we aren't doing a library object file.
+      if test -z "$libobj"; then
+       if test -n "$gentop"; then
+         $show "${rm}r $gentop"
+         $run ${rm}r $gentop
+       fi
+
+       exit $EXIT_SUCCESS
+      fi
+
+      if test "$build_libtool_libs" != yes; then
+       if test -n "$gentop"; then
+         $show "${rm}r $gentop"
+         $run ${rm}r $gentop
+       fi
+
+       # Create an invalid libtool object if no PIC, so that we don't
+       # accidentally link it into a program.
+       # $show "echo timestamp > $libobj"
+       # $run eval "echo timestamp > $libobj" || exit $?
+       exit $EXIT_SUCCESS
+      fi
+
+      if test -n "$pic_flag" || test "$pic_mode" != default; then
+       # Only do commands if we really have different PIC objects.
+       reload_objs="$libobjs $reload_conv_objs"
+       output="$libobj"
+       cmds=$reload_cmds
+       save_ifs="$IFS"; IFS='~'
+       for cmd in $cmds; do
+         IFS="$save_ifs"
+         eval cmd=\"$cmd\"
+         $show "$cmd"
+         $run eval "$cmd" || exit $?
+       done
+       IFS="$save_ifs"
+      fi
+
+      if test -n "$gentop"; then
+       $show "${rm}r $gentop"
+       $run ${rm}r $gentop
+      fi
+
+      exit $EXIT_SUCCESS
+      ;;
+
+    prog)
+      case $host in
+       *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+      esac
+      if test -n "$vinfo"; then
+       $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+      fi
+
+      if test -n "$release"; then
+       $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+      fi
+
+      if test "$preload" = yes; then
+       if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
+          test "$dlopen_self_static" = unknown; then
+         $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+       fi
+      fi
+
+      case $host in
+      *-*-rhapsody* | *-*-darwin1.[012])
+       # On Rhapsody replace the C library is the System framework
+       compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+       finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+       ;;
+      esac
+
+      case $host in
+      *darwin*)
+        # Don't allow lazy linking, it breaks C++ global constructors
+        if test "$tagname" = CXX ; then
+        compile_command="$compile_command ${wl}-bind_at_load"
+        finalize_command="$finalize_command ${wl}-bind_at_load"
+        fi
+        ;;
+      esac
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+       case " $new_libs " in
+       *" -L$path/$objdir "*) ;;
+       *)
+         case " $compile_deplibs " in
+         *" -L$path/$objdir "*)
+           new_libs="$new_libs -L$path/$objdir" ;;
+         esac
+         ;;
+       esac
+      done
+      for deplib in $compile_deplibs; do
+       case $deplib in
+       -L*)
+         case " $new_libs " in
+         *" $deplib "*) ;;
+         *) new_libs="$new_libs $deplib" ;;
+         esac
+         ;;
+       *) new_libs="$new_libs $deplib" ;;
+       esac
+      done
+      compile_deplibs="$new_libs"
+
+
+      compile_command="$compile_command $compile_deplibs"
+      finalize_command="$finalize_command $finalize_deplibs"
+
+      if test -n "$rpath$xrpath"; then
+       # If the user specified any rpath flags, then add them.
+       for libdir in $rpath $xrpath; do
+         # This is the magic to use -rpath.
+         case "$finalize_rpath " in
+         *" $libdir "*) ;;
+         *) finalize_rpath="$finalize_rpath $libdir" ;;
+         esac
+       done
+      fi
+
+      # Now hardcode the library paths
+      rpath=
+      hardcode_libdirs=
+      for libdir in $compile_rpath $finalize_rpath; do
+       if test -n "$hardcode_libdir_flag_spec"; then
+         if test -n "$hardcode_libdir_separator"; then
+           if test -z "$hardcode_libdirs"; then
+             hardcode_libdirs="$libdir"
+           else
+             # Just accumulate the unique libdirs.
+             case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+             *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+               ;;
+             *)
+               hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+               ;;
+             esac
+           fi
+         else
+           eval flag=\"$hardcode_libdir_flag_spec\"
+           rpath="$rpath $flag"
+         fi
+       elif test -n "$runpath_var"; then
+         case "$perm_rpath " in
+         *" $libdir "*) ;;
+         *) perm_rpath="$perm_rpath $libdir" ;;
+         esac
+       fi
+       case $host in
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+         testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
+         case :$dllsearchpath: in
+         *":$libdir:"*) ;;
+         *) dllsearchpath="$dllsearchpath:$libdir";;
+         esac
+         case :$dllsearchpath: in
+         *":$testbindir:"*) ;;
+         *) dllsearchpath="$dllsearchpath:$testbindir";;
+         esac
+         ;;
+       esac
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+        test -n "$hardcode_libdirs"; then
+       libdir="$hardcode_libdirs"
+       eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      compile_rpath="$rpath"
+
+      rpath=
+      hardcode_libdirs=
+      for libdir in $finalize_rpath; do
+       if test -n "$hardcode_libdir_flag_spec"; then
+         if test -n "$hardcode_libdir_separator"; then
+           if test -z "$hardcode_libdirs"; then
+             hardcode_libdirs="$libdir"
+           else
+             # Just accumulate the unique libdirs.
+             case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+             *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+               ;;
+             *)
+               hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+               ;;
+             esac
+           fi
+         else
+           eval flag=\"$hardcode_libdir_flag_spec\"
+           rpath="$rpath $flag"
+         fi
+       elif test -n "$runpath_var"; then
+         case "$finalize_perm_rpath " in
+         *" $libdir "*) ;;
+         *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+         esac
+       fi
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+        test -n "$hardcode_libdirs"; then
+       libdir="$hardcode_libdirs"
+       eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      finalize_rpath="$rpath"
+
+      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+       # Transform all the library objects into standard objects.
+       compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+       finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+      fi
+
+      dlsyms=
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+       if test -n "$NM" && test -n "$global_symbol_pipe"; then
+         dlsyms="${outputname}S.c"
+       else
+         $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+       fi
+      fi
+
+      if test -n "$dlsyms"; then
+       case $dlsyms in
+       "") ;;
+       *.c)
+         # Discover the nlist of each of the dlfiles.
+         nlist="$output_objdir/${outputname}.nm"
+
+         $show "$rm $nlist ${nlist}S ${nlist}T"
+         $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+         # Parse the name list into a source file.
+         $show "creating $output_objdir/$dlsyms"
+
+         test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+         if test "$dlself" = yes; then
+           $show "generating symbol list for \`$output'"
+
+           test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+           # Add our own program objects to the symbol list.
+           progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+           for arg in $progfiles; do
+             $show "extracting global C symbols from \`$arg'"
+             $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+           done
+
+           if test -n "$exclude_expsyms"; then
+             $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+             $run eval '$mv "$nlist"T "$nlist"'
+           fi
+
+           if test -n "$export_symbols_regex"; then
+             $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+             $run eval '$mv "$nlist"T "$nlist"'
+           fi
+
+           # Prepare the list of exported symbols
+           if test -z "$export_symbols"; then
+             export_symbols="$output_objdir/$outputname.exp"
+             $run $rm $export_symbols
+             $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+              case $host in
+              *cygwin* | *mingw* )
+               $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+               $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+                ;;
+              esac
+           else
+             $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+             $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+             $run eval 'mv "$nlist"T "$nlist"'
+              case $host in
+              *cygwin* | *mingw* )
+               $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+               $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+                ;;
+              esac
+           fi
+         fi
+
+         for arg in $dlprefiles; do
+           $show "extracting global C symbols from \`$arg'"
+           name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
+           $run eval '$echo ": $name " >> "$nlist"'
+           $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+         done
+
+         if test -z "$run"; then
+           # Make sure we have at least an empty file.
+           test -f "$nlist" || : > "$nlist"
+
+           if test -n "$exclude_expsyms"; then
+             $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+             $mv "$nlist"T "$nlist"
+           fi
+
+           # Try sorting and uniquifying the output.
+           if grep -v "^: " < "$nlist" |
+               if sort -k 3 </dev/null >/dev/null 2>&1; then
+                 sort -k 3
+               else
+                 sort +2
+               fi |
+               uniq > "$nlist"S; then
+             :
+           else
+             grep -v "^: " < "$nlist" > "$nlist"S
+           fi
+
+           if test -f "$nlist"S; then
+             eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+           else
+             $echo '/* NONE */' >> "$output_objdir/$dlsyms"
+           fi
+
+           $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+"
+
+           case $host in
+           *cygwin* | *mingw* )
+         $echo >> "$output_objdir/$dlsyms" "\
+/* DATA imports from DLLs on WIN32 can't be const, because
+   runtime relocations are performed -- see ld's documentation
+   on pseudo-relocs */
+struct {
+"
+             ;;
+           * )
+         $echo >> "$output_objdir/$dlsyms" "\
+const struct {
+"
+             ;;
+           esac
+
+
+         $echo >> "$output_objdir/$dlsyms" "\
+  const char *name;
+  lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+           eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
+
+           $echo >> "$output_objdir/$dlsyms" "\
+  {0, (lt_ptr) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+         fi
+
+         pic_flag_for_symtable=
+         case $host in
+         # compiling the symbol table file with pic_flag works around
+         # a FreeBSD bug that causes programs to crash when -lm is
+         # linked before any other PIC object.  But we must not use
+         # pic_flag when linking with -static.  The problem exists in
+         # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+         *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+           case "$compile_command " in
+           *" -static "*) ;;
+           *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
+           esac;;
+         *-*-hpux*)
+           case "$compile_command " in
+           *" -static "*) ;;
+           *) pic_flag_for_symtable=" $pic_flag";;
+           esac
+         esac
+
+         # Now compile the dynamic symbol file.
+         $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+         $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+         # Clean up the generated files.
+         $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+         $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+         # Transform the symbol file into the correct name.
+          case $host in
+          *cygwin* | *mingw* )
+            if test -f "$output_objdir/${outputname}.def" ; then
+              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
+              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
+            else
+              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+             fi
+            ;;
+          * )
+            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+            ;;
+          esac
+         ;;
+       *)
+         $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+      else
+       # We keep going just in case the user didn't refer to
+       # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
+       # really was required.
+
+       # Nullify the symbol file.
+       compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+       finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+      fi
+
+      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+       # Replace the output file specification.
+       compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+       link_command="$compile_command$compile_rpath"
+
+       # We have no uninstalled library dependencies, so finalize right now.
+       $show "$link_command"
+       $run eval "$link_command"
+       exit_status=$?
+
+       # Delete the generated files.
+       if test -n "$dlsyms"; then
+         $show "$rm $output_objdir/${outputname}S.${objext}"
+         $run $rm "$output_objdir/${outputname}S.${objext}"
+       fi
+
+       exit $exit_status
+      fi
+
+      if test -n "$shlibpath_var"; then
+       # We should set the shlibpath_var
+       rpath=
+       for dir in $temp_rpath; do
+         case $dir in
+         [\\/]* | [A-Za-z]:[\\/]*)
+           # Absolute path.
+           rpath="$rpath$dir:"
+           ;;
+         *)
+           # Relative path: add a thisdir entry.
+           rpath="$rpath\$thisdir/$dir:"
+           ;;
+         esac
+       done
+       temp_rpath="$rpath"
+      fi
+
+      if test -n "$compile_shlibpath$finalize_shlibpath"; then
+       compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+       finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      compile_var=
+      finalize_var=
+      if test -n "$runpath_var"; then
+       if test -n "$perm_rpath"; then
+         # We should set the runpath_var.
+         rpath=
+         for dir in $perm_rpath; do
+           rpath="$rpath$dir:"
+         done
+         compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+       fi
+       if test -n "$finalize_perm_rpath"; then
+         # We should set the runpath_var.
+         rpath=
+         for dir in $finalize_perm_rpath; do
+           rpath="$rpath$dir:"
+         done
+         finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+       fi
+      fi
+
+      if test "$no_install" = yes; then
+       # We don't need to create a wrapper script.
+       link_command="$compile_var$compile_command$compile_rpath"
+       # Replace the output file specification.
+       link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+       # Delete the old output file.
+       $run $rm $output
+       # Link the executable and exit
+       $show "$link_command"
+       $run eval "$link_command" || exit $?
+       exit $EXIT_SUCCESS
+      fi
+
+      if test "$hardcode_action" = relink; then
+       # Fast installation is not supported
+       link_command="$compile_var$compile_command$compile_rpath"
+       relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+       $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+       $echo "$modename: \`$output' will be relinked during installation" 1>&2
+      else
+       if test "$fast_install" != no; then
+         link_command="$finalize_var$compile_command$finalize_rpath"
+         if test "$fast_install" = yes; then
+           relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+         else
+           # fast_install is set to needless
+           relink_command=
+         fi
+       else
+         link_command="$compile_var$compile_command$compile_rpath"
+         relink_command="$finalize_var$finalize_command$finalize_rpath"
+       fi
+      fi
+
+      # Replace the output file specification.
+      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+      # Delete the old output files.
+      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+      $show "$link_command"
+      $run eval "$link_command" || exit $?
+
+      # Now create the wrapper script.
+      $show "creating $output"
+
+      # Quote the relink command for shipping.
+      if test -n "$relink_command"; then
+       # Preserve any variables that may affect compiler behavior
+       for var in $variables_saved_for_relink; do
+         if eval test -z \"\${$var+set}\"; then
+           relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+         elif eval var_value=\$$var; test -z "$var_value"; then
+           relink_command="$var=; export $var; $relink_command"
+         else
+           var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+           relink_command="$var=\"$var_value\"; export $var; $relink_command"
+         fi
+       done
+       relink_command="(cd `pwd`; $relink_command)"
+       relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Quote $echo for shipping.
+      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
+       case $progpath in
+       [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
+       *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+       esac
+       qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+      else
+       qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Only actually do things if our run command is non-null.
+      if test -z "$run"; then
+       # win32 will think the script is a binary if it has
+       # a .exe suffix, so we strip it off here.
+       case $output in
+         *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
+       esac
+       # test for cygwin because mv fails w/o .exe extensions
+       case $host in
+         *cygwin*)
+           exeext=.exe
+           outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
+         *) exeext= ;;
+       esac
+       case $host in
+         *cygwin* | *mingw* )
+            output_name=`basename $output`
+            output_path=`dirname $output`
+            cwrappersource="$output_path/$objdir/lt-$output_name.c"
+            cwrapper="$output_path/$output_name.exe"
+            $rm $cwrappersource $cwrapper
+            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+           cat > $cwrappersource <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+
+   The $output program cannot be directly executed until all the libtool
+   libraries that it depends on are installed.
+
+   This wrapper executable should never be moved out of the build directory.
+   If it is, it will not operate correctly.
+
+   Currently, it simply execs the wrapper *script* "/bin/sh $output",
+   but could eventually absorb all of the scripts functionality and
+   exec $objdir/$outputname directly.
+*/
+EOF
+           cat >> $cwrappersource<<"EOF"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/stat.h>
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+  defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# ifndef DIR_SEPARATOR_2
+#  define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+#  define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+  if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+/* -DDEBUG is fairly common in CFLAGS.  */
+#undef DEBUG
+#if defined DEBUGWRAPPER
+# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
+#else
+# define DEBUG(format, ...)
+#endif
+
+const char *program_name = NULL;
+
+void * xmalloc (size_t num);
+char * xstrdup (const char *string);
+const char * base_name (const char *name);
+char * find_executable(const char *wrapper);
+int    check_executable(const char *path);
+char * strendzap(char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+
+int
+main (int argc, char *argv[])
+{
+  char **newargz;
+  int i;
+
+  program_name = (char *) xstrdup (base_name (argv[0]));
+  DEBUG("(main) argv[0]      : %s\n",argv[0]);
+  DEBUG("(main) program_name : %s\n",program_name);
+  newargz = XMALLOC(char *, argc+2);
+EOF
+
+            cat >> $cwrappersource <<EOF
+  newargz[0] = (char *) xstrdup("$SHELL");
+EOF
+
+            cat >> $cwrappersource <<"EOF"
+  newargz[1] = find_executable(argv[0]);
+  if (newargz[1] == NULL)
+    lt_fatal("Couldn't find %s", argv[0]);
+  DEBUG("(main) found exe at : %s\n",newargz[1]);
+  /* we know the script has the same name, without the .exe */
+  /* so make sure newargz[1] doesn't end in .exe */
+  strendzap(newargz[1],".exe");
+  for (i = 1; i < argc; i++)
+    newargz[i+1] = xstrdup(argv[i]);
+  newargz[argc+1] = NULL;
+
+  for (i=0; i<argc+1; i++)
+  {
+    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
+    ;
+  }
+
+EOF
+
+            case $host_os in
+              mingw*)
+                cat >> $cwrappersource <<EOF
+  execv("$SHELL",(char const **)newargz);
+EOF
+              ;;
+              *)
+                cat >> $cwrappersource <<EOF
+  execv("$SHELL",newargz);
+EOF
+              ;;
+            esac
+
+            cat >> $cwrappersource <<"EOF"
+  return 127;
+}
+
+void *
+xmalloc (size_t num)
+{
+  void * p = (void *) malloc (num);
+  if (!p)
+    lt_fatal ("Memory exhausted");
+
+  return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
+;
+}
+
+const char *
+base_name (const char *name)
+{
+  const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  /* Skip over the disk name in MSDOS pathnames. */
+  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
+    name += 2;
+#endif
+
+  for (base = name; *name; name++)
+    if (IS_DIR_SEPARATOR (*name))
+      base = name + 1;
+  return base;
+}
+
+int
+check_executable(const char * path)
+{
+  struct stat st;
+
+  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
+  if ((!path) || (!*path))
+    return 0;
+
+  if ((stat (path, &st) >= 0) &&
+      (
+        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
+#if defined (S_IXOTH)
+       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
+#endif
+#if defined (S_IXGRP)
+       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
+#endif
+       ((st.st_mode & S_IXUSR) == S_IXUSR))
+      )
+    return 1;
+  else
+    return 0;
+}
+
+/* Searches for the full path of the wrapper.  Returns
+   newly allocated full path name if found, NULL otherwise */
+char *
+find_executable (const char* wrapper)
+{
+  int has_slash = 0;
+  const char* p;
+  const char* p_next;
+  /* static buffer for getcwd */
+  char tmp[LT_PATHMAX + 1];
+  int tmp_len;
+  char* concat_name;
+
+  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
+
+  if ((wrapper == NULL) || (*wrapper == '\0'))
+    return NULL;
+
+  /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
+  {
+    concat_name = xstrdup (wrapper);
+    if (check_executable(concat_name))
+      return concat_name;
+    XFREE(concat_name);
+  }
+  else
+  {
+#endif
+    if (IS_DIR_SEPARATOR (wrapper[0]))
+    {
+      concat_name = xstrdup (wrapper);
+      if (check_executable(concat_name))
+        return concat_name;
+      XFREE(concat_name);
+    }
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  }
+#endif
+
+  for (p = wrapper; *p; p++)
+    if (*p == '/')
+    {
+      has_slash = 1;
+      break;
+    }
+  if (!has_slash)
+  {
+    /* no slashes; search PATH */
+    const char* path = getenv ("PATH");
+    if (path != NULL)
+    {
+      for (p = path; *p; p = p_next)
+      {
+        const char* q;
+        size_t p_len;
+        for (q = p; *q; q++)
+          if (IS_PATH_SEPARATOR(*q))
+            break;
+        p_len = q - p;
+        p_next = (*q == '\0' ? q : q + 1);
+        if (p_len == 0)
+        {
+          /* empty path: current directory */
+          if (getcwd (tmp, LT_PATHMAX) == NULL)
+            lt_fatal ("getcwd failed");
+          tmp_len = strlen(tmp);
+          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+          memcpy (concat_name, tmp, tmp_len);
+          concat_name[tmp_len] = '/';
+          strcpy (concat_name + tmp_len + 1, wrapper);
+        }
+        else
+        {
+          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
+          memcpy (concat_name, p, p_len);
+          concat_name[p_len] = '/';
+          strcpy (concat_name + p_len + 1, wrapper);
+        }
+        if (check_executable(concat_name))
+          return concat_name;
+        XFREE(concat_name);
+      }
+    }
+    /* not found in PATH; assume curdir */
+  }
+  /* Relative path | not found in path: prepend cwd */
+  if (getcwd (tmp, LT_PATHMAX) == NULL)
+    lt_fatal ("getcwd failed");
+  tmp_len = strlen(tmp);
+  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+  memcpy (concat_name, tmp, tmp_len);
+  concat_name[tmp_len] = '/';
+  strcpy (concat_name + tmp_len + 1, wrapper);
+
+  if (check_executable(concat_name))
+    return concat_name;
+  XFREE(concat_name);
+  return NULL;
+}
+
+char *
+strendzap(char *str, const char *pat)
+{
+  size_t len, patlen;
+
+  assert(str != NULL);
+  assert(pat != NULL);
+
+  len = strlen(str);
+  patlen = strlen(pat);
+
+  if (patlen <= len)
+  {
+    str += len - patlen;
+    if (strcmp(str, pat) == 0)
+      *str = '\0';
+  }
+  return str;
+}
+
+static void
+lt_error_core (int exit_status, const char * mode,
+          const char * message, va_list ap)
+{
+  fprintf (stderr, "%s: %s: ", program_name, mode);
+  vfprintf (stderr, message, ap);
+  fprintf (stderr, ".\n");
+
+  if (exit_status >= 0)
+    exit (exit_status);
+}
+
+void
+lt_fatal (const char *message, ...)
+{
+  va_list ap;
+  va_start (ap, message);
+  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+  va_end (ap);
+}
+EOF
+          # we should really use a build-platform specific compiler
+          # here, but OTOH, the wrappers (shell script and this C one)
+          # are only useful if you want to execute the "real" binary.
+          # Since the "real" binary is built for $host, then this
+          # wrapper might as well be built for $host, too.
+          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
+          ;;
+        esac
+        $rm $output
+        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
+
+       $echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variable:
+  notinst_deplibs='$notinst_deplibs'
+else
+  # When we are sourced in execute mode, \$file and \$echo are already set.
+  if test \"\$libtool_execute_magic\" != \"$magic\"; then
+    echo=\"$qecho\"
+    file=\"\$0\"
+    # Make sure echo works.
+    if test \"X\$1\" = X--no-reexec; then
+      # Discard the --no-reexec flag, and continue.
+      shift
+    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+      # Yippee, \$echo works!
+      :
+    else
+      # Restart under the correct shell, and then maybe \$echo will work.
+      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+    fi
+  fi\
+"
+       $echo >> $output "\
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+  while test -n \"\$file\"; do
+    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+    # If there was a directory component, then change thisdir.
+    if test \"x\$destdir\" != \"x\$file\"; then
+      case \"\$destdir\" in
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+      *) thisdir=\"\$thisdir/\$destdir\" ;;
+      esac
+    fi
+
+    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+  done
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+       if test "$fast_install" = yes; then
+         $echo >> $output "\
+  program=lt-'$outputname'$exeext
+  progdir=\"\$thisdir/$objdir\"
+
+  if test ! -f \"\$progdir/\$program\" || \\
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+    file=\"\$\$-\$program\"
+
+    if test ! -d \"\$progdir\"; then
+      $mkdir \"\$progdir\"
+    else
+      $rm \"\$progdir/\$file\"
+    fi"
+
+         $echo >> $output "\
+
+    # relink executable if necessary
+    if test -n \"\$relink_command\"; then
+      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+      else
+       $echo \"\$relink_command_output\" >&2
+       $rm \"\$progdir/\$file\"
+       exit $EXIT_FAILURE
+      fi
+    fi
+
+    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+    { $rm \"\$progdir/\$program\";
+      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+    $rm \"\$progdir/\$file\"
+  fi"
+       else
+         $echo >> $output "\
+  program='$outputname'
+  progdir=\"\$thisdir/$objdir\"
+"
+       fi
+
+       $echo >> $output "\
+
+  if test -f \"\$progdir/\$program\"; then"
+
+       # Export our shlibpath_var if we have one.
+       if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+         $echo >> $output "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 sed
+    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+    export $shlibpath_var
+"
+       fi
+
+       # fixup the dll searchpath if we need to.
+       if test -n "$dllsearchpath"; then
+         $echo >> $output "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+       fi
+
+       $echo >> $output "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+"
+       case $host in
+       # Backslashes separate directories on plain windows
+       *-*-mingw | *-*-os2*)
+         $echo >> $output "\
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+         ;;
+
+       *)
+         $echo >> $output "\
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+         ;;
+       esac
+       $echo >> $output "\
+      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+      exit $EXIT_FAILURE
+    fi
+  else
+    # The program doesn't exist.
+    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+    \$echo \"This script is just a wrapper for \$program.\" 1>&2
+    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
+    exit $EXIT_FAILURE
+  fi
+fi\
+"
+       chmod +x $output
+      fi
+      exit $EXIT_SUCCESS
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    for oldlib in $oldlibs; do
+
+      if test "$build_libtool_libs" = convenience; then
+       oldobjs="$libobjs_save"
+       addlibs="$convenience"
+       build_libtool_libs=no
+      else
+       if test "$build_libtool_libs" = module; then
+         oldobjs="$libobjs_save"
+         build_libtool_libs=no
+       else
+         oldobjs="$old_deplibs $non_pic_objects"
+       fi
+       addlibs="$old_convenience"
+      fi
+
+      if test -n "$addlibs"; then
+       gentop="$output_objdir/${outputname}x"
+       generated="$generated $gentop"
+
+       func_extract_archives $gentop $addlibs
+       oldobjs="$oldobjs $func_extract_archives_result"
+      fi
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+       cmds=$old_archive_from_new_cmds
+      else
+       # POSIX demands no paths to be encoded in archives.  We have
+       # to avoid creating archives with duplicate basenames if we
+       # might have to extract them afterwards, e.g., when creating a
+       # static archive out of a convenience library, or when linking
+       # the entirety of a libtool archive into another (currently
+       # not supported by libtool).
+       if (for obj in $oldobjs
+           do
+             $echo "X$obj" | $Xsed -e 's%^.*/%%'
+           done | sort | sort -uc >/dev/null 2>&1); then
+         :
+       else
+         $echo "copying selected object files to avoid basename conflicts..."
+
+         if test -z "$gentop"; then
+           gentop="$output_objdir/${outputname}x"
+           generated="$generated $gentop"
+
+           $show "${rm}r $gentop"
+           $run ${rm}r "$gentop"
+           $show "$mkdir $gentop"
+           $run $mkdir "$gentop"
+           exit_status=$?
+           if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
+             exit $exit_status
+           fi
+         fi
+
+         save_oldobjs=$oldobjs
+         oldobjs=
+         counter=1
+         for obj in $save_oldobjs
+         do
+           objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+           case " $oldobjs " in
+           " ") oldobjs=$obj ;;
+           *[\ /]"$objbase "*)
+             while :; do
+               # Make sure we don't pick an alternate name that also
+               # overlaps.
+               newobj=lt$counter-$objbase
+               counter=`expr $counter + 1`
+               case " $oldobjs " in
+               *[\ /]"$newobj "*) ;;
+               *) if test ! -f "$gentop/$newobj"; then break; fi ;;
+               esac
+             done
+             $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+             $run ln "$obj" "$gentop/$newobj" ||
+             $run cp "$obj" "$gentop/$newobj"
+             oldobjs="$oldobjs $gentop/$newobj"
+             ;;
+           *) oldobjs="$oldobjs $obj" ;;
+           esac
+         done
+       fi
+
+       eval cmds=\"$old_archive_cmds\"
+
+       if len=`expr "X$cmds" : ".*"` &&
+            test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+         cmds=$old_archive_cmds
+       else
+         # the command line is too long to link in one step, link in parts
+         $echo "using piecewise archive linking..."
+         save_RANLIB=$RANLIB
+         RANLIB=:
+         objlist=
+         concat_cmds=
+         save_oldobjs=$oldobjs
+
+         # Is there a better way of finding the last object in the list?
+         for obj in $save_oldobjs
+         do
+           last_oldobj=$obj
+         done
+         for obj in $save_oldobjs
+         do
+           oldobjs="$objlist $obj"
+           objlist="$objlist $obj"
+           eval test_cmds=\"$old_archive_cmds\"
+           if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+              test "$len" -le "$max_cmd_len"; then
+             :
+           else
+             # the above command should be used before it gets too long
+             oldobjs=$objlist
+             if test "$obj" = "$last_oldobj" ; then
+               RANLIB=$save_RANLIB
+             fi
+             test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+             eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+             objlist=
+           fi
+         done
+         RANLIB=$save_RANLIB
+         oldobjs=$objlist
+         if test "X$oldobjs" = "X" ; then
+           eval cmds=\"\$concat_cmds\"
+         else
+           eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+         fi
+       fi
+      fi
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+        eval cmd=\"$cmd\"
+       IFS="$save_ifs"
+       $show "$cmd"
+       $run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$generated"; then
+      $show "${rm}r$generated"
+      $run ${rm}r$generated
+    fi
+
+    # Now create the libtool archive.
+    case $output in
+    *.la)
+      old_library=
+      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      $show "creating $output"
+
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+       if eval test -z \"\${$var+set}\"; then
+         relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+       elif eval var_value=\$$var; test -z "$var_value"; then
+         relink_command="$var=; export $var; $relink_command"
+       else
+         var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+         relink_command="$var=\"$var_value\"; export $var; $relink_command"
+       fi
+      done
+      # Quote the link command for shipping.
+      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      if test "$hardcode_automatic" = yes ; then
+       relink_command=
+      fi
+
+
+      # Only create the output if not a dry run.
+      if test -z "$run"; then
+       for installed in no yes; do
+         if test "$installed" = yes; then
+           if test -z "$install_libdir"; then
+             break
+           fi
+           output="$output_objdir/$outputname"i
+           # Replace all uninstalled libtool libraries with the installed ones
+           newdependency_libs=
+           for deplib in $dependency_libs; do
+             case $deplib in
+             *.la)
+               name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+               eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+               if test -z "$libdir"; then
+                 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+                 exit $EXIT_FAILURE
+               fi
+               newdependency_libs="$newdependency_libs $libdir/$name"
+               ;;
+             *) newdependency_libs="$newdependency_libs $deplib" ;;
+             esac
+           done
+           dependency_libs="$newdependency_libs"
+           newdlfiles=
+           for lib in $dlfiles; do
+             name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+             eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+             if test -z "$libdir"; then
+               $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+               exit $EXIT_FAILURE
+             fi
+             newdlfiles="$newdlfiles $libdir/$name"
+           done
+           dlfiles="$newdlfiles"
+           newdlprefiles=
+           for lib in $dlprefiles; do
+             name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+             eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+             if test -z "$libdir"; then
+               $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+               exit $EXIT_FAILURE
+             fi
+             newdlprefiles="$newdlprefiles $libdir/$name"
+           done
+           dlprefiles="$newdlprefiles"
+         else
+           newdlfiles=
+           for lib in $dlfiles; do
+             case $lib in
+               [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+               *) abs=`pwd`"/$lib" ;;
+             esac
+             newdlfiles="$newdlfiles $abs"
+           done
+           dlfiles="$newdlfiles"
+           newdlprefiles=
+           for lib in $dlprefiles; do
+             case $lib in
+               [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+               *) abs=`pwd`"/$lib" ;;
+             esac
+             newdlprefiles="$newdlprefiles $abs"
+           done
+           dlprefiles="$newdlprefiles"
+         fi
+         $rm $output
+         # place dlname in correct position for cygwin
+         tdlname=$dlname
+         case $host,$output,$installed,$module,$dlname in
+           *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+         esac
+         $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+         if test "$installed" = no && test "$need_relink" = yes; then
+           $echo >> $output "\
+relink_command=\"$relink_command\""
+         fi
+       done
+      fi
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
+      ;;
+    esac
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool install mode
+  install)
+    modename="$modename: install"
+
+    # There may be an optional sh(1) argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+       # Allow the use of GNU shtool's install command.
+       $echo "X$nonopt" | grep shtool > /dev/null; then
+      # Aesthetically quote it.
+      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+       arg="\"$arg\""
+       ;;
+      esac
+      install_prog="$arg "
+      arg="$1"
+      shift
+    else
+      install_prog=
+      arg=$nonopt
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+    case $arg in
+    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \      ]*|*]*|"")
+      arg="\"$arg\""
+      ;;
+    esac
+    install_prog="$install_prog$arg"
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=no
+    stripme=
+    for arg
+    do
+      if test -n "$dest"; then
+       files="$files $dest"
+       dest=$arg
+       continue
+      fi
+
+      case $arg in
+      -d) isdir=yes ;;
+      -f) 
+       case " $install_prog " in
+       *[\\\ /]cp\ *) ;;
+       *) prev=$arg ;;
+       esac
+       ;;
+      -g | -m | -o) prev=$arg ;;
+      -s)
+       stripme=" -s"
+       continue
+       ;;
+      -*)
+       ;;
+      *)
+       # If the previous option needed an argument, then skip it.
+       if test -n "$prev"; then
+         prev=
+       else
+         dest=$arg
+         continue
+       fi
+       ;;
+      esac
+
+      # Aesthetically quote the argument.
+      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+      case $arg in
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+       arg="\"$arg\""
+       ;;
+      esac
+      install_prog="$install_prog $arg"
+    done
+
+    if test -z "$install_prog"; then
+      $echo "$modename: you must specify an install program" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test -n "$prev"; then
+      $echo "$modename: the \`$prev' option requires an argument" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+       $echo "$modename: no file or destination specified" 1>&2
+      else
+       $echo "$modename: you must specify a destination" 1>&2
+      fi
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Strip any trailing slash from the destination.
+    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=yes
+    if test "$isdir" = yes; then
+      destdir="$dest"
+      destname=
+    else
+      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+      test "X$destdir" = "X$dest" && destdir=.
+      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files
+      if test "$#" -gt 2; then
+       $echo "$modename: \`$dest' is not a directory" 1>&2
+       $echo "$help" 1>&2
+       exit $EXIT_FAILURE
+      fi
+    fi
+    case $destdir in
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
+    *)
+      for file in $files; do
+       case $file in
+       *.lo) ;;
+       *)
+         $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+         $echo "$help" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+      done
+      ;;
+    esac
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    staticlibs=
+    future_libdirs=
+    current_libdirs=
+    for file in $files; do
+
+      # Do each installation.
+      case $file in
+      *.$libext)
+       # Do the static libraries later.
+       staticlibs="$staticlibs $file"
+       ;;
+
+      *.la)
+       # Check to see that this really is a libtool archive.
+       if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+       else
+         $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+         $echo "$help" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       library_names=
+       old_library=
+       relink_command=
+       # If there is no directory component, then add one.
+       case $file in
+       */* | *\\*) . $file ;;
+       *) . ./$file ;;
+       esac
+
+       # Add the libdir to current_libdirs if it is the destination.
+       if test "X$destdir" = "X$libdir"; then
+         case "$current_libdirs " in
+         *" $libdir "*) ;;
+         *) current_libdirs="$current_libdirs $libdir" ;;
+         esac
+       else
+         # Note the libdir as a future libdir.
+         case "$future_libdirs " in
+         *" $libdir "*) ;;
+         *) future_libdirs="$future_libdirs $libdir" ;;
+         esac
+       fi
+
+       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
+       test "X$dir" = "X$file/" && dir=
+       dir="$dir$objdir"
+
+       if test -n "$relink_command"; then
+         # Determine the prefix the user has applied to our future dir.
+         inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
+
+         # Don't allow the user to place us outside of our expected
+         # location b/c this prevents finding dependent libraries that
+         # are installed to the same prefix.
+         # At present, this check doesn't affect windows .dll's that
+         # are installed into $libdir/../bin (currently, that works fine)
+         # but it's something to keep an eye on.
+         if test "$inst_prefix_dir" = "$destdir"; then
+           $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+           exit $EXIT_FAILURE
+         fi
+
+         if test -n "$inst_prefix_dir"; then
+           # Stick the inst_prefix_dir data into the link command.
+           relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+         else
+           relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+         fi
+
+         $echo "$modename: warning: relinking \`$file'" 1>&2
+         $show "$relink_command"
+         if $run eval "$relink_command"; then :
+         else
+           $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+           exit $EXIT_FAILURE
+         fi
+       fi
+
+       # See the names of the shared library.
+       set dummy $library_names
+       if test -n "$2"; then
+         realname="$2"
+         shift
+         shift
+
+         srcname="$realname"
+         test -n "$relink_command" && srcname="$realname"T
+
+         # Install the shared library and build the symlinks.
+         $show "$install_prog $dir/$srcname $destdir/$realname"
+         $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+         if test -n "$stripme" && test -n "$striplib"; then
+           $show "$striplib $destdir/$realname"
+           $run eval "$striplib $destdir/$realname" || exit $?
+         fi
+
+         if test "$#" -gt 0; then
+           # Delete the old symlinks, and create new ones.
+           # Try `ln -sf' first, because the `ln' binary might depend on
+           # the symlink we replace!  Solaris /bin/ln does not understand -f,
+           # so we also need to try rm && ln -s.
+           for linkname
+           do
+             if test "$linkname" != "$realname"; then
+                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+             fi
+           done
+         fi
+
+         # Do each command in the postinstall commands.
+         lib="$destdir/$realname"
+         cmds=$postinstall_cmds
+         save_ifs="$IFS"; IFS='~'
+         for cmd in $cmds; do
+           IFS="$save_ifs"
+           eval cmd=\"$cmd\"
+           $show "$cmd"
+           $run eval "$cmd" || {
+             lt_exit=$?
+
+             # Restore the uninstalled library and exit
+             if test "$mode" = relink; then
+               $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+             fi
+
+             exit $lt_exit
+           }
+         done
+         IFS="$save_ifs"
+       fi
+
+       # Install the pseudo-library for information purposes.
+       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+       instname="$dir/$name"i
+       $show "$install_prog $instname $destdir/$name"
+       $run eval "$install_prog $instname $destdir/$name" || exit $?
+
+       # Maybe install the static library, too.
+       test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+       ;;
+
+      *.lo)
+       # Install (i.e. copy) a libtool object.
+
+       # Figure out destination file name, if it wasn't already specified.
+       if test -n "$destname"; then
+         destfile="$destdir/$destname"
+       else
+         destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+         destfile="$destdir/$destfile"
+       fi
+
+       # Deduce the name of the destination old-style object file.
+       case $destfile in
+       *.lo)
+         staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+         ;;
+       *.$objext)
+         staticdest="$destfile"
+         destfile=
+         ;;
+       *)
+         $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+         $echo "$help" 1>&2
+         exit $EXIT_FAILURE
+         ;;
+       esac
+
+       # Install the libtool object if requested.
+       if test -n "$destfile"; then
+         $show "$install_prog $file $destfile"
+         $run eval "$install_prog $file $destfile" || exit $?
+       fi
+
+       # Install the old object if enabled.
+       if test "$build_old_libs" = yes; then
+         # Deduce the name of the old-style object file.
+         staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+         $show "$install_prog $staticobj $staticdest"
+         $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+       fi
+       exit $EXIT_SUCCESS
+       ;;
+
+      *)
+       # Figure out destination file name, if it wasn't already specified.
+       if test -n "$destname"; then
+         destfile="$destdir/$destname"
+       else
+         destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+         destfile="$destdir/$destfile"
+       fi
+
+       # If the file is missing, and there is a .exe on the end, strip it
+       # because it is most likely a libtool script we actually want to
+       # install
+       stripped_ext=""
+       case $file in
+         *.exe)
+           if test ! -f "$file"; then
+             file=`$echo $file|${SED} 's,.exe$,,'`
+             stripped_ext=".exe"
+           fi
+           ;;
+       esac
+
+       # Do a test to see if this is really a libtool program.
+       case $host in
+       *cygwin*|*mingw*)
+           wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
+           ;;
+       *)
+           wrapper=$file
+           ;;
+       esac
+       if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
+         notinst_deplibs=
+         relink_command=
+
+         # Note that it is not necessary on cygwin/mingw to append a dot to
+         # foo even if both foo and FILE.exe exist: automatic-append-.exe
+         # behavior happens only for exec(3), not for open(2)!  Also, sourcing
+         # `FILE.' does not work on cygwin managed mounts.
+         #
+         # If there is no directory component, then add one.
+         case $wrapper in
+         */* | *\\*) . ${wrapper} ;;
+         *) . ./${wrapper} ;;
+         esac
+
+         # Check the variables that should have been set.
+         if test -z "$notinst_deplibs"; then
+           $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
+           exit $EXIT_FAILURE
+         fi
+
+         finalize=yes
+         for lib in $notinst_deplibs; do
+           # Check to see that each library is installed.
+           libdir=
+           if test -f "$lib"; then
+             # If there is no directory component, then add one.
+             case $lib in
+             */* | *\\*) . $lib ;;
+             *) . ./$lib ;;
+             esac
+           fi
+           libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+           if test -n "$libdir" && test ! -f "$libfile"; then
+             $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+             finalize=no
+           fi
+         done
+
+         relink_command=
+         # Note that it is not necessary on cygwin/mingw to append a dot to
+         # foo even if both foo and FILE.exe exist: automatic-append-.exe
+         # behavior happens only for exec(3), not for open(2)!  Also, sourcing
+         # `FILE.' does not work on cygwin managed mounts.
+         #
+         # If there is no directory component, then add one.
+         case $wrapper in
+         */* | *\\*) . ${wrapper} ;;
+         *) . ./${wrapper} ;;
+         esac
+
+         outputname=
+         if test "$fast_install" = no && test -n "$relink_command"; then
+           if test "$finalize" = yes && test -z "$run"; then
+             tmpdir=`func_mktempdir`
+             file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
+             outputname="$tmpdir/$file"
+             # Replace the output file specification.
+             relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+             $show "$relink_command"
+             if $run eval "$relink_command"; then :
+             else
+               $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+               ${rm}r "$tmpdir"
+               continue
+             fi
+             file="$outputname"
+           else
+             $echo "$modename: warning: cannot relink \`$file'" 1>&2
+           fi
+         else
+           # Install the binary that we compiled earlier.
+           file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+         fi
+       fi
+
+       # remove .exe since cygwin /usr/bin/install will append another
+       # one anyway 
+       case $install_prog,$host in
+       */usr/bin/install*,*cygwin*)
+         case $file:$destfile in
+         *.exe:*.exe)
+           # this is ok
+           ;;
+         *.exe:*)
+           destfile=$destfile.exe
+           ;;
+         *:*.exe)
+           destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
+           ;;
+         esac
+         ;;
+       esac
+       $show "$install_prog$stripme $file $destfile"
+       $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+       test -n "$outputname" && ${rm}r "$tmpdir"
+       ;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+      # Set up the ranlib parameters.
+      oldlib="$destdir/$name"
+
+      $show "$install_prog $file $oldlib"
+      $run eval "$install_prog \$file \$oldlib" || exit $?
+
+      if test -n "$stripme" && test -n "$old_striplib"; then
+       $show "$old_striplib $oldlib"
+       $run eval "$old_striplib $oldlib" || exit $?
+      fi
+
+      # Do each command in the postinstall commands.
+      cmds=$old_postinstall_cmds
+      save_ifs="$IFS"; IFS='~'
+      for cmd in $cmds; do
+       IFS="$save_ifs"
+       eval cmd=\"$cmd\"
+       $show "$cmd"
+       $run eval "$cmd" || exit $?
+      done
+      IFS="$save_ifs"
+    done
+
+    if test -n "$future_libdirs"; then
+      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+    fi
+
+    if test -n "$current_libdirs"; then
+      # Maybe just do a dry run.
+      test -n "$run" && current_libdirs=" -n$current_libdirs"
+      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+    else
+      exit $EXIT_SUCCESS
+    fi
+    ;;
+
+  # libtool finish mode
+  finish)
+    modename="$modename: finish"
+    libdirs="$nonopt"
+    admincmds=
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for dir
+      do
+       libdirs="$libdirs $dir"
+      done
+
+      for libdir in $libdirs; do
+       if test -n "$finish_cmds"; then
+         # Do each command in the finish commands.
+         cmds=$finish_cmds
+         save_ifs="$IFS"; IFS='~'
+         for cmd in $cmds; do
+           IFS="$save_ifs"
+           eval cmd=\"$cmd\"
+           $show "$cmd"
+           $run eval "$cmd" || admincmds="$admincmds
+       $cmd"
+         done
+         IFS="$save_ifs"
+       fi
+       if test -n "$finish_eval"; then
+         # Do the single finish_eval.
+         eval cmds=\"$finish_eval\"
+         $run eval "$cmds" || admincmds="$admincmds
+       $cmds"
+       fi
+      done
+    fi
+
+    # Exit here if they wanted silent mode.
+    test "$show" = : && exit $EXIT_SUCCESS
+
+    $echo "X----------------------------------------------------------------------" | $Xsed
+    $echo "Libraries have been installed in:"
+    for libdir in $libdirs; do
+      $echo "   $libdir"
+    done
+    $echo
+    $echo "If you ever happen to want to link against installed libraries"
+    $echo "in a given directory, LIBDIR, you must either use libtool, and"
+    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+    $echo "flag during linking and do at least one of the following:"
+    if test -n "$shlibpath_var"; then
+      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+      $echo "     during execution"
+    fi
+    if test -n "$runpath_var"; then
+      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+      $echo "     during linking"
+    fi
+    if test -n "$hardcode_libdir_flag_spec"; then
+      libdir=LIBDIR
+      eval flag=\"$hardcode_libdir_flag_spec\"
+
+      $echo "   - use the \`$flag' linker flag"
+    fi
+    if test -n "$admincmds"; then
+      $echo "   - have your system administrator run these commands:$admincmds"
+    fi
+    if test -f /etc/ld.so.conf; then
+      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+    fi
+    $echo
+    $echo "See any operating system documentation about shared libraries for"
+    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
+    $echo "X----------------------------------------------------------------------" | $Xsed
+    exit $EXIT_SUCCESS
+    ;;
+
+  # libtool execute mode
+  execute)
+    modename="$modename: execute"
+
+    # The first argument is the command name.
+    cmd="$nonopt"
+    if test -z "$cmd"; then
+      $echo "$modename: you must specify a COMMAND" 1>&2
+      $echo "$help"
+      exit $EXIT_FAILURE
+    fi
+
+    # Handle -dlopen flags immediately.
+    for file in $execute_dlfiles; do
+      if test ! -f "$file"; then
+       $echo "$modename: \`$file' is not a file" 1>&2
+       $echo "$help" 1>&2
+       exit $EXIT_FAILURE
+      fi
+
+      dir=
+      case $file in
+      *.la)
+       # Check to see that this really is a libtool archive.
+       if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+       else
+         $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+         $echo "$help" 1>&2
+         exit $EXIT_FAILURE
+       fi
+
+       # Read the libtool library.
+       dlname=
+       library_names=
+
+       # If there is no directory component, then add one.
+       case $file in
+       */* | *\\*) . $file ;;
+       *) . ./$file ;;
+       esac
+
+       # Skip this library if it cannot be dlopened.
+       if test -z "$dlname"; then
+         # Warn if it was a shared library.
+         test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+         continue
+       fi
+
+       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+       test "X$dir" = "X$file" && dir=.
+
+       if test -f "$dir/$objdir/$dlname"; then
+         dir="$dir/$objdir"
+       else
+         $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+         exit $EXIT_FAILURE
+       fi
+       ;;
+
+      *.lo)
+       # Just add the directory containing the .lo file.
+       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+       test "X$dir" = "X$file" && dir=.
+       ;;
+
+      *)
+       $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+       continue
+       ;;
+      esac
+
+      # Get the absolute pathname.
+      absdir=`cd "$dir" && pwd`
+      test -n "$absdir" && dir="$absdir"
+
+      # Now add the directory to shlibpath_var.
+      if eval "test -z \"\$$shlibpath_var\""; then
+       eval "$shlibpath_var=\"\$dir\""
+      else
+       eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+      fi
+    done
+
+    # This variable tells wrapper scripts just to set shlibpath_var
+    # rather than running their programs.
+    libtool_execute_magic="$magic"
+
+    # Check if any of the arguments is a wrapper script.
+    args=
+    for file
+    do
+      case $file in
+      -*) ;;
+      *)
+       # Do a test to see if this is really a libtool program.
+       if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+         # If there is no directory component, then add one.
+         case $file in
+         */* | *\\*) . $file ;;
+         *) . ./$file ;;
+         esac
+
+         # Transform arg to wrapped name.
+         file="$progdir/$program"
+       fi
+       ;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+      args="$args \"$file\""
+    done
+
+    if test -z "$run"; then
+      if test -n "$shlibpath_var"; then
+       # Export the shlibpath_var.
+       eval "export $shlibpath_var"
+      fi
+
+      # Restore saved environment variables
+      if test "${save_LC_ALL+set}" = set; then
+       LC_ALL="$save_LC_ALL"; export LC_ALL
+      fi
+      if test "${save_LANG+set}" = set; then
+       LANG="$save_LANG"; export LANG
+      fi
+
+      # Now prepare to actually exec the command.
+      exec_cmd="\$cmd$args"
+    else
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+       eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+       $echo "export $shlibpath_var"
+      fi
+      $echo "$cmd$args"
+      exit $EXIT_SUCCESS
+    fi
+    ;;
+
+  # libtool clean and uninstall mode
+  clean | uninstall)
+    modename="$modename: $mode"
+    rm="$nonopt"
+    files=
+    rmforce=
+    exit_status=0
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    for arg
+    do
+      case $arg in
+      -f) rm="$rm $arg"; rmforce=yes ;;
+      -*) rm="$rm $arg" ;;
+      *) files="$files $arg" ;;
+      esac
+    done
+
+    if test -z "$rm"; then
+      $echo "$modename: you must specify an RM program" 1>&2
+      $echo "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    rmdirs=
+
+    origobjdir="$objdir"
+    for file in $files; do
+      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+      if test "X$dir" = "X$file"; then
+       dir=.
+       objdir="$origobjdir"
+      else
+       objdir="$dir/$origobjdir"
+      fi
+      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+      test "$mode" = uninstall && objdir="$dir"
+
+      # Remember objdir for removal later, being careful to avoid duplicates
+      if test "$mode" = clean; then
+       case " $rmdirs " in
+         *" $objdir "*) ;;
+         *) rmdirs="$rmdirs $objdir" ;;
+       esac
+      fi
+
+      # Don't error if the file doesn't exist and rm -f was used.
+      if (test -L "$file") >/dev/null 2>&1 \
+       || (test -h "$file") >/dev/null 2>&1 \
+       || test -f "$file"; then
+       :
+      elif test -d "$file"; then
+       exit_status=1
+       continue
+      elif test "$rmforce" = yes; then
+       continue
+      fi
+
+      rmfiles="$file"
+
+      case $name in
+      *.la)
+       # Possibly a libtool archive, so verify it.
+       if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+         . $dir/$name
+
+         # Delete the libtool libraries and symlinks.
+         for n in $library_names; do
+           rmfiles="$rmfiles $objdir/$n"
+         done
+         test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+
+         case "$mode" in
+         clean)
+           case "  $library_names " in
+           # "  " in the beginning catches empty $dlname
+           *" $dlname "*) ;;
+           *) rmfiles="$rmfiles $objdir/$dlname" ;;
+           esac
+            test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+           ;;
+         uninstall)
+           if test -n "$library_names"; then
+             # Do each command in the postuninstall commands.
+             cmds=$postuninstall_cmds
+             save_ifs="$IFS"; IFS='~'
+             for cmd in $cmds; do
+               IFS="$save_ifs"
+               eval cmd=\"$cmd\"
+               $show "$cmd"
+               $run eval "$cmd"
+               if test "$?" -ne 0 && test "$rmforce" != yes; then
+                 exit_status=1
+               fi
+             done
+             IFS="$save_ifs"
+           fi
+
+           if test -n "$old_library"; then
+             # Do each command in the old_postuninstall commands.
+             cmds=$old_postuninstall_cmds
+             save_ifs="$IFS"; IFS='~'
+             for cmd in $cmds; do
+               IFS="$save_ifs"
+               eval cmd=\"$cmd\"
+               $show "$cmd"
+               $run eval "$cmd"
+               if test "$?" -ne 0 && test "$rmforce" != yes; then
+                 exit_status=1
+               fi
+             done
+             IFS="$save_ifs"
+           fi
+           # FIXME: should reinstall the best remaining shared library.
+           ;;
+         esac
+       fi
+       ;;
+
+      *.lo)
+       # Possibly a libtool object, so verify it.
+       if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+
+         # Read the .lo file
+         . $dir/$name
+
+         # Add PIC object to the list of files to remove.
+         if test -n "$pic_object" \
+            && test "$pic_object" != none; then
+           rmfiles="$rmfiles $dir/$pic_object"
+         fi
+
+         # Add non-PIC object to the list of files to remove.
+         if test -n "$non_pic_object" \
+            && test "$non_pic_object" != none; then
+           rmfiles="$rmfiles $dir/$non_pic_object"
+         fi
+       fi
+       ;;
+
+      *)
+       if test "$mode" = clean ; then
+         noexename=$name
+         case $file in
+         *.exe)
+           file=`$echo $file|${SED} 's,.exe$,,'`
+           noexename=`$echo $name|${SED} 's,.exe$,,'`
+           # $file with .exe has already been added to rmfiles,
+           # add $file without .exe
+           rmfiles="$rmfiles $file"
+           ;;
+         esac
+         # Do a test to see if this is a libtool program.
+         if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+           relink_command=
+           . $dir/$noexename
+
+           # note $name still contains .exe if it was in $file originally
+           # as does the version of $file that was added into $rmfiles
+           rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+           if test "$fast_install" = yes && test -n "$relink_command"; then
+             rmfiles="$rmfiles $objdir/lt-$name"
+           fi
+           if test "X$noexename" != "X$name" ; then
+             rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+           fi
+         fi
+       fi
+       ;;
+      esac
+      $show "$rm $rmfiles"
+      $run $rm $rmfiles || exit_status=1
+    done
+    objdir="$origobjdir"
+
+    # Try to remove the ${objdir}s in the directories where we deleted files
+    for dir in $rmdirs; do
+      if test -d "$dir"; then
+       $show "rmdir $dir"
+       $run rmdir $dir >/dev/null 2>&1
+      fi
+    done
+
+    exit $exit_status
+    ;;
+
+  "")
+    $echo "$modename: you must specify a MODE" 1>&2
+    $echo "$generic_help" 1>&2
+    exit $EXIT_FAILURE
+    ;;
+  esac
+
+  if test -z "$exec_cmd"; then
+    $echo "$modename: invalid operation mode \`$mode'" 1>&2
+    $echo "$generic_help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+fi # test -z "$show_help"
+
+if test -n "$exec_cmd"; then
+  eval exec $exec_cmd
+  exit $EXIT_FAILURE
+fi
+
+# We need to display help for each of the modes.
+case $mode in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+    --config          show all configuration variables
+    --debug           enable verbose shell tracing
+-n, --dry-run         display commands without modifying any files
+    --features        display basic configuration information and exit
+    --finish          same as \`--mode=finish'
+    --help            display this help message and exit
+    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
+    --quiet           same as \`--silent'
+    --silent          don't print informational messages
+    --tag=TAG         use configuration variables from tag TAG
+    --version         print version information
+
+MODE must be one of the following:
+
+      clean           remove files from the build directory
+      compile         compile a source file into a libtool object
+      execute         automatically set library path, then run a program
+      finish          complete the installation of libtool libraries
+      install         install libraries or executables
+      link            create a library or an executable
+      uninstall       remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE.
+
+Report bugs to <bug-libtool@gnu.org>."
+  exit $EXIT_SUCCESS
+  ;;
+
+clean)
+  $echo \
+"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+compile)
+  $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
+  -prefer-pic       try to building PIC objects only
+  -prefer-non-pic   try to building non-PIC objects only
+  -static           always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+  ;;
+
+execute)
+  $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+  -dlopen FILE      add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+  ;;
+
+finish)
+  $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges.  Use
+the \`--dry-run' option if you just want to see what would be executed."
+  ;;
+
+install)
+  $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command.  The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+  ;;
+
+link)
+  $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+  -all-static       do not do any dynamic linking at all
+  -avoid-version    do not add a version suffix if possible
+  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -export-symbols SYMFILE
+                   try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+                   try to export only the symbols matching REGEX
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -objectlist FILE  Use a list of object files found in FILE to specify objects
+  -precious-files-regex REGEX
+                    don't remove output files matching REGEX
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
+  -static           do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+                   specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename.  Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+  ;;
+
+uninstall)
+  $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+  ;;
+
+*)
+  $echo "$modename: invalid operation mode \`$mode'" 1>&2
+  $echo "$help" 1>&2
+  exit $EXIT_FAILURE
+  ;;
+esac
+
+$echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit $?
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries.  Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them.  This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration.  But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+disable_libs=shared
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+disable_libs=static
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/missing b/missing
new file mode 100755 (executable)
index 0000000..894e786
--- /dev/null
+++ b/missing
@@ -0,0 +1,360 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2005-06-08.21
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+#   Free Software Foundation, Inc.
+# Originally by Fran,cois 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., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, 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.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case "$1" in
+--run)
+  # Try to run requested program, and just exit if it succeeds.
+  run=
+  shift
+  "$@" && exit 0
+  # Exit code 63 means version mismatch.  This often happens
+  # when the user try to use an ancient version of a tool on
+  # a file that requires a minimum version.  In this case we
+  # we should proceed has if the program had been absent, or
+  # if --run hadn't been passed.
+  if test $? = 63; then
+    run=:
+    msg="probably too old"
+  fi
+  ;;
+
+  -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
+  --run           try to run the given command, and emulate it if it fails
+
+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
+  help2man     touch the output file
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  tar          try tar, gnutar, gtar, then tar without non-portable flags
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+    exit $?
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing $scriptversion (GNU Automake)"
+    exit $?
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+esac
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+  lex|yacc)
+    # Not GNU programs, they don't have --version.
+    ;;
+
+  tar)
+    if test -n "$run"; then
+       echo 1>&2 "ERROR: \`tar' requires --run"
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       exit 1
+    fi
+    ;;
+
+  *)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       # Could not run --version or --help.  This is probably someone
+       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # $TOOL exists and not knowing $TOOL uses missing.
+       exit 1
+    fi
+    ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+  aclocal*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  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 $msg.  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 $msg.  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 $msg.  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
+    ;;
+
+  autom4te)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.
+         You can get \`$1' as part of \`Autoconf' from any GNU
+         archive site."
+
+    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+    if test -f "$file"; then
+       touch $file
+    else
+       test -z "$file" || exec >$file
+       echo "#! /bin/sh"
+       echo "# Created by GNU Automake missing as a replacement of"
+       echo "#  $ $@"
+       echo "exit 0"
+       chmod +x $file
+       exit 1
+    fi
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' $msg.  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 $msg.  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
+    ;;
+
+  help2man)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+        you modified a dependency of a manual page.  You may need the
+        \`Help2man' package in order for those modifications to take
+        effect.  You can get \`Help2man' from any GNU archive site."
+
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+       file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+    fi
+    if [ -f "$file" ]; then
+       touch $file
+    else
+       test -z "$file" || exec >$file
+       echo ".ab help2man is required to generate this page"
+       exit 1
+    fi
+    ;;
+
+  makeinfo)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  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."
+    # The file to touch is that specified with -o ...
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+      # ... or it is the one specified with @setfilename ...
+      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+      # ... or it is derived from the source name (dir/f.texi becomes f.info)
+      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+    fi
+    # If the file does not exist, the user really needs makeinfo;
+    # let's fail without touching anything.
+    test -f $file || exit 1
+    touch $file
+    ;;
+
+  tar)
+    shift
+
+    # We have already tried tar in the generic part.
+    # Look for gnutar/gtar before invocation to avoid ugly error
+    # messages.
+    if (gnutar --version > /dev/null 2>&1); then
+       gnutar "$@" && exit 0
+    fi
+    if (gtar --version > /dev/null 2>&1); then
+       gtar "$@" && exit 0
+    fi
+    firstarg="$1"
+    if shift; then
+       case "$firstarg" in
+       *o*)
+           firstarg=`echo "$firstarg" | sed s/o//`
+           tar "$firstarg" "$@" && exit 0
+           ;;
+       esac
+       case "$firstarg" in
+       *h*)
+           firstarg=`echo "$firstarg" | sed s/h//`
+           tar "$firstarg" "$@" && exit 0
+           ;;
+       esac
+    fi
+
+    echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+         You may want to install GNU tar or Free paxutils, or check the
+         command line arguments."
+    exit 1
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+         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 prerequisites 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
+
+# Local variables:
+# 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/netware/Makefile b/netware/Makefile
new file mode 100644 (file)
index 0000000..c138dfa
--- /dev/null
@@ -0,0 +1,555 @@
+# Gnu Makefile for NetWare target
+# for use with gcc/nlmconv or Metrowerks CodeWarrior compiler
+# use with: make -f Makefile [help|all|clean|dev|devclean|dist|distclean]
+#
+# $id: $
+#
+
+DESCR  = Round Robin Database Tool $(RRD_VERSION_STR)
+COPYR  = Copyright (c) 1997-2007 by Tobias Oetiker
+WWWURL = http://www.rrdtool.org/
+MTSAFE = YES
+#SCREEN        = $(DESCR)
+STACK  = 65535
+# Comment the line below if you dont want to load protected automatically.
+#LDRING        = 3
+
+# You can set the default font used in graphs.
+# If not set here RRD defaults to DejaVuSansMono-Roman.ttf
+#RRD_DEFAULT_FONT = "sys:/java/nwgfx/lib/x11/fonts/ttf/tt0003m_.ttf"
+#RRD_DEFAULT_FONT = "VeraMono.ttf"
+
+# Vertical label angle: 90.0 (default) or 270.0
+RRDGRAPH_YLEGEND_ANGLE = 90.0
+
+# Set to one if you want to have piecharts.
+WITH_PIECHART = 0
+
+# Set the extension used for rrdcgi.
+ifndef CGIEXT
+CGIEXT = nlm
+endif
+
+# Edit the path below to point to your Novell NDK.
+ifndef NDKBASE
+NDKBASE        = c:/novell
+endif
+
+# Base for the lib sources
+ifndef LIBBASE
+LIBBASE        = ../..
+endif
+# All library code is statically linked to avoid problems with other lib NLMs.
+# Edit the path below to point to your libpng sources or set environment var.
+ifndef LIBPNG
+LIBPNG = $(LIBBASE)/libpng-1.2.16
+endif
+# Edit the path below to point to your freetype sources or set environment var.
+ifndef LIBFT2
+LIBFT2 = $(LIBBASE)/freetype-2.3.4
+endif
+# Edit the path below to point to your libart sources or set environment var.
+ifndef LIBART
+LIBART = $(LIBBASE)/libart_lgpl-2.3.17
+endif
+# Edit the path below to point to your zlib sources or set environment var.
+ifndef ZLIBSDK
+ZLIBSDK        = $(LIBBASE)/zlib-1.2.3
+endif
+
+# Edit the path below to point to your distribution folder.
+ifndef DISTDIR
+DISTDIR        = rrdtool-$(RRD_VERSION_STR)-nw
+endif
+DISTARC = $(DISTDIR).zip
+
+# Edit the path below to point to your distribution folder.
+ifndef DEVLDIR
+DEVLDIR        = rrdtool-$(RRD_VERSION_STR)-sdk-nw
+endif
+DEVLARC = $(DEVLDIR).zip
+
+# whatever...
+# NO_NULL_REALLOC = 1
+
+# Edit the var below to point to your lib architecture.
+ifndef LIBARCH
+# LIBARCH = CLIB
+LIBARCH = LIBC
+endif
+
+# The following line defines your compiler.
+ifdef METROWERKS
+       CC = mwccnlm
+else
+       CC = gcc
+endif
+# RM   = rm -f
+CP     = cp -afv
+# if you want to mark the target as MTSAFE you will need a tool for
+# generating the xdc data for the linker; here's a minimal tool:
+# http://www.gknw.net/development/prgtools/mkxdc.zip
+MPKXDC = mkxdc
+# CodeWarrior is too stupid to set the internal name properly when
+# the extension is not a NLM and not a registered type. So we need
+# to fix that after linking (since CGI isnt a known type - argh!):
+# http://www.gknw.net/development/prgtools/fixnlmname.zip
+FIXNLMN        = fixnlmname #-q
+# Here you can find a native Win32 binary of the original awk:
+# http://www.gknw.net/development/prgtools/awk.zip
+AWK    = awk
+ZIP    = zip -qzr9
+MV     = mv -fv
+
+# must be equal to DEBUG or NDEBUG
+DB     = NDEBUG
+# DB   = DEBUG
+# Optimization: -O<n> or debugging: -g
+ifeq ($(DB),NDEBUG)
+       OPT     = -O2
+       OBJDIR  = release
+else
+       OPT     = -g
+       OBJDIR  = debug
+endif
+
+# Project root
+PROOT  = ..
+
+# Include the version info retrieved from source.
+-include $(OBJDIR)/version.inc
+
+# Global flags for all compilers
+CFLAGS = $(OPT) -D$(DB) -nostdinc -DNETWARE -DN_PLAT_NLM -D_POSIX_SOURCE
+CFLAGS += -DHAVE_CONFIG_H
+
+ifeq ($(CC),mwccnlm)
+LD     = mwldnlm
+LDFLAGS        = -nostdlib $^ $(PRELUDE) $(LDLIBS) -o $@ -commandfile
+AR     = $(LD)
+ARFLAGS        = -nostdlib -type library -o
+LIBEXT = lib
+#RANLIB        =
+CFLAGS += -gccinc -inline off -opt nointrinsics -proc 586
+CFLAGS += -relax_pointers
+#CFLAGS        += -w on,nounused,nounusedexpr # -ansi strict
+ifeq ($(LIBARCH),LIBC)
+       PRELUDE = $(SDK_LIBC)/imports/libcpre.o
+       CFLAGS += -align 4
+else
+       PRELUDE = "$(METROWERKS)/Novell Support/libraries/runtime/prelude.obj"
+       CFLAGS += -include "$(METROWERKS)/Novell Support/headers/nlm_prefix.h"
+       CFLAGS += -align 1
+endif
+else
+LD     = nlmconv
+LDFLAGS        = -T
+AR     = ar
+ARFLAGS        = -cq
+LIBEXT = a
+RANLIB = ranlib
+CFLAGS += -fno-builtin -fpcc-struct-return -fno-strict-aliasing
+CFLAGS += -Wall -Wno-unused # -pedantic
+ifeq ($(LIBARCH),LIBC)
+       PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o
+else
+       PRELUDE = $(NDK_ROOT)/pre/prelude.o
+       CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
+endif
+endif
+
+ifeq ($(findstring linux,$(OSTYPE)),linux)
+#include $(NDKBASE)/nlmconv/ncpfs.inc
+DL     = '
+DS     = /
+else
+DS     = \\
+endif
+
+ifeq ($(MTSAFE),YES)
+       XDCOPT = -n
+endif
+ifeq ($(MTSAFE),NO)
+       XDCOPT = -u
+endif
+ifndef DESCR
+       DESCR = $(notdir $(@:.def=)) Command Extension
+endif
+DESCR += ($(LIBARCH)) - $(CC) build
+
+NDK_ROOT = $(NDKBASE)/ndk
+SDK_CLIB = $(NDK_ROOT)/nwsdk
+SDK_LIBC = $(NDK_ROOT)/libc
+
+INCLUDES += -I$(PROOT) -I$(PROOT)/src -I$(LIBPNG) -I$(LIBFT2)/include -I$(LIBART) -I$(ZLIBSDK)
+
+ifeq ($(LIBARCH),LIBC)
+       INCLUDES += -I$(SDK_LIBC)/include -I$(SDK_LIBC)/include/nks
+else
+       INCLUDES += -I$(SDK_CLIB)/include/nlm -I$(SDK_CLIB)/include
+endif
+
+CFLAGS += $(INCLUDES)
+
+vpath %.c $(PROOT)/src $(LIBPNG) $(LIBART)/libart_lgpl $(ZLIBSDK)
+
+RRDLIBOBJS     = \
+       $(OBJDIR)/rrd_afm.o \
+       $(OBJDIR)/rrd_afm_data.o \
+       $(OBJDIR)/rrd_create.o \
+       $(OBJDIR)/rrd_diff.o \
+       $(OBJDIR)/rrd_dump.o \
+       $(OBJDIR)/rrd_error.o \
+       $(OBJDIR)/rrd_fetch.o \
+       $(OBJDIR)/rrd_first.o \
+       $(OBJDIR)/rrd_format.o \
+       $(OBJDIR)/rrd_gfx.o \
+       $(OBJDIR)/rrd_graph.o \
+       $(OBJDIR)/rrd_graph_helper.o \
+       $(OBJDIR)/rrd_hw.o \
+       $(OBJDIR)/rrd_info.o \
+       $(OBJDIR)/rrd_last.o \
+       $(OBJDIR)/rrd_lastupdate.o \
+       $(OBJDIR)/rrd_nan_inf.o \
+       $(OBJDIR)/rrd_open.o \
+       $(OBJDIR)/rrd_resize.o \
+       $(OBJDIR)/rrd_restore.o \
+       $(OBJDIR)/rrd_rpncalc.o \
+       $(OBJDIR)/rrd_tune.o \
+       $(OBJDIR)/rrd_update.o \
+       $(OBJDIR)/rrd_version.o \
+       $(OBJDIR)/rrd_xport.o \
+       $(OBJDIR)/rrd_thread_safe.o \
+       $(EOLIST)
+
+XLIBOBJS       = \
+       $(OBJDIR)/rrd_getopt.o \
+       $(OBJDIR)/rrd_getopt1.o \
+       $(OBJDIR)/art_rgba_svp.o \
+       $(OBJDIR)/hash_32.o \
+       $(OBJDIR)/parsetime.o \
+       $(OBJDIR)/pngsize.o \
+       $(EOLIST)
+
+PNGLIBOBJS     = \
+       $(OBJDIR)/png.o \
+       $(OBJDIR)/pngerror.o \
+       $(OBJDIR)/pngget.o \
+       $(OBJDIR)/pngmem.o \
+       $(OBJDIR)/pngpread.o \
+       $(OBJDIR)/pngread.o \
+       $(OBJDIR)/pngrio.o \
+       $(OBJDIR)/pngrtran.o \
+       $(OBJDIR)/pngrutil.o \
+       $(OBJDIR)/pngset.o \
+       $(OBJDIR)/pngtrans.o \
+       $(OBJDIR)/pngwio.o \
+       $(OBJDIR)/pngwrite.o \
+       $(OBJDIR)/pngwtran.o \
+       $(OBJDIR)/pngwutil.o \
+       $(EOLIST)
+ifeq "$(wildcard $(LIBPNG)/pnggccrd.c)" "$(LIBPNG)/pnggccrd.c"
+PNGLIBOBJS     += \
+       $(OBJDIR)/pnggccrd.o \
+       $(OBJDIR)/pngvcrd.o \
+       $(EOLIST)
+endif
+
+ZLIBOBJS       = \
+       $(OBJDIR)/adler32.o \
+       $(OBJDIR)/compress.o \
+       $(OBJDIR)/crc32.o \
+       $(OBJDIR)/deflate.o \
+       $(OBJDIR)/inflate.o \
+       $(OBJDIR)/inffast.o \
+       $(OBJDIR)/inftrees.o \
+       $(OBJDIR)/trees.o \
+       $(OBJDIR)/zutil.o \
+       $(EOLIST)
+ifeq "$(wildcard $(ZLIBSDK)/infblock.c)" "$(ZLIBSDK)/infblock.c"
+ZLIBOBJS       += \
+       $(OBJDIR)/infblock.o \
+       $(OBJDIR)/infcodes.o \
+       $(OBJDIR)/infutil.o \
+       $(EOLIST)
+endif
+
+ARTLIBOBJS     = \
+       $(patsubst $(LIBART)/libart_lgpl/%.c,$(OBJDIR)/%.o,$(wildcard $(LIBART)/libart_lgpl/art_*.c))
+
+OBJS   := $(RRDLIBOBJS) $(XLIBOBJS) $(PNGLIBOBJS) $(ARTLIBOBJS) $(ZLIBOBJS)
+OBJCGI := $(OBJS) $(OBJDIR)/rrd_cgi.o
+OBJTOOL        := $(OBJS) $(OBJDIR)/rrd_tool.o
+
+LDLIBS += $(LIBFT2)/builds/netware/libc/libft2.$(LIBEXT)
+
+
+all: rrdtool rrdcgi
+
+rrdtool: $(OBJDIR) $(PROOT)/rrd_config.h $(OBJDIR)/rrdtool.nlm
+rrdcgi: $(OBJDIR) $(PROOT)/rrd_config.h $(OBJDIR)/rrdcgi.$(CGIEXT)
+librrd: $(OBJDIR) $(PROOT)/rrd_config.h $(OBJDIR)/librrd.$(LIBEXT)
+
+FORCE: ;
+
+dist: all $(DISTDIR) $(DISTDIR)/readme.txt
+       @-$(CP) $(OBJDIR)/rrdcgi.$(CGIEXT) $(DISTDIR)
+       @-$(CP) $(OBJDIR)/rrdtool.nlm $(DISTDIR)
+       @-$(CP) $(PROOT)/src/*.ttf $(DISTDIR)
+       @-$(CP) $(PROOT)/CHANGES $(DISTDIR)
+       @-$(CP) $(PROOT)/COPYING $(DISTDIR)
+       @-$(CP) $(PROOT)/COPYRIGHT $(DISTDIR)
+       @-$(CP) $(PROOT)/NEWS $(DISTDIR)
+       @-$(CP) $(PROOT)/README $(DISTDIR)
+       @echo Creating $(DISTARC)
+       @$(ZIP) $(DISTARC) $(DISTDIR)/* < $(DISTDIR)/readme.txt
+
+dev: librrd $(DEVLDIR) $(DEVLDIR)/readme.txt
+       @-mkdir $(DEVLDIR)$(DS)include
+       @-mkdir $(DEVLDIR)$(DS)lib
+       @-mkdir $(DEVLDIR)$(DS)src
+       @-$(CP) $(OBJDIR)/librrd.$(LIBEXT) $(DEVLDIR)/lib
+       @-$(CP) $(PROOT)/rrd_config.h $(DEVLDIR)/include
+       @-$(CP) $(PROOT)/src/rrd.h $(DEVLDIR)/include
+       @-$(CP) $(PROOT)/src/*.ttf $(DEVLDIR)/src
+       @-$(CP) $(PROOT)/CHANGES $(DEVLDIR)
+       @-$(CP) $(PROOT)/COPYING $(DEVLDIR)
+       @-$(CP) $(PROOT)/COPYRIGHT $(DEVLDIR)
+       @-$(CP) $(PROOT)/NEWS $(DEVLDIR)
+       @-$(CP) $(PROOT)/README $(DEVLDIR)
+       @echo Creating $(DEVLARC)
+       @$(ZIP) $(DEVLARC) $(DEVLDIR)/* < $(DEVLDIR)/readme.txt
+
+clean:
+       -$(RM) -r $(OBJDIR)
+       -$(RM) $(PROOT)/rrd_config.h
+
+distclean: clean
+       -$(RM) -r $(DISTDIR)
+       -$(RM) $(DISTARC)
+
+devclean: clean
+       -$(RM) -r $(DEVLDIR)
+       -$(RM) $(DEVLARC)
+
+$(OBJDIR):
+       @mkdir $@
+
+$(DISTDIR):
+       @mkdir $@
+
+$(DEVLDIR):
+       @mkdir $@
+
+$(OBJDIR)/version.inc: $(PROOT)/configure.ac $(OBJDIR) $(PROOT)/src/get_ver.awk
+       @echo Creating $@
+       @$(AWK) -f $(PROOT)/src/get_ver.awk $< > $@
+
+$(OBJDIR)/%.o: %.c
+       @echo Compiling $<
+       @$(CC) $(CFLAGS) -c $< -o $@
+
+$(OBJDIR)/rrdcgi.$(CGIEXT): $(OBJCGI) $(OBJDIR)/rrdcgi.def $(OBJDIR)/rrdcgi.xdc
+       @echo Linking $@
+       @-$(RM) $@
+       @$(LD) $(LDFLAGS) $(@:.$(CGIEXT)=.def)
+ifeq ($(LD),nlmconv)
+       @$(MV) $(notdir $@) $@
+endif
+ifneq ($(CGIEXT),nlm)
+ifeq ($(LD),mwldnlm)
+       @$(FIXNLMN) $@
+endif
+endif
+
+$(OBJDIR)/rrdtool.nlm: $(OBJTOOL) $(OBJDIR)/rrdtool.def $(OBJDIR)/rrdtool.xdc
+       @echo Linking $@
+       @-$(RM) $@
+       @$(LD) $(LDFLAGS) $(@:.nlm=.def)
+ifeq ($(LD),nlmconv)
+       @$(MV) $(notdir $@) $@
+endif
+
+$(OBJDIR)/librrd.$(LIBEXT): $(OBJS)
+       @echo Creating $@
+       @-$(RM) $@
+       @$(AR) $(ARFLAGS) $@ $^
+ifdef RANLIB
+       @$(RANLIB) $@
+endif
+
+$(OBJDIR)/%.xdc: Makefile
+       @echo Creating $@
+       @$(MPKXDC) $(XDCOPT) $@
+
+$(OBJDIR)/%.def: Makefile $(OBJDIR)/version.inc
+       @echo $(DL)# DEF Linker File for use with gcc and nlmconv$(DL) > $@
+       @echo $(DL)# or with Codewarrior command line compiler.$(DL) >> $@
+       @echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@
+       @echo $(DL)# All your changes will be lost!!$(DL) >> $@
+       @echo $(DL)#$(DL) >> $@
+       @echo $(DL)copyright "$(COPYR)"$(DL) >> $@
+       @echo $(DL)description "$(DESCR)"$(DL) >> $@
+       @echo $(DL)version $(RRD_VERSION)$(DL) >> $@
+ifdef NLMTYPE
+       @echo $(DL)type $(NLMTYPE)$(DL) >> $@
+else
+       @echo $(DL)type 0$(DL) >> $@
+endif
+ifdef STACK
+       @echo $(DL)stack $(STACK)$(DL) >> $@
+endif
+       @echo $(DL)threadname "$(notdir $(@:.def=))"$(DL) >> $@
+ifdef SCREEN
+       @echo $(DL)screenname "$(SCREEN)"$(DL) >> $@
+else
+       @echo $(DL)screenname "DEFAULT"$(DL) >> $@
+endif
+ifeq ($(DB),DEBUG)
+       @echo $(DL)debug$(DL) >> $@
+endif
+ifeq ($(LIBARCH),CLIB)
+       @echo $(DL)start _Prelude$(DL) >> $@
+       @echo $(DL)exit _Stop$(DL) >> $@
+       @echo $(DL)import @$(NDK_ROOT)/nwsdk/imports/clib.imp$(DL) >> $@
+       @echo $(DL)import @$(NDK_ROOT)/nwsdk/imports/threads.imp$(DL) >> $@
+       @echo $(DL)import @$(NDK_ROOT)/nwsdk/imports/nlmlib.imp$(DL) >> $@
+       @echo $(DL)module clib$(DL) >> $@
+else
+       @echo $(DL)start _LibCPrelude$(DL) >> $@
+       @echo $(DL)exit _LibCPostlude$(DL) >> $@
+       @echo $(DL)check _LibCCheckUnload$(DL) >> $@
+       @echo $(DL)import @$(NDK_ROOT)/libc/imports/libc.imp$(DL) >> $@
+       @echo $(DL)import @$(NDK_ROOT)/libc/imports/netware.imp$(DL) >> $@
+       @echo $(DL)module libc$(DL) >> $@
+       @echo $(DL)pseudopreemption$(DL) >> $@
+       @echo $(DL)flag_on 64$(DL) >> $@
+endif
+ifeq ($(LDRING),0)
+       @echo $(DL)flag_on 16$(DL) >> $@
+endif
+ifeq ($(LDRING),3)
+       @echo $(DL)flag_on 512$(DL) >> $@
+endif
+ifdef XDCOPT
+       @echo $(DL)xdcdata $(@:.def=.xdc)$(DL) >> $@
+endif
+ifeq ($(LD),nlmconv)
+       @echo $(DL)input $(OBJS) $(LDLIBS)$(DL) >> $@
+       @echo $(DL)input $(PRELUDE)$(DL) >> $@
+       @echo $(DL)output $(notdir $(@:.def=.nlm))$(DL) >> $@
+endif
+
+$(PROOT)/rrd_config.h: FORCE Makefile $(OBJDIR)/version.inc
+       @echo Creating $@
+       @echo $(DL)/* $(notdir $@) for NetWare target.$(DL) > $@
+       @echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@
+       @echo $(DL)** All your changes will be lost!!$(DL) >> $@
+       @echo $(DL)*/$(DL) >> $@
+       @echo $(DL)#ifndef NETWARE$(DL) >> $@
+       @echo $(DL)#error This $(notdir $@) is created for NetWare platform!$(DL) >> $@
+       @echo $(DL)#endif$(DL) >> $@
+       @echo $(DL)#ifndef RRD_CONFIG_H$(DL) >> $@
+       @echo $(DL)#define RRD_CONFIG_H$(DL) >> $@
+       @echo $(DL)#define OS "i586-pc-NetWare"$(DL) >> $@
+       @echo $(DL)#define PACKAGE_VERSION "$(RRD_VERSION_STR)"$(DL) >> $@
+       @echo $(DL)#define PACKAGE_BUGREPORT "tobi@oetiker.ch"$(DL) >> $@
+       @echo $(DL)#define NUMVERS $(RRD_NUMVERS)$(DL) >> $@
+       @echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
+       @echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_ERRNO_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@
+       @echo $(DL)#define HAVE_FLOAT_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
+       @echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
+       @echo $(DL)#define HAVE_LOCALE_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_MATH_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_MBSTOWCS 1$(DL) >> $@
+       @echo $(DL)#define HAVE_MEMMOVE 1$(DL) >> $@
+       @echo $(DL)#define HAVE_MKTIME 1$(DL) >> $@
+       @echo $(DL)#define HAVE_SELECT 1$(DL) >> $@
+       @echo $(DL)#define HAVE_SETLOCALE 1$(DL) >> $@
+       @echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_SNPRINTF 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STDARG_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STDDEF_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@
+       @echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_SYS_TYPES_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_TZSET 1$(DL) >> $@
+       @echo $(DL)#define HAVE_UNAME 1$(DL) >> $@
+       @echo $(DL)#define HAVE_VSNPRINTF 1$(DL) >> $@
+       @echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
+       @echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
+       @echo $(DL)#define HAVE_ZLIB_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_LIBZ 1$(DL) >> $@
+ifdef NO_NULL_REALLOC
+       @echo $(DL)#define NO_NULL_REALLOC 1$(DL) >> $@
+       @echo $(DL)#define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) ))$(DL) >> $@
+else
+       @echo $(DL)#define rrd_realloc(a,b) realloc((a), (b))$(DL) >> $@
+endif
+ifdef RRD_DEFAULT_FONT
+       @echo $(DL)#define RRD_DEFAULT_FONT $(RRD_DEFAULT_FONT)$(DL) >> $@
+endif
+       @echo $(DL)#define RRDGRAPH_YLEGEND_ANGLE $(RRDGRAPH_YLEGEND_ANGLE)$(DL) >> $@
+ifdef WITH_PIECHART
+       @echo $(DL)#define WITH_PIECHART $(WITH_PIECHART)$(DL) >> $@
+endif
+       @echo $(DL)#endif /* RRD_CONFIG_H */$(DL) >> $@
+
+$(DISTDIR)/readme.txt: Makefile
+       @echo Creating $@
+       @echo $(DL)This is a binary distribution for NetWare platform.$(DL) > $@
+       @echo $(DL)RRDTool version $(RRD_VERSION_STR)$(DL) >> $@
+       @echo $(DL)Please download the complete RRDTool package for$(DL) >> $@
+       @echo $(DL)any further documentation:$(DL) >> $@
+       @echo $(DL)$(WWWURL)$(DL) >> $@
+
+$(DEVLDIR)/readme.txt: Makefile
+       @echo Creating $@
+       @echo $(DL)This is a development distribution for NetWare platform.$(DL) > $@
+       @echo $(DL)RRDTool version $(RRD_VERSION_STR)$(DL) >> $@
+       @echo $(DL)Please download the complete RRDTool package for$(DL) >> $@
+       @echo $(DL)any further documentation:$(DL) >> $@
+       @echo $(DL)$(WWWURL)$(DL) >> $@
+
+help:
+       @echo $(DL)===========================================================$(DL)
+       @echo $(DL)Novell NDK Base = $(NDKBASE)$(DL)
+       @echo $(DL)libpng Source   = $(LIBPNG)$(DL)
+       @echo $(DL)libart Source   = $(LIBART)$(DL)
+       @echo $(DL)Freetype 2 SDK  = $(LIBFT2)$(DL)
+       @echo $(DL)Zlib SDK        = $(ZLIBSDK)$(DL)
+       @echo $(DL)===========================================================$(DL)
+       @echo $(DL)RRDTool $(RRD_VERSION_STR) - available targets are:$(DL)
+       @echo $(DL)$(MAKE) all$(DL)
+       @echo $(DL)$(MAKE) rrdtool$(DL)
+       @echo $(DL)$(MAKE) rrdcgi$(DL)
+       @echo $(DL)$(MAKE) librrd$(DL)
+       @echo $(DL)$(MAKE) clean$(DL)
+       @echo $(DL)$(MAKE) dev$(DL)
+       @echo $(DL)$(MAKE) devclean$(DL)
+       @echo $(DL)$(MAKE) dist$(DL)
+       @echo $(DL)$(MAKE) distclean$(DL)
+       @echo $(DL)===========================================================$(DL)
+
+
diff --git a/rrd_config.h.in b/rrd_config.h.in
new file mode 100644 (file)
index 0000000..9190c62
--- /dev/null
@@ -0,0 +1,355 @@
+/* rrd_config.h.in.  Generated from configure.ac by autoheader.  */
+
+
+
+#ifndef RRD_CONFIG_H
+#define RRD_CONFIG_H
+/* IEEE can be prevented from raising signals with fpsetmask(0) */
+#undef MUST_DISABLE_FPMASK
+
+/* IEEE math only works if SIGFPE gets actively set to IGNORE */
+
+#undef MUST_DISABLE_SIGFPE
+
+/* realloc does not support NULL as argument */
+#undef NO_NULL_REALLOC
+
+
+/* Define to 1 if you have the `chdir' function. */
+#undef HAVE_CHDIR
+
+/* Define to 1 if you have the `chroot' function. */
+#undef HAVE_CHROOT
+
+/* Define to 1 if you have the `class' function. */
+#undef HAVE_CLASS
+
+/* Define to 1 if you have the declaration of `fdatasync', and to 0 if you
+   don't. */
+#undef HAVE_DECL_FDATASYNC
+
+/* Define to 1 if you have the declaration of `madvise', and to 0 if you
+   don't. */
+#undef HAVE_DECL_MADVISE
+
+/* Define to 1 if you have the declaration of `posix_fadvise', and to 0 if you
+   don't. */
+#undef HAVE_DECL_POSIX_FADVISE
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+   */
+#undef HAVE_DIRENT_H
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#undef HAVE_DOPRNT
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `finite' function. */
+#undef HAVE_FINITE
+
+/* Define to 1 if you have the <float.h> header file. */
+#undef HAVE_FLOAT_H
+
+/* Define to 1 if you have the `fpclass' function. */
+#undef HAVE_FPCLASS
+
+/* Define to 1 if you have the `fpclassify' function. */
+#undef HAVE_FPCLASSIFY
+
+/* Define to 1 if you have the `fp_class' function. */
+#undef HAVE_FP_CLASS
+
+/* Define to 1 if you have the <fp_class.h> header file. */
+#undef HAVE_FP_CLASS_H
+
+/* Define to 1 if you have the `getpagesize' function. */
+#undef HAVE_GETPAGESIZE
+
+/* Define to 1 if you have the `getrusage' function. */
+#undef HAVE_GETRUSAGE
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define to 1 if you have the `getuid' function. */
+#undef HAVE_GETUID
+
+/* Define to 1 if you have the <ieeefp.h> header file. */
+#undef HAVE_IEEEFP_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `isfinite' function. */
+#undef HAVE_ISFINITE
+
+/* Define to 1 if you have the `isinf' function. */
+#undef HAVE_ISINF
+
+/* Define to 1 if you have the `isnan' function. */
+#undef HAVE_ISNAN
+
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
+/* Define to 1 if you have the <locale.h> header file. */
+#undef HAVE_LOCALE_H
+
+/* Define to 1 if you have the `madvise' function. */
+#undef HAVE_MADVISE
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
+
+/* Define to 1 if you have the <math.h> header file. */
+#undef HAVE_MATH_H
+
+/* Define to 1 if you have the `mbstowcs' function. */
+#undef HAVE_MBSTOWCS
+
+/* Define to 1 if you have the `memmove' function. */
+#undef HAVE_MEMMOVE
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `mktime' function. */
+#undef HAVE_MKTIME
+
+/* Define to 1 if you have a working `mmap' system call. */
+#undef HAVE_MMAP
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+#undef HAVE_NDIR_H
+
+/* Define to 1 if you have the `opendir' function. */
+#undef HAVE_OPENDIR
+
+/* Define to 1 if you have the `posix_fadvise' function. */
+#undef HAVE_POSIX_FADVISE
+
+/* Define if you have POSIX threads libraries and header files. */
+#undef HAVE_PTHREAD
+
+/* Define to 1 if you have the `readdir' function. */
+#undef HAVE_READDIR
+
+/* Define to 1 if you have the `setlocale' function. */
+#undef HAVE_SETLOCALE
+
+/* Define to 1 if you have the `snprintf' function. */
+#undef HAVE_SNPRINTF
+
+/* 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 `strchr' function. */
+#undef HAVE_STRCHR
+
+/* Define to 1 if you have the `strerror' function. */
+#undef HAVE_STRERROR
+
+/* Define to 1 if you have the `strerror_r' function. */
+#undef HAVE_STRERROR_R
+
+/* Define to 1 if you have the `strftime' function. */
+#undef HAVE_STRFTIME
+
+/* 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 to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+   */
+#undef HAVE_SYS_DIR_H
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+   */
+#undef HAVE_SYS_NDIR_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/resource.h> header file. */
+#undef HAVE_SYS_RESOURCE_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/times.h> header file. */
+#undef HAVE_SYS_TIMES_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 `tzset' function. */
+#undef HAVE_TZSET
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `vprintf' function. */
+#undef HAVE_VPRINTF
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#undef HAVE_VSNPRINTF
+
+/* 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 to necessary symbol if this constant uses a non-standard name on
+   your system. */
+#undef PTHREAD_CREATE_JOINABLE
+
+/* Vertical label angle: 90.0 (default) or 270.0 */
+#undef RRDGRAPH_YLEGEND_ANGLE
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+#undef TM_IN_SYS_TIME
+
+/* Version number of package */
+#undef VERSION
+
+/* Define to 1 if your processor stores words with the most significant byte
+   first (like Motorola and SPARC, unlike Intel and VAX). */
+#undef WORDS_BIGENDIAN
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+
+/* enable posix_fadvise on linux */
+#if defined(HAVE_POSIX_FADVISE) && defined(HAVE_FCNTL_H)
+#define _XOPEN_SOURCE 600
+#include <fcntl.h>
+#endif
+
+/* define strrchr, strchr and memcpy, memmove in terms of bsd funcs
+   make sure you are NOT using bcopy, index or rindex in the code */
+      
+#ifdef STDC_HEADERS
+# include <string.h>
+#else
+# ifndef HAVE_STRCHR
+#  define strchr index
+#  define strrchr rindex
+# endif
+char *strchr (), *strrchr ();
+# ifndef HAVE_MEMMOVE
+#  define memcpy(d, s, n) bcopy ((s), (d), (n))
+#  define memmove(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
+
+#ifdef NO_NULL_REALLOC
+# define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) ))
+#else
+# define rrd_realloc(a,b) realloc((a), (b))
+#endif
+
+#ifdef NEED_MALLOC_MALLOC_H
+#  include <malloc/malloc.h>
+#endif
+
+#ifdef HAVE_MATH_H
+#  include <math.h>
+#endif
+
+#ifdef HAVE_FLOAT_H
+#  include <float.h>
+#endif
+
+#ifdef HAVE_IEEEFP_H
+#  include <ieeefp.h>
+#endif
+
+#ifdef HAVE_FP_CLASS_H
+#  include <fp_class.h>
+#endif
+
+/* for Solaris */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF)
+#endif
+
+/* solaris 10 it defines isnan such that only forte can compile it ... bad bad  */
+#if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS))
+#  undef isnan
+#  define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN)
+#endif
+
+/* for OSF1 Digital Unix */
+#if (! defined(HAVE_ISINF) && defined(HAVE_FP_CLASS) && defined(HAVE_FP_CLASS_H))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fp_class(a) == FP_NEG_INF || fp_class(a) == FP_POS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_PLUS_INF) && defined(FP_MINUS_INF))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_MINUS_INF || fpclassify(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_INFINITE))
+#  define HAVE_ISINF 1
+#  define isinf(a) (fpclassify(a) == FP_INFINITE)
+#endif
+
+/* for AIX */
+#if (! defined(HAVE_ISINF) && defined(HAVE_CLASS))
+#  define HAVE_ISINF 1
+#  define isinf(a) (class(a) == FP_MINUS_INF || class(a) == FP_PLUS_INF)
+#endif
+
+#if (! defined (HAVE_FINITE) && defined (HAVE_ISFINITE))
+#  define HAVE_FINITE 1
+#  define finite(a) isfinite(a)
+#endif
+
+#if (! defined(HAVE_FINITE) && defined(HAVE_ISNAN) && defined(HAVE_ISINF))
+#  define HAVE_FINITE 1
+#  define finite(a) (! isnan(a) && ! isinf(a))
+#endif
+
+#ifndef HAVE_FINITE
+#error "Can't compile without finite function"
+#endif
+
+#ifndef HAVE_ISINF
+#error "Can't compile without isinf function"
+#endif
+
+#endif /* RRD_CONFIG_H */
+
diff --git a/rrdtool.spec b/rrdtool.spec
new file mode 100644 (file)
index 0000000..7d169c6
--- /dev/null
@@ -0,0 +1,481 @@
+%define with_python %{?_without_python: 0} %{?!_without_python: 1}
+%define with_php %{?_without_php: 0} %{?!_without_php: 1}
+%define with_tcl %{?_without_tcl: 0} %{?!_without_tcl: 1}
+%define with_ruby %{?_without_ruby: 0} %{?!_without_ruby: 1}
+%define php_rrd_svn 839
+%define php_extdir %(php-config --extension-dir 2>/dev/null || echo %{_libdir}/php4)
+
+Summary: Round Robin Database Tool to store and display time-series data
+Name: rrdtool
+Version: 1.2.26
+Release: 5%{?dist}
+License: GPL
+Group: Applications/Databases
+URL: http://oss.oetiker.ch/rrdtool/
+Source0: http://oss.oetiker.ch/%{name}/pub/%{name}-%{version}.tar.gz
+Source1: php4-svn%{php_rrd_svn}.tar.gz
+Patch0: rrdtool-1.2.13-php.patch
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires: gcc-c++, openssl-devel, freetype-devel
+BuildRequires: libpng-devel, zlib-devel, libart_lgpl-devel >= 2.0
+%if "%{?fedora}" >= "7"
+BuildRequires: perl-devel
+%endif
+
+%description
+RRD is the Acronym for Round Robin Database. RRD is a system to store and
+display time-series data (i.e. network bandwidth, machine-room temperature,
+server load average). It stores the data in a very compact way that will not
+expand over time, and it presents useful graphs by processing the data to
+enforce a certain data density. It can be used either via simple wrapper
+scripts (from shell or Perl) or via frontends that poll network devices and
+put a friendly user interface on it.
+
+%package devel
+Summary: RRDtool libraries and header files
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+RRD is the Acronym for Round Robin Database. RRD is a system to store and
+display time-series data (i.e. network bandwidth, machine-room temperature,
+server load average). This package allow you to use directly this library.
+
+%package doc
+Summary: RRDtool documentation
+Group: Documentation
+
+%description doc
+RRD is the Acronym for Round Robin Database. RRD is a system to store and
+display time-series data (i.e. network bandwidth, machine-room temperature,
+server load average). This package contains documentation on using RRD.
+
+%package perl
+Summary: Perl RRDtool bindings
+Group: Development/Languages
+Requires: %{name} = %{version}-%{release}
+Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
+Obsoletes: perl-%{name} < %{version}-%{release}
+Provides: perl-%{name} = %{version}-%{release}
+
+%description perl
+The Perl RRDtool bindings
+
+%if %{with_python}
+%{!?python_sitearch: %define python_sitearch %(%{__python} -c 'from distutils import sysconfig; print sysconfig.get_python_lib(1)')}
+# eval to 2.3 if python isn't yet present, workaround for no python in fc4 minimal buildroot
+%{!?python_version: %define python_version %(%{__python} -c 'import sys; print sys.version.split(" ")[0]' || echo "2.3")}
+
+%package python
+Summary: Python RRDtool bindings
+Group: Development/Languages
+BuildRequires: python-devel >= 2.3
+Requires: python >= %{python_version}
+Requires: %{name} = %{version}-%{release}
+Obsoletes: python-%{name} < %{version}-%{release}
+Provides: python-%{name} = %{version}-%{release}
+
+%description python
+Python RRDtool bindings.
+%endif
+
+%ifarch ppc64
+# php bits busted on ppc64 at the moment
+%define with_php 0
+%endif
+
+%if %{with_php}
+%package php
+Summary: PHP RRDtool bindings
+Group: Development/Languages
+BuildRequires: php-devel >= 4.0
+Requires: php >= 4.0
+Requires: %{name} = %{version}-%{release}
+Obsoletes: php-%{name} < %{version}-%{release}
+Provides: php-%{name} = %{version}-%{release}
+
+%description php
+The %{name}-php package includes a dynamic shared object (DSO) that adds
+RRDtool bindings to the PHP HTML-embedded scripting language.
+%endif
+
+%if %{with_tcl}
+%package tcl
+Summary: Tcl RRDtool bindings
+Group: Development/Languages
+BuildRequires: tcl-devel >= 8.0
+Requires: tcl >= 8.0
+Requires: %{name} = %{version}-%{release}
+Obsoletes: tcl-%{name} < %{version}-%{release}
+Provides: tcl-%{name} = %{version}-%{release}
+
+%description tcl
+The %{name}-tcl package includes RRDtool bindings for Tcl.
+%endif
+
+%if %{with_ruby}
+%{!?ruby_sitearch: %define ruby_sitearch %(ruby -rrbconfig -e 'puts Config::CONFIG["sitearchdir"]')}
+
+%package ruby
+Summary: Ruby RRDtool bindings
+Group: Development/Languages
+BuildRequires: ruby, ruby-devel
+Requires: ruby(abi) = 1.8
+Requires: %{name} = %{version}-%{release}
+
+%description ruby
+The %{name}-ruby package includes RRDtool bindings for Ruby.
+%endif
+
+%prep
+%setup -q
+%setup -q -T -D -a 1
+# Patch based on http://oss.oetiker.ch/rrdtool/pub/contrib/php_rrdtool.tgz
+%if %{with_php}
+%patch0 -p0 -b .php
+%{__perl} -pi -e 's|../config.h|../rrd_config.h|g' php4/rrdtool.c
+%endif
+
+# Fix to find correct python dir on lib64
+%{__perl} -pi -e 's|get_python_lib\(0,0,prefix|get_python_lib\(1,0,prefix|g' \
+    configure
+
+# Most edits shouldn't be necessary when using --libdir, but
+# w/o, some introduce hardcoded rpaths where they shouldn't,
+%{__perl} -pi.orig -e 's|/lib\b|/%{_lib}|g' \
+    configure Makefile.in php4/configure php4/ltconfig*
+
+%build
+%configure \
+    --with-perl-options='INSTALLDIRS="vendor"' \
+%if %{with_tcl}
+    --enable-tcl-site \
+    --with-tcllib=%{_libdir} \
+%else
+    --disable-tcl \
+%endif
+%if %{with_python}
+    --enable-python \
+%else
+    --disable-python \
+%endif
+%if %{with_ruby}
+    --enable-ruby \
+%endif
+    --disable-static \
+    --with-pic
+
+# Fix another rpath issue
+%{__perl} -pi.orig -e 's|-Wl,--rpath -Wl,\$rp||g' \
+    bindings/perl-shared/Makefile.PL
+
+# Force RRDp bits where we want 'em, not sure yet why the
+# --with-perl-options and --libdir don't take
+pushd bindings/perl-piped/
+%{__perl} Makefile.PL INSTALLDIRS=vendor
+%{__perl} -pi.orig -e 's|/lib/perl|/%{_lib}/perl|g' Makefile
+popd
+
+%{__make} %{?_smp_mflags}
+
+# Build the php module, the tmp install is required
+%if %{with_php}
+%define rrdtmp %{_tmppath}/%{name}-%{version}-tmpinstall
+%{__make} install DESTDIR="%{rrdtmp}"
+pushd php4/
+%configure \
+    --with-rrdtool="%{rrdtmp}%{_prefix}" \
+    --disable-static
+%{__make} %{?_smp_mflags}
+popd
+%{__rm} -rf %{rrdtmp}
+%endif
+
+# Fix @perl@ and @PERL@
+find examples/ -type f \
+    -exec %{__perl} -pi -e 's|^#! \@perl\@|#!%{__perl}|gi' {} \;
+find examples/ -name "*.pl" \
+    -exec %{__perl} -pi -e 's|\015||gi' {} \;
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make DESTDIR="$RPM_BUILD_ROOT" install
+
+# Install the php module
+%if %{with_php}
+%{__install} -D -m0755 php4/modules/rrdtool.so \
+    %{buildroot}%{php_extdir}/rrdtool.so
+# Clean up the examples for inclusion as docs
+%{__rm} -rf php4/examples/.svn
+# Put the php config bit into place
+%{__mkdir_p} %{buildroot}%{_sysconfdir}/php.d
+%{__cat} << __EOF__ > %{buildroot}%{_sysconfdir}/php.d/rrdtool.ini
+; Enable rrdtool extension module
+extension=rrdtool.so
+__EOF__
+%endif
+
+# Pesky RRDp.pm...
+%{__mv} $RPM_BUILD_ROOT%{perl_vendorarch}/../RRDp.pm $RPM_BUILD_ROOT%{perl_vendorarch}/
+
+# We only want .txt and .html files for the main documentation
+%{__mkdir_p} doc2/html doc2/txt
+%{__cp} -a doc/*.txt doc2/txt/
+%{__cp} -a doc/*.html doc2/html/
+
+# Put perl docs in perl package
+%{__mkdir_p} doc3/html
+%{__mv} doc2/html/RRD*.html doc3/html/
+
+# Clean up the examples
+%{__rm} -f examples/Makefile* examples/*.in
+
+# This is so rpm doesn't pick up perl module dependencies automatically
+find examples/ -type f -exec chmod 0644 {} \;
+
+# Clean up the buildroot
+%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{version}/{txt,html}/ \
+       $RPM_BUILD_ROOT%{perl_vendorarch}/ntmake.pl \
+       $RPM_BUILD_ROOT%{perl_archlib}/perllocal.pod \
+        $RPM_BUILD_ROOT%{_datadir}/%{name}/examples \
+        $RPM_BUILD_ROOT%{perl_vendorarch}/auto/*/{.packlist,*.bs}
+
+%clean
+%{__rm} -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(-,root,root,-)
+%{_bindir}/*
+%{_libdir}/*.so.*
+%{_datadir}/%{name}
+%{_mandir}/man1/*
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/*.h
+%exclude %{_libdir}/*.la
+%{_libdir}/*.so
+
+%files doc
+%defattr(-,root,root,-)
+%doc CHANGES CONTRIBUTORS COPYING COPYRIGHT README TODO NEWS THREADS
+%doc examples doc2/html doc2/txt
+
+%files perl
+%defattr(-,root,root,-)
+%doc doc3/html
+%{_mandir}/man3/*
+%{perl_vendorarch}/*.pm
+%attr(0755,root,root) %{perl_vendorarch}/auto/RRDs/
+
+%if %{with_python}
+%files python
+%defattr(-,root,root,-)
+%doc bindings/python/AUTHORS bindings/python/COPYING bindings/python/README
+%{python_sitearch}/rrdtoolmodule.so
+%endif
+
+%if %{with_php}
+%files php
+%defattr(-,root,root,0755)
+%doc php4/examples php4/README
+%config(noreplace) %{_sysconfdir}/php.d/rrdtool.ini
+%{php_extdir}/rrdtool.so
+%endif
+
+%if %{with_tcl}
+%files tcl
+%defattr(-,root,root,-)
+%doc bindings/tcl/README
+%{_libdir}/tclrrd*.so
+%{_libdir}/rrdtool/*.tcl
+%endif
+
+%if %{with_ruby}
+%files ruby
+%defattr(-,root,root,-)
+%doc bindings/ruby/README
+%{ruby_sitearch}/RRD.so
+%endif
+
+%changelog
+* Mon May 21 2007 Jarod Wilson <jwilson@redhat.com> 1.2.23-5
+- BR: ruby so %%ruby_sitearch gets set
+
+* Mon May 21 2007 Jarod Wilson <jwilson@redhat.com> 1.2.23-4
+- Build ruby bindings
+
+* Thu May 03 2007 Jarod Wilson <jwilson@redhat.com> 1.2.23-3
+- Disable php bits on ppc64 for now, they fail to build
+
+* Thu May 03 2007 Jarod Wilson <jwilson@redhat.com> 1.2.23-2
+- Add BR: perl-devel for Fedora 7 and later
+
+* Tue May 01 2007 Jarod Wilson <jwilson@redhat.com> 1.2.23-1
+- New upstream release
+
+* Tue May 01 2007 Jarod Wilson <jwilson@redhat.com> 1.2.21-1
+- New upstream release
+
+* Wed Apr 25 2007 Jarod Wilson <jwilson@redhat.com> 1.2.19-2
+- Define %%python_version *before* its needed (#237826)
+
+* Mon Apr 09 2007 Jarod Wilson <jwilson@redhat.com> 1.2.19-1
+- New upstream release
+
+* Tue Jan 23 2007 Jarod Wilson <jwilson@redhat.com> 1.2.18-1
+- New upstream release
+
+* Mon Jan 22 2007 Jarod Wilson <jwilson@redhat.com> 1.2.17-1
+- New upstream release
+
+* Tue Jan 02 2007 Jarod Wilson <jwilson@redhat.com> 1.2.15-9
+- Fix crash with long error strings (upstream
+  changesets 929 and 935)
+
+* Thu Dec 14 2006 Jarod Wilson <jwilson@redhat.com> 1.2.15-8
+- Fix for log grid memory leak (#201241)
+
+* Tue Dec 12 2006 Jarod Wilson <jwilson@redhat.com> 1.2.15-7
+- Rebuild for python 2.5
+
+* Tue Nov 14 2006 Jarod Wilson <jwilson@redhat.com> 1.2.15-6
+- Conditionalize python, php and tcl bits (Resolves #203275)
+
+* Wed Oct 25 2006 Jarod Wilson <jwilson@redhat.com> 1.2.15-5
+- Add tcl sub-package (#203275)
+
+* Tue Sep 05 2006 Jarod Wilson <jwilson@redhat.com> 1.2.15-4
+- Rebuild for new glibc
+
+* Wed Aug 02 2006 Jarod Wilson <jwilson@redhat.com> 1.2.15-3
+- One more addition to initrrdtool patch, to fully revert
+  and correct upstream changeset 839
+- Fix for no python in minimal fc4 buildroots
+
+* Tue Aug  1 2006 Mihai Ibanescu <misa@redhat.com> 1.2.15-2
+- Fixed rrdtool-python to import the module properly (patch
+  rrdtool-1.2.15-initrrdtool.patch)
+
+* Mon Jul 17 2006 Jarod Wilson <jwilson@redhat.com> 1.2.15-1
+- Update to 1.2.15
+- Minor spec cleanups
+
+* Sat Jun 24 2006 Jarod Wilson <jwilson@redhat.com> 1.2.13-7
+- Fix up Obsoletes
+
+* Mon Jun 19 2006 Jarod Wilson <jwilson@redhat.com> 1.2.13-6
+- Flip perl, php and python sub-package names around to 
+  conform with general practices
+
+* Sat Jun 10 2006 Jarod Wilson <jwilson@redhat.com> 1.2.13-5
+- Minor fixes to make package own created directories
+
+* Wed Jun 07 2006 Jarod Wilson <jwilson@redhat.com> 1.2.13-4
+- Add php bits back into the mix
+
+* Mon Jun 05 2006 Jarod Wilson <jwilson@redhat.com> 1.2.13-3
+- Merge spec fixes from bz 185909
+
+* Sun Jun 04 2006 Jarod Wilson <jwilson@redhat.com> 1.2.13-2
+- Remove explicit perl dep, version grabbing using rpm during
+  rpmbuild not guaranteed to work (fails on ppc in plague),
+  and auto-gen perl deps are sufficient
+
+* Sat Jun 03 2006 Jarod Wilson <jwilson@redhat.com> 1.2.13-1
+- Update to release 1.2.13
+- Merge spec changes from dag, atrpms and mdk builds
+- Additional hacktastic contortions for lib64 & rpath messiness
+- Add missing post/postun ldconfig
+- Fix a bunch of rpmlint errors
+- Disable static libs, per FE guidelines
+- Split off docs
+
+* Wed Apr 19 2006 Chris Ricker <kaboom@oobleck.net> 1.2.12-1
+- Rev to 1.2
+
+* Fri May 20 2005 Matthias Saou <http://freshrpms.net/> 1.0.49-5
+- Include patch from Michael to fix perl module compilation on FC4 (#156242).
+
+* Fri May 20 2005 Matthias Saou <http://freshrpms.net/> 1.0.49-4
+- Fix for the php module patch (Joe Pruett, Dag Wieers), #156716.
+- Update source URL to new location since 1.2 is now the default stable.
+- Don't (yet) update to 1.0.50, as it introduces some changes in the perl
+  modules install.
+
+* Mon Jan 31 2005 Matthias Saou <http://freshrpms.net/> 1.0.49-3
+- Put perl modules in vendor_perl and not site_perl. #146513
+
+* Thu Jan 13 2005 Matthias Saou <http://freshrpms.net/> 1.0.49-2
+- Minor cleanups.
+
+* Thu Aug 25 2004 Dag Wieers <dag@wieers.com> - 1.0.49-1
+- Updated to release 1.0.49.
+
+* Wed Aug 25 2004 Dag Wieers <dag@wieers.com> - 1.0.48-3
+- Fixes for x86_64. (Garrick Staples)
+
+* Fri Jul  2 2004 Matthias Saou <http://freshrpms.net/> 1.0.48-3
+- Actually apply the patch for fixing the php module, doh!
+
+* Thu May 27 2004 Matthias Saou <http://freshrpms.net/> 1.0.48-2
+- Added php.d config entry to load the module once installed.
+
+* Thu May 13 2004 Dag Wieers <dag@wieers.com> - 1.0.48-1
+- Updated to release 1.0.48.
+
+* Tue Apr 06 2004 Dag Wieers <dag@wieers.com> - 1.0.47-1
+- Updated to release 1.0.47.
+
+* Thu Mar  4 2004 Matthias Saou <http://freshrpms.net/> 1.0.46-2
+- Change the strict dependency on perl to fix problem with the recent
+  update.
+
+* Mon Jan  5 2004 Matthias Saou <http://freshrpms.net/> 1.0.46-1
+- Update to 1.0.46.
+- Use system libpng and zlib instead of bundled ones.
+- Added php-rrdtool sub-package for the php4 module.
+
+* Fri Dec  5 2003 Matthias Saou <http://freshrpms.net/> 1.0.45-4
+- Added epoch to the perl dependency to work with rpm > 4.2.
+- Fixed the %% escaping in the perl dep.
+
+* Mon Nov 17 2003 Matthias Saou <http://freshrpms.net/> 1.0.45-2
+- Rebuild for Fedora Core 1.
+
+* Sun Aug  3 2003 Matthias Saou <http://freshrpms.net/>
+- Update to 1.0.45.
+
+* Wed Apr 16 2003 Matthias Saou <http://freshrpms.net/>
+- Update to 1.0.42.
+
+* Mon Mar 31 2003 Matthias Saou <http://freshrpms.net/>
+- Rebuilt for Red Hat Linux 9.
+
+* Wed Mar  5 2003 Matthias Saou <http://freshrpms.net/>
+- Added explicit perl version dependency.
+
+* Sun Feb 23 2003 Matthias Saou <http://freshrpms.net/>
+- Update to 1.0.41.
+
+* Fri Jan 31 2003 Matthias Saou <http://freshrpms.net/>
+- Update to 1.0.40.
+- Spec file cleanup.
+
+* Fri Jul 05 2002 Henri Gomez <hgomez@users.sourceforge.net>
+- 1.0.39
+
+* Mon Jun 03 2002 Henri Gomez <hgomez@users.sourceforge.net>
+- 1.0.38
+
+* Fri Apr 19 2002 Henri Gomez <hgomez@users.sourceforge.net>
+- 1.0.37
+
+* Tue Mar 12 2002 Henri Gomez <hgomez@users.sourceforge.net>
+- 1.0.34
+- rrdtools include zlib 1.1.4 which fix vulnerabilities in 1.1.3
+
diff --git a/src/DejaVuSansMono-Roman.ttf b/src/DejaVuSansMono-Roman.ttf
new file mode 100644 (file)
index 0000000..691c8d6
Binary files /dev/null and b/src/DejaVuSansMono-Roman.ttf differ
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644 (file)
index 0000000..f3c476e
--- /dev/null
@@ -0,0 +1,134 @@
+## Process this file with automake to produce Makefile.in
+
+#AUTOMAKE_OPTIONS   = foreign
+#
+#ACLOCAL_M4       = $(top_srcdir)/config/aclocal.m4
+#AUTOHEADER = @AUTOHEADER@ --localdir=$(top_srcdir)/config
+fontsdir =  $(datadir)/rrdtool/fonts
+fonts_DATA = DejaVuSansMono-Roman.ttf
+
+#INCLUDES = $(FREETYPE_INCLUDES) $(ART_INCLUDES) \
+#           $(PNG_INCLUDES) $(ZLIB_INCLUDES)
+RRD_DEFAULT_FONT=@RRD_DEFAULT_FONT@
+AM_CPPFLAGS = -DRRD_DEFAULT_FONT=\"$(RRD_DEFAULT_FONT)\" -DNUMVERS=@NUMVERS@
+
+UPD_C_FILES =          \
+       rrd_getopt.c    \
+       rrd_getopt1.c   \
+       parsetime.c     \
+       rrd_hw.c        \
+       rrd_diff.c      \
+       rrd_format.c    \
+       rrd_info.c      \
+       rrd_error.c     \
+       rrd_open.c      \
+       rrd_nan_inf.c   \
+       rrd_rpncalc.c   \
+       rrd_update.c
+
+RRD_C_FILES =          \
+       hash_32.c       \
+       pngsize.c       \
+       rrd_create.c    \
+       rrd_dump.c      \
+       rrd_fetch.c     \
+       rrd_graph.c     \
+       rrd_graph_helper.c      \
+       rrd_last.c      \
+       rrd_lastupdate.c        \
+       rrd_first.c     \
+       rrd_resize.c    \
+       rrd_restore.c   \
+       rrd_tune.c      \
+       rrd_version.c   \
+       rrd_xport.c     \
+        art_rgba_svp.c \
+       rrd_gfx.c \
+       rrd_afm.c rrd_afm_data.c \
+       rrd_tool.c
+
+noinst_HEADERS = \
+        art_rgba_svp.h \
+       unused.h \
+       rrd_gfx.h \
+       rrd_getopt.h parsetime.h \
+       rrd_format.h rrd_tool.h rrd_xport.h rrd.h rrd_hw.h rrd_rpncalc.h \
+       rrd_nan_inf.h fnv.h rrd_graph.h rrd_afm.h rrd_afm_data.h \
+       rrd_is_thread_safe.h
+
+noinst_LTLIBRARIES        = librrdupd.la
+
+lib_LTLIBRARIES           = librrd.la 
+if BUILD_MULTITHREAD
+lib_LTLIBRARIES           += librrd_th.la
+endif
+
+librrdupd_la_SOURCES      = $(UPD_C_FILES) rrd_not_thread_safe.c
+librrdupd_la_LIBADD       = $(CORE_LIBS)
+
+librrd_la_SOURCES         = $(RRD_C_FILES)
+librrd_la_LIBADD          = librrdupd.la $(ALL_LIBS)
+
+# This flag accepts an argument of the form current[:revision[:age]]. So,
+# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to 1.
+#
+# If either revision or age are omitted, they default to 0. Also note that
+# age must be less than or equal to the current interface number.
+#
+# Here are a set of rules to help you update your library version information:
+#
+#   1. Start with version information of 0:0:0 for each libtool library.
+#
+#   2. Update the version information only immediately before a public
+#   release of your software. More frequent updates are unnecessary, and
+#   only guarantee that the current interface number gets larger faster.
+#
+#   3. If the library source code has changed at all since the last update,
+#   then increment revision (c:r:a becomes c:r+1:a).
+#
+#   4. If any interfaces have been added, removed, or changed since the last
+#   update, increment current, and set revision to 0.
+#
+#   5. If any interfaces have been added since the last public release, then
+#   increment age.
+#
+#   6. If any interfaces have been removed since the last public release,
+#   then set age to 0.
+#
+# Never try to set the interface numbers so that they correspond to the
+# release number of your package. This is an abuse that only fosters
+# misunderstanding of the purpose of library versions. Instead, use the
+# -release flag (see Release numbers), but be warned that every release of
+# your package will not be binary compatible with any other release.
+#
+# see http://www.gnu.org/software/libtool/manual.html#SEC32 for explanation
+librrd_la_LDFLAGS         = -version-info 2:12:0
+
+librrd_th_la_SOURCES         = $(UPD_C_FILES) $(RRD_C_FILES) rrd_thread_safe.c
+librrd_th_la_CFLAGS          = $(MULTITHREAD_CFLAGS)
+librrd_th_la_LDFLAGS         = $(MULTITHREAD_LDFLAGS) -version-info 2:11:0
+librrd_th_la_LIBADD          = $(ALL_LIBS)
+
+include_HEADERS        = rrd.h
+
+bin_PROGRAMS   = rrdtool rrdupdate
+
+if BUILD_RRDCGI
+bin_PROGRAMS += rrdcgi
+endif
+
+rrdcgi_SOURCES = rrd_cgi.c
+rrdcgi_LDADD   = librrd.la
+
+rrdupdate_SOURCES = rrdupdate.c
+rrdupdate_LDADD          = librrdupd.la
+
+rrdtool_SOURCES = 
+rrdtool_DEPENDENCIES = rrd_tool.o librrd.la
+rrdtool_LDADD  = librrd.la
+
+# strftime is here because we do not usually need it. unices have propper
+# iso date support
+EXTRA_DIST= strftime.c strftime.h $(fonts_DATA) \
+       win32comp.c  rrd_thread_safe_nt.c get_ver.awk
+
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644 (file)
index 0000000..ac1342b
--- /dev/null
@@ -0,0 +1,1076 @@
+# Makefile.in generated by automake 1.9.6 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@
+
+
+
+
+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 = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+@BUILD_MULTITHREAD_TRUE@am__append_1 = librrd_th.la
+bin_PROGRAMS = rrdtool$(EXEEXT) rrdupdate$(EXEEXT) $(am__EXEEXT_1)
+@BUILD_RRDCGI_TRUE@am__append_2 = rrdcgi
+subdir = src
+DIST_COMMON = $(include_HEADERS) $(noinst_HEADERS) \
+       $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+       $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/rrd_config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
+       "$(DESTDIR)$(fontsdir)" "$(DESTDIR)$(includedir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+librrd_la_DEPENDENCIES = librrdupd.la $(am__DEPENDENCIES_1)
+am__objects_1 = hash_32.lo pngsize.lo rrd_create.lo rrd_dump.lo \
+       rrd_fetch.lo rrd_graph.lo rrd_graph_helper.lo rrd_last.lo \
+       rrd_lastupdate.lo rrd_first.lo rrd_resize.lo rrd_restore.lo \
+       rrd_tune.lo rrd_version.lo rrd_xport.lo art_rgba_svp.lo \
+       rrd_gfx.lo rrd_afm.lo rrd_afm_data.lo rrd_tool.lo
+am_librrd_la_OBJECTS = $(am__objects_1)
+librrd_la_OBJECTS = $(am_librrd_la_OBJECTS)
+librrd_th_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am__objects_2 = librrd_th_la-rrd_getopt.lo librrd_th_la-rrd_getopt1.lo \
+       librrd_th_la-parsetime.lo librrd_th_la-rrd_hw.lo \
+       librrd_th_la-rrd_diff.lo librrd_th_la-rrd_format.lo \
+       librrd_th_la-rrd_info.lo librrd_th_la-rrd_error.lo \
+       librrd_th_la-rrd_open.lo librrd_th_la-rrd_nan_inf.lo \
+       librrd_th_la-rrd_rpncalc.lo librrd_th_la-rrd_update.lo
+am__objects_3 = librrd_th_la-hash_32.lo librrd_th_la-pngsize.lo \
+       librrd_th_la-rrd_create.lo librrd_th_la-rrd_dump.lo \
+       librrd_th_la-rrd_fetch.lo librrd_th_la-rrd_graph.lo \
+       librrd_th_la-rrd_graph_helper.lo librrd_th_la-rrd_last.lo \
+       librrd_th_la-rrd_lastupdate.lo librrd_th_la-rrd_first.lo \
+       librrd_th_la-rrd_resize.lo librrd_th_la-rrd_restore.lo \
+       librrd_th_la-rrd_tune.lo librrd_th_la-rrd_version.lo \
+       librrd_th_la-rrd_xport.lo librrd_th_la-art_rgba_svp.lo \
+       librrd_th_la-rrd_gfx.lo librrd_th_la-rrd_afm.lo \
+       librrd_th_la-rrd_afm_data.lo librrd_th_la-rrd_tool.lo
+am_librrd_th_la_OBJECTS = $(am__objects_2) $(am__objects_3) \
+       librrd_th_la-rrd_thread_safe.lo
+librrd_th_la_OBJECTS = $(am_librrd_th_la_OBJECTS)
+@BUILD_MULTITHREAD_TRUE@am_librrd_th_la_rpath = -rpath $(libdir)
+librrdupd_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am__objects_4 = rrd_getopt.lo rrd_getopt1.lo parsetime.lo rrd_hw.lo \
+       rrd_diff.lo rrd_format.lo rrd_info.lo rrd_error.lo rrd_open.lo \
+       rrd_nan_inf.lo rrd_rpncalc.lo rrd_update.lo
+am_librrdupd_la_OBJECTS = $(am__objects_4) rrd_not_thread_safe.lo
+librrdupd_la_OBJECTS = $(am_librrdupd_la_OBJECTS)
+@BUILD_RRDCGI_TRUE@am__EXEEXT_1 = rrdcgi$(EXEEXT)
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_rrdcgi_OBJECTS = rrd_cgi.$(OBJEXT)
+rrdcgi_OBJECTS = $(am_rrdcgi_OBJECTS)
+rrdcgi_DEPENDENCIES = librrd.la
+am_rrdtool_OBJECTS =
+rrdtool_OBJECTS = $(am_rrdtool_OBJECTS)
+am_rrdupdate_OBJECTS = rrdupdate.$(OBJEXT)
+rrdupdate_OBJECTS = $(am_rrdupdate_OBJECTS)
+rrdupdate_DEPENDENCIES = librrdupd.la
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+       $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+       $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(librrd_la_SOURCES) $(librrd_th_la_SOURCES) \
+       $(librrdupd_la_SOURCES) $(rrdcgi_SOURCES) $(rrdtool_SOURCES) \
+       $(rrdupdate_SOURCES)
+DIST_SOURCES = $(librrd_la_SOURCES) $(librrd_th_la_SOURCES) \
+       $(librrdupd_la_SOURCES) $(rrdcgi_SOURCES) $(rrdtool_SOURCES) \
+       $(rrdupdate_SOURCES)
+fontsDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(fonts_DATA)
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS) $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALL_LIBS = @ALL_LIBS@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_MULTITHREAD_FALSE = @BUILD_MULTITHREAD_FALSE@
+BUILD_MULTITHREAD_TRUE = @BUILD_MULTITHREAD_TRUE@
+BUILD_RRDCGI_FALSE = @BUILD_RRDCGI_FALSE@
+BUILD_RRDCGI_TRUE = @BUILD_RRDCGI_TRUE@
+BUILD_TCL_FALSE = @BUILD_TCL_FALSE@
+BUILD_TCL_SITE_FALSE = @BUILD_TCL_SITE_FALSE@
+BUILD_TCL_SITE_TRUE = @BUILD_TCL_SITE_TRUE@
+BUILD_TCL_TRUE = @BUILD_TCL_TRUE@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMP_PERL = @COMP_PERL@
+COMP_PYTHON = @COMP_PYTHON@
+COMP_RUBY = @COMP_RUBY@
+CORE_LIBS = @CORE_LIBS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MULTITHREAD_CFLAGS = @MULTITHREAD_CFLAGS@
+MULTITHREAD_LDFLAGS = @MULTITHREAD_LDFLAGS@
+NROFF = @NROFF@
+NUMVERS = @NUMVERS@
+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@
+PERL = @PERL@
+PERLCC = @PERLCC@
+PERLCCFLAGS = @PERLCCFLAGS@
+PERLFLAGS = @PERLFLAGS@
+PERLLD = @PERLLD@
+PERLLDFLAGS = @PERLLDFLAGS@
+PERL_CC = @PERL_CC@
+PERL_MAKE_OPTIONS = @PERL_MAKE_OPTIONS@
+PERL_VERSION = @PERL_VERSION@
+PKGCONFIG = @PKGCONFIG@
+PTHREAD_CC = @PTHREAD_CC@
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+PYTHON = @PYTHON@
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
+PYTHON_PREFIX = @PYTHON_PREFIX@
+PYTHON_VERSION = @PYTHON_VERSION@
+RANLIB = @RANLIB@
+RRDDOCDIR = @RRDDOCDIR@
+RRDGRAPH_YLEGEND_ANGLE = @RRDGRAPH_YLEGEND_ANGLE@
+
+#INCLUDES = $(FREETYPE_INCLUDES) $(ART_INCLUDES) \
+#           $(PNG_INCLUDES) $(ZLIB_INCLUDES)
+RRD_DEFAULT_FONT = @RRD_DEFAULT_FONT@
+RUBY = @RUBY@
+RUBY_MAKE_OPTIONS = @RUBY_MAKE_OPTIONS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TCL_LD_SEARCH_FLAGS = @TCL_LD_SEARCH_FLAGS@
+TCL_PACKAGE_DIR = @TCL_PACKAGE_DIR@
+TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@
+TCL_PREFIX = @TCL_PREFIX@
+TCL_SHLIB_CFLAGS = @TCL_SHLIB_CFLAGS@
+TCL_SHLIB_LD = @TCL_SHLIB_LD@
+TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@
+TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
+TCL_VERSION = @TCL_VERSION@
+TROFF = @TROFF@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+acx_pthread_config = @acx_pthread_config@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_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 = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pyexecdir = @pyexecdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+
+#AUTOMAKE_OPTIONS   = foreign
+#
+#ACLOCAL_M4       = $(top_srcdir)/config/aclocal.m4
+#AUTOHEADER = @AUTOHEADER@ --localdir=$(top_srcdir)/config
+fontsdir = $(datadir)/rrdtool/fonts
+fonts_DATA = DejaVuSansMono-Roman.ttf
+AM_CPPFLAGS = -DRRD_DEFAULT_FONT=\"$(RRD_DEFAULT_FONT)\" -DNUMVERS=@NUMVERS@
+UPD_C_FILES = \
+       rrd_getopt.c    \
+       rrd_getopt1.c   \
+       parsetime.c     \
+       rrd_hw.c        \
+       rrd_diff.c      \
+       rrd_format.c    \
+       rrd_info.c      \
+       rrd_error.c     \
+       rrd_open.c      \
+       rrd_nan_inf.c   \
+       rrd_rpncalc.c   \
+       rrd_update.c
+
+RRD_C_FILES = \
+       hash_32.c       \
+       pngsize.c       \
+       rrd_create.c    \
+       rrd_dump.c      \
+       rrd_fetch.c     \
+       rrd_graph.c     \
+       rrd_graph_helper.c      \
+       rrd_last.c      \
+       rrd_lastupdate.c        \
+       rrd_first.c     \
+       rrd_resize.c    \
+       rrd_restore.c   \
+       rrd_tune.c      \
+       rrd_version.c   \
+       rrd_xport.c     \
+        art_rgba_svp.c \
+       rrd_gfx.c \
+       rrd_afm.c rrd_afm_data.c \
+       rrd_tool.c
+
+noinst_HEADERS = \
+        art_rgba_svp.h \
+       unused.h \
+       rrd_gfx.h \
+       rrd_getopt.h parsetime.h \
+       rrd_format.h rrd_tool.h rrd_xport.h rrd.h rrd_hw.h rrd_rpncalc.h \
+       rrd_nan_inf.h fnv.h rrd_graph.h rrd_afm.h rrd_afm_data.h \
+       rrd_is_thread_safe.h
+
+noinst_LTLIBRARIES = librrdupd.la
+lib_LTLIBRARIES = librrd.la $(am__append_1)
+librrdupd_la_SOURCES = $(UPD_C_FILES) rrd_not_thread_safe.c
+librrdupd_la_LIBADD = $(CORE_LIBS)
+librrd_la_SOURCES = $(RRD_C_FILES)
+librrd_la_LIBADD = librrdupd.la $(ALL_LIBS)
+
+# This flag accepts an argument of the form current[:revision[:age]]. So,
+# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to 1.
+#
+# If either revision or age are omitted, they default to 0. Also note that
+# age must be less than or equal to the current interface number.
+#
+# Here are a set of rules to help you update your library version information:
+#
+#   1. Start with version information of 0:0:0 for each libtool library.
+#
+#   2. Update the version information only immediately before a public
+#   release of your software. More frequent updates are unnecessary, and
+#   only guarantee that the current interface number gets larger faster.
+#
+#   3. If the library source code has changed at all since the last update,
+#   then increment revision (c:r:a becomes c:r+1:a).
+#
+#   4. If any interfaces have been added, removed, or changed since the last
+#   update, increment current, and set revision to 0.
+#
+#   5. If any interfaces have been added since the last public release, then
+#   increment age.
+#
+#   6. If any interfaces have been removed since the last public release,
+#   then set age to 0.
+#
+# Never try to set the interface numbers so that they correspond to the
+# release number of your package. This is an abuse that only fosters
+# misunderstanding of the purpose of library versions. Instead, use the
+# -release flag (see Release numbers), but be warned that every release of
+# your package will not be binary compatible with any other release.
+#
+# see http://www.gnu.org/software/libtool/manual.html#SEC32 for explanation
+librrd_la_LDFLAGS = -version-info 2:12:0
+librrd_th_la_SOURCES = $(UPD_C_FILES) $(RRD_C_FILES) rrd_thread_safe.c
+librrd_th_la_CFLAGS = $(MULTITHREAD_CFLAGS)
+librrd_th_la_LDFLAGS = $(MULTITHREAD_LDFLAGS) -version-info 2:11:0
+librrd_th_la_LIBADD = $(ALL_LIBS)
+include_HEADERS = rrd.h
+rrdcgi_SOURCES = rrd_cgi.c
+rrdcgi_LDADD = librrd.la
+rrdupdate_SOURCES = rrdupdate.c
+rrdupdate_LDADD = librrdupd.la
+rrdtool_SOURCES = 
+rrdtool_DEPENDENCIES = rrd_tool.o librrd.la
+rrdtool_LDADD = librrd.la
+
+# strftime is here because we do not usually need it. unices have propper
+# iso date support
+EXTRA_DIST = strftime.c strftime.h $(fonts_DATA) \
+       win32comp.c  rrd_thread_safe_nt.c get_ver.awk
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --foreign  src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+       @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         if test -f $$p; then \
+           f=$(am__strip_dir) \
+           echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+           $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-libLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         p=$(am__strip_dir) \
+         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+       done
+
+clean-libLTLIBRARIES:
+       -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+       @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
+
+clean-noinstLTLIBRARIES:
+       -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+       @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
+librrd.la: $(librrd_la_OBJECTS) $(librrd_la_DEPENDENCIES) 
+       $(LINK) -rpath $(libdir) $(librrd_la_LDFLAGS) $(librrd_la_OBJECTS) $(librrd_la_LIBADD) $(LIBS)
+librrd_th.la: $(librrd_th_la_OBJECTS) $(librrd_th_la_DEPENDENCIES) 
+       $(LINK) $(am_librrd_th_la_rpath) $(librrd_th_la_LDFLAGS) $(librrd_th_la_OBJECTS) $(librrd_th_la_LIBADD) $(LIBS)
+librrdupd.la: $(librrdupd_la_OBJECTS) $(librrdupd_la_DEPENDENCIES) 
+       $(LINK)  $(librrdupd_la_LDFLAGS) $(librrdupd_la_OBJECTS) $(librrdupd_la_LIBADD) $(LIBS)
+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 \
+            || test -f $$p1 \
+         ; then \
+           f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(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:
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         echo " rm -f $$p $$f"; \
+         rm -f $$p $$f ; \
+       done
+rrdcgi$(EXEEXT): $(rrdcgi_OBJECTS) $(rrdcgi_DEPENDENCIES) 
+       @rm -f rrdcgi$(EXEEXT)
+       $(LINK) $(rrdcgi_LDFLAGS) $(rrdcgi_OBJECTS) $(rrdcgi_LDADD) $(LIBS)
+rrdtool$(EXEEXT): $(rrdtool_OBJECTS) $(rrdtool_DEPENDENCIES) 
+       @rm -f rrdtool$(EXEEXT)
+       $(LINK) $(rrdtool_LDFLAGS) $(rrdtool_OBJECTS) $(rrdtool_LDADD) $(LIBS)
+rrdupdate$(EXEEXT): $(rrdupdate_OBJECTS) $(rrdupdate_DEPENDENCIES) 
+       @rm -f rrdupdate$(EXEEXT)
+       $(LINK) $(rrdupdate_LDFLAGS) $(rrdupdate_OBJECTS) $(rrdupdate_LDADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/art_rgba_svp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash_32.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-art_rgba_svp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-hash_32.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-parsetime.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-pngsize.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_afm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_afm_data.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_create.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_diff.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_dump.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_error.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_fetch.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_first.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_format.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_getopt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_getopt1.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_gfx.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_graph.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_graph_helper.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_hw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_info.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_last.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_lastupdate.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_nan_inf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_open.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_resize.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_restore.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_rpncalc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_thread_safe.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_tool.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_tune.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_update.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_version.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/librrd_th_la-rrd_xport.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parsetime.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pngsize.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_afm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_afm_data.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_cgi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_create.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_diff.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_dump.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_error.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_fetch.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_first.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_format.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_getopt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_getopt1.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_gfx.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_graph.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_graph_helper.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_hw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_info.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_last.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_lastupdate.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_nan_inf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_not_thread_safe.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_open.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_resize.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_restore.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_rpncalc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_tool.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_tune.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_update.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_version.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrd_xport.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrdupdate.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) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@   if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $<
+
+librrd_th_la-rrd_getopt.lo: rrd_getopt.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_getopt.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_getopt.Tpo" -c -o librrd_th_la-rrd_getopt.lo `test -f 'rrd_getopt.c' || echo '$(srcdir)/'`rrd_getopt.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_getopt.Tpo" "$(DEPDIR)/librrd_th_la-rrd_getopt.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_getopt.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_getopt.c' object='librrd_th_la-rrd_getopt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_getopt.lo `test -f 'rrd_getopt.c' || echo '$(srcdir)/'`rrd_getopt.c
+
+librrd_th_la-rrd_getopt1.lo: rrd_getopt1.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_getopt1.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_getopt1.Tpo" -c -o librrd_th_la-rrd_getopt1.lo `test -f 'rrd_getopt1.c' || echo '$(srcdir)/'`rrd_getopt1.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_getopt1.Tpo" "$(DEPDIR)/librrd_th_la-rrd_getopt1.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_getopt1.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_getopt1.c' object='librrd_th_la-rrd_getopt1.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_getopt1.lo `test -f 'rrd_getopt1.c' || echo '$(srcdir)/'`rrd_getopt1.c
+
+librrd_th_la-parsetime.lo: parsetime.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-parsetime.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-parsetime.Tpo" -c -o librrd_th_la-parsetime.lo `test -f 'parsetime.c' || echo '$(srcdir)/'`parsetime.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-parsetime.Tpo" "$(DEPDIR)/librrd_th_la-parsetime.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-parsetime.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='parsetime.c' object='librrd_th_la-parsetime.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-parsetime.lo `test -f 'parsetime.c' || echo '$(srcdir)/'`parsetime.c
+
+librrd_th_la-rrd_hw.lo: rrd_hw.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_hw.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_hw.Tpo" -c -o librrd_th_la-rrd_hw.lo `test -f 'rrd_hw.c' || echo '$(srcdir)/'`rrd_hw.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_hw.Tpo" "$(DEPDIR)/librrd_th_la-rrd_hw.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_hw.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_hw.c' object='librrd_th_la-rrd_hw.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_hw.lo `test -f 'rrd_hw.c' || echo '$(srcdir)/'`rrd_hw.c
+
+librrd_th_la-rrd_diff.lo: rrd_diff.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_diff.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_diff.Tpo" -c -o librrd_th_la-rrd_diff.lo `test -f 'rrd_diff.c' || echo '$(srcdir)/'`rrd_diff.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_diff.Tpo" "$(DEPDIR)/librrd_th_la-rrd_diff.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_diff.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_diff.c' object='librrd_th_la-rrd_diff.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_diff.lo `test -f 'rrd_diff.c' || echo '$(srcdir)/'`rrd_diff.c
+
+librrd_th_la-rrd_format.lo: rrd_format.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_format.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_format.Tpo" -c -o librrd_th_la-rrd_format.lo `test -f 'rrd_format.c' || echo '$(srcdir)/'`rrd_format.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_format.Tpo" "$(DEPDIR)/librrd_th_la-rrd_format.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_format.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_format.c' object='librrd_th_la-rrd_format.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_format.lo `test -f 'rrd_format.c' || echo '$(srcdir)/'`rrd_format.c
+
+librrd_th_la-rrd_info.lo: rrd_info.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_info.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_info.Tpo" -c -o librrd_th_la-rrd_info.lo `test -f 'rrd_info.c' || echo '$(srcdir)/'`rrd_info.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_info.Tpo" "$(DEPDIR)/librrd_th_la-rrd_info.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_info.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_info.c' object='librrd_th_la-rrd_info.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_info.lo `test -f 'rrd_info.c' || echo '$(srcdir)/'`rrd_info.c
+
+librrd_th_la-rrd_error.lo: rrd_error.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_error.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_error.Tpo" -c -o librrd_th_la-rrd_error.lo `test -f 'rrd_error.c' || echo '$(srcdir)/'`rrd_error.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_error.Tpo" "$(DEPDIR)/librrd_th_la-rrd_error.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_error.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_error.c' object='librrd_th_la-rrd_error.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_error.lo `test -f 'rrd_error.c' || echo '$(srcdir)/'`rrd_error.c
+
+librrd_th_la-rrd_open.lo: rrd_open.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_open.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_open.Tpo" -c -o librrd_th_la-rrd_open.lo `test -f 'rrd_open.c' || echo '$(srcdir)/'`rrd_open.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_open.Tpo" "$(DEPDIR)/librrd_th_la-rrd_open.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_open.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_open.c' object='librrd_th_la-rrd_open.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_open.lo `test -f 'rrd_open.c' || echo '$(srcdir)/'`rrd_open.c
+
+librrd_th_la-rrd_nan_inf.lo: rrd_nan_inf.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_nan_inf.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_nan_inf.Tpo" -c -o librrd_th_la-rrd_nan_inf.lo `test -f 'rrd_nan_inf.c' || echo '$(srcdir)/'`rrd_nan_inf.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_nan_inf.Tpo" "$(DEPDIR)/librrd_th_la-rrd_nan_inf.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_nan_inf.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_nan_inf.c' object='librrd_th_la-rrd_nan_inf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_nan_inf.lo `test -f 'rrd_nan_inf.c' || echo '$(srcdir)/'`rrd_nan_inf.c
+
+librrd_th_la-rrd_rpncalc.lo: rrd_rpncalc.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_rpncalc.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_rpncalc.Tpo" -c -o librrd_th_la-rrd_rpncalc.lo `test -f 'rrd_rpncalc.c' || echo '$(srcdir)/'`rrd_rpncalc.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_rpncalc.Tpo" "$(DEPDIR)/librrd_th_la-rrd_rpncalc.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_rpncalc.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_rpncalc.c' object='librrd_th_la-rrd_rpncalc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_rpncalc.lo `test -f 'rrd_rpncalc.c' || echo '$(srcdir)/'`rrd_rpncalc.c
+
+librrd_th_la-rrd_update.lo: rrd_update.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_update.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_update.Tpo" -c -o librrd_th_la-rrd_update.lo `test -f 'rrd_update.c' || echo '$(srcdir)/'`rrd_update.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_update.Tpo" "$(DEPDIR)/librrd_th_la-rrd_update.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_update.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_update.c' object='librrd_th_la-rrd_update.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_update.lo `test -f 'rrd_update.c' || echo '$(srcdir)/'`rrd_update.c
+
+librrd_th_la-hash_32.lo: hash_32.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-hash_32.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-hash_32.Tpo" -c -o librrd_th_la-hash_32.lo `test -f 'hash_32.c' || echo '$(srcdir)/'`hash_32.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-hash_32.Tpo" "$(DEPDIR)/librrd_th_la-hash_32.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-hash_32.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='hash_32.c' object='librrd_th_la-hash_32.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-hash_32.lo `test -f 'hash_32.c' || echo '$(srcdir)/'`hash_32.c
+
+librrd_th_la-pngsize.lo: pngsize.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-pngsize.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-pngsize.Tpo" -c -o librrd_th_la-pngsize.lo `test -f 'pngsize.c' || echo '$(srcdir)/'`pngsize.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-pngsize.Tpo" "$(DEPDIR)/librrd_th_la-pngsize.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-pngsize.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='pngsize.c' object='librrd_th_la-pngsize.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-pngsize.lo `test -f 'pngsize.c' || echo '$(srcdir)/'`pngsize.c
+
+librrd_th_la-rrd_create.lo: rrd_create.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_create.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_create.Tpo" -c -o librrd_th_la-rrd_create.lo `test -f 'rrd_create.c' || echo '$(srcdir)/'`rrd_create.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_create.Tpo" "$(DEPDIR)/librrd_th_la-rrd_create.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_create.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_create.c' object='librrd_th_la-rrd_create.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_create.lo `test -f 'rrd_create.c' || echo '$(srcdir)/'`rrd_create.c
+
+librrd_th_la-rrd_dump.lo: rrd_dump.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_dump.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_dump.Tpo" -c -o librrd_th_la-rrd_dump.lo `test -f 'rrd_dump.c' || echo '$(srcdir)/'`rrd_dump.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_dump.Tpo" "$(DEPDIR)/librrd_th_la-rrd_dump.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_dump.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_dump.c' object='librrd_th_la-rrd_dump.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_dump.lo `test -f 'rrd_dump.c' || echo '$(srcdir)/'`rrd_dump.c
+
+librrd_th_la-rrd_fetch.lo: rrd_fetch.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_fetch.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_fetch.Tpo" -c -o librrd_th_la-rrd_fetch.lo `test -f 'rrd_fetch.c' || echo '$(srcdir)/'`rrd_fetch.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_fetch.Tpo" "$(DEPDIR)/librrd_th_la-rrd_fetch.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_fetch.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_fetch.c' object='librrd_th_la-rrd_fetch.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_fetch.lo `test -f 'rrd_fetch.c' || echo '$(srcdir)/'`rrd_fetch.c
+
+librrd_th_la-rrd_graph.lo: rrd_graph.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_graph.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_graph.Tpo" -c -o librrd_th_la-rrd_graph.lo `test -f 'rrd_graph.c' || echo '$(srcdir)/'`rrd_graph.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_graph.Tpo" "$(DEPDIR)/librrd_th_la-rrd_graph.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_graph.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_graph.c' object='librrd_th_la-rrd_graph.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_graph.lo `test -f 'rrd_graph.c' || echo '$(srcdir)/'`rrd_graph.c
+
+librrd_th_la-rrd_graph_helper.lo: rrd_graph_helper.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_graph_helper.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_graph_helper.Tpo" -c -o librrd_th_la-rrd_graph_helper.lo `test -f 'rrd_graph_helper.c' || echo '$(srcdir)/'`rrd_graph_helper.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_graph_helper.Tpo" "$(DEPDIR)/librrd_th_la-rrd_graph_helper.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_graph_helper.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_graph_helper.c' object='librrd_th_la-rrd_graph_helper.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_graph_helper.lo `test -f 'rrd_graph_helper.c' || echo '$(srcdir)/'`rrd_graph_helper.c
+
+librrd_th_la-rrd_last.lo: rrd_last.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_last.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_last.Tpo" -c -o librrd_th_la-rrd_last.lo `test -f 'rrd_last.c' || echo '$(srcdir)/'`rrd_last.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_last.Tpo" "$(DEPDIR)/librrd_th_la-rrd_last.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_last.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_last.c' object='librrd_th_la-rrd_last.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_last.lo `test -f 'rrd_last.c' || echo '$(srcdir)/'`rrd_last.c
+
+librrd_th_la-rrd_lastupdate.lo: rrd_lastupdate.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_lastupdate.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_lastupdate.Tpo" -c -o librrd_th_la-rrd_lastupdate.lo `test -f 'rrd_lastupdate.c' || echo '$(srcdir)/'`rrd_lastupdate.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_lastupdate.Tpo" "$(DEPDIR)/librrd_th_la-rrd_lastupdate.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_lastupdate.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_lastupdate.c' object='librrd_th_la-rrd_lastupdate.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_lastupdate.lo `test -f 'rrd_lastupdate.c' || echo '$(srcdir)/'`rrd_lastupdate.c
+
+librrd_th_la-rrd_first.lo: rrd_first.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_first.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_first.Tpo" -c -o librrd_th_la-rrd_first.lo `test -f 'rrd_first.c' || echo '$(srcdir)/'`rrd_first.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_first.Tpo" "$(DEPDIR)/librrd_th_la-rrd_first.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_first.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_first.c' object='librrd_th_la-rrd_first.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_first.lo `test -f 'rrd_first.c' || echo '$(srcdir)/'`rrd_first.c
+
+librrd_th_la-rrd_resize.lo: rrd_resize.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_resize.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_resize.Tpo" -c -o librrd_th_la-rrd_resize.lo `test -f 'rrd_resize.c' || echo '$(srcdir)/'`rrd_resize.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_resize.Tpo" "$(DEPDIR)/librrd_th_la-rrd_resize.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_resize.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_resize.c' object='librrd_th_la-rrd_resize.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_resize.lo `test -f 'rrd_resize.c' || echo '$(srcdir)/'`rrd_resize.c
+
+librrd_th_la-rrd_restore.lo: rrd_restore.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_restore.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_restore.Tpo" -c -o librrd_th_la-rrd_restore.lo `test -f 'rrd_restore.c' || echo '$(srcdir)/'`rrd_restore.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_restore.Tpo" "$(DEPDIR)/librrd_th_la-rrd_restore.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_restore.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_restore.c' object='librrd_th_la-rrd_restore.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_restore.lo `test -f 'rrd_restore.c' || echo '$(srcdir)/'`rrd_restore.c
+
+librrd_th_la-rrd_tune.lo: rrd_tune.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_tune.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_tune.Tpo" -c -o librrd_th_la-rrd_tune.lo `test -f 'rrd_tune.c' || echo '$(srcdir)/'`rrd_tune.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_tune.Tpo" "$(DEPDIR)/librrd_th_la-rrd_tune.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_tune.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_tune.c' object='librrd_th_la-rrd_tune.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_tune.lo `test -f 'rrd_tune.c' || echo '$(srcdir)/'`rrd_tune.c
+
+librrd_th_la-rrd_version.lo: rrd_version.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_version.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_version.Tpo" -c -o librrd_th_la-rrd_version.lo `test -f 'rrd_version.c' || echo '$(srcdir)/'`rrd_version.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_version.Tpo" "$(DEPDIR)/librrd_th_la-rrd_version.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_version.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_version.c' object='librrd_th_la-rrd_version.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_version.lo `test -f 'rrd_version.c' || echo '$(srcdir)/'`rrd_version.c
+
+librrd_th_la-rrd_xport.lo: rrd_xport.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_xport.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_xport.Tpo" -c -o librrd_th_la-rrd_xport.lo `test -f 'rrd_xport.c' || echo '$(srcdir)/'`rrd_xport.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_xport.Tpo" "$(DEPDIR)/librrd_th_la-rrd_xport.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_xport.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_xport.c' object='librrd_th_la-rrd_xport.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_xport.lo `test -f 'rrd_xport.c' || echo '$(srcdir)/'`rrd_xport.c
+
+librrd_th_la-art_rgba_svp.lo: art_rgba_svp.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-art_rgba_svp.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-art_rgba_svp.Tpo" -c -o librrd_th_la-art_rgba_svp.lo `test -f 'art_rgba_svp.c' || echo '$(srcdir)/'`art_rgba_svp.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-art_rgba_svp.Tpo" "$(DEPDIR)/librrd_th_la-art_rgba_svp.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-art_rgba_svp.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='art_rgba_svp.c' object='librrd_th_la-art_rgba_svp.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-art_rgba_svp.lo `test -f 'art_rgba_svp.c' || echo '$(srcdir)/'`art_rgba_svp.c
+
+librrd_th_la-rrd_gfx.lo: rrd_gfx.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_gfx.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_gfx.Tpo" -c -o librrd_th_la-rrd_gfx.lo `test -f 'rrd_gfx.c' || echo '$(srcdir)/'`rrd_gfx.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_gfx.Tpo" "$(DEPDIR)/librrd_th_la-rrd_gfx.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_gfx.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_gfx.c' object='librrd_th_la-rrd_gfx.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_gfx.lo `test -f 'rrd_gfx.c' || echo '$(srcdir)/'`rrd_gfx.c
+
+librrd_th_la-rrd_afm.lo: rrd_afm.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_afm.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_afm.Tpo" -c -o librrd_th_la-rrd_afm.lo `test -f 'rrd_afm.c' || echo '$(srcdir)/'`rrd_afm.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_afm.Tpo" "$(DEPDIR)/librrd_th_la-rrd_afm.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_afm.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_afm.c' object='librrd_th_la-rrd_afm.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_afm.lo `test -f 'rrd_afm.c' || echo '$(srcdir)/'`rrd_afm.c
+
+librrd_th_la-rrd_afm_data.lo: rrd_afm_data.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_afm_data.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_afm_data.Tpo" -c -o librrd_th_la-rrd_afm_data.lo `test -f 'rrd_afm_data.c' || echo '$(srcdir)/'`rrd_afm_data.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_afm_data.Tpo" "$(DEPDIR)/librrd_th_la-rrd_afm_data.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_afm_data.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_afm_data.c' object='librrd_th_la-rrd_afm_data.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_afm_data.lo `test -f 'rrd_afm_data.c' || echo '$(srcdir)/'`rrd_afm_data.c
+
+librrd_th_la-rrd_tool.lo: rrd_tool.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_tool.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_tool.Tpo" -c -o librrd_th_la-rrd_tool.lo `test -f 'rrd_tool.c' || echo '$(srcdir)/'`rrd_tool.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_tool.Tpo" "$(DEPDIR)/librrd_th_la-rrd_tool.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_tool.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_tool.c' object='librrd_th_la-rrd_tool.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_tool.lo `test -f 'rrd_tool.c' || echo '$(srcdir)/'`rrd_tool.c
+
+librrd_th_la-rrd_thread_safe.lo: rrd_thread_safe.c
+@am__fastdepCC_TRUE@   if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -MT librrd_th_la-rrd_thread_safe.lo -MD -MP -MF "$(DEPDIR)/librrd_th_la-rrd_thread_safe.Tpo" -c -o librrd_th_la-rrd_thread_safe.lo `test -f 'rrd_thread_safe.c' || echo '$(srcdir)/'`rrd_thread_safe.c; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/librrd_th_la-rrd_thread_safe.Tpo" "$(DEPDIR)/librrd_th_la-rrd_thread_safe.Plo"; else rm -f "$(DEPDIR)/librrd_th_la-rrd_thread_safe.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='rrd_thread_safe.c' object='librrd_th_la-rrd_thread_safe.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(librrd_th_la_CFLAGS) $(CFLAGS) -c -o librrd_th_la-rrd_thread_safe.lo `test -f 'rrd_thread_safe.c' || echo '$(srcdir)/'`rrd_thread_safe.c
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+distclean-libtool:
+       -rm -f libtool
+uninstall-info-am:
+install-fontsDATA: $(fonts_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(fontsdir)" || $(mkdir_p) "$(DESTDIR)$(fontsdir)"
+       @list='$(fonts_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(fontsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(fontsdir)/$$f'"; \
+         $(fontsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(fontsdir)/$$f"; \
+       done
+
+uninstall-fontsDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(fonts_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(fontsdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(fontsdir)/$$f"; \
+       done
+install-includeHEADERS: $(include_HEADERS)
+       @$(NORMAL_INSTALL)
+       test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)"
+       @list='$(include_HEADERS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+         $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+       done
+
+uninstall-includeHEADERS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(include_HEADERS)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+         rm -f "$(DESTDIR)$(includedir)/$$f"; \
+       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)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       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; }'`; \
+       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)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       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; }'`; \
+       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)
+       @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
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) $(HEADERS)
+install-binPROGRAMS: install-libLTLIBRARIES
+
+installdirs:
+       for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(fontsdir)" "$(DESTDIR)$(includedir)"; 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 clean-libLTLIBRARIES \
+       clean-libtool clean-noinstLTLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-fontsDATA install-includeHEADERS
+
+install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-fontsDATA \
+       uninstall-includeHEADERS uninstall-info-am \
+       uninstall-libLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+       clean-generic clean-libLTLIBRARIES clean-libtool \
+       clean-noinstLTLIBRARIES ctags distclean distclean-compile \
+       distclean-generic distclean-libtool distclean-tags distdir 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-fontsDATA install-includeHEADERS \
+       install-info install-info-am install-libLTLIBRARIES \
+       install-man install-strip installcheck installcheck-am \
+       installdirs maintainer-clean maintainer-clean-generic \
+       mostlyclean mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+       uninstall-am uninstall-binPROGRAMS uninstall-fontsDATA \
+       uninstall-includeHEADERS uninstall-info-am \
+       uninstall-libLTLIBRARIES
+
+# 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/src/art_rgba_svp.c b/src/art_rgba_svp.c
new file mode 100644 (file)
index 0000000..25083d7
--- /dev/null
@@ -0,0 +1,333 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ *  art_rgba_svp.c: A slightly modified version of art_rgb_svp to render into rgba buffer
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public License
+ *  as published by the Free Software Foundation; either version 2 of
+ *  the License, or (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *  Authors:
+ *    Raph Levien <raph@acm.org>
+ *    Lauris Kaplinski <lauris@ariman.ee>
+ *
+ *  Copyright (C) 1998 Raph Levien
+ *
+ */
+
+#define SP_ART_RGBA_SVP_C
+
+/* Render a sorted vector path into an RGBA buffer. */
+
+#include <libart_lgpl/art_misc.h>
+#include <libart_lgpl/art_svp.h>
+#include <libart_lgpl/art_svp_render_aa.h>
+#include <libart_lgpl/art_rgb.h>
+
+#include "art_rgba_svp.h"
+#include "unused.h"
+
+static void art_rgba_fill_run (art_u8 * linebuf, art_u8 r, art_u8 g, art_u8 b, int n);
+static void art_rgba_run_alpha (art_u8 * linebuf, art_u8 r, art_u8 g, art_u8 b, int alpha, int n);
+
+typedef struct _ArtRgbaSVPAlphaData ArtRgbaSVPAlphaData;
+
+struct _ArtRgbaSVPAlphaData {
+  int alphatab[256];
+  art_u8 r, g, b, alpha;
+  art_u8 *buf;
+  int rowstride;
+  int libart_x0, libart_x1;
+};
+
+static void
+art_rgba_svp_alpha_callback (void *callback_data, int UNUSED(y),
+                           int start, ArtSVPRenderAAStep *steps, int n_steps)
+{
+  ArtRgbaSVPAlphaData *data = callback_data;
+  art_u8 *linebuf;
+  int run_x0, run_x1;
+  art_u32 running_sum = start;
+  int libart_x0, libart_x1;
+  int k;
+  art_u8 r, g, b;
+  int *alphatab;
+  int alpha;
+
+  linebuf = data->buf;
+  libart_x0 = data->libart_x0;
+  libart_x1 = data->libart_x1;
+
+  r = data->r;
+  g = data->g;
+  b = data->b;
+  alphatab = data->alphatab;
+
+  if (n_steps > 0)
+    {
+      run_x1 = steps[0].x;
+      if (run_x1 > libart_x0)
+       {
+         alpha = (running_sum >> 16) & 0xff;
+         if (alpha)
+           art_rgba_run_alpha (linebuf,
+                              r, g, b, alphatab[alpha],
+                              run_x1 - libart_x0);
+       }
+
+      /* render the steps into tmpbuf */
+      for (k = 0; k < n_steps - 1; k++)
+       {
+         running_sum += steps[k].delta;
+         run_x0 = run_x1;
+         run_x1 = steps[k + 1].x;
+         if (run_x1 > run_x0)
+           {
+             alpha = (running_sum >> 16) & 0xff;
+             if (alpha)
+               art_rgba_run_alpha (linebuf + (run_x0 - libart_x0) * 4,
+                                  r, g, b, alphatab[alpha],
+                                  run_x1 - run_x0);
+           }
+       }
+      running_sum += steps[k].delta;
+      if (libart_x1 > run_x1)
+       {
+         alpha = (running_sum >> 16) & 0xff;
+         if (alpha)
+           art_rgba_run_alpha (linebuf + (run_x1 - libart_x0) * 4,
+                              r, g, b, alphatab[alpha],
+                              libart_x1 - run_x1);
+       }
+    }
+  else
+    {
+      alpha = (running_sum >> 16) & 0xff;
+      if (alpha)
+       art_rgba_run_alpha (linebuf,
+                          r, g, b, alphatab[alpha],
+                          libart_x1 - libart_x0);
+    }
+
+  data->buf += data->rowstride;
+}
+
+static void
+art_rgba_svp_alpha_opaque_callback (void *callback_data, int UNUSED(y),
+                                  int start,
+                                  ArtSVPRenderAAStep *steps, int n_steps)
+{
+  ArtRgbaSVPAlphaData *data = callback_data;
+  art_u8 *linebuf;
+  int run_x0, run_x1;
+  art_u32 running_sum = start;
+  int libart_x0, libart_x1;
+  int k;
+  art_u8 r, g, b;
+  int *alphatab;
+  int alpha;
+
+  linebuf = data->buf;
+  libart_x0 = data->libart_x0;
+  libart_x1 = data->libart_x1;
+
+  r = data->r;
+  g = data->g;
+  b = data->b;
+  alphatab = data->alphatab;
+
+  if (n_steps > 0)
+    {
+      run_x1 = steps[0].x;
+      if (run_x1 > libart_x0)
+       {
+         alpha = running_sum >> 16;
+         if (alpha)
+           {
+             if (alpha >= 255)
+               art_rgba_fill_run (linebuf,
+                                 r, g, b,
+                                 run_x1 - libart_x0);
+             else
+               art_rgba_run_alpha (linebuf,
+                                  r, g, b, alphatab[alpha],
+                                  run_x1 - libart_x0);
+           }
+       }
+
+      /* render the steps into tmpbuf */
+      for (k = 0; k < n_steps - 1; k++)
+       {
+         running_sum += steps[k].delta;
+         run_x0 = run_x1;
+         run_x1 = steps[k + 1].x;
+         if (run_x1 > run_x0)
+           {
+             alpha = running_sum >> 16;
+             if (alpha)
+               {
+                 if (alpha >= 255)
+                   art_rgba_fill_run (linebuf + (run_x0 - libart_x0) * 4,
+                                     r, g, b,
+                                     run_x1 - run_x0);
+                 else
+                   art_rgba_run_alpha (linebuf + (run_x0 - libart_x0) * 4,
+                                      r, g, b, alphatab[alpha],
+                                      run_x1 - run_x0);
+               }
+           }
+       }
+      running_sum += steps[k].delta;
+      if (libart_x1 > run_x1)
+       {
+         alpha = running_sum >> 16;
+         if (alpha)
+           {
+             if (alpha >= 255)
+               art_rgba_fill_run (linebuf + (run_x1 - libart_x0) * 4,
+                                 r, g, b,
+                                 libart_x1 - run_x1);
+             else
+               art_rgba_run_alpha (linebuf + (run_x1 - libart_x0) * 4,
+                                  r, g, b, alphatab[alpha],
+                                  libart_x1 - run_x1);
+           }
+       }
+    }
+  else
+    {
+      alpha = running_sum >> 16;
+      if (alpha)
+       {
+         if (alpha >= 255)
+           art_rgba_fill_run (linebuf,
+                             r, g, b,
+                             libart_x1 - libart_x0);
+         else
+           art_rgba_run_alpha (linebuf,
+                              r, g, b, alphatab[alpha],
+                              libart_x1 - libart_x0);
+       }
+    }
+
+  data->buf += data->rowstride;
+}
+
+/**
+ * gnome_print_art_rgba_svp_alpha: Alpha-composite sorted vector path over RGBA buffer.
+ * @svp: The source sorted vector path.
+ * @libart_x0: Left coordinate of destination rectangle.
+ * @libart_y0: Top coordinate of destination rectangle.
+ * @libart_x1: Right coordinate of destination rectangle.
+ * @libart_y1: Bottom coordinate of destination rectangle.
+ * @rgba: Color in 0xRRGGBBAA format.
+ * @buf: Destination RGB buffer.
+ * @rowstride: Rowstride of @buf buffer.
+ * @alphagamma: #ArtAlphaGamma for gamma-correcting the compositing.
+ *
+ * Renders the shape specified with @svp over the @buf RGB buffer.
+ * @libart_x1 - @x0 specifies the width, and @libart_y1 - @libart_y0 specifies the height,
+ * of the rectangle rendered. The new pixels are stored starting at
+ * the first byte of @buf. Thus, the @x0 and @libart_y0 parameters specify
+ * an offset within @svp, and may be tweaked as a way of doing
+ * integer-pixel translations without fiddling with @svp itself.
+ *
+ * The @rgba argument specifies the color for the rendering. Pixels of
+ * entirely 0 winding number are left untouched. Pixels of entirely
+ * 1 winding number have the color @rgba composited over them (ie,
+ * are replaced by the red, green, blue components of @rgba if the alpha
+ * component is 0xff). Pixels of intermediate coverage are interpolated
+ * according to the rule in @alphagamma, or default to linear if
+ * @alphagamma is NULL.
+ **/
+void
+gnome_print_art_rgba_svp_alpha (const ArtSVP *svp,
+                               int libart_x0, int libart_y0, int libart_x1, int libart_y1,
+                               art_u32 rgba,
+                               art_u8 *buf, int rowstride,
+                               ArtAlphaGamma UNUSED(*alphagamma))
+{
+  ArtRgbaSVPAlphaData data;
+  int r, g, b, alpha;
+  int i;
+  int a, da;
+
+  r = rgba >> 24;
+  g = (rgba >> 16) & 0xff;
+  b = (rgba >> 8) & 0xff;
+  alpha = rgba & 0xff;
+
+  data.r = r;
+  data.g = g;
+  data.b = b;
+  data.alpha = alpha;
+
+  a = 0x8000;
+  da = (alpha * 66051 + 0x80) >> 8; /* 66051 equals 2 ^ 32 / (255 * 255) */
+
+  for (i = 0; i < 256; i++)
+    {
+      data.alphatab[i] = a >> 16;
+      a += da;
+    }
+
+  data.buf = buf;
+  data.rowstride = rowstride;
+  data.libart_x0 = libart_x0;
+  data.libart_x1 = libart_x1;
+  if (alpha == 255)
+    art_svp_render_aa (svp, libart_x0, libart_y0, libart_x1, libart_y1, art_rgba_svp_alpha_opaque_callback,
+                      &data);
+  else
+    art_svp_render_aa (svp, libart_x0, libart_y0, libart_x1, libart_y1, art_rgba_svp_alpha_callback, &data);
+}
+
+static void
+art_rgba_fill_run (art_u8 * buf, art_u8 r, art_u8 g, art_u8 b, int n)
+{
+       int i;
+
+       for (i = 0; i < n; i++) {
+               * buf++ = r;
+               * buf++ = g;
+               * buf++ = b;
+               * buf++ = 255;
+       }
+}
+
+/* fixme: this */
+
+static void
+art_rgba_run_alpha (art_u8 * buf, art_u8 r, art_u8 g, art_u8 b, int alpha, int n)
+{
+       int i;
+       int br, bg, bb, ba;
+       int cr, cg, cb;
+
+       for (i = 0; i < n; i++) {
+               br = * (buf + 0);
+               bg = * (buf + 1);
+               bb = * (buf + 2);
+               ba = * (buf + 3);
+
+               cr = (br * ba + 0x80) >> 8;
+               cg = (bg * ba + 0x80) >> 8;
+               cb = (bb * ba + 0x80) >> 8;
+
+               * buf++ = cr + (((r - cr) * alpha + 0x80) >> 8);
+               * buf++ = cg + (((g - cg) * alpha + 0x80) >> 8);
+               * buf++ = cb + (((b - cb) * alpha + 0x80) >> 8);
+               * buf++ = ba + (((255 - ba) * alpha + 0x80) >> 8);
+       }
+}
+
+
diff --git a/src/art_rgba_svp.h b/src/art_rgba_svp.h
new file mode 100644 (file)
index 0000000..4cac175
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef SP_ART_RGBA_SVP_H
+#define SP_ART_RGBA_SVP_H
+
+#include <libart_lgpl/art_misc.h>
+#include <libart_lgpl/art_alphagamma.h>
+#include <libart_lgpl/art_affine.h>
+#include <libart_lgpl/art_svp.h>
+#include <libart_lgpl/art_uta.h>
+
+void
+gnome_print_art_rgba_svp_alpha (const ArtSVP *svp,
+                               int x0, int y0, int x1, int y1,
+                               art_u32 rgba,
+                               art_u8 *buf, int rowstride,
+                               ArtAlphaGamma *alphagamma);
+
+#endif /* SP_ART_RGBA_SVP_H */
diff --git a/src/fnv.h b/src/fnv.h
new file mode 100644 (file)
index 0000000..75004ad
--- /dev/null
+++ b/src/fnv.h
@@ -0,0 +1,108 @@
+/*
+ * fnv - Fowler/Noll/Vo- hash code
+ *
+ * @(#) $Revision: 1028 $
+ * @(#) $Id: fnv.h 1028 2007-04-02 06:21:19Z oetiker $
+ * @(#) $Source$
+ *
+ ***
+ *
+ * Fowler/Noll/Vo- hash
+ *
+ * The basis of this hash algorithm was taken from an idea sent
+ * as reviewer comments to the IEEE POSIX P1003.2 committee by:
+ *
+ *      Phong Vo (http://www.research.att.com/info/kpv/)
+ *      Glenn Fowler (http://www.research.att.com/~gsf/)
+ *
+ * In a subsequent ballot round:
+ *
+ *      Landon Curt Noll (http://reality.sgi.com/chongo/)
+ *
+ * improved on their algorithm.  Some people tried this hash
+ * and found that it worked rather well.  In an EMail message
+ * to Landon, they named it the ``Fowler/Noll/Vo'' or FNV hash.
+ *
+ * FNV hashes are architected to be fast while maintaining a low
+ * collision rate. The FNV speed allows one to quickly hash lots
+ * of data while maintaining a reasonable collision rate.  See:
+ *
+ *      http://reality.sgi.com/chongo/tech/comp/fnv/
+ *
+ * for more details as well as other forms of the FNV hash.
+ *
+ ***
+ *
+ * NOTE: The FNV-0 historic hash is not recommended.  One should use
+ *      the FNV-1 hash instead.
+ *
+ * To use the 32 bit FNV-0 historic hash, pass FNV0_32_INIT as the
+ * Fnv32_t hashval argument to fnv_32_buf() or fnv_32_str().
+ *
+ * To use the 64 bit FNV-0 historic hash, pass FNV0_64_INIT as the
+ * Fnv64_t hashval argument to fnv_64_buf() or fnv_64_str().
+ *
+ * To use the recommended 32 bit FNV-1 hash, pass FNV1_32_INIT as the
+ * Fnv32_t hashval argument to fnv_32_buf() or fnv_32_str().
+ *
+ * To use the recommended 64 bit FNV-1 hash, pass FNV1_64_INIT as the
+ * Fnv64_t hashval argument to fnv_64_buf() or fnv_64_str().
+ *
+ ***
+ *
+ * Please do not copyright this code.  This code is in the public domain.
+ *
+ * LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
+ * EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+ * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * By:
+ *     chongo <Landon Curt Noll> /\oo/\
+ *     http://reality.sgi.com/chongo/
+ *     EMail: chongo_fnv at prime dot engr dot sgi dot com
+ *
+ * Share and Enjoy!    :-)
+ */
+
+#if !defined(__FNV_H__)
+#define __FNV_H__
+
+
+/*
+ * 32 bit FNV-0 hash type
+ */
+typedef unsigned long Fnv32_t;
+
+
+/* 
+ * 32 bit FNV-0 zero initial basis
+ *
+ * This historic hash is not recommended.  One should use
+ * the FNV-1 hash and inital basis instead.
+ */
+#define FNV0_32_INIT ((Fnv32_t)0)
+
+
+/*
+ * 32 bit FNV-1 non-zero initial basis
+ *
+ * The FNV-1 initial basis is the FNV-0 hash of the following 32 octets:
+ *
+ *              chongo <Landon Curt Noll> /\../\
+ *
+ * Note that the \'s above are not back-slashing escape characters.
+ * They are literal ASCII  backslash 0x5c characters.
+ */
+#define FNV1_32_INIT ((Fnv32_t)0x811c9dc5)
+
+Fnv32_t fnv_32_buf(const void *, size_t, Fnv32_t);
+
+Fnv32_t fnv_32_str(const char *, Fnv32_t );
+
+unsigned long FnvHash(const char *);
+
+#endif /* __FNV_H__ */
diff --git a/src/get_ver.awk b/src/get_ver.awk
new file mode 100644 (file)
index 0000000..e8c4552
--- /dev/null
@@ -0,0 +1,40 @@
+# ****************************************************************************
+# RRDtool 1.2.19  Copyright by Tobi Oetiker, 1997-2007
+# ****************************************************************************
+# get_ver.awk   AWK Script for non-configure builds
+# ****************************************************************************
+# $Id: get_ver.awk 1000 2007-14-02 05:51:34Z oetiker $
+# ****************************************************************************
+BEGIN {
+  # fetch rrdtool version number from input file and write them to STDOUT
+  while ((getline < ARGV[1]) > 0) {
+    if (match ($0, /^AC_INIT/)) {
+      split($1, t, ",");
+      my_ver_str = substr(t[2],2,length(t[2])-3);
+      split(my_ver_str, v, ".");
+      gsub("[^0-9].*$", "", v[3]);
+      my_ver = v[1] "," v[2] "," v[3];
+    }
+    if (match ($0, /^NUMVERS=/)) {
+      split($1, t, "=");
+      my_ver_num = t[2];
+    }
+  }
+  # read from from input file, replace placeholders, and write to STDOUT
+  if (ARGV[2]) {
+    while ((getline < ARGV[2]) > 0) {
+      if (match ($0, /@@NUMVERS@@/)) {
+        gsub("@@NUMVERS@@", my_ver_num, $0);
+      }
+      if (match ($0, /@@PACKAGE_VERSION@@/)) {
+        gsub("@@PACKAGE_VERSION@@", "" my_ver_str "", $0);
+      }
+      print;
+    }
+  } else {
+    print "RRD_VERSION = " my_ver "";
+    print "RRD_VERSION_STR = " my_ver_str "";
+    print "RRD_NUMVERS = " my_ver_num "";
+  }
+}
+
diff --git a/src/hash_32.c b/src/hash_32.c
new file mode 100644 (file)
index 0000000..d7edbee
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+ * hash_32 - 32 bit Fowler/Noll/Vo hash code
+ *
+ *
+ ***
+ *
+ * Fowler/Noll/Vo hash
+ *
+ * The basis of this hash algorithm was taken from an idea sent
+ * as reviewer comments to the IEEE POSIX P1003.2 committee by:
+ *
+ *      Phong Vo (http://www.research.att.com/info/kpv/)
+ *      Glenn Fowler (http://www.research.att.com/~gsf/)
+ *
+ * In a subsequent ballot round:
+ *
+ *      Landon Curt Noll (http://reality.sgi.com/chongo/)
+ *
+ * improved on their algorithm.  Some people tried this hash
+ * and found that it worked rather well.  In an EMail message
+ * to Landon, they named it the ``Fowler/Noll/Vo'' or FNV hash.
+ *
+ * FNV hashes are architected to be fast while maintaining a low
+ * collision rate. The FNV speed allows one to quickly hash lots
+ * of data while maintaining a reasonable collision rate.  See:
+ *
+ *      http://reality.sgi.com/chongo/tech/comp/fnv/
+ *
+ * for more details as well as other forms of the FNV hash.
+ ***
+ *
+ * NOTE: The FNV-0 historic hash is not recommended.  One should use
+ *      the FNV-1 hash instead.
+ *
+ * To use the 32 bit FNV-0 historic hash, pass FNV0_32_INIT as the
+ * Fnv32_t hashval argument to fnv_32_buf() or fnv_32_str().
+ *
+ * To use the recommended 32 bit FNV-1 hash, pass FNV1_32_INIT as the
+ * Fnv32_t hashval argument to fnv_32_buf() or fnv_32_str().
+ *
+ ***
+ *
+ * Please do not copyright this code.  This code is in the public domain.
+ *
+ * LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
+ * EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+ * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * By:
+ *     chongo <Landon Curt Noll> /\oo/\
+ *     http://reality.sgi.com/chongo/
+ *     EMail: chongo_fnv at prime dot engr dot sgi dot com
+ *
+ * Share and Enjoy!    :-)
+ */
+
+#include <stdlib.h>
+#include "fnv.h"
+
+
+/* 
+ * 32 bit magic FNV-0 and FNV-1 prime 
+ */
+#define FNV_32_PRIME ((Fnv32_t)0x01000193)     
+
+
+/*
+ * fnv_32_buf - perform a 32 bit Fowler/Noll/Vo hash on a buffer
+ *
+ * input:
+ *     buf     - start of buffer to hash
+ *     len     - length of buffer in octets
+ *     hval    - previous hash value or 0 if first call
+ *
+ * returns:
+ *     32 bit hash as a static hash type
+ *
+ * NOTE: To use the 32 bit FNV-0 historic hash, use FNV0_32_INIT as the hval
+ *      argument on the first call to either fnv_32_buf() or fnv_32_str().
+ *
+ * NOTE: To use the recommended 32 bit FNV-1 hash, use FNV1_32_INIT as the hval
+ *      argument on the first call to either fnv_32_buf() or fnv_32_str().
+ */
+Fnv32_t
+fnv_32_buf(const void *buf, size_t len, Fnv32_t hval)
+{
+    const unsigned char *bp = (const unsigned char *)buf;      /* start of buffer */
+    const unsigned char *be = bp + len;                /* beyond end of buffer */
+
+    /*
+     * FNV-1 hash each octet in the buffer
+     */
+    while (bp < be) {
+
+       /* multiply by the 32 bit FNV magic prime mod 2^64 */
+       hval *= FNV_32_PRIME;
+
+       /* xor the bottom with the current octet */
+       hval ^= (Fnv32_t)*bp++;
+    }
+
+    /* return our new hash value */
+    return hval;
+}
+
+
+/*
+ * fnv_32_str - perform a 32 bit Fowler/Noll/Vo hash on a string
+ *
+ * input:
+ *     str     - string to hash
+ *     hval    - previous hash value or 0 if first call
+ *
+ * returns:
+ *     32 bit hash as a static hash type
+ *
+ * NOTE: To use the 32 bit FNV-0 historic hash, use FNV0_32_INIT as the hval
+ *      argument on the first call to either fnv_32_buf() or fnv_32_str().
+ *
+ * NOTE: To use the recommended 32 bit FNV-1 hash, use FNV1_32_INIT as the hval
+ *      argument on the first call to either fnv_32_buf() or fnv_32_str().
+ */
+Fnv32_t
+fnv_32_str(const char *str, Fnv32_t hval)
+{
+    const unsigned char *s = (const unsigned char *)str;       /* unsigned string */
+
+    /*
+     * FNV-1 hash each octet in the buffer
+     */
+    while (*s) {
+
+       /* multiply by the 32 bit FNV magic prime mod 2^64 */
+       hval *= FNV_32_PRIME;
+
+       /* xor the bottom with the current octet */
+       hval ^= (Fnv32_t)*s++;
+    }
+
+    /* return our new hash value */
+    return hval;
+}
+
+/* a wrapper function for fnv_32_str */
+unsigned long FnvHash(const char *str)
+{
+  return fnv_32_str(str,FNV1_32_INIT);
+}
diff --git a/src/parsetime.c b/src/parsetime.c
new file mode 100644 (file)
index 0000000..919dd50
--- /dev/null
@@ -0,0 +1,981 @@
+/*  
+ *  parsetime.c - parse time for at(1)
+ *  Copyright (C) 1993, 1994  Thomas Koenig
+ *
+ *  modifications for English-language times
+ *  Copyright (C) 1993  David Parsons
+ *
+ *  A lot of modifications and extensions 
+ *  (including the new syntax being useful for RRDB)
+ *  Copyright (C) 1999  Oleg Cherevko (aka Olwi Deer)
+ *
+ *  severe structural damage inflicted by Tobi Oetiker in 1999
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. The name of the author(s) may not be used to endorse or promote
+ *    products derived from this software without specific prior written
+ *    permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``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 AUTHOR(S) 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, WETHER 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.
+ */
+
+/* NOTE: nothing in here is thread-safe!!!! Not even the localtime
+   calls ... */
+
+/*
+ * The BNF-like specification of the time syntax parsed is below:
+ *                                                               
+ * As usual, [ X ] means that X is optional, { X } means that X may
+ * be either omitted or specified as many times as needed,
+ * alternatives are separated by |, brackets are used for grouping.
+ * (# marks the beginning of comment that extends to the end of line)
+ *
+ * TIME-SPECIFICATION ::= TIME-REFERENCE [ OFFSET-SPEC ] |
+ *                                        OFFSET-SPEC   |
+ *                        ( START | END ) OFFSET-SPEC 
+ *
+ * TIME-REFERENCE ::= NOW | TIME-OF-DAY-SPEC [ DAY-SPEC-1 ] |
+ *                        [ TIME-OF-DAY-SPEC ] DAY-SPEC-2
+ *
+ * TIME-OF-DAY-SPEC ::= NUMBER (':') NUMBER [am|pm] | # HH:MM
+ *                     'noon' | 'midnight' | 'teatime'
+ *
+ * DAY-SPEC-1 ::= NUMBER '/' NUMBER '/' NUMBER |  # MM/DD/[YY]YY
+ *                NUMBER '.' NUMBER '.' NUMBER |  # DD.MM.[YY]YY
+ *                NUMBER                          # Seconds since 1970
+ *                NUMBER                          # YYYYMMDD
+ *
+ * DAY-SPEC-2 ::= MONTH-NAME NUMBER [NUMBER] |    # Month DD [YY]YY
+ *                'yesterday' | 'today' | 'tomorrow' |
+ *                DAY-OF-WEEK
+ *
+ *
+ * OFFSET-SPEC ::= '+'|'-' NUMBER TIME-UNIT { ['+'|'-'] NUMBER TIME-UNIT }
+ *
+ * TIME-UNIT ::= SECONDS | MINUTES | HOURS |
+ *               DAYS | WEEKS | MONTHS | YEARS
+ *
+ * NOW ::= 'now' | 'n'
+ *
+ * START ::= 'start' | 's'
+ * END   ::= 'end' | 'e'
+ *
+ * SECONDS ::= 'seconds' | 'second' | 'sec' | 's'
+ * MINUTES ::= 'minutes' | 'minute' | 'min' | 'm'
+ * HOURS   ::= 'hours' | 'hour' | 'hr' | 'h'
+ * DAYS    ::= 'days' | 'day' | 'd'
+ * WEEKS   ::= 'weeks' | 'week' | 'wk' | 'w'
+ * MONTHS  ::= 'months' | 'month' | 'mon' | 'm'
+ * YEARS   ::= 'years' | 'year' | 'yr' | 'y'
+ *
+ * MONTH-NAME ::= 'jan' | 'january' | 'feb' | 'february' | 'mar' | 'march' |
+ *                'apr' | 'april' | 'may' | 'jun' | 'june' | 'jul' | 'july' |
+ *                'aug' | 'august' | 'sep' | 'september' | 'oct' | 'october' |
+ *               'nov' | 'november' | 'dec' | 'december'
+ *
+ * DAY-OF-WEEK ::= 'sunday' | 'sun' | 'monday' | 'mon' | 'tuesday' | 'tue' |
+ *                 'wednesday' | 'wed' | 'thursday' | 'thu' | 'friday' | 'fri' |
+ *                 'saturday' | 'sat'
+ *
+ *
+ * As you may note, there is an ambiguity with respect to
+ * the 'm' time unit (which can mean either minutes or months).
+ * To cope with this, code tries to read users mind :) by applying
+ * certain heuristics. There are two of them:
+ *
+ * 1. If 'm' is used in context of (i.e. right after the) years,
+ *    months, weeks, or days it is assumed to mean months, while
+ *    in the context of hours, minutes, and seconds it means minutes.
+ *    (e.g., in -1y6m or +3w1m 'm' means 'months', while in
+ *    -3h20m or +5s2m 'm' means 'minutes')
+ *
+ * 2. Out of context (i.e. right after the '+' or '-' sign) the
+ *    meaning of 'm' is guessed from the number it directly follows.
+ *    Currently, if the number absolute value is below 25 it is assumed
+ *    that 'm' means months, otherwise it is treated as minutes.
+ *    (e.g., -25m == -25 minutes, while +24m == +24 months)
+ *
+ */
+
+/* System Headers */
+
+/* Local headers */
+
+#include "rrd_tool.h"
+#include <stdarg.h>
+
+/* Structures and unions */
+
+enum { /* symbols */
+    MIDNIGHT, NOON, TEATIME,
+    PM, AM, YESTERDAY, TODAY, TOMORROW, NOW, START, END,
+    SECONDS, MINUTES, HOURS, DAYS, WEEKS, MONTHS, YEARS,
+    MONTHS_MINUTES,
+    NUMBER, PLUS, MINUS, DOT, COLON, SLASH, ID, JUNK,
+    JAN, FEB, MAR, APR, MAY, JUN,
+    JUL, AUG, SEP, OCT, NOV, DEC,
+    SUN, MON, TUE, WED, THU, FRI, SAT
+    };
+
+/* the below is for plus_minus() */
+#define PREVIOUS_OP    (-1)
+
+/* parse translation table - table driven parsers can be your FRIEND!
+ */
+struct SpecialToken {
+    char *name;        /* token name */
+    int value; /* token id */
+};
+static struct SpecialToken VariousWords[] = {
+    { "midnight", MIDNIGHT },  /* 00:00:00 of today or tomorrow */
+    { "noon", NOON },          /* 12:00:00 of today or tomorrow */
+    { "teatime", TEATIME },    /* 16:00:00 of today or tomorrow */
+    { "am", AM },              /* morning times for 0-12 clock */
+    { "pm", PM },              /* evening times for 0-12 clock */
+    { "tomorrow", TOMORROW },
+    { "yesterday", YESTERDAY },
+    { "today", TODAY },
+    { "now", NOW },
+    { "n", NOW },
+    { "start", START },
+    { "s", START },    
+    { "end", END },
+    { "e", END },
+
+    { "jan", JAN },
+    { "feb", FEB },
+    { "mar", MAR },
+    { "apr", APR },
+    { "may", MAY },
+    { "jun", JUN },
+    { "jul", JUL },
+    { "aug", AUG },
+    { "sep", SEP },
+    { "oct", OCT },
+    { "nov", NOV },
+    { "dec", DEC },
+    { "january", JAN },
+    { "february", FEB },
+    { "march", MAR },
+    { "april", APR },
+    { "may", MAY },
+    { "june", JUN },
+    { "july", JUL },
+    { "august", AUG },
+    { "september", SEP },
+    { "october", OCT },
+    { "november", NOV },
+    { "december", DEC },
+    { "sunday", SUN },
+    { "sun", SUN },
+    { "monday", MON },
+    { "mon", MON },
+    { "tuesday", TUE },
+    { "tue", TUE },
+    { "wednesday", WED },
+    { "wed", WED },
+    { "thursday", THU },
+    { "thu", THU },
+    { "friday", FRI },
+    { "fri", FRI },
+    { "saturday", SAT },
+    { "sat", SAT },
+    { NULL, 0 }                        /*** SENTINEL ***/
+};
+
+static struct SpecialToken TimeMultipliers[] = {
+    { "second", SECONDS },     /* seconds multiplier */
+    { "seconds", SECONDS },    /* (pluralized) */
+    { "sec", SECONDS },                /* (generic) */
+    { "s", SECONDS },          /* (short generic) */
+    { "minute", MINUTES },     /* minutes multiplier */
+    { "minutes", MINUTES },    /* (pluralized) */
+    { "min", MINUTES },                /* (generic) */
+    { "m", MONTHS_MINUTES },   /* (short generic) */
+    { "hour", HOURS },         /* hours ... */
+    { "hours", HOURS },                /* (pluralized) */
+    { "hr", HOURS },           /* (generic) */
+    { "h", HOURS },            /* (short generic) */
+    { "day", DAYS },           /* days ... */
+    { "days", DAYS },          /* (pluralized) */
+    { "d", DAYS },             /* (short generic) */
+    { "week", WEEKS },         /* week ... */
+    { "weeks", WEEKS },                /* (pluralized) */
+    { "wk", WEEKS },           /* (generic) */
+    { "w", WEEKS },            /* (short generic) */
+    { "month", MONTHS },       /* week ... */
+    { "months", MONTHS },      /* (pluralized) */
+    { "mon", MONTHS },         /* (generic) */
+    { "year", YEARS },         /* year ... */
+    { "years", YEARS },                /* (pluralized) */
+    { "yr", YEARS },           /* (generic) */
+    { "y", YEARS },            /* (short generic) */
+    { NULL, 0 }                        /*** SENTINEL ***/
+};
+
+/* File scope variables */
+
+/* context dependent list of specials for parser to recognize,
+ * required for us to be able distinguish between 'mon' as 'month'
+ * and 'mon' as 'monday'
+ */
+static struct SpecialToken *Specials;
+
+static const char **scp;       /* scanner - pointer at arglist */
+static char scc;       /* scanner - count of remaining arguments */
+static const char *sct;        /* scanner - next char pointer in current argument */
+static int need;       /* scanner - need to advance to next argument */
+
+static char *sc_token=NULL;    /* scanner - token buffer */
+static size_t sc_len;   /* scanner - length of token buffer */
+static int sc_tokid;   /* scanner - token id */
+
+/* Local functions */
+static void EnsureMemFree (void);
+
+static void EnsureMemFree (void)
+{
+  if( sc_token )
+    {
+    free(sc_token);
+    sc_token = NULL;
+    }
+}
+
+/*
+ * A hack to compensate for the lack of the C++ exceptions
+ *
+ * Every function func that might generate parsing "exception"
+ * should return TIME_OK (aka NULL) or pointer to the error message,
+ * and should be called like this: try(func(args));
+ *
+ * if the try is not successful it will reset the token pointer ...
+ *
+ * [NOTE: when try(...) is used as the only statement in the "if-true"
+ *  part of the if statement that also has an "else" part it should be
+ *  either enclosed in the curly braces (despite the fact that it looks
+ *  like a single statement) or NOT followed by the ";"]
+ */
+#define try(b)         { \
+                       char *_e; \
+                       if((_e=(b))) \
+                         { \
+                         EnsureMemFree(); \
+                         return _e; \
+                         } \
+                       }
+
+/*
+ * The panic() function was used in the original code to die, we redefine
+ * it as macro to start the chain of ascending returns that in conjunction
+ * with the try(b) above will simulate a sort of "exception handling"
+ */
+
+#define panic(e)       { \
+                       return (e); \
+                       }
+
+/*
+ * ve() and e() are used to set the return error,
+ * the most appropriate use for these is inside panic(...) 
+ */
+#define MAX_ERR_MSG_LEN        1024
+static char errmsg[ MAX_ERR_MSG_LEN ];
+
+static char *
+ve ( char *fmt, va_list ap )
+{
+#ifdef HAVE_VSNPRINTF
+  vsnprintf( errmsg, MAX_ERR_MSG_LEN, fmt, ap );
+#else
+  vsprintf( errmsg, fmt, ap );
+#endif
+  EnsureMemFree();
+  return( errmsg );
+}
+
+static char *
+e ( char *fmt, ... )
+{
+  char *err;
+  va_list ap;
+  va_start( ap, fmt );
+  err = ve( fmt, ap );
+  va_end( ap );
+  return( err );
+}
+
+/* Compare S1 and S2, ignoring case, returning less than, equal to or
+   greater than zero if S1 is lexicographically less than,
+   equal to or greater than S2.  -- copied from GNU libc*/
+static int
+mystrcasecmp (s1, s2)
+     const char *s1;
+     const char *s2;
+{
+  const unsigned char *p1 = (const unsigned char *) s1;
+  const unsigned char *p2 = (const unsigned char *) s2;
+  unsigned char c1, c2;
+
+  if (p1 == p2)
+    return 0;
+
+  do
+    {
+      c1 = tolower (*p1++);
+      c2 = tolower (*p2++);
+      if (c1 == '\0')
+       break;
+    }
+  while (c1 == c2);
+
+  return c1 - c2;
+}
+
+/*
+ * parse a token, checking if it's something special to us
+ */
+static int
+parse_token(char *arg)
+{
+    int i;
+
+    for (i=0; Specials[i].name != NULL; i++)
+       if (mystrcasecmp(Specials[i].name, arg) == 0)
+           return sc_tokid = Specials[i].value;
+
+    /* not special - must be some random id */
+    return sc_tokid = ID;
+} /* parse_token */
+
+
+
+/*
+ * init_scanner() sets up the scanner to eat arguments
+ */
+static char *
+init_scanner(int argc, const char **argv)
+{
+    scp = argv;
+    scc = argc;
+    need = 1;
+    sc_len = 1;
+    while (argc-- > 0)
+       sc_len += strlen(*argv++);
+
+    sc_token = (char *) malloc(sc_len*sizeof(char));
+    if( sc_token == NULL )
+      return "Failed to allocate memory";
+    return TIME_OK;
+} /* init_scanner */
+
+/*
+ * token() fetches a token from the input stream
+ */
+static int
+token()
+{
+    int idx;
+
+    while (1) {
+       memset(sc_token, '\0', sc_len);
+       sc_tokid = EOF;
+       idx = 0;
+
+       /* if we need to read another argument, walk along the argument list;
+        * when we fall off the arglist, we'll just return EOF forever
+        */
+       if (need) {
+           if (scc < 1)
+               return sc_tokid;
+           sct = *scp;
+           scp++;
+           scc--;
+           need = 0;
+       }
+       /* eat whitespace now - if we walk off the end of the argument,
+        * we'll continue, which puts us up at the top of the while loop
+        * to fetch the next argument in
+        */
+       while (isspace((unsigned char)*sct) || *sct == '_' || *sct == ',' )
+           ++sct;
+       if (!*sct) {
+           need = 1;
+           continue;
+       }
+
+       /* preserve the first character of the new token
+        */
+       sc_token[0] = *sct++;
+
+       /* then see what it is
+        */
+       if (isdigit((unsigned char)(sc_token[0]))) {
+           while (isdigit((unsigned char)(*sct)))
+               sc_token[++idx] = *sct++;
+           sc_token[++idx] = '\0';
+           return sc_tokid = NUMBER;
+       }
+       else if (isalpha((unsigned char)(sc_token[0]))) {
+           while (isalpha((unsigned char)(*sct)))
+               sc_token[++idx] = *sct++;
+           sc_token[++idx] = '\0';
+           return parse_token(sc_token);
+       }
+       else switch(sc_token[0]) {
+           case ':': return sc_tokid = COLON;
+           case '.': return sc_tokid = DOT;
+           case '+': return sc_tokid = PLUS;
+           case '-': return sc_tokid = MINUS;
+           case '/': return sc_tokid = SLASH;
+       default:
+        /*OK, we did not make it ... */
+           sct--;
+           return sc_tokid = EOF;
+       }
+    } /* while (1) */
+} /* token */
+
+
+/* 
+ * expect2() gets a token and complains if it's not the token we want
+ */
+static char *
+expect2(int desired, char *complain_fmt, ...)
+{
+    va_list ap;
+    va_start( ap, complain_fmt );
+    if (token() != desired) {
+       panic(ve( complain_fmt, ap ));
+    }
+    va_end( ap );
+    return TIME_OK;
+    
+} /* expect2 */
+
+
+/*
+ * plus_minus() is used to parse a single NUMBER TIME-UNIT pair
+ *              for the OFFSET-SPEC.
+ *              It also applies those m-guessing heuristics.
+ */
+static char *
+plus_minus(struct rrd_time_value *ptv, int doop)
+{
+    static int op = PLUS;
+    static int prev_multiplier = -1;
+    int delta;
+
+    if( doop >= 0 ) 
+      {
+      op = doop;
+      try(expect2(NUMBER,"There should be number after '%c'", op == PLUS ? '+' : '-'));
+      prev_multiplier = -1; /* reset months-minutes guessing mechanics */
+      }
+    /* if doop is < 0 then we repeat the previous op
+     * with the prefetched number */
+
+    delta = atoi(sc_token);
+
+    if( token() == MONTHS_MINUTES )
+      {
+      /* hard job to guess what does that -5m means: -5mon or -5min? */
+      switch(prev_multiplier)
+       {
+        case DAYS:
+        case WEEKS:
+        case MONTHS:
+        case YEARS:
+             sc_tokid = MONTHS;
+            break;
+
+        case SECONDS:
+        case MINUTES:
+        case HOURS:
+            sc_tokid = MINUTES;
+            break;
+
+        default:
+             if( delta < 6 ) /* it may be some other value but in the context
+                              * of RRD who needs less than 6 min deltas? */
+               sc_tokid = MONTHS;
+             else
+              sc_tokid = MINUTES;
+        }
+      }
+    prev_multiplier = sc_tokid;
+    switch (sc_tokid) {
+    case YEARS:
+           ptv->tm.tm_year += (op == PLUS) ? delta : -delta;
+           return TIME_OK;
+    case MONTHS:
+           ptv->tm.tm_mon += (op == PLUS) ? delta : -delta;
+           return TIME_OK;
+    case WEEKS:
+           delta *= 7;
+           /* FALLTHRU */
+    case DAYS:
+           ptv->tm.tm_mday += (op == PLUS) ? delta : -delta;
+           return TIME_OK;
+    case HOURS:
+           ptv->offset += (op == PLUS) ? delta*60*60 : -delta*60*60;
+           return TIME_OK;
+    case MINUTES:
+           ptv->offset += (op == PLUS) ? delta*60 : -delta*60;
+           return TIME_OK;
+    case SECONDS:
+           ptv->offset += (op == PLUS) ? delta : -delta;
+           return TIME_OK;
+    default: /*default unit is seconds */
+       ptv->offset += (op == PLUS) ? delta : -delta;
+       return TIME_OK;
+    }
+    panic(e("well-known time unit expected after %d", delta));
+    /* NORETURN */
+    return TIME_OK; /* to make compiler happy :) */
+} /* plus_minus */
+
+
+/*
+ * tod() computes the time of day (TIME-OF-DAY-SPEC)
+ */
+static char *
+tod(struct rrd_time_value *ptv)
+{
+    int hour, minute = 0;
+    int tlen;
+    /* save token status in  case we must abort */
+    int scc_sv = scc; 
+    const char *sct_sv = sct; 
+    int sc_tokid_sv = sc_tokid;
+
+    tlen = strlen(sc_token);
+    
+    /* first pick out the time of day - we assume a HH (COLON|DOT) MM time
+     */    
+    if (tlen > 2) {
+      return TIME_OK;
+    }
+    
+    hour = atoi(sc_token);
+
+    token();
+    if (sc_tokid == SLASH || sc_tokid == DOT) {
+      /* guess we are looking at a date */
+      scc = scc_sv;
+      sct = sct_sv;
+      sc_tokid = sc_tokid_sv;
+      sprintf (sc_token,"%d", hour);
+      return TIME_OK;
+    }
+    if (sc_tokid == COLON ) {
+       try(expect2(NUMBER,
+            "Parsing HH:MM syntax, expecting MM as number, got none"));
+       minute = atoi(sc_token);
+       if (minute > 59) {
+           panic(e("parsing HH:MM syntax, got MM = %d (>59!)", minute ));
+       }
+       token();
+    }
+
+    /* check if an AM or PM specifier was given
+     */
+    if (sc_tokid == AM || sc_tokid == PM) {
+       if (hour > 12) {
+           panic(e("there cannot be more than 12 AM or PM hours"));
+       }
+       if (sc_tokid == PM) {
+           if (hour != 12)     /* 12:xx PM is 12:xx, not 24:xx */
+                       hour += 12;
+       } else {
+           if (hour == 12)     /* 12:xx AM is 00:xx, not 12:xx */
+                       hour = 0;
+       }
+       token();
+    } 
+    else if (hour > 23) {
+      /* guess it was not a time then ... */
+      scc = scc_sv;
+      sct = sct_sv;
+      sc_tokid = sc_tokid_sv;
+      sprintf (sc_token,"%d", hour);
+      return TIME_OK;
+    }
+    ptv->tm.tm_hour = hour;
+    ptv->tm.tm_min = minute;
+    ptv->tm.tm_sec = 0;
+    if (ptv->tm.tm_hour == 24) {
+       ptv->tm.tm_hour = 0;
+       ptv->tm.tm_mday++;
+    }
+  return TIME_OK;
+} /* tod */
+
+
+/*
+ * assign_date() assigns a date, adjusting year as appropriate
+ */
+static char *
+assign_date(struct rrd_time_value *ptv, long mday, long mon, long year)
+{
+    if (year > 138) {
+       if (year > 1970)
+           year -= 1900;
+       else {
+           panic(e("invalid year %d (should be either 00-99 or >1900)",
+                    year));
+       }
+    } else if( year >= 0 && year < 38 ) {
+       year += 100;         /* Allow year 2000-2037 to be specified as   */
+    }                       /* 00-37 until the problem of 2038 year will */
+                            /* arise for unices with 32-bit time_t :)    */
+    if (year < 70) {
+      panic(e("won't handle dates before epoch (01/01/1970), sorry"));
+    }
+
+    ptv->tm.tm_mday = mday;
+    ptv->tm.tm_mon = mon;
+    ptv->tm.tm_year = year;
+  return TIME_OK;
+} /* assign_date */
+
+
+/* 
+ * day() picks apart DAY-SPEC-[12]
+ */
+static char *
+day(struct rrd_time_value *ptv)
+{
+    /* using time_t seems to help portability with 64bit oses */    
+    time_t mday=0, wday, mon, year = ptv->tm.tm_year;
+    int tlen;
+
+    switch (sc_tokid) {
+    case YESTERDAY:
+           ptv->tm.tm_mday--;
+           /* FALLTRHU */
+    case TODAY:        /* force ourselves to stay in today - no further processing */
+           token();
+           break;
+    case TOMORROW:
+           ptv->tm.tm_mday++;
+           token();
+           break;
+
+    case JAN: case FEB: case MAR: case APR: case MAY: case JUN:
+    case JUL: case AUG: case SEP: case OCT: case NOV: case DEC:
+           /* do month mday [year]
+            */
+           mon = (sc_tokid-JAN);
+           try(expect2(NUMBER,
+               "the day of the month should follow month name"));
+           mday = atol(sc_token);
+           if (token() == NUMBER) {
+               year = atol(sc_token);
+               token();
+           }
+           else
+               year = ptv->tm.tm_year;
+           try(assign_date(ptv, mday, mon, year));
+           break;
+
+    case SUN: case MON: case TUE:
+    case WED: case THU: case FRI:
+    case SAT:
+           /* do a particular day of the week
+            */
+           wday = (sc_tokid-SUN);
+           ptv->tm.tm_mday += (wday - ptv->tm.tm_wday);
+            token();
+           break;
+           /*
+           mday = ptv->tm.tm_mday;
+           mday += (wday - ptv->tm.tm_wday);
+           ptv->tm.tm_wday = wday;
+
+           try(assign_date(ptv, mday, ptv->tm.tm_mon, ptv->tm.tm_year));
+           break;
+           */
+
+    case NUMBER:
+           /* get numeric <sec since 1970>, MM/DD/[YY]YY, or DD.MM.[YY]YY
+            */
+           tlen = strlen(sc_token);
+           mon = atol(sc_token);
+            if (mon > 10*365*24*60*60) {
+               ptv->tm=*localtime(&mon);
+               token();
+               break;
+           }
+
+           if (mon > 19700101 && mon < 24000101){ /*works between 1900 and 2400 */
+               char  cmon[3],cmday[3],cyear[5];
+               strncpy(cyear,sc_token,4);cyear[4]='\0';              
+               year = atol(cyear);           
+               strncpy(cmon,&(sc_token[4]),2);cmon[2]='\0';
+               mon = atol(cmon);
+               strncpy(cmday,&(sc_token[6]),2);cmday[2]='\0';
+               mday = atol(cmday);
+               token();
+           } else { 
+             token();
+             
+             if (mon <= 31 && (sc_tokid == SLASH || sc_tokid == DOT)) {
+               int sep;                    
+               sep = sc_tokid;
+               try(expect2(NUMBER,"there should be %s number after '%c'",
+                          sep == DOT ? "month" : "day", sep == DOT ? '.' : '/'));
+               mday = atol(sc_token);
+               if (token() == sep) {
+                 try(expect2(NUMBER,"there should be year number after '%c'",
+                            sep == DOT ? '.' : '/'));
+                 year = atol(sc_token);
+                 token();
+               }
+               
+               /* flip months and days for European timing
+                */
+               if (sep == DOT) {
+                 long x = mday;
+                 mday = mon;
+                 mon = x;
+               }
+             }
+           }
+
+           mon--;
+           if(mon < 0 || mon > 11 ) {
+               panic(e("did you really mean month %d?", mon+1));
+           }
+           if(mday < 1 || mday > 31) {
+               panic(e("I'm afraid that %d is not a valid day of the month",
+                       mday));
+           }      
+           try(assign_date(ptv, mday, mon, year));
+           break;
+    } /* case */
+    return TIME_OK;
+} /* month */
+
+
+/* Global functions */
+
+
+/*
+ * parsetime() is the external interface that takes tspec, parses
+ * it and puts the result in the rrd_time_value structure *ptv.
+ * It can return either absolute times (these are ensured to be
+ * correct) or relative time references that are expected to be
+ * added to some absolute time value and then normalized by
+ * mktime() The return value is either TIME_OK (aka NULL) or
+ * the pointer to the error message in the case of problems
+ */
+char *
+parsetime(const char *tspec, struct rrd_time_value *ptv)
+{
+    time_t now = time(NULL);
+    int hr = 0;
+    /* this MUST be initialized to zero for midnight/noon/teatime */
+
+    Specials = VariousWords; /* initialize special words context */
+
+    try(init_scanner( 1, &tspec ));
+
+    /* establish the default time reference */
+    ptv->type = ABSOLUTE_TIME;
+    ptv->offset = 0;
+    ptv->tm = *localtime(&now);
+    ptv->tm.tm_isdst = -1; /* mk time can figure this out for us ... */
+
+    token();
+    switch (sc_tokid) {
+    case PLUS:
+    case MINUS:
+           break; /* jump to OFFSET-SPEC part */
+
+    case START:
+           ptv->type = RELATIVE_TO_START_TIME;
+           goto KeepItRelative;
+    case END:
+           ptv->type = RELATIVE_TO_END_TIME;
+        KeepItRelative:
+           ptv->tm.tm_sec  = 0;
+           ptv->tm.tm_min  = 0;
+           ptv->tm.tm_hour = 0;
+           ptv->tm.tm_mday = 0;
+           ptv->tm.tm_mon  = 0;
+           ptv->tm.tm_year = 0;
+           /* FALLTHRU */
+    case NOW:
+           {
+           int time_reference = sc_tokid;
+           token();
+           if( sc_tokid == PLUS || sc_tokid == MINUS )
+             break;
+           if( time_reference != NOW ) {
+             panic(e("'start' or 'end' MUST be followed by +|- offset"));
+           }
+           else
+             if( sc_tokid != EOF ) {
+               panic(e("if 'now' is followed by a token it must be +|- offset"));      
+             }
+           };
+           break;
+
+    /* Only absolute time specifications below */
+    case NUMBER:
+           {
+             long hour_sv = ptv->tm.tm_hour;
+             long year_sv = ptv->tm.tm_year;
+              ptv->tm.tm_hour = 30;
+              ptv->tm.tm_year = 30000;
+             try(tod(ptv))
+             try(day(ptv))
+             if ( ptv->tm.tm_hour == 30 &&  ptv->tm.tm_year != 30000 ){
+               try(tod(ptv))
+              }
+             if ( ptv->tm.tm_hour == 30 ){
+               ptv->tm.tm_hour = hour_sv;
+              }
+             if ( ptv->tm.tm_year == 30000 ){
+               ptv->tm.tm_year = year_sv;
+              }
+           };      
+            break;
+    /* fix month parsing */
+    case JAN: case FEB: case MAR: case APR: case MAY: case JUN:
+    case JUL: case AUG: case SEP: case OCT: case NOV: case DEC:
+            try(day(ptv));
+           if (sc_tokid != NUMBER) break;
+           try(tod(ptv))
+           break;
+
+           /* evil coding for TEATIME|NOON|MIDNIGHT - we've initialized
+            * hr to zero up above, then fall into this case in such a
+            * way so we add +12 +4 hours to it for teatime, +12 hours
+            * to it for noon, and nothing at all for midnight, then
+            * set our rettime to that hour before leaping into the
+            * month scanner
+            */
+    case TEATIME:
+           hr += 4;
+           /* FALLTHRU */
+    case NOON:
+           hr += 12;
+           /* FALLTHRU */
+    case MIDNIGHT:
+            /* if (ptv->tm.tm_hour >= hr) {
+               ptv->tm.tm_mday++;
+               ptv->tm.tm_wday++;
+           } */ /* shifting does not makes sense here ... noon is noon */ 
+           ptv->tm.tm_hour = hr;
+           ptv->tm.tm_min = 0;
+           ptv->tm.tm_sec = 0;
+           token();
+           try(day(ptv));
+           break;
+    default:
+           panic(e("unparsable time: %s%s",sc_token,sct));
+           break;
+    } /* ugly case statement */
+
+    /*
+     * the OFFSET-SPEC part
+     *
+     * (NOTE, the sc_tokid was prefetched for us by the previous code)
+     */
+    if( sc_tokid == PLUS || sc_tokid == MINUS ) {
+       Specials = TimeMultipliers; /* switch special words context */
+       while( sc_tokid == PLUS || sc_tokid == MINUS ||
+                              sc_tokid == NUMBER ) {
+           if( sc_tokid == NUMBER ) {
+               try(plus_minus(ptv, PREVIOUS_OP ));
+           } else
+               try(plus_minus(ptv, sc_tokid));
+           token(); /* We will get EOF eventually but that's OK, since
+                           token() will return us as many EOFs as needed */
+       }
+    }
+
+    /* now we should be at EOF */
+    if( sc_tokid != EOF ) {
+      panic(e("unparsable trailing text: '...%s%s'", sc_token, sct));
+    }
+
+    ptv->tm.tm_isdst = -1; /* for mktime to guess DST status */
+    if( ptv->type == ABSOLUTE_TIME )
+      if( mktime( &ptv->tm ) == -1 ) { /* normalize & check */
+        /* can happen for "nonexistent" times, e.g. around 3am */
+       /* when winter -> summer time correction eats a hour */
+        panic(e("the specified time is incorrect (out of range?)"));
+      }
+    EnsureMemFree();
+    return TIME_OK;
+} /* parsetime */
+
+
+int proc_start_end (struct rrd_time_value *start_tv, 
+                   struct rrd_time_value *end_tv, 
+                   time_t *start, 
+                   time_t *end){
+    if (start_tv->type == RELATIVE_TO_END_TIME  && /* same as the line above */
+       end_tv->type == RELATIVE_TO_START_TIME) {
+       rrd_set_error("the start and end times cannot be specified "
+                     "relative to each other");
+       return -1;
+    }
+
+    if (start_tv->type == RELATIVE_TO_START_TIME) {
+       rrd_set_error("the start time cannot be specified relative to itself");
+       return -1;
+    }
+
+    if (end_tv->type == RELATIVE_TO_END_TIME) {
+       rrd_set_error("the end time cannot be specified relative to itself");
+       return -1;
+    }
+
+    if( start_tv->type == RELATIVE_TO_END_TIME) {
+       struct tm tmtmp;
+       *end = mktime(&(end_tv->tm)) + end_tv->offset;    
+       tmtmp = *localtime(end); /* reinit end including offset */
+       tmtmp.tm_mday += start_tv->tm.tm_mday;
+       tmtmp.tm_mon += start_tv->tm.tm_mon;
+       tmtmp.tm_year += start_tv->tm.tm_year;  
+       *start = mktime(&tmtmp) + start_tv->offset;
+    } else {
+       *start = mktime(&(start_tv->tm)) + start_tv->offset;
+    }
+    if (end_tv->type == RELATIVE_TO_START_TIME) {
+       struct tm tmtmp;
+       *start = mktime(&(start_tv->tm)) + start_tv->offset;
+       tmtmp = *localtime(start);
+       tmtmp.tm_mday += end_tv->tm.tm_mday;
+       tmtmp.tm_mon += end_tv->tm.tm_mon;
+       tmtmp.tm_year += end_tv->tm.tm_year;    
+       *end = mktime(&tmtmp) + end_tv->offset;
+    } else {
+       *end = mktime(&(end_tv->tm)) + end_tv->offset;
+    }    
+    return 0;
+} /* proc_start_end */
+
+
+
+
+
+
+
diff --git a/src/parsetime.h b/src/parsetime.h
new file mode 100644 (file)
index 0000000..d9a34e8
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef __PARSETIME_H__
+#define __PARSETIME_H__
+
+#include <stdio.h>
+
+#include "rrd.h"
+
+#endif
diff --git a/src/pngsize.c b/src/pngsize.c
new file mode 100644 (file)
index 0000000..6b8b264
--- /dev/null
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * pngsize.c  determine the size of a PNG image
+ *****************************************************************************/
+
+#include <png.h>
+#include "rrd_tool.h"
+
+int
+PngSize(FILE *fd, long *width, long *height)
+{
+  png_structp png_read_ptr = 
+    png_create_read_struct(PNG_LIBPNG_VER_STRING, 
+                          (png_voidp)NULL,
+                               /* we would need to point to error handlers
+                                  here to do it properly */
+                          (png_error_ptr)NULL, (png_error_ptr)NULL);
+    
+  png_infop info_ptr = png_create_info_struct(png_read_ptr);
+
+  (*width)=0;
+  (*height)=0;
+
+/* this is to make compile on aix work since they seem to define jmpbuf
+   to be _jmpbuf which breaks compilation */
+
+#ifdef jmpbuf
+#undef jmpbuf
+#endif
+
+#ifndef png_jmpbuf
+#  define png_jmpbuf(png_ptr)   ((png_ptr)->jmpbuf)
+#endif
+
+  if (setjmp(png_jmpbuf(png_read_ptr))){
+    png_destroy_read_struct(&png_read_ptr, &info_ptr, (png_infopp)NULL);
+    return 0;
+  }
+
+  png_init_io(png_read_ptr,fd);
+  png_read_info(png_read_ptr, info_ptr);
+  (*width)=png_get_image_width(png_read_ptr, info_ptr);
+  (*height)=png_get_image_height(png_read_ptr, info_ptr);
+  
+  png_destroy_read_struct(&png_read_ptr, &info_ptr, NULL);
+  if (*width >0 && *height >0) 
+    return 1;
+  else
+    return 0;
+}
+
+
+
diff --git a/src/rrd.h b/src/rrd.h
new file mode 100644 (file)
index 0000000..e63236a
--- /dev/null
+++ b/src/rrd.h
@@ -0,0 +1,152 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrdlib.h   Public header file for librrd
+ *****************************************************************************
+ * $Id: rrd.h 1235 2007-11-20 00:15:07Z oetiker $
+ * $Log$
+ * Revision 1.9  2005/02/13 16:13:33  oetiker
+ * let rrd_graph return the actual value range it picked ...
+ * -- Henrik Stoerner <henrik@hswn.dk>
+ *
+ * Revision 1.8  2004/05/26 22:11:12  oetiker
+ * reduce compiler warnings. Many small fixes. -- Mike Slifcak <slif@bellsouth.net>
+ *
+ * Revision 1.7  2003/11/12 22:14:26  oetiker
+ * allow to pass an open filehandle into rrd_graph as an extra argument
+ *
+ * Revision 1.6  2003/11/11 19:46:21  oetiker
+ * replaced time_value with rrd_time_value as MacOS X introduced a struct of that name in their standard headers
+ *
+ * Revision 1.5  2003/04/25 18:35:08  jake
+ * Alternate update interface, updatev. Returns info about CDPs written to disk as result of update. Output format is similar to rrd_info, a hash of key-values.
+ *
+ * Revision 1.4  2003/04/01 22:52:23  jake
+ * Fix Win32 build. VC++ 6.0 and 7.0 now use the thread-safe code.
+ *
+ * Revision 1.3  2003/02/13 07:05:27  oetiker
+ * Find attached the patch I promised to send to you. Please note that there
+ * are three new source files (src/rrd_is_thread_safe.h, src/rrd_thread_safe.c
+ * and src/rrd_not_thread_safe.c) and the introduction of librrd_th. This
+ * library is identical to librrd, but it contains support code for per-thread
+ * global variables currently used for error information only. This is similar
+ * to how errno per-thread variables are implemented.  librrd_th must be linked
+ * alongside of libpthred
+ *
+ * There is also a new file "THREADS", holding some documentation.
+ *
+ * -- Peter Stamfest <peter@stamfest.at>
+ *
+ * Revision 1.2  2002/05/07 21:58:32  oetiker
+ * new command rrdtool xport integrated
+ * --  Wolfgang Schrimm <Wolfgang.Schrimm@urz.uni-heidelberg.de>
+ *
+ * Revision 1.1.1.1  2001/02/25 22:25:05  oetiker
+ * checkin
+ *
+ *****************************************************************************/
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+#ifndef _RRDLIB_H
+#define _RRDLIB_H
+
+#include <time.h>
+#include <stdio.h> /* for FILE */
+
+/* Transplanted from rrd_format.h */
+typedef double       rrd_value_t;         /* the data storage type is
+                                           * double */
+/* END rrd_format.h */
+
+/* main function blocks */
+int    rrd_create(int, char **);
+int    rrd_update(int, char **);
+int    rrd_graph(int, char **, char ***, int *, int *, FILE *, double *, double *);
+int    rrd_fetch(int, char **, time_t *, time_t *, unsigned long *,
+                unsigned long *, char ***, rrd_value_t **);
+int    rrd_restore(int, char **);
+int    rrd_dump(int, char **);
+int    rrd_tune(int, char **);
+time_t rrd_last(int, char **);
+time_t rrd_first(int, char **);
+int    rrd_resize(int, char **);
+char * rrd_strversion(void);
+double rrd_version(void);
+int    rrd_xport(int, char **, int *, time_t *, time_t *,
+                unsigned long *, unsigned long *,
+                char ***, rrd_value_t **);
+
+/* thread-safe (hopefully) */
+int    rrd_create_r(const char *filename,
+                   unsigned long pdp_step, time_t last_up,
+                   int argc, const char **argv);
+/* NOTE: rrd_update_r are only thread-safe if no at-style time
+   specifications get used!!! */
+
+int    rrd_update_r(const char *filename, const char *_template,
+                   int argc, const char **argv);
+int    rrd_fetch_r(const char *filename, const char* cf,
+                   time_t *start, time_t *end,
+                   unsigned long *step,
+                   unsigned long *ds_cnt,
+                   char        ***ds_namv,
+                   rrd_value_t **data);
+int    rrd_dump_r(const char *filename, char *outname);
+time_t rrd_last_r(const char *filename);
+time_t rrd_first_r(const char *filename, int rraindex);
+
+/* Transplanted from parsetime.h */
+typedef enum {
+        ABSOLUTE_TIME,
+        RELATIVE_TO_START_TIME, 
+        RELATIVE_TO_END_TIME
+} timetype;
+
+#define TIME_OK NULL
+
+struct rrd_time_value {
+  timetype type;
+  long offset;
+  struct tm tm;
+};
+
+char *parsetime(const char *spec, struct rrd_time_value *ptv);
+/* END parsetime.h */
+
+struct rrd_context {
+    int len;
+    int errlen;
+    char *lib_errstr;
+    char *rrd_error;
+};
+
+/* returns the current per-thread rrd_context */
+struct rrd_context *rrd_get_context(void);
+
+
+int proc_start_end (struct rrd_time_value *,  struct rrd_time_value *, time_t *, time_t *);
+
+/* HELPER FUNCTIONS */
+void rrd_set_error(char *,...);
+void rrd_clear_error(void);
+int  rrd_test_error(void);
+char *rrd_get_error(void);
+
+/** MULTITHREADED HELPER FUNCTIONS */
+struct rrd_context *rrd_new_context(void);
+void   rrd_free_context (struct rrd_context *buf);
+
+/* void   rrd_set_error_r  (struct rrd_context *, char *, ...); */
+/* void   rrd_clear_error_r(struct rrd_context *); */
+/* int    rrd_test_error_r (struct rrd_context *); */
+/* char  *rrd_get_error_r  (struct rrd_context *); */
+
+int  LockRRD(FILE *);
+
+#endif /* _RRDLIB_H */
+
+#ifdef  __cplusplus
+}
+#endif
diff --git a/src/rrd_afm.c b/src/rrd_afm.c
new file mode 100644 (file)
index 0000000..5277230
--- /dev/null
@@ -0,0 +1,287 @@
+/****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ ****************************************************************************
+ * rrd_afm.h  Parsing afm tables to find width of strings.
+ ****************************************************************************
+ * $Id: rrd_afm.c 1235 2007-11-20 00:15:07Z oetiker $
+*/
+
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) && !defined(HAVE_CONFIG_H)
+#include "../win32/config.h"
+#else
+#ifdef HAVE_CONFIG_H
+#include "../rrd_config.h"
+#endif
+#endif
+
+#include "rrd_afm.h"
+#include "rrd_afm_data.h"
+
+#include <stdio.h>
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "unused.h"
+
+#if 0
+# define DEBUG 1
+# define DLOG(x) fprintf x
+#else
+# define DEBUG 0
+# define DLOG(x) 
+#endif
+
+/* Adobe SVG View and Batik 1.1.1 can't handle ligatures.
+   So disable it as we just waste speed.
+   Besides, it doesn't matter much in normal text.
+*/
+#define ENABLE_LIGATURES 0
+
+static const afm_fontinfo *afm_last_used_font = NULL;
+static const char *last_unknown_font = NULL;
+
+#define is_font(p, name) \
+  (!strcmp(p->postscript_name, name) || !strcmp(p->fullname, name))
+
+static const afm_fontinfo *afm_searchfont(const char *name)
+{
+  int i;
+  const afm_fontinfo *p = afm_last_used_font;
+  if (p && is_font(p, name))
+    return p;
+  p = afm_fontinfolist;
+  for (i = 0; i < afm_fontinfo_count; i++, p++) {
+    if (is_font(p, name)) {
+      afm_last_used_font = p;
+      return p;
+    }
+  }
+  return NULL;
+}
+
+
+/* returns always a font, never NULL.
+   The rest of the code depends on the result never being NULL.
+   See rrd_afm.h */
+static const afm_fontinfo *afm_findfont(const char *name)
+{
+  const afm_fontinfo *p = afm_searchfont(name);
+  if (p)
+    return p;
+  if (!last_unknown_font || strcmp(name, last_unknown_font)) {
+         fprintf(stderr, "Can't find font '%s'\n", name);
+         last_unknown_font = name;
+  }
+  p = afm_searchfont(RRD_AFM_DEFAULT_FONT);
+  if (p)
+    return p;
+  return afm_fontinfolist; /* anything, just anything. */
+}
+
+const char *afm_get_font_postscript_name(const char* font)
+{
+  const afm_fontinfo *p = afm_findfont(font);
+  return p->postscript_name;
+}
+
+const char *afm_get_font_name(const char* font)
+{
+  const afm_fontinfo *p = afm_findfont(font);
+  return p->fullname;
+}
+
+double afm_get_ascender(const char* font, double size)
+{
+  const afm_fontinfo *p = afm_findfont(font);
+  return size * p->ascender / 1000.0;
+}
+
+double afm_get_descender(const char* font, double size)
+{
+  const afm_fontinfo *p = afm_findfont(font);
+  return size * p->descender / 1000.0;
+}
+
+static int afm_find_char_index(const afm_fontinfo *fontinfo,
+    afm_cunicode ch1)
+{
+  int idx = ch1 - 32;
+  afm_cuint16 *indexP;
+  int numIndexChars, i;
+  if (idx <= 0)
+    return 0;
+  if (idx <= 126 - 32)
+    return idx;
+  indexP = fontinfo->highchars_index;
+  if (indexP == 0)
+    return 0;
+  numIndexChars = fontinfo->highchars_count;
+  DLOG((stderr, " find highbit, num = %d\n", numIndexChars));
+  if (ch1 >= 161 && ch1 <= 255) {
+    idx = ch1 - 161;
+    DLOG((stderr, "  161, idx = %d -> %d\n", idx, indexP[idx]));
+    if (idx < numIndexChars && indexP[idx] == ch1) {
+      idx += 127 - 32;
+      DLOG((stderr, "  161-guessed ok to %d\n", idx));
+      return idx;
+    }
+  }
+  for (i = 0; i < numIndexChars; i++) {
+    DLOG((stderr, "    compares to %d -> %d\n", indexP[i], i));
+    if (indexP[i] == ch1)
+      return i + 127 - 32;
+  }
+  DLOG((stderr, "Did not find %d in highchars_index ??\n", ch1));
+  return 0;
+}
+
+#if ENABLE_LIGATURES
+static afm_cunicode afm_find_combined_ligature(const afm_fontinfo *fontinfo,
+    afm_cunicode ch1, afm_cunicode ch2)
+{
+  afm_cunicode *p = fontinfo->ligatures;
+  int num = fontinfo->ligatures_count;
+  int i;
+  if (!num)
+    return 0;
+  DLOG((stderr, " find-lig, num = %d\n", num));
+  for (i = 0; i < num; i++, p += 3) {
+    DLOG((stderr, "    lig: %d + %d -> %d (%c %c %c)\n",
+        p[0], p[1], p[2], p[0], p[1], p[2]));
+    if (ch1 == *p && ch2 == p[1]) {
+      DLOG((stderr, "   matches.\n"));
+      return p[2];
+    }
+  }
+  return 0;
+}
+#endif
+
+#define READ_ESCAPED(p, val) \
+  if ((val = *p++) == 0) { \
+    val = 254 + *p++; \
+  } else if (!--val) { \
+    val = *p++ << 8; \
+    val |= *p++; \
+  }
+
+
+static long afm_find_kern(const afm_fontinfo *fontinfo,
+    int kern_idx, afm_cunicode ch2)
+{
+  afm_cuint8 *p8 = fontinfo->kerning_data + kern_idx;
+  int num;
+  READ_ESCAPED(p8, num);
+  DLOG((stderr, " find kern, num pairs = %d\n", num));
+  while (num > 0) {
+    afm_unicode ch;
+    READ_ESCAPED(p8, ch);
+    DLOG((stderr, "     pair-char = %d\n", ch));
+    if (ch == ch2) {
+      DLOG((stderr, " got kern = %d\n", *(afm_csint8*)p8));
+      return *(afm_csint8*)p8;
+    }
+    p8++;
+    num--;
+  }
+  return 0;
+}
+
+/* measure width of a text string */
+double afm_get_text_width( double start, const char* font, double size,
+          double tabwidth, const char* text)
+{
+#ifdef HAVE_MBSTOWCS     
+    size_t clen = strlen(text) + 1;
+    wchar_t *cstr = malloc(sizeof(wchar_t) * clen); /* yes we are allocating probably too much here, I know */
+    int text_count = mbstowcs(cstr, text, clen);
+    double w;
+    if (text_count == -1)
+           text_count = mbstowcs(cstr, "Enc-Err", 6);
+#ifdef __APPLE__
+       while (text_count > 0) {
+               text_count--;
+               cstr[text_count] = afm_fix_osx_charset(cstr[text_count]); /* unsafe macro */
+       }
+#endif
+    w = afm_get_text_width_wide(start, font, size, tabwidth, cstr);
+    free(cstr);
+    return w;
+#else
+    return afm_get_text_width_wide(start, font, size, tabwidth, text);
+#endif
+}
+
+double afm_get_text_width_wide( double UNUSED(start), const char* font, double size,
+          double UNUSED(tabwidth), const afm_char* text)
+{
+  const afm_fontinfo *fontinfo = afm_findfont(font);
+  long width = 0;
+  double widthf;
+  const afm_char *up = text;
+  DLOG((stderr, "================= %s\n", text));
+  if (fontinfo == NULL) {
+      while (*up)
+         up++;
+    return size * (up - text);
+  }
+  while (1) {
+    afm_unicode ch1, ch2;
+    int idx1, kern_idx;
+    if ((ch1 = *up) == 0)
+        break;
+    ch2 = *++up;
+    DLOG((stderr, "------------- Loop: %d + %d (%c%c)   at %d\n",
+          ch1, ch2, ch1, ch2 ? ch2 : ' ',
+         (up - (const unsigned char*)text) - 1));
+    idx1 = afm_find_char_index(fontinfo, ch1);
+    DLOG((stderr, "  idx1 = %d\n", idx1));
+#if ENABLE_LIGATURES
+    if (ch2) {
+      int ch1_new = afm_find_combined_ligature(fontinfo, ch1, ch2);
+      DLOG((stderr, "  lig-ch = %d\n", ch1_new));
+      if (ch1_new) {
+        ch1 = ch1_new;
+        idx1 = afm_find_char_index(fontinfo, ch1);
+        ch2 = *++up;
+        DLOG((stderr, "  -> idx1 = %d, ch2 = %d (%c)\n", 
+            idx1, ch2, ch2 ? ch2 : ' '));
+      }
+    }
+#endif
+    width += fontinfo->widths[idx1];
+    DLOG((stderr, "Plain width of %d = %d\n", ch1, fontinfo->widths[idx1]));
+    if (fontinfo->kerning_index && ch2) {
+      kern_idx = fontinfo->kerning_index[idx1];
+      DLOG((stderr, "    kern_idx = %d\n", kern_idx));
+      if (kern_idx > 0)
+        width += afm_find_kern(fontinfo, kern_idx, ch2);
+    }
+  }
+  widthf = (width * 6 / 1000.0) * size;
+  DLOG((stderr, "Returns %ld (%ld) -> %f\n", width, width * 6, widthf));
+  return widthf;
+}
+
+#ifdef __APPLE__
+const unsigned char afm_mac2iso[128] = {
+  '\xC4', '\xC5', '\xC7', '\xC9', '\xD1', '\xD6', '\xDC', '\xE1', /* 80 */
+  '\xE0', '\xE2', '\xE4', '\xE3', '\xE5', '\xE7', '\xE9', '\xE8', /* 88 */
+  '\xEA', '\xEB', '\xED', '\xEC', '\xEE', '\xEF', '\xF1', '\xF3', /* 90 */
+  '\xF2', '\xF4', '\xF6', '\xF5', '\xFA', '\xF9', '\xFB', '\xFC', /* 98 */
+  '\xDD', '\xB0', '\xA2', '\xA3', '\xA7', ' ',    '\xB6', '\xDF', /* A0 */
+  '\xAE', '\xA9', ' ',    '\xB4', '\xA8', ' ',    '\xC6', '\xD8', /* A8 */
+  ' ',    '\xB1', '\xBE', ' ',    '\xA5', '\xB5', ' ',    ' ',    /* B0 */
+  '\xBD', '\xBC', ' ',    '\xAA', '\xBA', ' ',    '\xE6', '\xF8', /* B8 */
+  '\xBF', '\xA1', '\xAC', ' ',    ' ',    ' ',    ' ',    '\xAB', /* C0 */
+  '\xBB', ' ',    '\xA0', '\xC0', '\xC3', '\xD5', ' ',    '\xA6', /* C8 */
+  '\xAD', ' ',    '"',    '"',    '\'',   '\'',   '\xF7', '\xD7', /* D0 */
+  '\xFF', ' ',    ' ',    '\xA4', '\xD0', '\xF0', '\xDE', '\xFE', /* D8 */
+  '\xFD', '\xB7', ' ',    ' ',    ' ',    '\xC2', '\xCA', '\xC1', /* E0 */
+  '\xCB', '\xC8', '\xCD', '\xCE', '\xCF', '\xCC', '\xD3', '\xD4', /* E8 */
+  ' ',    '\xD2', '\xDA', '\xDB', '\xD9', ' ',    ' ',    ' ',    /* F0 */
+  '\xAF', ' ',    ' ',    ' ',    '\xB8', ' ',    ' ',    ' ',    /* F8 */
+};
+#endif
diff --git a/src/rrd_afm.h b/src/rrd_afm.h
new file mode 100644 (file)
index 0000000..a9f28d8
--- /dev/null
@@ -0,0 +1,54 @@
+/****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ ****************************************************************************
+ * rrd_afm.h  Parsing afm tables to find width of strings.
+ ****************************************************************************/
+
+#ifndef  RRD_AFM_H
+#define RRD_AFM_H
+
+#include <stdlib.h>
+#ifdef HAVE_MBSTOWCS
+#define afm_char wchar_t
+#else
+#define afm_char unsigned char
+#endif
+/*
+   If the font specified by the name parameter in the routes below
+   is not found
+   (because it is not compiled into rrd_afm_data.c by compile_afm.pl)
+   the font specified by RRD_AFM_DEFAULT_FONT will be used.
+   If it is not installed, it uses the first font compiled
+   into rrd_afm_data.c
+   So they will always use some font.
+*/
+
+#define RRD_AFM_DEFAULT_FONT "Courier"
+
+/* measure width of a text string */
+/* fontname can be full name or postscript name */
+double afm_get_text_width( double start, const char* font, double size,
+                           double tabwidth, const char* text);
+double afm_get_text_width_wide( double start, const char* font, double size,
+                           double tabwidth, const afm_char* text);
+
+double afm_get_ascender(const char* font, double size);
+double afm_get_descender(const char* font, double size);
+
+/* get postscript name from fullname or postscript name */
+const char *afm_get_font_postscript_name ( const char* font);
+const char *afm_get_font_name(const char* font);
+
+/* cc -E -dM /dev/null */
+#ifdef __APPLE__
+/* need charset conversion from macintosh to unicode. */
+extern const unsigned char afm_mac2iso[128];
+#define afm_fix_osx_charset(c) \
+       ( (c) >= 128 && (c) <= 255 ? afm_mac2iso[(c) - 128] : (c))
+#else
+/* UNSAFE macro */
+#define afm_fix_osx_charset(x) (x)
+#endif
+
+#endif
diff --git a/src/rrd_afm_data.c b/src/rrd_afm_data.c
new file mode 100644 (file)
index 0000000..ab7f1aa
--- /dev/null
@@ -0,0 +1,3338 @@
+/****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ ****************************************************************************
+ * rrd_afm_data.c  Encoded afm (Adobe Font Metrics) for selected fonts.
+ ****************************************************************************
+ *
+ * THIS FILE IS AUTOGENERATED BY PERL. DO NOT EDIT.
+ *
+ ****************************************************************************/
+
+#include "rrd_afm_data.h"
+#include <stdlib.h>
+
+
+
+/* ------------------------------------------------------------------*/
+/* FontName: Courier */
+/* FullName: Courier */
+/* FamilyName: Courier */
+static afm_cuint8 afm_Courier_widths[] = { /* 315 */
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100
+};
+static afm_cuint16 afm_Courier_highchars_index[] = { /* 220 */
+  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
+  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
+  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
+  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
+  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
+  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
+  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
+  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
+  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
+  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
+  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
+  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
+  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
+  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
+  64257,64258
+};
+static afm_cunicode afm_Courier_ligatures[] = { /* 3 */
+  102,105,64257
+};
+
+
+/* ------------------------------------------------------------------*/
+/* FontName: Courier-Bold */
+/* FullName: Courier Bold */
+/* FamilyName: Courier */
+static afm_cuint8 afm_Courier_Bold_widths[] = { /* 315 */
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100
+};
+static afm_cuint16 afm_Courier_Bold_highchars_index[] = { /* 220 */
+  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
+  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
+  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
+  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
+  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
+  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
+  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
+  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
+  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
+  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
+  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
+  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
+  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
+  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
+  64257,64258
+};
+static afm_cunicode afm_Courier_Bold_ligatures[] = { /* 3 */
+  102,105,64257
+};
+
+
+/* ------------------------------------------------------------------*/
+/* FontName: Courier-BoldOblique */
+/* FullName: Courier Bold Oblique */
+/* FamilyName: Courier */
+static afm_cuint8 afm_Courier_BoldOblique_widths[] = { /* 315 */
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100
+};
+static afm_cuint16 afm_Courier_BoldOblique_highchars_index[] = { /* 220 */
+  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
+  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
+  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
+  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
+  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
+  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
+  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
+  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
+  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
+  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
+  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
+  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
+  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
+  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
+  64257,64258
+};
+static afm_cunicode afm_Courier_BoldOblique_ligatures[] = { /* 3 */
+  102,105,64257
+};
+
+
+/* ------------------------------------------------------------------*/
+/* FontName: Courier-Oblique */
+/* FullName: Courier Oblique */
+/* FamilyName: Courier */
+static afm_cuint8 afm_Courier_Oblique_widths[] = { /* 315 */
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100
+};
+static afm_cuint16 afm_Courier_Oblique_highchars_index[] = { /* 220 */
+  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
+  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
+  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
+  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
+  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
+  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
+  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
+  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
+  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
+  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
+  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
+  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
+  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
+  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
+  64257,64258
+};
+static afm_cunicode afm_Courier_Oblique_ligatures[] = { /* 3 */
+  102,105,64257
+};
+
+
+/* ------------------------------------------------------------------*/
+/* FontName: Helvetica */
+/* FullName: Helvetica */
+/* FamilyName: Helvetica */
+static afm_cuint8 afm_Helvetica_widths[] = { /* 315 */
+  46,46,59,93,93,148,111,32,56,56,65,97,46,56,46,46,93,93,93,93,93,
+  93,93,93,93,93,46,46,97,97,97,93,169,111,111,120,120,111,102,130,
+  120,46,83,111,93,139,120,130,111,130,120,111,102,120,111,157,111,
+  111,102,46,46,46,78,93,56,93,93,83,93,93,46,93,93,37,37,83,37,139,
+  93,93,93,93,56,83,46,93,83,120,83,83,83,56,43,56,97,56,93,93,93,
+  93,43,93,56,123,62,93,97,123,56,67,97,56,56,56,93,90,46,56,56,61,
+  93,139,139,139,102,111,111,111,111,111,111,167,120,111,111,111,111,
+  46,46,46,46,120,120,130,130,130,130,130,97,130,120,120,120,120,111,
+  111,102,93,93,93,93,93,93,148,83,93,93,93,93,46,46,46,46,93,93,93,
+  93,93,93,93,97,102,93,93,93,93,83,93,83,111,93,111,93,111,93,120,
+  83,120,83,120,107,120,93,111,93,111,93,111,93,111,93,130,93,130,
+  93,46,46,46,37,46,46,111,83,93,37,93,37,93,50,93,37,120,93,120,93,
+  120,93,130,93,130,93,167,157,120,56,120,56,120,56,111,83,111,83,
+  111,83,102,46,102,53,120,93,120,93,120,93,120,93,111,102,83,102,
+  83,102,83,93,111,83,56,56,56,56,56,56,56,56,93,167,37,37,37,56,56,
+  56,93,93,58,167,167,56,56,28,93,167,79,102,100,97,76,92,92,92,79,
+  42,83,83
+};
+static afm_sint16 afm_Helvetica_kerning_index[] = { /* 315 */
+  1,0,0,0,0,0,0,0,0,0,0,0,29,0,38,0,0,0,0,0,0,0,0,0,0,0,49,52,0,0,
+  0,0,0,55,170,197,202,0,241,0,0,0,345,418,510,0,0,545,594,687,710,
+  772,777,938,966,1115,0,1259,0,0,0,0,0,0,0,1407,1419,1468,0,1476,
+  1494,1575,1587,0,0,1595,0,1638,1668,1700,1718,0,1730,1847,0,0,1854,
+  1924,1994,2017,2087,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,0,0,0,0,0,0,0,0,0,0,2130,2245,2360,2475,2590,2705,0,2820,0,0,
+  0,0,0,0,0,0,0,0,2825,2874,2923,2972,3021,0,3070,3119,3147,3175,3203,
+  3231,0,0,3379,3391,3403,3415,3427,3439,0,3451,3459,3477,3495,3513,
+  0,0,0,0,0,3531,3563,3581,3599,3617,3635,0,3653,0,0,0,0,3882,0,3952,
+  4022,4137,4149,4264,4276,4391,4403,4408,4416,4421,4429,0,4468,0,
+  0,4507,0,4525,0,4543,0,4561,0,4579,0,4591,0,0,0,0,0,0,4603,4695,
+  4738,0,4773,0,4808,0,4843,0,0,4878,0,4910,0,4942,4974,5023,5041,
+  5090,0,0,5108,5170,5287,5349,5466,5528,5645,5650,5657,5662,5669,
+  5674,5681,0,5842,0,6003,0,6031,0,6059,0,6087,0,6115,0,6263,0,6306,
+  0,6349,0,6392,6397,0,0,0,0,0,0,0,0,0,0,6404,6409,0,0,6447,0,0,0,
+  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+};
+static afm_cuint8 afm_Helvetica_kerning_data[] = { /* 6450 */
+  42,11,85,249,87,249,88,250,90,242,222,242,0,100,249,0,102,249,0,
+  122,242,1,32,24,247,1,32,28,252,3,1,32,25,240,1,32,29,240,4,33,247,
+  1,32,25,240,1,32,29,240,2,33,249,2,33,249,49,68,252,72,252,80,252,
+  82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,250,120,250,
+  122,250,200,252,211,252,212,252,213,252,214,252,215,252,217,252,
+  218,249,219,249,220,249,221,249,222,240,250,252,251,252,252,252,
+  253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,0,78,
+  252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,249,0,
+  113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,12,45,
+  254,47,254,86,255,218,255,219,255,220,255,221,255,0,108,255,0,112,
+  255,0,114,255,0,116,255,3,45,252,47,252,18,45,245,47,245,66,250,
+  87,245,88,250,90,242,193,250,194,250,195,250,196,250,197,250,198,
+  250,222,242,0,2,250,0,4,250,0,6,250,0,122,242,45,45,232,47,232,66,
+  244,98,249,102,252,112,252,115,249,193,244,194,244,195,244,196,244,
+  197,244,198,244,225,249,226,249,227,249,228,249,229,249,230,249,
+  233,252,234,252,235,252,236,252,243,252,244,252,245,252,246,252,
+  247,252,249,252,0,2,244,0,3,249,0,4,244,0,5,249,0,6,244,0,7,249,
+  0,21,252,0,25,252,0,27,252,0,29,252,0,79,252,0,83,252,0,87,249,0,
+  89,249,0,91,249,32,45,252,47,252,66,254,98,254,118,254,193,254,194,
+  254,195,254,196,254,197,254,198,254,225,254,226,254,227,254,228,
+  254,229,254,230,254,250,254,251,254,252,254,253,254,0,2,254,0,3,
+  254,0,4,254,0,5,254,0,6,254,0,7,254,0,109,254,0,113,254,0,115,254,
+  0,117,254,40,80,249,102,250,112,250,118,252,122,249,211,249,212,
+  249,213,249,214,249,215,249,217,249,233,250,234,250,235,250,236,
+  250,243,250,244,250,245,250,246,250,247,250,249,250,250,252,251,
+  252,252,252,253,252,254,249,0,1,249,0,21,250,0,25,250,0,27,250,0,
+  29,250,0,78,249,0,79,250,0,82,249,0,83,250,0,109,252,0,113,252,0,
+  115,252,0,117,252,14,85,239,87,239,88,245,90,234,122,252,222,234,
+  254,252,0,1,252,0,100,239,0,102,239,0,122,234,1,32,25,230,1,32,29,
+  234,22,45,250,47,250,66,254,85,250,87,249,88,252,89,247,90,245,193,
+  254,194,254,195,254,196,254,197,254,198,254,222,245,0,2,254,0,4,
+  254,0,6,254,0,100,250,0,102,250,0,122,245,41,45,227,47,227,66,237,
+  98,250,102,249,112,249,193,237,194,237,195,237,196,237,197,237,198,
+  237,225,250,226,250,227,250,228,250,229,250,230,250,233,249,234,
+  249,235,249,236,249,243,249,244,249,245,249,246,249,247,249,249,
+  249,0,2,237,0,3,250,0,4,237,0,5,250,0,6,237,0,7,250,0,21,249,0,25,
+  249,0,27,249,0,29,249,0,79,249,0,83,249,10,86,255,218,255,219,255,
+  220,255,221,255,0,108,255,0,112,255,0,114,255,0,116,255,27,80,254,
+  85,252,86,250,87,249,88,252,90,249,211,254,212,254,213,254,214,254,
+  215,254,217,254,218,250,219,250,220,250,221,250,222,249,0,78,254,
+  0,82,254,0,100,252,0,102,252,0,108,250,0,112,250,0,114,250,0,116,
+  250,0,122,249,3,45,254,47,254,70,45,237,46,234,47,237,59,254,60,
+  254,66,237,80,250,98,237,102,237,112,237,115,237,118,237,120,237,
+  122,237,193,237,194,237,195,237,196,237,197,237,198,237,211,250,
+  212,250,213,250,214,250,215,250,217,250,225,237,226,237,227,237,
+  228,247,229,237,230,237,233,247,234,237,235,237,236,237,243,237,
+  244,237,245,237,246,247,247,237,249,237,250,237,251,237,252,237,
+  253,237,254,237,0,1,247,0,2,237,0,3,247,0,4,237,0,5,247,0,6,237,
+  0,7,237,0,21,247,0,25,237,0,27,237,0,29,237,0,78,250,0,79,247,0,
+  82,250,0,83,237,0,87,237,0,89,237,0,91,237,0,109,247,0,113,237,0,
+  115,237,0,117,237,13,45,250,47,250,66,250,193,250,194,250,195,250,
+  196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,65,45,236,46,244,
+  47,236,59,250,60,250,66,244,72,250,80,250,98,245,102,244,112,244,
+  118,245,193,244,194,244,195,244,196,244,197,244,198,244,211,250,
+  212,250,213,250,214,250,215,250,217,250,225,245,226,245,227,245,
+  228,245,229,245,230,245,233,244,234,244,235,244,236,244,243,244,
+  244,244,245,244,246,244,247,244,249,244,250,245,251,245,252,245,
+  253,245,0,2,244,0,3,245,0,4,244,0,5,245,0,6,244,0,7,245,0,21,244,
+  0,25,244,0,27,244,0,29,244,0,32,250,0,36,250,0,78,250,0,79,244,0,
+  82,250,0,83,244,0,109,245,0,113,245,0,115,245,0,117,245,63,45,244,
+  46,250,47,244,66,249,80,254,98,250,102,252,112,252,118,252,122,254,
+  193,249,194,249,195,249,196,249,197,249,198,249,211,254,212,254,
+  213,254,214,254,215,254,217,254,225,250,226,250,227,250,228,250,
+  229,250,230,250,233,252,234,252,235,252,236,252,243,252,244,252,
+  245,252,246,252,247,252,249,252,250,252,251,252,252,252,253,252,
+  254,254,0,1,254,0,2,249,0,3,250,0,4,249,0,5,250,0,6,249,0,7,250,
+  0,21,252,0,25,252,0,27,252,0,29,252,0,78,254,0,79,252,0,82,254,0,
+  83,252,0,109,252,0,113,252,0,115,252,0,117,252,65,45,234,46,234,
+  47,234,59,247,60,247,66,239,80,243,98,234,102,234,106,254,112,234,
+  118,239,193,239,194,239,195,239,196,239,197,239,198,239,211,243,
+  212,243,213,243,214,243,215,243,217,243,225,234,226,234,227,234,
+  228,234,229,234,230,234,233,234,234,234,235,234,236,234,238,254,
+  243,234,244,234,245,234,246,234,247,234,249,234,250,239,251,239,
+  252,239,253,239,0,2,239,0,3,245,0,4,239,0,5,245,0,6,239,0,7,234,
+  0,21,245,0,25,234,0,27,234,0,29,234,0,49,254,0,78,243,0,79,234,0,
+  82,243,0,83,234,0,109,239,0,113,239,0,115,239,0,117,239,6,119,254,
+  120,254,122,252,254,252,0,1,252,21,45,250,47,250,99,255,109,254,
+  118,254,119,254,122,254,250,254,251,254,252,254,253,254,254,254,
+  0,1,254,0,60,254,0,62,254,0,68,254,0,109,254,0,113,254,0,115,254,
+  0,117,254,4,45,254,108,254,0,57,254,9,45,254,47,254,119,252,120,
+  254,121,252,122,254,254,254,0,1,254,34,45,252,47,252,98,252,102,
+  252,112,252,225,252,226,252,227,252,228,252,229,252,230,252,233,
+  252,234,252,235,252,236,252,243,252,244,252,245,252,246,252,247,
+  252,249,252,0,3,252,0,5,252,0,7,252,0,21,252,0,25,252,0,27,252,0,
+  29,252,0,51,252,0,79,252,0,83,252,1,32,25,8,1,32,29,10,5,115,255,
+  0,87,255,0,89,255,0,91,255,4,122,252,254,252,0,1,252,19,102,254,
+  112,254,233,254,234,254,235,254,236,254,243,254,244,254,245,254,
+  246,254,247,254,249,254,0,21,254,0,25,254,0,27,254,0,29,254,0,79,
+  254,0,83,254,13,118,255,122,254,250,255,251,255,252,255,253,255,
+  254,254,0,1,254,0,109,255,0,113,255,0,115,255,0,117,255,14,118,255,
+  119,254,122,254,250,255,251,255,252,255,253,255,254,254,0,1,254,
+  0,109,255,0,113,255,0,115,255,0,117,255,9,45,250,47,250,119,254,
+  120,254,121,252,122,252,254,252,0,1,252,6,45,251,47,251,122,252,
+  254,252,0,1,252,50,45,249,47,249,59,5,60,5,98,255,106,3,108,3,109,
+  3,110,4,111,4,113,5,117,7,118,3,119,5,122,5,225,255,226,255,227,
+  255,228,255,229,255,230,255,237,3,238,3,239,3,240,3,242,4,250,3,
+  251,3,252,3,253,3,254,5,0,1,5,0,3,255,0,5,255,0,7,255,0,45,3,0,49,
+  3,0,57,3,0,60,3,0,62,3,0,68,3,0,70,4,0,72,4,0,74,4,0,101,7,0,109,
+  3,0,113,3,0,115,3,0,117,3,4,45,254,47,254,120,252,31,45,244,47,244,
+  98,253,102,253,112,253,225,253,226,253,227,253,228,253,229,253,230,
+  253,233,253,234,253,235,253,236,253,243,253,244,253,245,253,246,
+  253,247,253,249,253,0,3,253,0,5,253,0,7,253,0,21,253,0,25,253,0,
+  27,253,0,29,253,0,79,253,0,83,253,31,45,247,47,247,98,254,102,255,
+  112,255,225,254,226,254,227,254,228,254,229,254,230,254,233,255,
+  234,255,235,255,236,255,243,255,244,255,245,255,246,255,247,255,
+  249,255,0,3,254,0,5,254,0,7,254,0,21,255,0,25,255,0,27,255,0,29,
+  255,0,79,255,0,83,255,10,102,252,233,252,234,252,235,252,236,252,
+  0,21,252,0,25,252,0,27,252,0,29,252,31,45,240,47,240,98,254,102,
+  254,112,254,225,254,226,254,227,254,228,254,229,254,230,254,233,
+  254,234,254,235,254,236,254,243,254,244,254,245,254,246,254,247,
+  254,249,254,0,3,254,0,5,254,0,7,254,0,21,254,0,25,254,0,27,254,0,
+  29,254,0,79,254,0,83,254,19,102,254,112,254,233,254,234,254,235,
+  254,236,254,243,254,244,254,245,254,246,254,247,254,249,254,0,21,
+  254,0,25,254,0,27,254,0,29,254,0,79,254,0,83,254,49,68,252,72,252,
+  80,252,82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,250,
+  120,250,122,250,200,252,211,252,212,252,213,252,214,252,215,252,
+  217,252,218,249,219,249,220,249,221,249,222,240,250,252,251,252,
+  252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,
+  0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,
+  249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,
+  49,68,252,72,252,80,252,82,252,85,237,86,249,87,245,88,249,90,240,
+  118,252,119,250,120,250,122,250,200,252,211,252,212,252,213,252,
+  214,252,215,252,217,252,218,249,219,249,220,249,221,249,222,240,
+  250,252,251,252,252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,
+  0,32,252,0,36,252,0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,
+  0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,
+  252,0,122,240,49,68,252,72,252,80,252,82,252,85,237,86,249,87,245,
+  88,249,90,240,118,252,119,250,120,250,122,250,200,252,211,252,212,
+  252,213,252,214,252,215,252,217,252,218,249,219,249,220,249,221,
+  249,222,240,250,252,251,252,252,252,253,252,254,250,0,1,250,0,8,
+  252,0,14,252,0,32,252,0,36,252,0,78,252,0,82,252,0,100,237,0,102,
+  237,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,
+  0,116,249,0,117,252,0,122,240,49,68,252,72,252,80,252,82,252,85,
+  237,86,249,87,245,88,249,90,240,118,252,119,250,120,250,122,250,
+  200,252,211,252,212,252,213,252,214,252,215,252,217,252,218,249,
+  219,249,220,249,221,249,222,240,250,252,251,252,252,252,253,252,
+  254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,0,78,252,0,82,
+  252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,249,0,113,252,
+  0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,49,68,252,72,252,
+  80,252,82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,250,
+  120,250,122,250,200,252,211,252,212,252,213,252,214,252,215,252,
+  217,252,218,249,219,249,220,249,221,249,222,240,250,252,251,252,
+  252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,
+  0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,
+  249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,
+  49,68,252,72,252,80,252,82,252,85,237,86,249,87,245,88,249,90,240,
+  118,252,119,250,120,250,122,250,200,252,211,252,212,252,213,252,
+  214,252,215,252,217,252,218,249,219,249,220,249,221,249,222,240,
+  250,252,251,252,252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,
+  0,32,252,0,36,252,0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,
+  0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,
+  252,0,122,240,3,45,252,47,252,22,45,250,47,250,66,254,85,250,87,
+  249,88,252,89,247,90,245,193,254,194,254,195,254,196,254,197,254,
+  198,254,222,245,0,2,254,0,4,254,0,6,254,0,100,250,0,102,250,0,122,
+  245,22,45,250,47,250,66,254,85,250,87,249,88,252,89,247,90,245,193,
+  254,194,254,195,254,196,254,197,254,198,254,222,245,0,2,254,0,4,
+  254,0,6,254,0,100,250,0,102,250,0,122,245,22,45,250,47,250,66,254,
+  85,250,87,249,88,252,89,247,90,245,193,254,194,254,195,254,196,254,
+  197,254,198,254,222,245,0,2,254,0,4,254,0,6,254,0,100,250,0,102,
+  250,0,122,245,22,45,250,47,250,66,254,85,250,87,249,88,252,89,247,
+  90,245,193,254,194,254,195,254,196,254,197,254,198,254,222,245,0,
+  2,254,0,4,254,0,6,254,0,100,250,0,102,250,0,122,245,22,45,250,47,
+  250,66,254,85,250,87,249,88,252,89,247,90,245,193,254,194,254,195,
+  254,196,254,197,254,198,254,222,245,0,2,254,0,4,254,0,6,254,0,100,
+  250,0,102,250,0,122,245,22,45,250,47,250,66,254,85,250,87,249,88,
+  252,89,247,90,245,193,254,194,254,195,254,196,254,197,254,198,254,
+  222,245,0,2,254,0,4,254,0,6,254,0,100,250,0,102,250,0,122,245,13,
+  45,250,47,250,66,250,193,250,194,250,195,250,196,250,197,250,198,
+  250,0,2,250,0,4,250,0,6,250,13,45,250,47,250,66,250,193,250,194,
+  250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,13,45,
+  250,47,250,66,250,193,250,194,250,195,250,196,250,197,250,198,250,
+  0,2,250,0,4,250,0,6,250,13,45,250,47,250,66,250,193,250,194,250,
+  195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,65,45,234,
+  46,234,47,234,59,247,60,247,66,239,80,243,98,234,102,234,106,254,
+  112,234,118,239,193,239,194,239,195,239,196,239,197,239,198,239,
+  211,243,212,243,213,243,214,243,215,243,217,243,225,234,226,234,
+  227,234,228,245,229,234,230,234,233,234,234,234,235,234,236,234,
+  238,254,243,234,244,234,245,234,246,234,247,234,249,234,250,239,
+  251,239,252,239,253,239,0,2,239,0,3,245,0,4,239,0,5,245,0,6,239,
+  0,7,234,0,21,245,0,25,234,0,27,234,0,29,234,0,49,254,0,78,243,0,
+  79,245,0,82,243,0,83,234,0,109,239,0,113,239,0,115,239,0,117,239,
+  6,119,254,120,254,122,252,254,252,0,1,252,6,119,254,120,254,122,
+  252,254,252,0,1,252,6,119,254,120,254,122,252,254,252,0,1,252,6,
+  119,254,120,254,122,252,254,252,0,1,252,6,119,254,120,254,122,252,
+  254,252,0,1,252,6,119,254,120,254,122,252,254,252,0,1,252,4,45,254,
+  108,254,0,57,254,9,45,254,47,254,119,252,120,254,121,252,122,254,
+  254,254,0,1,254,9,45,254,47,254,119,252,120,254,121,252,122,254,
+  254,254,0,1,254,9,45,254,47,254,119,252,120,254,121,252,122,254,
+  254,254,0,1,254,9,45,254,47,254,119,252,120,254,121,252,122,254,
+  254,254,0,1,254,14,118,255,119,254,122,254,250,255,251,255,252,255,
+  253,255,254,254,0,1,254,0,109,255,0,113,255,0,115,255,0,117,255,
+  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
+  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
+  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
+  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
+  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
+  95,45,241,47,241,98,248,99,248,100,248,101,248,102,248,103,248,104,
+  248,105,248,106,248,107,248,108,248,109,248,110,248,111,248,112,
+  248,113,248,114,248,115,248,116,248,117,248,118,248,119,245,120,
+  245,121,243,122,245,123,248,225,248,226,248,227,248,228,248,229,
+  248,230,248,232,248,233,248,234,248,235,248,236,248,237,248,238,
+  248,239,248,240,248,242,248,243,248,244,248,245,248,246,248,247,
+  248,249,248,250,248,251,248,252,248,253,248,254,245,0,1,245,0,3,
+  248,0,5,248,0,7,248,0,9,248,0,15,248,0,19,248,0,21,248,0,25,248,
+  0,27,248,0,29,248,0,33,248,0,37,248,0,45,248,0,49,248,0,57,248,0,
+  60,248,0,62,248,0,68,248,0,70,248,0,72,248,0,74,248,0,79,248,0,83,
+  248,0,87,248,0,89,248,0,91,248,0,93,248,0,97,248,0,99,248,0,101,
+  248,0,109,248,0,113,248,0,115,248,0,117,248,0,124,248,0,126,248,
+  0,128,248,1,2,25,248,31,45,240,47,240,98,254,102,254,112,254,225,
+  254,226,254,227,254,228,254,229,254,230,254,233,254,234,254,235,
+  254,236,254,243,254,244,254,245,254,246,254,247,254,249,254,0,3,
+  254,0,5,254,0,7,254,0,21,254,0,25,254,0,27,254,0,29,254,0,79,254,
+  0,83,254,31,45,240,47,240,98,254,102,254,112,254,225,254,226,254,
+  227,254,228,254,229,254,230,254,233,254,234,254,235,254,236,254,
+  243,254,244,254,245,254,246,254,247,254,249,254,0,3,254,0,5,254,
+  0,7,254,0,21,254,0,25,254,0,27,254,0,29,254,0,79,254,0,83,254,49,
+  68,252,72,252,80,252,82,252,85,237,86,249,87,245,88,249,90,240,118,
+  252,119,250,120,250,122,250,200,252,211,252,212,252,213,252,214,
+  252,215,252,217,252,218,249,219,249,220,249,221,249,222,240,250,
+  252,251,252,252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,
+  252,0,36,252,0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,
+  252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,
+  0,122,240,6,119,254,120,254,122,252,254,252,0,1,252,49,68,252,72,
+  252,80,252,82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,
+  250,120,250,122,250,200,252,211,252,212,252,213,252,214,252,215,
+  252,217,252,218,249,219,249,220,249,221,249,222,240,250,252,251,
+  252,252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,
+  36,252,0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,
+  0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,
+  240,6,119,254,120,254,122,252,254,252,0,1,252,49,68,252,72,252,80,
+  252,82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,250,120,
+  250,122,250,200,252,211,252,212,252,213,252,214,252,215,252,217,
+  252,218,249,219,249,220,249,221,249,222,240,250,252,251,252,252,
+  252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,0,
+  78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,249,
+  0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,6,119,
+  254,120,254,122,252,254,252,0,1,252,3,45,252,47,252,4,45,254,108,
+  254,0,57,254,3,45,252,47,252,4,45,254,108,254,0,57,254,18,45,245,
+  47,245,66,250,87,245,88,250,90,242,193,250,194,250,195,250,196,250,
+  197,250,198,250,222,242,0,2,250,0,4,250,0,6,250,0,122,242,18,45,
+  245,47,245,66,250,87,245,88,250,90,242,193,250,194,250,195,250,196,
+  250,197,250,198,250,222,242,0,2,250,0,4,250,0,6,250,0,122,242,9,
+  45,254,47,254,119,252,120,254,121,252,122,254,254,254,0,1,254,9,
+  45,254,47,254,119,252,120,254,121,252,122,254,254,254,0,1,254,9,
+  45,254,47,254,119,252,120,254,121,252,122,254,254,254,0,1,254,9,
+  45,254,47,254,119,252,120,254,121,252,122,254,254,254,0,1,254,5,
+  115,255,0,87,255,0,89,255,0,91,255,5,115,255,0,87,255,0,89,255,0,
+  91,255,40,80,249,102,250,112,250,118,252,122,249,211,249,212,249,
+  213,249,214,249,215,249,217,249,233,250,234,250,235,250,236,250,
+  243,250,244,250,245,250,246,250,247,250,249,250,250,252,251,252,
+  252,252,253,252,254,249,0,1,249,0,21,250,0,25,250,0,27,250,0,29,
+  250,0,78,249,0,79,250,0,82,249,0,83,250,0,109,252,0,113,252,0,115,
+  252,0,117,252,19,102,254,112,254,233,254,234,254,235,254,236,254,
+  243,254,244,254,245,254,246,254,247,254,249,254,0,21,254,0,25,254,
+  0,27,254,0,29,254,0,79,254,0,83,254,14,85,239,87,239,88,245,90,234,
+  122,252,222,234,254,252,0,1,252,0,100,239,0,102,239,0,122,234,1,
+  32,25,230,1,32,29,234,14,85,239,87,239,88,245,90,234,122,252,222,
+  234,254,252,0,1,252,0,100,239,0,102,239,0,122,234,1,32,25,230,1,
+  32,29,234,14,85,239,87,239,88,245,90,234,122,252,222,234,254,252,
+  0,1,252,0,100,239,0,102,239,0,122,234,1,32,25,230,1,32,29,234,14,
+  85,239,87,239,88,245,90,234,122,252,222,234,254,252,0,1,252,0,100,
+  239,0,102,239,0,122,234,1,32,25,230,1,32,29,234,14,118,255,119,254,
+  122,254,250,255,251,255,252,255,253,255,254,254,0,1,254,0,109,255,
+  0,113,255,0,115,255,0,117,255,14,118,255,119,254,122,254,250,255,
+  251,255,252,255,253,255,254,254,0,1,254,0,109,255,0,113,255,0,115,
+  255,0,117,255,14,118,255,119,254,122,254,250,255,251,255,252,255,
+  253,255,254,254,0,1,254,0,109,255,0,113,255,0,115,255,0,117,255,
+  22,45,250,47,250,66,254,85,250,87,249,88,252,89,247,90,245,193,254,
+  194,254,195,254,196,254,197,254,198,254,222,245,0,2,254,0,4,254,
+  0,6,254,0,100,250,0,102,250,0,122,245,9,45,250,47,250,119,254,120,
+  254,121,252,122,252,254,252,0,1,252,22,45,250,47,250,66,254,85,250,
+  87,249,88,252,89,247,90,245,193,254,194,254,195,254,196,254,197,
+  254,198,254,222,245,0,2,254,0,4,254,0,6,254,0,100,250,0,102,250,
+  0,122,245,9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,
+  0,1,252,27,80,254,85,252,86,250,87,249,88,252,90,249,211,254,212,
+  254,213,254,214,254,215,254,217,254,218,250,219,250,220,250,221,
+  250,222,249,0,78,254,0,82,254,0,100,252,0,102,252,0,108,250,0,112,
+  250,0,114,250,0,116,250,0,122,249,50,45,249,47,249,59,5,60,5,98,
+  255,106,3,108,3,109,3,110,4,111,4,113,5,117,7,118,3,119,5,122,5,
+  225,255,226,255,227,255,228,255,229,255,230,255,237,3,238,3,239,
+  3,240,3,242,4,250,3,251,3,252,3,253,3,254,5,0,1,5,0,3,255,0,5,255,
+  0,7,255,0,45,3,0,49,3,0,57,3,0,60,3,0,62,3,0,68,3,0,70,4,0,72,4,
+  0,74,4,0,101,7,0,109,3,0,113,3,0,115,3,0,117,3,27,80,254,85,252,
+  86,250,87,249,88,252,90,249,211,254,212,254,213,254,214,254,215,
+  254,217,254,218,250,219,250,220,250,221,250,222,249,0,78,254,0,82,
+  254,0,100,252,0,102,252,0,108,250,0,112,250,0,114,250,0,116,250,
+  0,122,249,50,45,249,47,249,59,5,60,5,98,255,106,3,108,3,109,3,110,
+  4,111,4,113,5,117,7,118,3,119,5,122,5,225,255,226,255,227,255,228,
+  255,229,255,230,255,237,3,238,3,239,3,240,3,242,4,250,3,251,3,252,
+  3,253,3,254,5,0,1,5,0,3,255,0,5,255,0,7,255,0,45,3,0,49,3,0,57,3,
+  0,60,3,0,62,3,0,68,3,0,70,4,0,72,4,0,74,4,0,101,7,0,109,3,0,113,
+  3,0,115,3,0,117,3,27,80,254,85,252,86,250,87,249,88,252,90,249,211,
+  254,212,254,213,254,214,254,215,254,217,254,218,250,219,250,220,
+  250,221,250,222,249,0,78,254,0,82,254,0,100,252,0,102,252,0,108,
+  250,0,112,250,0,114,250,0,116,250,0,122,249,50,45,249,47,249,59,
+  5,60,5,98,255,106,3,108,3,109,3,110,4,111,4,113,5,117,7,118,3,119,
+  5,122,5,225,255,226,255,227,255,228,255,229,255,230,255,237,3,238,
+  3,239,3,240,3,242,4,250,3,251,3,252,3,253,3,254,5,0,1,5,0,3,255,
+  0,5,255,0,7,255,0,45,3,0,49,3,0,57,3,0,60,3,0,62,3,0,68,3,0,70,4,
+  0,72,4,0,74,4,0,101,7,0,109,3,0,113,3,0,115,3,0,117,3,3,45,254,47,
+  254,4,45,254,47,254,120,252,3,45,254,47,254,4,45,254,47,254,120,
+  252,3,45,254,47,254,4,45,254,47,254,120,252,70,45,237,46,234,47,
+  237,59,254,60,254,66,237,80,250,98,237,102,237,112,237,115,237,118,
+  237,120,237,122,237,193,237,194,237,195,237,196,237,197,237,198,
+  237,211,250,212,250,213,250,214,250,215,250,217,250,225,237,226,
+  237,227,237,228,247,229,237,230,237,233,247,234,237,235,237,236,
+  237,243,237,244,237,245,237,246,247,247,237,249,237,250,237,251,
+  237,252,237,253,237,254,237,0,1,247,0,2,237,0,3,247,0,4,237,0,5,
+  247,0,6,237,0,7,237,0,21,247,0,25,237,0,27,237,0,29,237,0,78,250,
+  0,79,247,0,82,250,0,83,237,0,87,237,0,89,237,0,91,237,0,109,247,
+  0,113,237,0,115,237,0,117,237,70,45,237,46,234,47,237,59,254,60,
+  254,66,237,80,250,98,237,102,237,112,237,115,237,118,237,120,237,
+  122,237,193,237,194,237,195,237,196,237,197,237,198,237,211,250,
+  212,250,213,250,214,250,215,250,217,250,225,237,226,237,227,237,
+  228,247,229,237,230,237,233,247,234,237,235,237,236,237,243,237,
+  244,237,245,237,246,247,247,237,249,237,250,237,251,237,252,237,
+  253,237,254,237,0,1,247,0,2,237,0,3,247,0,4,237,0,5,247,0,6,237,
+  0,7,237,0,21,247,0,25,237,0,27,237,0,29,237,0,78,250,0,79,247,0,
+  82,250,0,83,237,0,87,237,0,89,237,0,91,237,0,109,247,0,113,237,0,
+  115,237,0,117,237,13,45,250,47,250,66,250,193,250,194,250,195,250,
+  196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,13,45,250,47,250,
+  66,250,193,250,194,250,195,250,196,250,197,250,198,250,0,2,250,0,
+  4,250,0,6,250,13,45,250,47,250,66,250,193,250,194,250,195,250,196,
+  250,197,250,198,250,0,2,250,0,4,250,0,6,250,13,45,250,47,250,66,
+  250,193,250,194,250,195,250,196,250,197,250,198,250,0,2,250,0,4,
+  250,0,6,250,65,45,234,46,234,47,234,59,247,60,247,66,239,80,243,
+  98,234,102,234,106,254,112,234,118,239,193,239,194,239,195,239,196,
+  239,197,239,198,239,211,243,212,243,213,243,214,243,215,243,217,
+  243,225,234,226,234,227,234,228,245,229,234,230,234,233,234,234,
+  234,235,234,236,234,238,254,243,234,244,234,245,234,246,234,247,
+  234,249,234,250,239,251,239,252,239,253,239,0,2,239,0,3,245,0,4,
+  239,0,5,245,0,6,239,0,7,234,0,21,245,0,25,234,0,27,234,0,29,234,
+  0,49,254,0,78,243,0,79,234,0,82,243,0,83,234,0,109,239,0,113,239,
+  0,115,239,0,117,239,19,102,254,112,254,233,254,234,254,235,254,236,
+  254,243,254,244,254,245,254,246,254,247,254,249,254,0,21,254,0,25,
+  254,0,27,254,0,29,254,0,79,254,0,83,254,19,102,254,112,254,233,254,
+  234,254,235,254,236,254,243,254,244,254,245,254,246,254,247,254,
+  249,254,0,21,254,0,25,254,0,27,254,0,29,254,0,79,254,0,83,254,19,
+  102,254,112,254,233,254,234,254,235,254,236,254,243,254,244,254,
+  245,254,246,254,247,254,249,254,0,21,254,0,25,254,0,27,254,0,29,
+  254,0,79,254,0,83,254,3,45,254,47,254,4,45,254,47,254,120,252,2,
+  1,32,24,247,14,33,245,101,249,115,249,116,249,0,19,249,0,87,249,
+  0,89,249,0,91,249,0,93,249,0,97,249,0,99,249,1,2,25,249,1,32,25,
+  247,2,33,250
+};
+static afm_cuint16 afm_Helvetica_highchars_index[] = { /* 220 */
+  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
+  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
+  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
+  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
+  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
+  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
+  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
+  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
+  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
+  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
+  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
+  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
+  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
+  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
+  64257,64258
+};
+static afm_cunicode afm_Helvetica_ligatures[] = { /* 3 */
+  102,105,64257
+};
+
+
+/* ------------------------------------------------------------------*/
+/* FontName: Helvetica-Bold */
+/* FullName: Helvetica Bold */
+/* FamilyName: Helvetica */
+static afm_cuint8 afm_Helvetica_Bold_widths[] = { /* 315 */
+  46,56,79,93,93,148,120,40,56,56,65,97,46,56,46,46,93,93,93,93,93,
+  93,93,93,93,93,56,56,97,97,97,102,163,120,120,120,120,111,102,130,
+  120,46,93,120,102,139,120,130,111,130,120,111,102,120,111,157,111,
+  111,102,56,46,56,97,93,56,93,102,93,102,93,56,102,102,46,46,93,46,
+  148,102,102,102,102,65,93,56,102,93,130,93,93,83,65,47,65,97,56,
+  93,93,93,93,47,93,56,123,62,93,97,123,56,67,97,56,56,56,102,93,46,
+  56,56,61,93,139,139,139,102,120,120,120,120,120,120,167,120,111,
+  111,111,111,46,46,46,46,120,120,130,130,130,130,130,97,130,120,120,
+  120,120,111,111,102,93,93,93,93,93,93,148,93,93,93,93,93,46,46,46,
+  46,102,102,102,102,102,102,102,97,102,102,102,102,102,93,102,93,
+  120,93,120,93,120,93,120,93,120,93,120,124,120,102,111,93,111,93,
+  111,93,111,93,130,102,130,102,46,46,46,46,46,46,120,93,102,46,102,
+  46,102,67,102,46,120,102,120,102,120,102,130,102,130,102,167,157,
+  120,65,120,65,120,65,111,93,111,93,111,93,102,56,102,65,120,102,
+  120,102,120,102,120,102,111,102,83,102,83,102,83,93,111,93,56,56,
+  56,56,56,56,56,56,93,167,46,46,46,83,83,83,93,93,58,167,167,56,56,
+  28,93,167,82,102,100,97,92,92,92,92,82,42,102,102
+};
+static afm_sint16 afm_Helvetica_Bold_kerning_index[] = { /* 315 */
+  1,0,0,0,0,0,0,0,0,0,0,0,29,0,40,0,0,0,0,0,0,0,0,0,0,0,51,54,0,0,
+  0,0,0,57,172,0,218,0,257,0,0,0,308,358,450,0,0,485,534,627,654,0,
+  716,874,902,1051,0,1199,0,0,0,0,0,0,0,1338,1358,1401,1427,1444,1462,
+  1517,1548,0,0,1556,1577,1587,1617,1649,1663,0,1671,1752,0,0,1755,
+  1803,1828,1851,1921,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,0,0,0,0,0,0,0,0,0,0,1944,2059,2174,2289,2404,2519,0,0,0,0,0,
+  0,0,0,0,0,0,0,2634,2683,2732,2781,2830,0,2879,2928,2956,2984,3012,
+  3040,0,0,3179,3199,3219,3239,3259,3279,0,3299,3325,3343,3361,3379,
+  0,0,0,0,0,3397,3429,3443,3457,3471,3485,0,3499,0,0,0,0,3513,0,3583,
+  3653,3768,3788,3903,3923,4038,0,4058,0,4084,4110,0,4149,4188,0,4205,
+  0,4223,0,4241,0,4259,0,4277,0,4308,0,0,0,0,0,0,4339,4431,4452,4487,
+  4497,4532,0,0,4542,4577,0,4587,0,4619,0,4651,4683,4732,4746,4795,
+  0,0,4809,4871,4952,5014,5095,5157,0,5238,0,5241,0,5244,5247,0,5405,
+  0,5563,0,5591,0,5619,0,5647,0,5675,0,5814,0,5837,0,5860,0,0,5883,
+  0,0,0,0,0,0,0,0,0,0,5886,5891,0,0,5942,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,0,0,0,0,0,0,0,0
+};
+static afm_cuint8 afm_Helvetica_Bold_kerning_data[] = { /* 5945 */
+  42,11,85,240,87,244,88,244,90,237,222,237,0,100,240,0,102,240,0,
+  122,237,1,32,24,247,1,32,28,244,4,33,250,1,32,25,237,1,32,29,237,
+  4,33,250,1,32,25,237,1,32,29,237,2,33,250,2,33,250,49,68,250,72,
+  249,80,250,82,250,85,242,86,249,87,244,88,247,90,239,118,252,119,
+  250,120,252,122,252,200,250,211,250,212,250,213,250,214,250,215,
+  250,217,250,218,249,219,249,220,249,221,249,222,239,250,252,251,
+  252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,0,32,249,0,
+  36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,0,109,252,
+  0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,
+  239,20,66,252,86,255,193,252,194,252,195,252,196,252,197,252,198,
+  252,218,255,219,255,220,255,221,255,0,2,252,0,4,252,0,6,252,0,108,
+  255,0,112,255,0,114,255,0,116,255,18,45,252,47,252,66,250,87,250,
+  88,250,90,245,193,250,194,250,195,250,196,250,197,250,198,250,222,
+  245,0,2,250,0,4,250,0,6,250,0,122,245,23,45,240,47,240,66,244,98,
+  254,193,244,194,244,195,244,196,244,197,244,198,244,225,254,226,
+  254,227,254,228,254,229,254,230,254,0,2,244,0,3,254,0,4,244,0,5,
+  254,0,6,244,0,7,254,22,45,254,47,254,66,254,118,254,193,254,194,
+  254,195,254,196,254,197,254,198,254,250,254,251,254,252,254,253,
+  254,0,2,254,0,4,254,0,6,254,0,109,254,0,113,254,0,115,254,0,117,
+  254,40,80,252,102,254,112,251,118,252,122,250,211,252,212,252,213,
+  252,214,252,215,252,217,252,233,254,234,254,235,254,236,254,243,
+  251,244,251,245,251,246,251,247,251,249,251,250,252,251,252,252,
+  252,253,252,254,250,0,1,250,0,21,254,0,25,254,0,27,254,0,29,254,
+  0,78,252,0,79,251,0,82,252,0,83,251,0,109,252,0,113,252,0,115,252,
+  0,117,252,14,85,242,87,239,88,244,90,237,122,252,222,237,254,252,
+  0,1,252,0,100,242,0,102,242,0,122,237,1,32,25,234,1,32,29,234,22,
+  45,250,47,250,66,249,85,250,87,249,88,249,89,249,90,245,193,249,
+  194,249,195,249,196,249,197,249,198,249,222,245,0,2,249,0,4,249,
+  0,6,249,0,100,250,0,102,250,0,122,245,41,45,237,47,237,66,240,98,
+  252,102,252,112,250,193,240,194,240,195,240,196,240,197,240,198,
+  240,225,252,226,252,227,252,228,252,229,252,230,252,233,252,234,
+  252,235,252,236,252,243,250,244,250,245,250,246,250,247,250,249,
+  250,0,2,240,0,3,252,0,4,240,0,5,252,0,6,240,0,7,252,0,21,252,0,25,
+  252,0,27,252,0,29,252,0,79,250,0,83,250,12,45,3,47,3,86,255,218,
+  255,219,255,220,255,221,255,0,108,255,0,112,255,0,114,255,0,116,
+  255,27,80,254,85,254,86,254,87,249,88,250,90,249,211,254,212,254,
+  213,254,214,254,215,254,217,254,218,254,219,254,220,254,221,254,
+  222,249,0,78,254,0,82,254,0,100,254,0,102,254,0,108,254,0,112,254,
+  0,114,254,0,116,254,0,122,249,69,45,244,46,237,47,244,59,250,60,
+  250,66,242,80,250,98,244,102,247,112,244,115,244,118,242,120,247,
+  122,247,193,242,194,242,195,242,196,242,197,242,198,242,211,250,
+  212,250,213,250,214,250,215,250,217,250,225,244,226,244,227,244,
+  228,244,229,244,230,244,233,247,234,247,235,247,236,247,243,244,
+  244,244,245,244,246,244,247,244,249,244,250,242,251,242,252,242,
+  253,242,254,247,0,1,247,0,2,242,0,3,244,0,4,242,0,5,244,0,6,242,
+  0,7,244,0,21,247,0,25,247,0,27,247,0,29,247,0,78,250,0,79,244,0,
+  82,250,0,83,244,0,87,244,0,89,244,0,109,242,0,113,242,0,115,242,
+  0,117,242,13,45,252,47,252,66,249,193,249,194,249,195,249,196,249,
+  197,249,198,249,0,2,249,0,4,249,0,6,249,65,45,237,46,244,47,237,
+  59,250,60,250,66,244,72,249,80,249,98,247,102,249,112,242,118,247,
+  193,244,194,244,195,244,196,244,197,244,198,244,211,249,212,249,
+  213,249,214,249,215,249,217,249,225,247,226,247,227,247,228,247,
+  229,247,230,247,233,249,234,249,235,249,236,249,243,242,244,242,
+  245,242,246,242,247,242,249,242,250,247,251,247,252,247,253,247,
+  0,2,244,0,3,247,0,4,244,0,5,247,0,6,244,0,7,247,0,21,249,0,25,249,
+  0,27,249,0,29,249,0,32,249,0,36,249,0,78,249,0,79,242,0,82,249,0,
+  83,242,0,109,247,0,113,247,0,115,247,0,117,247,65,45,244,46,250,
+  47,244,59,255,60,255,66,247,80,254,98,250,102,251,112,247,118,249,
+  122,254,193,247,194,247,195,247,196,247,197,247,198,247,211,254,
+  212,254,213,254,214,254,215,254,217,254,225,250,226,250,227,250,
+  228,250,229,250,230,250,233,251,234,251,235,251,236,251,243,247,
+  244,247,245,247,246,247,247,247,249,247,250,249,251,249,252,249,
+  253,249,254,254,0,1,254,0,2,247,0,3,250,0,4,247,0,5,250,0,6,247,
+  0,7,250,0,21,251,0,25,251,0,27,251,0,29,251,0,78,254,0,79,247,0,
+  82,254,0,83,247,0,109,249,0,113,249,0,115,249,0,117,249,61,45,240,
+  47,240,59,249,60,249,66,239,80,245,98,242,102,244,112,240,118,240,
+  193,239,194,239,195,239,196,239,197,239,198,239,211,245,212,245,
+  213,245,214,245,215,245,217,245,225,242,226,242,227,242,228,242,
+  229,242,230,242,233,244,234,244,235,244,236,244,243,240,244,240,
+  245,240,246,240,247,240,249,240,250,240,251,240,252,240,253,240,
+  0,2,239,0,3,242,0,4,239,0,5,242,0,6,239,0,7,242,0,21,244,0,25,244,
+  0,27,244,0,29,244,0,78,245,0,79,240,0,82,245,0,83,240,0,109,240,
+  0,113,240,0,115,240,0,117,240,9,104,255,119,254,120,254,122,254,
+  254,254,0,1,254,0,33,255,0,37,255,18,109,255,118,254,119,254,122,
+  254,250,254,251,254,252,254,253,254,254,254,0,1,254,0,60,255,0,62,
+  255,0,68,255,0,109,254,0,113,254,0,115,254,0,117,254,11,105,255,
+  108,254,109,254,122,255,254,255,0,1,255,0,57,254,0,60,254,0,62,254,
+  0,68,254,8,101,255,119,254,120,254,122,254,254,254,0,1,254,0,19,
+  255,9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,254,
+  23,45,255,47,255,102,255,112,254,233,255,234,255,235,255,236,255,
+  243,254,244,254,245,254,246,254,247,254,249,254,0,21,255,0,25,255,
+  0,27,255,0,29,255,0,79,254,0,83,254,1,32,25,5,1,32,29,5,13,102,2,
+  104,255,233,2,234,2,235,2,236,2,0,21,2,0,25,2,0,27,2,0,29,2,0,33,
+  255,0,37,255,4,122,254,254,254,0,1,254,10,112,254,243,254,244,254,
+  245,254,246,254,247,254,249,254,0,79,254,0,83,254,5,120,254,122,
+  254,254,254,0,1,254,13,118,254,122,252,250,254,251,254,252,254,253,
+  254,254,252,0,1,252,0,109,254,0,113,254,0,115,254,0,117,254,14,118,
+  255,119,250,122,254,250,255,251,255,252,255,253,255,254,254,0,1,
+  254,0,109,255,0,113,255,0,115,255,0,117,255,7,119,254,120,254,121,
+  252,122,254,254,254,0,1,254,4,122,254,254,254,0,1,254,34,45,247,
+  46,254,47,247,100,254,101,254,104,254,112,254,114,254,116,254,117,
+  3,119,2,122,2,232,254,243,254,244,254,245,254,246,254,247,254,249,
+  254,254,2,0,1,2,0,9,254,0,15,254,0,19,254,0,33,254,0,37,254,0,79,
+  254,0,83,254,0,93,254,0,97,254,0,99,254,0,101,3,1,2,25,254,2,120,
+  254,22,45,244,47,244,98,254,112,252,225,254,226,254,227,254,228,
+  254,229,254,230,254,243,252,244,252,245,252,246,252,247,252,249,
+  252,0,3,254,0,5,254,0,7,254,0,79,252,0,83,252,12,45,250,47,250,112,
+  254,243,254,244,254,245,254,246,254,247,254,249,254,0,79,254,0,83,
+  254,10,102,255,233,255,234,255,235,255,236,255,0,21,255,0,25,255,
+  0,27,255,0,29,255,31,45,244,47,244,98,252,102,255,112,253,225,252,
+  226,252,227,252,228,252,229,252,230,252,233,255,234,255,235,255,
+  236,255,243,253,244,253,245,253,246,253,247,253,249,253,0,3,252,
+  0,5,252,0,7,252,0,21,255,0,25,255,0,27,255,0,29,255,0,79,253,0,83,
+  253,10,102,2,233,2,234,2,235,2,236,2,0,21,2,0,25,2,0,27,2,0,29,2,
+  49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,88,247,90,239,
+  118,252,119,250,120,252,122,252,200,250,211,250,212,250,213,250,
+  214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,239,
+  250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,
+  0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,
+  0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,
+  252,0,122,239,49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,
+  88,247,90,239,118,252,119,250,120,252,122,252,200,250,211,250,212,
+  250,213,250,214,250,215,250,217,250,218,249,219,249,220,249,221,
+  249,222,239,250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,
+  250,0,14,250,0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,
+  242,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,
+  0,116,249,0,117,252,0,122,239,49,68,250,72,249,80,250,82,250,85,
+  242,86,249,87,244,88,247,90,239,118,252,119,250,120,252,122,252,
+  200,250,211,250,212,250,213,250,214,250,215,250,217,250,218,249,
+  219,249,220,249,221,249,222,239,250,252,251,252,252,252,253,252,
+  254,252,0,1,252,0,8,250,0,14,250,0,32,249,0,36,249,0,78,250,0,82,
+  250,0,100,242,0,102,242,0,108,249,0,109,252,0,112,249,0,113,252,
+  0,114,249,0,115,252,0,116,249,0,117,252,0,122,239,49,68,250,72,249,
+  80,250,82,250,85,242,86,249,87,244,88,247,90,239,118,252,119,250,
+  120,252,122,252,200,250,211,250,212,250,213,250,214,250,215,250,
+  217,250,218,249,219,249,220,249,221,249,222,239,250,252,251,252,
+  252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,0,32,249,0,36,249,
+  0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,0,109,252,0,112,
+  249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,239,
+  49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,88,247,90,239,
+  118,252,119,250,120,252,122,252,200,250,211,250,212,250,213,250,
+  214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,239,
+  250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,
+  0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,
+  0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,
+  252,0,122,239,49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,
+  88,247,90,239,118,252,119,250,120,252,122,252,200,250,211,250,212,
+  250,213,250,214,250,215,250,217,250,218,249,219,249,220,249,221,
+  249,222,239,250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,
+  250,0,14,250,0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,
+  242,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,
+  0,116,249,0,117,252,0,122,239,22,45,250,47,250,66,249,85,250,87,
+  249,88,249,89,249,90,245,193,249,194,249,195,249,196,249,197,249,
+  198,249,222,245,0,2,249,0,4,249,0,6,249,0,100,250,0,102,250,0,122,
+  245,22,45,250,47,250,66,249,85,250,87,249,88,249,89,249,90,245,193,
+  249,194,249,195,249,196,249,197,249,198,249,222,245,0,2,249,0,4,
+  249,0,6,249,0,100,250,0,102,250,0,122,245,22,45,250,47,250,66,249,
+  85,250,87,249,88,249,89,249,90,245,193,249,194,249,195,249,196,249,
+  197,249,198,249,222,245,0,2,249,0,4,249,0,6,249,0,100,250,0,102,
+  250,0,122,245,22,45,250,47,250,66,249,85,250,87,249,88,249,89,249,
+  90,245,193,249,194,249,195,249,196,249,197,249,198,249,222,245,0,
+  2,249,0,4,249,0,6,249,0,100,250,0,102,250,0,122,245,22,45,250,47,
+  250,66,249,85,250,87,249,88,249,89,249,90,245,193,249,194,249,195,
+  249,196,249,197,249,198,249,222,245,0,2,249,0,4,249,0,6,249,0,100,
+  250,0,102,250,0,122,245,22,45,250,47,250,66,249,85,250,87,249,88,
+  249,89,249,90,245,193,249,194,249,195,249,196,249,197,249,198,249,
+  222,245,0,2,249,0,4,249,0,6,249,0,100,250,0,102,250,0,122,245,13,
+  45,252,47,252,66,249,193,249,194,249,195,249,196,249,197,249,198,
+  249,0,2,249,0,4,249,0,6,249,13,45,252,47,252,66,249,193,249,194,
+  249,195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,13,45,
+  252,47,252,66,249,193,249,194,249,195,249,196,249,197,249,198,249,
+  0,2,249,0,4,249,0,6,249,13,45,252,47,252,66,249,193,249,194,249,
+  195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,61,45,240,
+  47,240,59,249,60,249,66,239,80,245,98,242,102,244,112,240,118,240,
+  193,239,194,239,195,239,196,239,197,239,198,239,211,245,212,245,
+  213,245,214,245,215,245,217,245,225,242,226,242,227,242,228,242,
+  229,242,230,242,233,244,234,244,235,244,236,244,243,240,244,240,
+  245,240,246,240,247,240,249,240,250,240,251,240,252,240,253,240,
+  0,2,239,0,3,242,0,4,239,0,5,242,0,6,239,0,7,242,0,21,244,0,25,244,
+  0,27,244,0,29,244,0,78,245,0,79,240,0,82,245,0,83,240,0,109,240,
+  0,113,240,0,115,240,0,117,240,9,104,255,119,254,120,254,122,254,
+  254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,254,120,254,122,
+  254,254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,254,120,254,
+  122,254,254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,254,120,
+  254,122,254,254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,254,
+  120,254,122,254,254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,
+  254,120,254,122,254,254,254,0,1,254,0,33,255,0,37,255,11,105,255,
+  108,254,109,254,122,255,254,255,0,1,255,0,57,254,0,60,254,0,62,254,
+  0,68,254,9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,
+  254,9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,254,
+  9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,254,9,45,
+  2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,254,14,118,255,
+  119,250,122,254,250,255,251,255,252,255,253,255,254,254,0,1,254,
+  0,109,255,0,113,255,0,115,255,0,117,255,7,119,254,120,254,121,252,
+  122,254,254,254,0,1,254,7,119,254,120,254,121,252,122,254,254,254,
+  0,1,254,7,119,254,120,254,121,252,122,254,254,254,0,1,254,7,119,
+  254,120,254,121,252,122,254,254,254,0,1,254,7,119,254,120,254,121,
+  252,122,254,254,254,0,1,254,7,119,254,120,254,121,252,122,254,254,
+  254,0,1,254,31,45,244,47,244,98,252,102,255,112,253,225,252,226,
+  252,227,252,228,252,229,252,230,252,233,255,234,255,235,255,236,
+  255,243,253,244,253,245,253,246,253,247,253,249,253,0,3,252,0,5,
+  252,0,7,252,0,21,255,0,25,255,0,27,255,0,29,255,0,79,253,0,83,253,
+  31,45,244,47,244,98,252,102,255,112,253,225,252,226,252,227,252,
+  228,252,229,252,230,252,233,255,234,255,235,255,236,255,243,253,
+  244,253,245,253,246,253,247,253,249,253,0,3,252,0,5,252,0,7,252,
+  0,21,255,0,25,255,0,27,255,0,29,255,0,79,253,0,83,253,49,68,250,
+  72,249,80,250,82,250,85,242,86,249,87,244,88,247,90,239,118,252,
+  119,250,120,252,122,252,200,250,211,250,212,250,213,250,214,250,
+  215,250,217,250,218,249,219,249,220,249,221,249,222,239,250,252,
+  251,252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,0,32,249,
+  0,36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,0,109,252,
+  0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,
+  239,9,104,255,119,254,120,254,122,254,254,254,0,1,254,0,33,255,0,
+  37,255,49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,88,247,
+  90,239,118,252,119,250,120,252,122,252,200,250,211,250,212,250,213,
+  250,214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,
+  239,250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,
+  250,0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,
+  249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,
+  0,117,252,0,122,239,9,104,255,119,254,120,254,122,254,254,254,0,
+  1,254,0,33,255,0,37,255,49,68,250,72,249,80,250,82,250,85,242,86,
+  249,87,244,88,247,90,239,118,252,119,250,120,252,122,252,200,250,
+  211,250,212,250,213,250,214,250,215,250,217,250,218,249,219,249,
+  220,249,221,249,222,239,250,252,251,252,252,252,253,252,254,252,
+  0,1,252,0,8,250,0,14,250,0,32,249,0,36,249,0,78,250,0,82,250,0,100,
+  242,0,102,242,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,
+  0,115,252,0,116,249,0,117,252,0,122,239,9,104,255,119,254,120,254,
+  122,254,254,254,0,1,254,0,33,255,0,37,255,11,105,255,108,254,109,
+  254,122,255,254,255,0,1,255,0,57,254,0,60,254,0,62,254,0,68,254,
+  11,105,255,108,254,109,254,122,255,254,255,0,1,255,0,57,254,0,60,
+  254,0,62,254,0,68,254,18,45,252,47,252,66,250,87,250,88,250,90,245,
+  193,250,194,250,195,250,196,250,197,250,198,250,222,245,0,2,250,
+  0,4,250,0,6,250,0,122,245,18,45,252,47,252,66,250,87,250,88,250,
+  90,245,193,250,194,250,195,250,196,250,197,250,198,250,222,245,0,
+  2,250,0,4,250,0,6,250,0,122,245,8,101,255,119,254,120,254,122,254,
+  254,254,0,1,254,0,19,255,9,45,2,47,3,119,254,120,254,121,254,122,
+  254,254,254,0,1,254,9,45,2,47,3,119,254,120,254,121,254,122,254,
+  254,254,0,1,254,9,45,2,47,3,119,254,120,254,121,254,122,254,254,
+  254,0,1,254,9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,
+  0,1,254,13,102,2,104,255,233,2,234,2,235,2,236,2,0,21,2,0,25,2,0,
+  27,2,0,29,2,0,33,255,0,37,255,13,102,2,104,255,233,2,234,2,235,2,
+  236,2,0,21,2,0,25,2,0,27,2,0,29,2,0,33,255,0,37,255,40,80,252,102,
+  254,112,251,118,252,122,250,211,252,212,252,213,252,214,252,215,
+  252,217,252,233,254,234,254,235,254,236,254,243,251,244,251,245,
+  251,246,251,247,251,249,251,250,252,251,252,252,252,253,252,254,
+  250,0,1,250,0,21,254,0,25,254,0,27,254,0,29,254,0,78,252,0,79,251,
+  0,82,252,0,83,251,0,109,252,0,113,252,0,115,252,0,117,252,10,112,
+  254,243,254,244,254,245,254,246,254,247,254,249,254,0,79,254,0,83,
+  254,14,85,242,87,239,88,244,90,237,122,252,222,237,254,252,0,1,252,
+  0,100,242,0,102,242,0,122,237,1,32,25,234,1,32,29,234,5,120,254,
+  122,254,254,254,0,1,254,14,85,242,87,239,88,244,90,237,122,252,222,
+  237,254,252,0,1,252,0,100,242,0,102,242,0,122,237,1,32,25,234,1,
+  32,29,234,5,120,254,122,254,254,254,0,1,254,14,85,242,87,239,88,
+  244,90,237,122,252,222,237,254,252,0,1,252,0,100,242,0,102,242,0,
+  122,237,1,32,25,234,1,32,29,234,5,120,254,122,254,254,254,0,1,254,
+  14,118,255,119,250,122,254,250,255,251,255,252,255,253,255,254,254,
+  0,1,254,0,109,255,0,113,255,0,115,255,0,117,255,14,118,255,119,250,
+  122,254,250,255,251,255,252,255,253,255,254,254,0,1,254,0,109,255,
+  0,113,255,0,115,255,0,117,255,14,118,255,119,250,122,254,250,255,
+  251,255,252,255,253,255,254,254,0,1,254,0,109,255,0,113,255,0,115,
+  255,0,117,255,22,45,250,47,250,66,249,85,250,87,249,88,249,89,249,
+  90,245,193,249,194,249,195,249,196,249,197,249,198,249,222,245,0,
+  2,249,0,4,249,0,6,249,0,100,250,0,102,250,0,122,245,7,119,254,120,
+  254,121,252,122,254,254,254,0,1,254,22,45,250,47,250,66,249,85,250,
+  87,249,88,249,89,249,90,245,193,249,194,249,195,249,196,249,197,
+  249,198,249,222,245,0,2,249,0,4,249,0,6,249,0,100,250,0,102,250,
+  0,122,245,7,119,254,120,254,121,252,122,254,254,254,0,1,254,27,80,
+  254,85,254,86,254,87,249,88,250,90,249,211,254,212,254,213,254,214,
+  254,215,254,217,254,218,254,219,254,220,254,221,254,222,249,0,78,
+  254,0,82,254,0,100,254,0,102,254,0,108,254,0,112,254,0,114,254,0,
+  116,254,0,122,249,34,45,247,46,254,47,247,100,254,101,254,104,254,
+  112,254,114,254,116,254,117,3,119,2,122,2,232,254,243,254,244,254,
+  245,254,246,254,247,254,249,254,254,2,0,1,2,0,9,254,0,15,254,0,19,
+  254,0,33,254,0,37,254,0,79,254,0,83,254,0,93,254,0,97,254,0,99,254,
+  0,101,3,1,2,25,254,27,80,254,85,254,86,254,87,249,88,250,90,249,
+  211,254,212,254,213,254,214,254,215,254,217,254,218,254,219,254,
+  220,254,221,254,222,249,0,78,254,0,82,254,0,100,254,0,102,254,0,
+  108,254,0,112,254,0,114,254,0,116,254,0,122,249,34,45,247,46,254,
+  47,247,100,254,101,254,104,254,112,254,114,254,116,254,117,3,119,
+  2,122,2,232,254,243,254,244,254,245,254,246,254,247,254,249,254,
+  254,2,0,1,2,0,9,254,0,15,254,0,19,254,0,33,254,0,37,254,0,79,254,
+  0,83,254,0,93,254,0,97,254,0,99,254,0,101,3,1,2,25,254,27,80,254,
+  85,254,86,254,87,249,88,250,90,249,211,254,212,254,213,254,214,254,
+  215,254,217,254,218,254,219,254,220,254,221,254,222,249,0,78,254,
+  0,82,254,0,100,254,0,102,254,0,108,254,0,112,254,0,114,254,0,116,
+  254,0,122,249,34,45,247,46,254,47,247,100,254,101,254,104,254,112,
+  254,114,254,116,254,117,3,119,2,122,2,232,254,243,254,244,254,245,
+  254,246,254,247,254,249,254,254,2,0,1,2,0,9,254,0,15,254,0,19,254,
+  0,33,254,0,37,254,0,79,254,0,83,254,0,93,254,0,97,254,0,99,254,0,
+  101,3,1,2,25,254,2,120,254,2,120,254,2,120,254,69,45,244,46,237,
+  47,244,59,250,60,250,66,242,80,250,98,244,102,247,112,244,115,244,
+  118,242,120,247,122,247,193,242,194,242,195,242,196,242,197,242,
+  198,242,211,250,212,250,213,250,214,250,215,250,217,250,225,244,
+  226,244,227,244,228,244,229,244,230,244,233,247,234,247,235,247,
+  236,247,243,244,244,244,245,244,246,244,247,244,249,244,250,242,
+  251,242,252,242,253,242,254,247,0,1,247,0,2,242,0,3,244,0,4,242,
+  0,5,244,0,6,242,0,7,244,0,21,247,0,25,247,0,27,247,0,29,247,0,78,
+  250,0,79,244,0,82,250,0,83,244,0,87,244,0,89,244,0,109,242,0,113,
+  242,0,115,242,0,117,242,69,45,244,46,237,47,244,59,250,60,250,66,
+  242,80,250,98,244,102,247,112,244,115,244,118,242,120,247,122,247,
+  193,242,194,242,195,242,196,242,197,242,198,242,211,250,212,250,
+  213,250,214,250,215,250,217,250,225,244,226,244,227,244,228,244,
+  229,244,230,244,233,247,234,247,235,247,236,247,243,244,244,244,
+  245,244,246,244,247,244,249,244,250,242,251,242,252,242,253,242,
+  254,247,0,1,247,0,2,242,0,3,244,0,4,242,0,5,244,0,6,242,0,7,244,
+  0,21,247,0,25,247,0,27,247,0,29,247,0,78,250,0,79,244,0,82,250,0,
+  83,244,0,87,244,0,89,244,0,109,242,0,113,242,0,115,242,0,117,242,
+  13,45,252,47,252,66,249,193,249,194,249,195,249,196,249,197,249,
+  198,249,0,2,249,0,4,249,0,6,249,13,45,252,47,252,66,249,193,249,
+  194,249,195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,
+  13,45,252,47,252,66,249,193,249,194,249,195,249,196,249,197,249,
+  198,249,0,2,249,0,4,249,0,6,249,13,45,252,47,252,66,249,193,249,
+  194,249,195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,
+  61,45,240,47,240,59,249,60,249,66,239,80,245,98,242,102,244,112,
+  240,118,240,193,239,194,239,195,239,196,239,197,239,198,239,211,
+  245,212,245,213,245,214,245,215,245,217,245,225,242,226,242,227,
+  242,228,242,229,242,230,242,233,244,234,244,235,244,236,244,243,
+  240,244,240,245,240,246,240,247,240,249,240,250,240,251,240,252,
+  240,253,240,0,2,239,0,3,242,0,4,239,0,5,242,0,6,239,0,7,242,0,21,
+  244,0,25,244,0,27,244,0,29,244,0,78,245,0,79,240,0,82,245,0,83,240,
+  0,109,240,0,113,240,0,115,240,0,117,240,10,102,2,233,2,234,2,235,
+  2,236,2,0,21,2,0,25,2,0,27,2,0,29,2,10,102,2,233,2,234,2,235,2,236,
+  2,0,21,2,0,25,2,0,27,2,0,29,2,10,102,2,233,2,234,2,235,2,236,2,0,
+  21,2,0,25,2,0,27,2,0,29,2,2,120,254,2,1,32,24,249,19,33,244,101,
+  244,109,254,115,250,116,247,119,254,0,19,244,0,60,254,0,62,254,0,
+  68,254,0,87,250,0,89,250,0,91,250,0,93,247,0,97,247,0,99,247,1,2,
+  25,247,1,32,25,249,2,33,244
+};
+static afm_cuint16 afm_Helvetica_Bold_highchars_index[] = { /* 220 */
+  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
+  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
+  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
+  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
+  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
+  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
+  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
+  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
+  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
+  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
+  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
+  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
+  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
+  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
+  64257,64258
+};
+static afm_cunicode afm_Helvetica_Bold_ligatures[] = { /* 3 */
+  102,105,64257
+};
+
+
+/* ------------------------------------------------------------------*/
+/* FontName: Helvetica-BoldOblique */
+/* FullName: Helvetica Bold Oblique */
+/* FamilyName: Helvetica */
+static afm_cuint8 afm_Helvetica_BoldOblique_widths[] = { /* 315 */
+  46,56,79,93,93,148,120,40,56,56,65,97,46,56,46,46,93,93,93,93,93,
+  93,93,93,93,93,56,56,97,97,97,102,163,120,120,120,120,111,102,130,
+  120,46,93,120,102,139,120,130,111,130,120,111,102,120,111,157,111,
+  111,102,56,46,56,97,93,56,93,102,93,102,93,56,102,102,46,46,93,46,
+  148,102,102,102,102,65,93,56,102,93,130,93,93,83,65,47,65,97,56,
+  93,93,93,93,47,93,56,123,62,93,97,123,56,67,97,56,56,56,102,93,46,
+  56,56,61,93,139,139,139,102,120,120,120,120,120,120,167,120,111,
+  111,111,111,46,46,46,46,120,120,130,130,130,130,130,97,130,120,120,
+  120,120,111,111,102,93,93,93,93,93,93,148,93,93,93,93,93,46,46,46,
+  46,102,102,102,102,102,102,102,97,102,102,102,102,102,93,102,93,
+  120,93,120,93,120,93,120,93,120,93,120,124,120,102,111,93,111,93,
+  111,93,111,93,130,102,130,102,46,46,46,46,46,46,120,93,102,46,102,
+  46,102,67,102,46,120,102,120,102,120,102,130,102,130,102,167,157,
+  120,65,120,65,120,65,111,93,111,93,111,93,102,56,102,65,120,102,
+  120,102,120,102,120,102,111,102,83,102,83,102,83,93,111,93,56,56,
+  56,56,56,56,56,56,93,167,46,46,46,83,83,83,93,93,58,167,167,56,56,
+  28,93,167,82,102,100,97,92,92,92,92,82,42,102,102
+};
+static afm_sint16 afm_Helvetica_BoldOblique_kerning_index[] = { /* 315 */
+  1,0,0,0,0,0,0,0,0,0,0,0,29,0,40,0,0,0,0,0,0,0,0,0,0,0,51,54,0,0,
+  0,0,0,57,172,0,218,0,257,0,0,0,308,358,450,0,0,485,534,627,654,0,
+  716,874,902,1051,0,1199,0,0,0,0,0,0,0,1338,1358,1401,1427,1444,1462,
+  1517,1548,0,0,1556,1577,1587,1617,1649,1663,0,1671,1752,0,0,1755,
+  1803,1828,1851,1921,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,0,0,0,0,0,0,0,0,0,0,1944,2059,2174,2289,2404,2519,0,0,0,0,0,
+  0,0,0,0,0,0,0,2634,2683,2732,2781,2830,0,2879,2928,2956,2984,3012,
+  3040,0,0,3179,3199,3219,3239,3259,3279,0,3299,3325,3343,3361,3379,
+  0,0,0,0,0,3397,3429,3443,3457,3471,3485,0,3499,0,0,0,0,3513,0,3583,
+  3653,3768,3788,3903,3923,4038,0,4058,0,4084,4110,0,4149,4188,0,4205,
+  0,4223,0,4241,0,4259,0,4277,0,4308,0,0,0,0,0,0,4339,4431,4452,4487,
+  4497,4532,0,0,4542,4577,0,4587,0,4619,0,4651,4683,4732,4746,4795,
+  0,0,4809,4871,4952,5014,5095,5157,0,5238,0,5241,0,5244,5247,0,5405,
+  0,5563,0,5591,0,5619,0,5647,0,5675,0,5814,0,5837,0,5860,0,0,5883,
+  0,0,0,0,0,0,0,0,0,0,5886,5891,0,0,5942,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,0,0,0,0,0,0,0,0
+};
+static afm_cuint8 afm_Helvetica_BoldOblique_kerning_data[] = { /* 5945 */
+  42,11,85,240,87,244,88,244,90,237,222,237,0,100,240,0,102,240,0,
+  122,237,1,32,24,247,1,32,28,244,4,33,250,1,32,25,237,1,32,29,237,
+  4,33,250,1,32,25,237,1,32,29,237,2,33,250,2,33,250,49,68,250,72,
+  249,80,250,82,250,85,242,86,249,87,244,88,247,90,239,118,252,119,
+  250,120,252,122,252,200,250,211,250,212,250,213,250,214,250,215,
+  250,217,250,218,249,219,249,220,249,221,249,222,239,250,252,251,
+  252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,0,32,249,0,
+  36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,0,109,252,
+  0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,
+  239,20,66,252,86,255,193,252,194,252,195,252,196,252,197,252,198,
+  252,218,255,219,255,220,255,221,255,0,2,252,0,4,252,0,6,252,0,108,
+  255,0,112,255,0,114,255,0,116,255,18,45,252,47,252,66,250,87,250,
+  88,250,90,245,193,250,194,250,195,250,196,250,197,250,198,250,222,
+  245,0,2,250,0,4,250,0,6,250,0,122,245,23,45,240,47,240,66,244,98,
+  254,193,244,194,244,195,244,196,244,197,244,198,244,225,254,226,
+  254,227,254,228,254,229,254,230,254,0,2,244,0,3,254,0,4,244,0,5,
+  254,0,6,244,0,7,254,22,45,254,47,254,66,254,118,254,193,254,194,
+  254,195,254,196,254,197,254,198,254,250,254,251,254,252,254,253,
+  254,0,2,254,0,4,254,0,6,254,0,109,254,0,113,254,0,115,254,0,117,
+  254,40,80,252,102,254,112,251,118,252,122,250,211,252,212,252,213,
+  252,214,252,215,252,217,252,233,254,234,254,235,254,236,254,243,
+  251,244,251,245,251,246,251,247,251,249,251,250,252,251,252,252,
+  252,253,252,254,250,0,1,250,0,21,254,0,25,254,0,27,254,0,29,254,
+  0,78,252,0,79,251,0,82,252,0,83,251,0,109,252,0,113,252,0,115,252,
+  0,117,252,14,85,242,87,239,88,244,90,237,122,252,222,237,254,252,
+  0,1,252,0,100,242,0,102,242,0,122,237,1,32,25,234,1,32,29,234,22,
+  45,250,47,250,66,249,85,250,87,249,88,249,89,249,90,245,193,249,
+  194,249,195,249,196,249,197,249,198,249,222,245,0,2,249,0,4,249,
+  0,6,249,0,100,250,0,102,250,0,122,245,41,45,237,47,237,66,240,98,
+  252,102,252,112,250,193,240,194,240,195,240,196,240,197,240,198,
+  240,225,252,226,252,227,252,228,252,229,252,230,252,233,252,234,
+  252,235,252,236,252,243,250,244,250,245,250,246,250,247,250,249,
+  250,0,2,240,0,3,252,0,4,240,0,5,252,0,6,240,0,7,252,0,21,252,0,25,
+  252,0,27,252,0,29,252,0,79,250,0,83,250,12,45,3,47,3,86,255,218,
+  255,219,255,220,255,221,255,0,108,255,0,112,255,0,114,255,0,116,
+  255,27,80,254,85,254,86,254,87,249,88,250,90,249,211,254,212,254,
+  213,254,214,254,215,254,217,254,218,254,219,254,220,254,221,254,
+  222,249,0,78,254,0,82,254,0,100,254,0,102,254,0,108,254,0,112,254,
+  0,114,254,0,116,254,0,122,249,69,45,244,46,237,47,244,59,250,60,
+  250,66,242,80,250,98,244,102,247,112,244,115,244,118,242,120,247,
+  122,247,193,242,194,242,195,242,196,242,197,242,198,242,211,250,
+  212,250,213,250,214,250,215,250,217,250,225,244,226,244,227,244,
+  228,244,229,244,230,244,233,247,234,247,235,247,236,247,243,244,
+  244,244,245,244,246,244,247,244,249,244,250,242,251,242,252,242,
+  253,242,254,247,0,1,247,0,2,242,0,3,244,0,4,242,0,5,244,0,6,242,
+  0,7,244,0,21,247,0,25,247,0,27,247,0,29,247,0,78,250,0,79,244,0,
+  82,250,0,83,244,0,87,244,0,89,244,0,109,242,0,113,242,0,115,242,
+  0,117,242,13,45,252,47,252,66,249,193,249,194,249,195,249,196,249,
+  197,249,198,249,0,2,249,0,4,249,0,6,249,65,45,237,46,244,47,237,
+  59,250,60,250,66,244,72,249,80,249,98,247,102,249,112,242,118,247,
+  193,244,194,244,195,244,196,244,197,244,198,244,211,249,212,249,
+  213,249,214,249,215,249,217,249,225,247,226,247,227,247,228,247,
+  229,247,230,247,233,249,234,249,235,249,236,249,243,242,244,242,
+  245,242,246,242,247,242,249,242,250,247,251,247,252,247,253,247,
+  0,2,244,0,3,247,0,4,244,0,5,247,0,6,244,0,7,247,0,21,249,0,25,249,
+  0,27,249,0,29,249,0,32,249,0,36,249,0,78,249,0,79,242,0,82,249,0,
+  83,242,0,109,247,0,113,247,0,115,247,0,117,247,65,45,244,46,250,
+  47,244,59,255,60,255,66,247,80,254,98,250,102,251,112,247,118,249,
+  122,254,193,247,194,247,195,247,196,247,197,247,198,247,211,254,
+  212,254,213,254,214,254,215,254,217,254,225,250,226,250,227,250,
+  228,250,229,250,230,250,233,251,234,251,235,251,236,251,243,247,
+  244,247,245,247,246,247,247,247,249,247,250,249,251,249,252,249,
+  253,249,254,254,0,1,254,0,2,247,0,3,250,0,4,247,0,5,250,0,6,247,
+  0,7,250,0,21,251,0,25,251,0,27,251,0,29,251,0,78,254,0,79,247,0,
+  82,254,0,83,247,0,109,249,0,113,249,0,115,249,0,117,249,61,45,240,
+  47,240,59,249,60,249,66,239,80,245,98,242,102,244,112,240,118,240,
+  193,239,194,239,195,239,196,239,197,239,198,239,211,245,212,245,
+  213,245,214,245,215,245,217,245,225,242,226,242,227,242,228,242,
+  229,242,230,242,233,244,234,244,235,244,236,244,243,240,244,240,
+  245,240,246,240,247,240,249,240,250,240,251,240,252,240,253,240,
+  0,2,239,0,3,242,0,4,239,0,5,242,0,6,239,0,7,242,0,21,244,0,25,244,
+  0,27,244,0,29,244,0,78,245,0,79,240,0,82,245,0,83,240,0,109,240,
+  0,113,240,0,115,240,0,117,240,9,104,255,119,254,120,254,122,254,
+  254,254,0,1,254,0,33,255,0,37,255,18,109,255,118,254,119,254,122,
+  254,250,254,251,254,252,254,253,254,254,254,0,1,254,0,60,255,0,62,
+  255,0,68,255,0,109,254,0,113,254,0,115,254,0,117,254,11,105,255,
+  108,254,109,254,122,255,254,255,0,1,255,0,57,254,0,60,254,0,62,254,
+  0,68,254,8,101,255,119,254,120,254,122,254,254,254,0,1,254,0,19,
+  255,9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,254,
+  23,45,255,47,255,102,255,112,254,233,255,234,255,235,255,236,255,
+  243,254,244,254,245,254,246,254,247,254,249,254,0,21,255,0,25,255,
+  0,27,255,0,29,255,0,79,254,0,83,254,1,32,25,5,1,32,29,5,13,102,2,
+  104,255,233,2,234,2,235,2,236,2,0,21,2,0,25,2,0,27,2,0,29,2,0,33,
+  255,0,37,255,4,122,254,254,254,0,1,254,10,112,254,243,254,244,254,
+  245,254,246,254,247,254,249,254,0,79,254,0,83,254,5,120,254,122,
+  254,254,254,0,1,254,13,118,254,122,252,250,254,251,254,252,254,253,
+  254,254,252,0,1,252,0,109,254,0,113,254,0,115,254,0,117,254,14,118,
+  255,119,250,122,254,250,255,251,255,252,255,253,255,254,254,0,1,
+  254,0,109,255,0,113,255,0,115,255,0,117,255,7,119,254,120,254,121,
+  252,122,254,254,254,0,1,254,4,122,254,254,254,0,1,254,34,45,247,
+  46,254,47,247,100,254,101,254,104,254,112,254,114,254,116,254,117,
+  3,119,2,122,2,232,254,243,254,244,254,245,254,246,254,247,254,249,
+  254,254,2,0,1,2,0,9,254,0,15,254,0,19,254,0,33,254,0,37,254,0,79,
+  254,0,83,254,0,93,254,0,97,254,0,99,254,0,101,3,1,2,25,254,2,120,
+  254,22,45,244,47,244,98,254,112,252,225,254,226,254,227,254,228,
+  254,229,254,230,254,243,252,244,252,245,252,246,252,247,252,249,
+  252,0,3,254,0,5,254,0,7,254,0,79,252,0,83,252,12,45,250,47,250,112,
+  254,243,254,244,254,245,254,246,254,247,254,249,254,0,79,254,0,83,
+  254,10,102,255,233,255,234,255,235,255,236,255,0,21,255,0,25,255,
+  0,27,255,0,29,255,31,45,244,47,244,98,252,102,255,112,253,225,252,
+  226,252,227,252,228,252,229,252,230,252,233,255,234,255,235,255,
+  236,255,243,253,244,253,245,253,246,253,247,253,249,253,0,3,252,
+  0,5,252,0,7,252,0,21,255,0,25,255,0,27,255,0,29,255,0,79,253,0,83,
+  253,10,102,2,233,2,234,2,235,2,236,2,0,21,2,0,25,2,0,27,2,0,29,2,
+  49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,88,247,90,239,
+  118,252,119,250,120,252,122,252,200,250,211,250,212,250,213,250,
+  214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,239,
+  250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,
+  0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,
+  0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,
+  252,0,122,239,49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,
+  88,247,90,239,118,252,119,250,120,252,122,252,200,250,211,250,212,
+  250,213,250,214,250,215,250,217,250,218,249,219,249,220,249,221,
+  249,222,239,250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,
+  250,0,14,250,0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,
+  242,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,
+  0,116,249,0,117,252,0,122,239,49,68,250,72,249,80,250,82,250,85,
+  242,86,249,87,244,88,247,90,239,118,252,119,250,120,252,122,252,
+  200,250,211,250,212,250,213,250,214,250,215,250,217,250,218,249,
+  219,249,220,249,221,249,222,239,250,252,251,252,252,252,253,252,
+  254,252,0,1,252,0,8,250,0,14,250,0,32,249,0,36,249,0,78,250,0,82,
+  250,0,100,242,0,102,242,0,108,249,0,109,252,0,112,249,0,113,252,
+  0,114,249,0,115,252,0,116,249,0,117,252,0,122,239,49,68,250,72,249,
+  80,250,82,250,85,242,86,249,87,244,88,247,90,239,118,252,119,250,
+  120,252,122,252,200,250,211,250,212,250,213,250,214,250,215,250,
+  217,250,218,249,219,249,220,249,221,249,222,239,250,252,251,252,
+  252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,0,32,249,0,36,249,
+  0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,0,109,252,0,112,
+  249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,239,
+  49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,88,247,90,239,
+  118,252,119,250,120,252,122,252,200,250,211,250,212,250,213,250,
+  214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,239,
+  250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,
+  0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,
+  0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,
+  252,0,122,239,49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,
+  88,247,90,239,118,252,119,250,120,252,122,252,200,250,211,250,212,
+  250,213,250,214,250,215,250,217,250,218,249,219,249,220,249,221,
+  249,222,239,250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,
+  250,0,14,250,0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,
+  242,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,
+  0,116,249,0,117,252,0,122,239,22,45,250,47,250,66,249,85,250,87,
+  249,88,249,89,249,90,245,193,249,194,249,195,249,196,249,197,249,
+  198,249,222,245,0,2,249,0,4,249,0,6,249,0,100,250,0,102,250,0,122,
+  245,22,45,250,47,250,66,249,85,250,87,249,88,249,89,249,90,245,193,
+  249,194,249,195,249,196,249,197,249,198,249,222,245,0,2,249,0,4,
+  249,0,6,249,0,100,250,0,102,250,0,122,245,22,45,250,47,250,66,249,
+  85,250,87,249,88,249,89,249,90,245,193,249,194,249,195,249,196,249,
+  197,249,198,249,222,245,0,2,249,0,4,249,0,6,249,0,100,250,0,102,
+  250,0,122,245,22,45,250,47,250,66,249,85,250,87,249,88,249,89,249,
+  90,245,193,249,194,249,195,249,196,249,197,249,198,249,222,245,0,
+  2,249,0,4,249,0,6,249,0,100,250,0,102,250,0,122,245,22,45,250,47,
+  250,66,249,85,250,87,249,88,249,89,249,90,245,193,249,194,249,195,
+  249,196,249,197,249,198,249,222,245,0,2,249,0,4,249,0,6,249,0,100,
+  250,0,102,250,0,122,245,22,45,250,47,250,66,249,85,250,87,249,88,
+  249,89,249,90,245,193,249,194,249,195,249,196,249,197,249,198,249,
+  222,245,0,2,249,0,4,249,0,6,249,0,100,250,0,102,250,0,122,245,13,
+  45,252,47,252,66,249,193,249,194,249,195,249,196,249,197,249,198,
+  249,0,2,249,0,4,249,0,6,249,13,45,252,47,252,66,249,193,249,194,
+  249,195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,13,45,
+  252,47,252,66,249,193,249,194,249,195,249,196,249,197,249,198,249,
+  0,2,249,0,4,249,0,6,249,13,45,252,47,252,66,249,193,249,194,249,
+  195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,61,45,240,
+  47,240,59,249,60,249,66,239,80,245,98,242,102,244,112,240,118,240,
+  193,239,194,239,195,239,196,239,197,239,198,239,211,245,212,245,
+  213,245,214,245,215,245,217,245,225,242,226,242,227,242,228,242,
+  229,242,230,242,233,244,234,244,235,244,236,244,243,240,244,240,
+  245,240,246,240,247,240,249,240,250,240,251,240,252,240,253,240,
+  0,2,239,0,3,242,0,4,239,0,5,242,0,6,239,0,7,242,0,21,244,0,25,244,
+  0,27,244,0,29,244,0,78,245,0,79,240,0,82,245,0,83,240,0,109,240,
+  0,113,240,0,115,240,0,117,240,9,104,255,119,254,120,254,122,254,
+  254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,254,120,254,122,
+  254,254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,254,120,254,
+  122,254,254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,254,120,
+  254,122,254,254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,254,
+  120,254,122,254,254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,
+  254,120,254,122,254,254,254,0,1,254,0,33,255,0,37,255,11,105,255,
+  108,254,109,254,122,255,254,255,0,1,255,0,57,254,0,60,254,0,62,254,
+  0,68,254,9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,
+  254,9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,254,
+  9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,254,9,45,
+  2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,254,14,118,255,
+  119,250,122,254,250,255,251,255,252,255,253,255,254,254,0,1,254,
+  0,109,255,0,113,255,0,115,255,0,117,255,7,119,254,120,254,121,252,
+  122,254,254,254,0,1,254,7,119,254,120,254,121,252,122,254,254,254,
+  0,1,254,7,119,254,120,254,121,252,122,254,254,254,0,1,254,7,119,
+  254,120,254,121,252,122,254,254,254,0,1,254,7,119,254,120,254,121,
+  252,122,254,254,254,0,1,254,7,119,254,120,254,121,252,122,254,254,
+  254,0,1,254,31,45,244,47,244,98,252,102,255,112,253,225,252,226,
+  252,227,252,228,252,229,252,230,252,233,255,234,255,235,255,236,
+  255,243,253,244,253,245,253,246,253,247,253,249,253,0,3,252,0,5,
+  252,0,7,252,0,21,255,0,25,255,0,27,255,0,29,255,0,79,253,0,83,253,
+  31,45,244,47,244,98,252,102,255,112,253,225,252,226,252,227,252,
+  228,252,229,252,230,252,233,255,234,255,235,255,236,255,243,253,
+  244,253,245,253,246,253,247,253,249,253,0,3,252,0,5,252,0,7,252,
+  0,21,255,0,25,255,0,27,255,0,29,255,0,79,253,0,83,253,49,68,250,
+  72,249,80,250,82,250,85,242,86,249,87,244,88,247,90,239,118,252,
+  119,250,120,252,122,252,200,250,211,250,212,250,213,250,214,250,
+  215,250,217,250,218,249,219,249,220,249,221,249,222,239,250,252,
+  251,252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,0,32,249,
+  0,36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,0,109,252,
+  0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,
+  239,9,104,255,119,254,120,254,122,254,254,254,0,1,254,0,33,255,0,
+  37,255,49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,88,247,
+  90,239,118,252,119,250,120,252,122,252,200,250,211,250,212,250,213,
+  250,214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,
+  239,250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,
+  250,0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,
+  249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,
+  0,117,252,0,122,239,9,104,255,119,254,120,254,122,254,254,254,0,
+  1,254,0,33,255,0,37,255,49,68,250,72,249,80,250,82,250,85,242,86,
+  249,87,244,88,247,90,239,118,252,119,250,120,252,122,252,200,250,
+  211,250,212,250,213,250,214,250,215,250,217,250,218,249,219,249,
+  220,249,221,249,222,239,250,252,251,252,252,252,253,252,254,252,
+  0,1,252,0,8,250,0,14,250,0,32,249,0,36,249,0,78,250,0,82,250,0,100,
+  242,0,102,242,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,
+  0,115,252,0,116,249,0,117,252,0,122,239,9,104,255,119,254,120,254,
+  122,254,254,254,0,1,254,0,33,255,0,37,255,11,105,255,108,254,109,
+  254,122,255,254,255,0,1,255,0,57,254,0,60,254,0,62,254,0,68,254,
+  11,105,255,108,254,109,254,122,255,254,255,0,1,255,0,57,254,0,60,
+  254,0,62,254,0,68,254,18,45,252,47,252,66,250,87,250,88,250,90,245,
+  193,250,194,250,195,250,196,250,197,250,198,250,222,245,0,2,250,
+  0,4,250,0,6,250,0,122,245,18,45,252,47,252,66,250,87,250,88,250,
+  90,245,193,250,194,250,195,250,196,250,197,250,198,250,222,245,0,
+  2,250,0,4,250,0,6,250,0,122,245,8,101,255,119,254,120,254,122,254,
+  254,254,0,1,254,0,19,255,9,45,2,47,3,119,254,120,254,121,254,122,
+  254,254,254,0,1,254,9,45,2,47,3,119,254,120,254,121,254,122,254,
+  254,254,0,1,254,9,45,2,47,3,119,254,120,254,121,254,122,254,254,
+  254,0,1,254,9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,
+  0,1,254,13,102,2,104,255,233,2,234,2,235,2,236,2,0,21,2,0,25,2,0,
+  27,2,0,29,2,0,33,255,0,37,255,13,102,2,104,255,233,2,234,2,235,2,
+  236,2,0,21,2,0,25,2,0,27,2,0,29,2,0,33,255,0,37,255,40,80,252,102,
+  254,112,251,118,252,122,250,211,252,212,252,213,252,214,252,215,
+  252,217,252,233,254,234,254,235,254,236,254,243,251,244,251,245,
+  251,246,251,247,251,249,251,250,252,251,252,252,252,253,252,254,
+  250,0,1,250,0,21,254,0,25,254,0,27,254,0,29,254,0,78,252,0,79,251,
+  0,82,252,0,83,251,0,109,252,0,113,252,0,115,252,0,117,252,10,112,
+  254,243,254,244,254,245,254,246,254,247,254,249,254,0,79,254,0,83,
+  254,14,85,242,87,239,88,244,90,237,122,252,222,237,254,252,0,1,252,
+  0,100,242,0,102,242,0,122,237,1,32,25,234,1,32,29,234,5,120,254,
+  122,254,254,254,0,1,254,14,85,242,87,239,88,244,90,237,122,252,222,
+  237,254,252,0,1,252,0,100,242,0,102,242,0,122,237,1,32,25,234,1,
+  32,29,234,5,120,254,122,254,254,254,0,1,254,14,85,242,87,239,88,
+  244,90,237,122,252,222,237,254,252,0,1,252,0,100,242,0,102,242,0,
+  122,237,1,32,25,234,1,32,29,234,5,120,254,122,254,254,254,0,1,254,
+  14,118,255,119,250,122,254,250,255,251,255,252,255,253,255,254,254,
+  0,1,254,0,109,255,0,113,255,0,115,255,0,117,255,14,118,255,119,250,
+  122,254,250,255,251,255,252,255,253,255,254,254,0,1,254,0,109,255,
+  0,113,255,0,115,255,0,117,255,14,118,255,119,250,122,254,250,255,
+  251,255,252,255,253,255,254,254,0,1,254,0,109,255,0,113,255,0,115,
+  255,0,117,255,22,45,250,47,250,66,249,85,250,87,249,88,249,89,249,
+  90,245,193,249,194,249,195,249,196,249,197,249,198,249,222,245,0,
+  2,249,0,4,249,0,6,249,0,100,250,0,102,250,0,122,245,7,119,254,120,
+  254,121,252,122,254,254,254,0,1,254,22,45,250,47,250,66,249,85,250,
+  87,249,88,249,89,249,90,245,193,249,194,249,195,249,196,249,197,
+  249,198,249,222,245,0,2,249,0,4,249,0,6,249,0,100,250,0,102,250,
+  0,122,245,7,119,254,120,254,121,252,122,254,254,254,0,1,254,27,80,
+  254,85,254,86,254,87,249,88,250,90,249,211,254,212,254,213,254,214,
+  254,215,254,217,254,218,254,219,254,220,254,221,254,222,249,0,78,
+  254,0,82,254,0,100,254,0,102,254,0,108,254,0,112,254,0,114,254,0,
+  116,254,0,122,249,34,45,247,46,254,47,247,100,254,101,254,104,254,
+  112,254,114,254,116,254,117,3,119,2,122,2,232,254,243,254,244,254,
+  245,254,246,254,247,254,249,254,254,2,0,1,2,0,9,254,0,15,254,0,19,
+  254,0,33,254,0,37,254,0,79,254,0,83,254,0,93,254,0,97,254,0,99,254,
+  0,101,3,1,2,25,254,27,80,254,85,254,86,254,87,249,88,250,90,249,
+  211,254,212,254,213,254,214,254,215,254,217,254,218,254,219,254,
+  220,254,221,254,222,249,0,78,254,0,82,254,0,100,254,0,102,254,0,
+  108,254,0,112,254,0,114,254,0,116,254,0,122,249,34,45,247,46,254,
+  47,247,100,254,101,254,104,254,112,254,114,254,116,254,117,3,119,
+  2,122,2,232,254,243,254,244,254,245,254,246,254,247,254,249,254,
+  254,2,0,1,2,0,9,254,0,15,254,0,19,254,0,33,254,0,37,254,0,79,254,
+  0,83,254,0,93,254,0,97,254,0,99,254,0,101,3,1,2,25,254,27,80,254,
+  85,254,86,254,87,249,88,250,90,249,211,254,212,254,213,254,214,254,
+  215,254,217,254,218,254,219,254,220,254,221,254,222,249,0,78,254,
+  0,82,254,0,100,254,0,102,254,0,108,254,0,112,254,0,114,254,0,116,
+  254,0,122,249,34,45,247,46,254,47,247,100,254,101,254,104,254,112,
+  254,114,254,116,254,117,3,119,2,122,2,232,254,243,254,244,254,245,
+  254,246,254,247,254,249,254,254,2,0,1,2,0,9,254,0,15,254,0,19,254,
+  0,33,254,0,37,254,0,79,254,0,83,254,0,93,254,0,97,254,0,99,254,0,
+  101,3,1,2,25,254,2,120,254,2,120,254,2,120,254,69,45,244,46,237,
+  47,244,59,250,60,250,66,242,80,250,98,244,102,247,112,244,115,244,
+  118,242,120,247,122,247,193,242,194,242,195,242,196,242,197,242,
+  198,242,211,250,212,250,213,250,214,250,215,250,217,250,225,244,
+  226,244,227,244,228,244,229,244,230,244,233,247,234,247,235,247,
+  236,247,243,244,244,244,245,244,246,244,247,244,249,244,250,242,
+  251,242,252,242,253,242,254,247,0,1,247,0,2,242,0,3,244,0,4,242,
+  0,5,244,0,6,242,0,7,244,0,21,247,0,25,247,0,27,247,0,29,247,0,78,
+  250,0,79,244,0,82,250,0,83,244,0,87,244,0,89,244,0,109,242,0,113,
+  242,0,115,242,0,117,242,69,45,244,46,237,47,244,59,250,60,250,66,
+  242,80,250,98,244,102,247,112,244,115,244,118,242,120,247,122,247,
+  193,242,194,242,195,242,196,242,197,242,198,242,211,250,212,250,
+  213,250,214,250,215,250,217,250,225,244,226,244,227,244,228,244,
+  229,244,230,244,233,247,234,247,235,247,236,247,243,244,244,244,
+  245,244,246,244,247,244,249,244,250,242,251,242,252,242,253,242,
+  254,247,0,1,247,0,2,242,0,3,244,0,4,242,0,5,244,0,6,242,0,7,244,
+  0,21,247,0,25,247,0,27,247,0,29,247,0,78,250,0,79,244,0,82,250,0,
+  83,244,0,87,244,0,89,244,0,109,242,0,113,242,0,115,242,0,117,242,
+  13,45,252,47,252,66,249,193,249,194,249,195,249,196,249,197,249,
+  198,249,0,2,249,0,4,249,0,6,249,13,45,252,47,252,66,249,193,249,
+  194,249,195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,
+  13,45,252,47,252,66,249,193,249,194,249,195,249,196,249,197,249,
+  198,249,0,2,249,0,4,249,0,6,249,13,45,252,47,252,66,249,193,249,
+  194,249,195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,
+  61,45,240,47,240,59,249,60,249,66,239,80,245,98,242,102,244,112,
+  240,118,240,193,239,194,239,195,239,196,239,197,239,198,239,211,
+  245,212,245,213,245,214,245,215,245,217,245,225,242,226,242,227,
+  242,228,242,229,242,230,242,233,244,234,244,235,244,236,244,243,
+  240,244,240,245,240,246,240,247,240,249,240,250,240,251,240,252,
+  240,253,240,0,2,239,0,3,242,0,4,239,0,5,242,0,6,239,0,7,242,0,21,
+  244,0,25,244,0,27,244,0,29,244,0,78,245,0,79,240,0,82,245,0,83,240,
+  0,109,240,0,113,240,0,115,240,0,117,240,10,102,2,233,2,234,2,235,
+  2,236,2,0,21,2,0,25,2,0,27,2,0,29,2,10,102,2,233,2,234,2,235,2,236,
+  2,0,21,2,0,25,2,0,27,2,0,29,2,10,102,2,233,2,234,2,235,2,236,2,0,
+  21,2,0,25,2,0,27,2,0,29,2,2,120,254,2,1,32,24,249,19,33,244,101,
+  244,109,254,115,250,116,247,119,254,0,19,244,0,60,254,0,62,254,0,
+  68,254,0,87,250,0,89,250,0,91,250,0,93,247,0,97,247,0,99,247,1,2,
+  25,247,1,32,25,249,2,33,244
+};
+static afm_cuint16 afm_Helvetica_BoldOblique_highchars_index[] = { /* 220 */
+  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
+  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
+  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
+  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
+  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
+  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
+  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
+  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
+  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
+  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
+  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
+  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
+  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
+  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
+  64257,64258
+};
+static afm_cunicode afm_Helvetica_BoldOblique_ligatures[] = { /* 3 */
+  102,105,64257
+};
+
+
+/* ------------------------------------------------------------------*/
+/* FontName: Helvetica-Oblique */
+/* FullName: Helvetica Oblique */
+/* FamilyName: Helvetica */
+static afm_cuint8 afm_Helvetica_Oblique_widths[] = { /* 315 */
+  46,46,59,93,93,148,111,32,56,56,65,97,46,56,46,46,93,93,93,93,93,
+  93,93,93,93,93,46,46,97,97,97,93,169,111,111,120,120,111,102,130,
+  120,46,83,111,93,139,120,130,111,130,120,111,102,120,111,157,111,
+  111,102,46,46,46,78,93,56,93,93,83,93,93,46,93,93,37,37,83,37,139,
+  93,93,93,93,56,83,46,93,83,120,83,83,83,56,43,56,97,56,93,93,93,
+  93,43,93,56,123,62,93,97,123,56,67,97,56,56,56,93,90,46,56,56,61,
+  93,139,139,139,102,111,111,111,111,111,111,167,120,111,111,111,111,
+  46,46,46,46,120,120,130,130,130,130,130,97,130,120,120,120,120,111,
+  111,102,93,93,93,93,93,93,148,83,93,93,93,93,46,46,46,46,93,93,93,
+  93,93,93,93,97,102,93,93,93,93,83,93,83,111,93,111,93,111,93,120,
+  83,120,83,120,107,120,93,111,93,111,93,111,93,111,93,130,93,130,
+  93,46,46,46,37,46,46,111,83,93,37,93,37,93,50,93,37,120,93,120,93,
+  120,93,130,93,130,93,167,157,120,56,120,56,120,56,111,83,111,83,
+  111,83,102,46,102,53,120,93,120,93,120,93,120,93,111,102,83,102,
+  83,102,83,93,111,83,56,56,56,56,56,56,56,56,93,167,37,37,37,56,56,
+  56,93,93,58,167,167,56,56,28,93,167,79,102,100,97,76,92,92,92,79,
+  42,83,83
+};
+static afm_sint16 afm_Helvetica_Oblique_kerning_index[] = { /* 315 */
+  1,0,0,0,0,0,0,0,0,0,0,0,29,0,38,0,0,0,0,0,0,0,0,0,0,0,49,52,0,0,
+  0,0,0,55,170,197,202,0,241,0,0,0,345,418,510,0,0,545,594,687,710,
+  772,777,938,966,1115,0,1259,0,0,0,0,0,0,0,1407,1419,1468,0,1476,
+  1494,1575,1587,0,0,1595,0,1638,1668,1700,1718,0,1730,1847,0,0,1854,
+  1924,1994,2017,2087,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,0,0,0,0,0,0,0,0,0,0,2130,2245,2360,2475,2590,2705,0,2820,0,0,
+  0,0,0,0,0,0,0,0,2825,2874,2923,2972,3021,0,3070,3119,3147,3175,3203,
+  3231,0,0,3379,3391,3403,3415,3427,3439,0,3451,3459,3477,3495,3513,
+  0,0,0,0,0,3531,3563,3581,3599,3617,3635,0,3653,0,0,0,0,3882,0,3952,
+  4022,4137,4149,4264,4276,4391,4403,4408,4416,4421,4429,0,4468,0,
+  0,4507,0,4525,0,4543,0,4561,0,4579,0,4591,0,0,0,0,0,0,4603,4695,
+  4738,0,4773,0,4808,0,4843,0,0,4878,0,4910,0,4942,4974,5023,5041,
+  5090,0,0,5108,5170,5287,5349,5466,5528,5645,5650,5657,5662,5669,
+  5674,5681,0,5842,0,6003,0,6031,0,6059,0,6087,0,6115,0,6263,0,6306,
+  0,6349,0,6392,6397,0,0,0,0,0,0,0,0,0,0,6404,6409,0,0,6447,0,0,0,
+  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+};
+static afm_cuint8 afm_Helvetica_Oblique_kerning_data[] = { /* 6450 */
+  42,11,85,249,87,249,88,250,90,242,222,242,0,100,249,0,102,249,0,
+  122,242,1,32,24,247,1,32,28,252,3,1,32,25,240,1,32,29,240,4,33,247,
+  1,32,25,240,1,32,29,240,2,33,249,2,33,249,49,68,252,72,252,80,252,
+  82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,250,120,250,
+  122,250,200,252,211,252,212,252,213,252,214,252,215,252,217,252,
+  218,249,219,249,220,249,221,249,222,240,250,252,251,252,252,252,
+  253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,0,78,
+  252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,249,0,
+  113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,12,45,
+  254,47,254,86,255,218,255,219,255,220,255,221,255,0,108,255,0,112,
+  255,0,114,255,0,116,255,3,45,252,47,252,18,45,245,47,245,66,250,
+  87,245,88,250,90,242,193,250,194,250,195,250,196,250,197,250,198,
+  250,222,242,0,2,250,0,4,250,0,6,250,0,122,242,45,45,232,47,232,66,
+  244,98,249,102,252,112,252,115,249,193,244,194,244,195,244,196,244,
+  197,244,198,244,225,249,226,249,227,249,228,249,229,249,230,249,
+  233,252,234,252,235,252,236,252,243,252,244,252,245,252,246,252,
+  247,252,249,252,0,2,244,0,3,249,0,4,244,0,5,249,0,6,244,0,7,249,
+  0,21,252,0,25,252,0,27,252,0,29,252,0,79,252,0,83,252,0,87,249,0,
+  89,249,0,91,249,32,45,252,47,252,66,254,98,254,118,254,193,254,194,
+  254,195,254,196,254,197,254,198,254,225,254,226,254,227,254,228,
+  254,229,254,230,254,250,254,251,254,252,254,253,254,0,2,254,0,3,
+  254,0,4,254,0,5,254,0,6,254,0,7,254,0,109,254,0,113,254,0,115,254,
+  0,117,254,40,80,249,102,250,112,250,118,252,122,249,211,249,212,
+  249,213,249,214,249,215,249,217,249,233,250,234,250,235,250,236,
+  250,243,250,244,250,245,250,246,250,247,250,249,250,250,252,251,
+  252,252,252,253,252,254,249,0,1,249,0,21,250,0,25,250,0,27,250,0,
+  29,250,0,78,249,0,79,250,0,82,249,0,83,250,0,109,252,0,113,252,0,
+  115,252,0,117,252,14,85,239,87,239,88,245,90,234,122,252,222,234,
+  254,252,0,1,252,0,100,239,0,102,239,0,122,234,1,32,25,230,1,32,29,
+  234,22,45,250,47,250,66,254,85,250,87,249,88,252,89,247,90,245,193,
+  254,194,254,195,254,196,254,197,254,198,254,222,245,0,2,254,0,4,
+  254,0,6,254,0,100,250,0,102,250,0,122,245,41,45,227,47,227,66,237,
+  98,250,102,249,112,249,193,237,194,237,195,237,196,237,197,237,198,
+  237,225,250,226,250,227,250,228,250,229,250,230,250,233,249,234,
+  249,235,249,236,249,243,249,244,249,245,249,246,249,247,249,249,
+  249,0,2,237,0,3,250,0,4,237,0,5,250,0,6,237,0,7,250,0,21,249,0,25,
+  249,0,27,249,0,29,249,0,79,249,0,83,249,10,86,255,218,255,219,255,
+  220,255,221,255,0,108,255,0,112,255,0,114,255,0,116,255,27,80,254,
+  85,252,86,250,87,249,88,252,90,249,211,254,212,254,213,254,214,254,
+  215,254,217,254,218,250,219,250,220,250,221,250,222,249,0,78,254,
+  0,82,254,0,100,252,0,102,252,0,108,250,0,112,250,0,114,250,0,116,
+  250,0,122,249,3,45,254,47,254,70,45,237,46,234,47,237,59,254,60,
+  254,66,237,80,250,98,237,102,237,112,237,115,237,118,237,120,237,
+  122,237,193,237,194,237,195,237,196,237,197,237,198,237,211,250,
+  212,250,213,250,214,250,215,250,217,250,225,237,226,237,227,237,
+  228,247,229,237,230,237,233,247,234,237,235,237,236,237,243,237,
+  244,237,245,237,246,247,247,237,249,237,250,237,251,237,252,237,
+  253,237,254,237,0,1,247,0,2,237,0,3,247,0,4,237,0,5,247,0,6,237,
+  0,7,237,0,21,247,0,25,237,0,27,237,0,29,237,0,78,250,0,79,247,0,
+  82,250,0,83,237,0,87,237,0,89,237,0,91,237,0,109,247,0,113,237,0,
+  115,237,0,117,237,13,45,250,47,250,66,250,193,250,194,250,195,250,
+  196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,65,45,236,46,244,
+  47,236,59,250,60,250,66,244,72,250,80,250,98,245,102,244,112,244,
+  118,245,193,244,194,244,195,244,196,244,197,244,198,244,211,250,
+  212,250,213,250,214,250,215,250,217,250,225,245,226,245,227,245,
+  228,245,229,245,230,245,233,244,234,244,235,244,236,244,243,244,
+  244,244,245,244,246,244,247,244,249,244,250,245,251,245,252,245,
+  253,245,0,2,244,0,3,245,0,4,244,0,5,245,0,6,244,0,7,245,0,21,244,
+  0,25,244,0,27,244,0,29,244,0,32,250,0,36,250,0,78,250,0,79,244,0,
+  82,250,0,83,244,0,109,245,0,113,245,0,115,245,0,117,245,63,45,244,
+  46,250,47,244,66,249,80,254,98,250,102,252,112,252,118,252,122,254,
+  193,249,194,249,195,249,196,249,197,249,198,249,211,254,212,254,
+  213,254,214,254,215,254,217,254,225,250,226,250,227,250,228,250,
+  229,250,230,250,233,252,234,252,235,252,236,252,243,252,244,252,
+  245,252,246,252,247,252,249,252,250,252,251,252,252,252,253,252,
+  254,254,0,1,254,0,2,249,0,3,250,0,4,249,0,5,250,0,6,249,0,7,250,
+  0,21,252,0,25,252,0,27,252,0,29,252,0,78,254,0,79,252,0,82,254,0,
+  83,252,0,109,252,0,113,252,0,115,252,0,117,252,65,45,234,46,234,
+  47,234,59,247,60,247,66,239,80,243,98,234,102,234,106,254,112,234,
+  118,239,193,239,194,239,195,239,196,239,197,239,198,239,211,243,
+  212,243,213,243,214,243,215,243,217,243,225,234,226,234,227,234,
+  228,234,229,234,230,234,233,234,234,234,235,234,236,234,238,254,
+  243,234,244,234,245,234,246,234,247,234,249,234,250,239,251,239,
+  252,239,253,239,0,2,239,0,3,245,0,4,239,0,5,245,0,6,239,0,7,234,
+  0,21,245,0,25,234,0,27,234,0,29,234,0,49,254,0,78,243,0,79,234,0,
+  82,243,0,83,234,0,109,239,0,113,239,0,115,239,0,117,239,6,119,254,
+  120,254,122,252,254,252,0,1,252,21,45,250,47,250,99,255,109,254,
+  118,254,119,254,122,254,250,254,251,254,252,254,253,254,254,254,
+  0,1,254,0,60,254,0,62,254,0,68,254,0,109,254,0,113,254,0,115,254,
+  0,117,254,4,45,254,108,254,0,57,254,9,45,254,47,254,119,252,120,
+  254,121,252,122,254,254,254,0,1,254,34,45,252,47,252,98,252,102,
+  252,112,252,225,252,226,252,227,252,228,252,229,252,230,252,233,
+  252,234,252,235,252,236,252,243,252,244,252,245,252,246,252,247,
+  252,249,252,0,3,252,0,5,252,0,7,252,0,21,252,0,25,252,0,27,252,0,
+  29,252,0,51,252,0,79,252,0,83,252,1,32,25,8,1,32,29,10,5,115,255,
+  0,87,255,0,89,255,0,91,255,4,122,252,254,252,0,1,252,19,102,254,
+  112,254,233,254,234,254,235,254,236,254,243,254,244,254,245,254,
+  246,254,247,254,249,254,0,21,254,0,25,254,0,27,254,0,29,254,0,79,
+  254,0,83,254,13,118,255,122,254,250,255,251,255,252,255,253,255,
+  254,254,0,1,254,0,109,255,0,113,255,0,115,255,0,117,255,14,118,255,
+  119,254,122,254,250,255,251,255,252,255,253,255,254,254,0,1,254,
+  0,109,255,0,113,255,0,115,255,0,117,255,9,45,250,47,250,119,254,
+  120,254,121,252,122,252,254,252,0,1,252,6,45,251,47,251,122,252,
+  254,252,0,1,252,50,45,249,47,249,59,5,60,5,98,255,106,3,108,3,109,
+  3,110,4,111,4,113,5,117,7,118,3,119,5,122,5,225,255,226,255,227,
+  255,228,255,229,255,230,255,237,3,238,3,239,3,240,3,242,4,250,3,
+  251,3,252,3,253,3,254,5,0,1,5,0,3,255,0,5,255,0,7,255,0,45,3,0,49,
+  3,0,57,3,0,60,3,0,62,3,0,68,3,0,70,4,0,72,4,0,74,4,0,101,7,0,109,
+  3,0,113,3,0,115,3,0,117,3,4,45,254,47,254,120,252,31,45,244,47,244,
+  98,253,102,253,112,253,225,253,226,253,227,253,228,253,229,253,230,
+  253,233,253,234,253,235,253,236,253,243,253,244,253,245,253,246,
+  253,247,253,249,253,0,3,253,0,5,253,0,7,253,0,21,253,0,25,253,0,
+  27,253,0,29,253,0,79,253,0,83,253,31,45,247,47,247,98,254,102,255,
+  112,255,225,254,226,254,227,254,228,254,229,254,230,254,233,255,
+  234,255,235,255,236,255,243,255,244,255,245,255,246,255,247,255,
+  249,255,0,3,254,0,5,254,0,7,254,0,21,255,0,25,255,0,27,255,0,29,
+  255,0,79,255,0,83,255,10,102,252,233,252,234,252,235,252,236,252,
+  0,21,252,0,25,252,0,27,252,0,29,252,31,45,240,47,240,98,254,102,
+  254,112,254,225,254,226,254,227,254,228,254,229,254,230,254,233,
+  254,234,254,235,254,236,254,243,254,244,254,245,254,246,254,247,
+  254,249,254,0,3,254,0,5,254,0,7,254,0,21,254,0,25,254,0,27,254,0,
+  29,254,0,79,254,0,83,254,19,102,254,112,254,233,254,234,254,235,
+  254,236,254,243,254,244,254,245,254,246,254,247,254,249,254,0,21,
+  254,0,25,254,0,27,254,0,29,254,0,79,254,0,83,254,49,68,252,72,252,
+  80,252,82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,250,
+  120,250,122,250,200,252,211,252,212,252,213,252,214,252,215,252,
+  217,252,218,249,219,249,220,249,221,249,222,240,250,252,251,252,
+  252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,
+  0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,
+  249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,
+  49,68,252,72,252,80,252,82,252,85,237,86,249,87,245,88,249,90,240,
+  118,252,119,250,120,250,122,250,200,252,211,252,212,252,213,252,
+  214,252,215,252,217,252,218,249,219,249,220,249,221,249,222,240,
+  250,252,251,252,252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,
+  0,32,252,0,36,252,0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,
+  0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,
+  252,0,122,240,49,68,252,72,252,80,252,82,252,85,237,86,249,87,245,
+  88,249,90,240,118,252,119,250,120,250,122,250,200,252,211,252,212,
+  252,213,252,214,252,215,252,217,252,218,249,219,249,220,249,221,
+  249,222,240,250,252,251,252,252,252,253,252,254,250,0,1,250,0,8,
+  252,0,14,252,0,32,252,0,36,252,0,78,252,0,82,252,0,100,237,0,102,
+  237,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,
+  0,116,249,0,117,252,0,122,240,49,68,252,72,252,80,252,82,252,85,
+  237,86,249,87,245,88,249,90,240,118,252,119,250,120,250,122,250,
+  200,252,211,252,212,252,213,252,214,252,215,252,217,252,218,249,
+  219,249,220,249,221,249,222,240,250,252,251,252,252,252,253,252,
+  254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,0,78,252,0,82,
+  252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,249,0,113,252,
+  0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,49,68,252,72,252,
+  80,252,82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,250,
+  120,250,122,250,200,252,211,252,212,252,213,252,214,252,215,252,
+  217,252,218,249,219,249,220,249,221,249,222,240,250,252,251,252,
+  252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,
+  0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,
+  249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,
+  49,68,252,72,252,80,252,82,252,85,237,86,249,87,245,88,249,90,240,
+  118,252,119,250,120,250,122,250,200,252,211,252,212,252,213,252,
+  214,252,215,252,217,252,218,249,219,249,220,249,221,249,222,240,
+  250,252,251,252,252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,
+  0,32,252,0,36,252,0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,
+  0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,
+  252,0,122,240,3,45,252,47,252,22,45,250,47,250,66,254,85,250,87,
+  249,88,252,89,247,90,245,193,254,194,254,195,254,196,254,197,254,
+  198,254,222,245,0,2,254,0,4,254,0,6,254,0,100,250,0,102,250,0,122,
+  245,22,45,250,47,250,66,254,85,250,87,249,88,252,89,247,90,245,193,
+  254,194,254,195,254,196,254,197,254,198,254,222,245,0,2,254,0,4,
+  254,0,6,254,0,100,250,0,102,250,0,122,245,22,45,250,47,250,66,254,
+  85,250,87,249,88,252,89,247,90,245,193,254,194,254,195,254,196,254,
+  197,254,198,254,222,245,0,2,254,0,4,254,0,6,254,0,100,250,0,102,
+  250,0,122,245,22,45,250,47,250,66,254,85,250,87,249,88,252,89,247,
+  90,245,193,254,194,254,195,254,196,254,197,254,198,254,222,245,0,
+  2,254,0,4,254,0,6,254,0,100,250,0,102,250,0,122,245,22,45,250,47,
+  250,66,254,85,250,87,249,88,252,89,247,90,245,193,254,194,254,195,
+  254,196,254,197,254,198,254,222,245,0,2,254,0,4,254,0,6,254,0,100,
+  250,0,102,250,0,122,245,22,45,250,47,250,66,254,85,250,87,249,88,
+  252,89,247,90,245,193,254,194,254,195,254,196,254,197,254,198,254,
+  222,245,0,2,254,0,4,254,0,6,254,0,100,250,0,102,250,0,122,245,13,
+  45,250,47,250,66,250,193,250,194,250,195,250,196,250,197,250,198,
+  250,0,2,250,0,4,250,0,6,250,13,45,250,47,250,66,250,193,250,194,
+  250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,13,45,
+  250,47,250,66,250,193,250,194,250,195,250,196,250,197,250,198,250,
+  0,2,250,0,4,250,0,6,250,13,45,250,47,250,66,250,193,250,194,250,
+  195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,65,45,234,
+  46,234,47,234,59,247,60,247,66,239,80,243,98,234,102,234,106,254,
+  112,234,118,239,193,239,194,239,195,239,196,239,197,239,198,239,
+  211,243,212,243,213,243,214,243,215,243,217,243,225,234,226,234,
+  227,234,228,245,229,234,230,234,233,234,234,234,235,234,236,234,
+  238,254,243,234,244,234,245,234,246,234,247,234,249,234,250,239,
+  251,239,252,239,253,239,0,2,239,0,3,245,0,4,239,0,5,245,0,6,239,
+  0,7,234,0,21,245,0,25,234,0,27,234,0,29,234,0,49,254,0,78,243,0,
+  79,245,0,82,243,0,83,234,0,109,239,0,113,239,0,115,239,0,117,239,
+  6,119,254,120,254,122,252,254,252,0,1,252,6,119,254,120,254,122,
+  252,254,252,0,1,252,6,119,254,120,254,122,252,254,252,0,1,252,6,
+  119,254,120,254,122,252,254,252,0,1,252,6,119,254,120,254,122,252,
+  254,252,0,1,252,6,119,254,120,254,122,252,254,252,0,1,252,4,45,254,
+  108,254,0,57,254,9,45,254,47,254,119,252,120,254,121,252,122,254,
+  254,254,0,1,254,9,45,254,47,254,119,252,120,254,121,252,122,254,
+  254,254,0,1,254,9,45,254,47,254,119,252,120,254,121,252,122,254,
+  254,254,0,1,254,9,45,254,47,254,119,252,120,254,121,252,122,254,
+  254,254,0,1,254,14,118,255,119,254,122,254,250,255,251,255,252,255,
+  253,255,254,254,0,1,254,0,109,255,0,113,255,0,115,255,0,117,255,
+  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
+  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
+  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
+  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
+  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
+  95,45,241,47,241,98,248,99,248,100,248,101,248,102,248,103,248,104,
+  248,105,248,106,248,107,248,108,248,109,248,110,248,111,248,112,
+  248,113,248,114,248,115,248,116,248,117,248,118,248,119,245,120,
+  245,121,243,122,245,123,248,225,248,226,248,227,248,228,248,229,
+  248,230,248,232,248,233,248,234,248,235,248,236,248,237,248,238,
+  248,239,248,240,248,242,248,243,248,244,248,245,248,246,248,247,
+  248,249,248,250,248,251,248,252,248,253,248,254,245,0,1,245,0,3,
+  248,0,5,248,0,7,248,0,9,248,0,15,248,0,19,248,0,21,248,0,25,248,
+  0,27,248,0,29,248,0,33,248,0,37,248,0,45,248,0,49,248,0,57,248,0,
+  60,248,0,62,248,0,68,248,0,70,248,0,72,248,0,74,248,0,79,248,0,83,
+  248,0,87,248,0,89,248,0,91,248,0,93,248,0,97,248,0,99,248,0,101,
+  248,0,109,248,0,113,248,0,115,248,0,117,248,0,124,248,0,126,248,
+  0,128,248,1,2,25,248,31,45,240,47,240,98,254,102,254,112,254,225,
+  254,226,254,227,254,228,254,229,254,230,254,233,254,234,254,235,
+  254,236,254,243,254,244,254,245,254,246,254,247,254,249,254,0,3,
+  254,0,5,254,0,7,254,0,21,254,0,25,254,0,27,254,0,29,254,0,79,254,
+  0,83,254,31,45,240,47,240,98,254,102,254,112,254,225,254,226,254,
+  227,254,228,254,229,254,230,254,233,254,234,254,235,254,236,254,
+  243,254,244,254,245,254,246,254,247,254,249,254,0,3,254,0,5,254,
+  0,7,254,0,21,254,0,25,254,0,27,254,0,29,254,0,79,254,0,83,254,49,
+  68,252,72,252,80,252,82,252,85,237,86,249,87,245,88,249,90,240,118,
+  252,119,250,120,250,122,250,200,252,211,252,212,252,213,252,214,
+  252,215,252,217,252,218,249,219,249,220,249,221,249,222,240,250,
+  252,251,252,252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,
+  252,0,36,252,0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,
+  252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,
+  0,122,240,6,119,254,120,254,122,252,254,252,0,1,252,49,68,252,72,
+  252,80,252,82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,
+  250,120,250,122,250,200,252,211,252,212,252,213,252,214,252,215,
+  252,217,252,218,249,219,249,220,249,221,249,222,240,250,252,251,
+  252,252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,
+  36,252,0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,
+  0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,
+  240,6,119,254,120,254,122,252,254,252,0,1,252,49,68,252,72,252,80,
+  252,82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,250,120,
+  250,122,250,200,252,211,252,212,252,213,252,214,252,215,252,217,
+  252,218,249,219,249,220,249,221,249,222,240,250,252,251,252,252,
+  252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,0,
+  78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,249,
+  0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,6,119,
+  254,120,254,122,252,254,252,0,1,252,3,45,252,47,252,4,45,254,108,
+  254,0,57,254,3,45,252,47,252,4,45,254,108,254,0,57,254,18,45,245,
+  47,245,66,250,87,245,88,250,90,242,193,250,194,250,195,250,196,250,
+  197,250,198,250,222,242,0,2,250,0,4,250,0,6,250,0,122,242,18,45,
+  245,47,245,66,250,87,245,88,250,90,242,193,250,194,250,195,250,196,
+  250,197,250,198,250,222,242,0,2,250,0,4,250,0,6,250,0,122,242,9,
+  45,254,47,254,119,252,120,254,121,252,122,254,254,254,0,1,254,9,
+  45,254,47,254,119,252,120,254,121,252,122,254,254,254,0,1,254,9,
+  45,254,47,254,119,252,120,254,121,252,122,254,254,254,0,1,254,9,
+  45,254,47,254,119,252,120,254,121,252,122,254,254,254,0,1,254,5,
+  115,255,0,87,255,0,89,255,0,91,255,5,115,255,0,87,255,0,89,255,0,
+  91,255,40,80,249,102,250,112,250,118,252,122,249,211,249,212,249,
+  213,249,214,249,215,249,217,249,233,250,234,250,235,250,236,250,
+  243,250,244,250,245,250,246,250,247,250,249,250,250,252,251,252,
+  252,252,253,252,254,249,0,1,249,0,21,250,0,25,250,0,27,250,0,29,
+  250,0,78,249,0,79,250,0,82,249,0,83,250,0,109,252,0,113,252,0,115,
+  252,0,117,252,19,102,254,112,254,233,254,234,254,235,254,236,254,
+  243,254,244,254,245,254,246,254,247,254,249,254,0,21,254,0,25,254,
+  0,27,254,0,29,254,0,79,254,0,83,254,14,85,239,87,239,88,245,90,234,
+  122,252,222,234,254,252,0,1,252,0,100,239,0,102,239,0,122,234,1,
+  32,25,230,1,32,29,234,14,85,239,87,239,88,245,90,234,122,252,222,
+  234,254,252,0,1,252,0,100,239,0,102,239,0,122,234,1,32,25,230,1,
+  32,29,234,14,85,239,87,239,88,245,90,234,122,252,222,234,254,252,
+  0,1,252,0,100,239,0,102,239,0,122,234,1,32,25,230,1,32,29,234,14,
+  85,239,87,239,88,245,90,234,122,252,222,234,254,252,0,1,252,0,100,
+  239,0,102,239,0,122,234,1,32,25,230,1,32,29,234,14,118,255,119,254,
+  122,254,250,255,251,255,252,255,253,255,254,254,0,1,254,0,109,255,
+  0,113,255,0,115,255,0,117,255,14,118,255,119,254,122,254,250,255,
+  251,255,252,255,253,255,254,254,0,1,254,0,109,255,0,113,255,0,115,
+  255,0,117,255,14,118,255,119,254,122,254,250,255,251,255,252,255,
+  253,255,254,254,0,1,254,0,109,255,0,113,255,0,115,255,0,117,255,
+  22,45,250,47,250,66,254,85,250,87,249,88,252,89,247,90,245,193,254,
+  194,254,195,254,196,254,197,254,198,254,222,245,0,2,254,0,4,254,
+  0,6,254,0,100,250,0,102,250,0,122,245,9,45,250,47,250,119,254,120,
+  254,121,252,122,252,254,252,0,1,252,22,45,250,47,250,66,254,85,250,
+  87,249,88,252,89,247,90,245,193,254,194,254,195,254,196,254,197,
+  254,198,254,222,245,0,2,254,0,4,254,0,6,254,0,100,250,0,102,250,
+  0,122,245,9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,
+  0,1,252,27,80,254,85,252,86,250,87,249,88,252,90,249,211,254,212,
+  254,213,254,214,254,215,254,217,254,218,250,219,250,220,250,221,
+  250,222,249,0,78,254,0,82,254,0,100,252,0,102,252,0,108,250,0,112,
+  250,0,114,250,0,116,250,0,122,249,50,45,249,47,249,59,5,60,5,98,
+  255,106,3,108,3,109,3,110,4,111,4,113,5,117,7,118,3,119,5,122,5,
+  225,255,226,255,227,255,228,255,229,255,230,255,237,3,238,3,239,
+  3,240,3,242,4,250,3,251,3,252,3,253,3,254,5,0,1,5,0,3,255,0,5,255,
+  0,7,255,0,45,3,0,49,3,0,57,3,0,60,3,0,62,3,0,68,3,0,70,4,0,72,4,
+  0,74,4,0,101,7,0,109,3,0,113,3,0,115,3,0,117,3,27,80,254,85,252,
+  86,250,87,249,88,252,90,249,211,254,212,254,213,254,214,254,215,
+  254,217,254,218,250,219,250,220,250,221,250,222,249,0,78,254,0,82,
+  254,0,100,252,0,102,252,0,108,250,0,112,250,0,114,250,0,116,250,
+  0,122,249,50,45,249,47,249,59,5,60,5,98,255,106,3,108,3,109,3,110,
+  4,111,4,113,5,117,7,118,3,119,5,122,5,225,255,226,255,227,255,228,
+  255,229,255,230,255,237,3,238,3,239,3,240,3,242,4,250,3,251,3,252,
+  3,253,3,254,5,0,1,5,0,3,255,0,5,255,0,7,255,0,45,3,0,49,3,0,57,3,
+  0,60,3,0,62,3,0,68,3,0,70,4,0,72,4,0,74,4,0,101,7,0,109,3,0,113,
+  3,0,115,3,0,117,3,27,80,254,85,252,86,250,87,249,88,252,90,249,211,
+  254,212,254,213,254,214,254,215,254,217,254,218,250,219,250,220,
+  250,221,250,222,249,0,78,254,0,82,254,0,100,252,0,102,252,0,108,
+  250,0,112,250,0,114,250,0,116,250,0,122,249,50,45,249,47,249,59,
+  5,60,5,98,255,106,3,108,3,109,3,110,4,111,4,113,5,117,7,118,3,119,
+  5,122,5,225,255,226,255,227,255,228,255,229,255,230,255,237,3,238,
+  3,239,3,240,3,242,4,250,3,251,3,252,3,253,3,254,5,0,1,5,0,3,255,
+  0,5,255,0,7,255,0,45,3,0,49,3,0,57,3,0,60,3,0,62,3,0,68,3,0,70,4,
+  0,72,4,0,74,4,0,101,7,0,109,3,0,113,3,0,115,3,0,117,3,3,45,254,47,
+  254,4,45,254,47,254,120,252,3,45,254,47,254,4,45,254,47,254,120,
+  252,3,45,254,47,254,4,45,254,47,254,120,252,70,45,237,46,234,47,
+  237,59,254,60,254,66,237,80,250,98,237,102,237,112,237,115,237,118,
+  237,120,237,122,237,193,237,194,237,195,237,196,237,197,237,198,
+  237,211,250,212,250,213,250,214,250,215,250,217,250,225,237,226,
+  237,227,237,228,247,229,237,230,237,233,247,234,237,235,237,236,
+  237,243,237,244,237,245,237,246,247,247,237,249,237,250,237,251,
+  237,252,237,253,237,254,237,0,1,247,0,2,237,0,3,247,0,4,237,0,5,
+  247,0,6,237,0,7,237,0,21,247,0,25,237,0,27,237,0,29,237,0,78,250,
+  0,79,247,0,82,250,0,83,237,0,87,237,0,89,237,0,91,237,0,109,247,
+  0,113,237,0,115,237,0,117,237,70,45,237,46,234,47,237,59,254,60,
+  254,66,237,80,250,98,237,102,237,112,237,115,237,118,237,120,237,
+  122,237,193,237,194,237,195,237,196,237,197,237,198,237,211,250,
+  212,250,213,250,214,250,215,250,217,250,225,237,226,237,227,237,
+  228,247,229,237,230,237,233,247,234,237,235,237,236,237,243,237,
+  244,237,245,237,246,247,247,237,249,237,250,237,251,237,252,237,
+  253,237,254,237,0,1,247,0,2,237,0,3,247,0,4,237,0,5,247,0,6,237,
+  0,7,237,0,21,247,0,25,237,0,27,237,0,29,237,0,78,250,0,79,247,0,
+  82,250,0,83,237,0,87,237,0,89,237,0,91,237,0,109,247,0,113,237,0,
+  115,237,0,117,237,13,45,250,47,250,66,250,193,250,194,250,195,250,
+  196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,13,45,250,47,250,
+  66,250,193,250,194,250,195,250,196,250,197,250,198,250,0,2,250,0,
+  4,250,0,6,250,13,45,250,47,250,66,250,193,250,194,250,195,250,196,
+  250,197,250,198,250,0,2,250,0,4,250,0,6,250,13,45,250,47,250,66,
+  250,193,250,194,250,195,250,196,250,197,250,198,250,0,2,250,0,4,
+  250,0,6,250,65,45,234,46,234,47,234,59,247,60,247,66,239,80,243,
+  98,234,102,234,106,254,112,234,118,239,193,239,194,239,195,239,196,
+  239,197,239,198,239,211,243,212,243,213,243,214,243,215,243,217,
+  243,225,234,226,234,227,234,228,245,229,234,230,234,233,234,234,
+  234,235,234,236,234,238,254,243,234,244,234,245,234,246,234,247,
+  234,249,234,250,239,251,239,252,239,253,239,0,2,239,0,3,245,0,4,
+  239,0,5,245,0,6,239,0,7,234,0,21,245,0,25,234,0,27,234,0,29,234,
+  0,49,254,0,78,243,0,79,234,0,82,243,0,83,234,0,109,239,0,113,239,
+  0,115,239,0,117,239,19,102,254,112,254,233,254,234,254,235,254,236,
+  254,243,254,244,254,245,254,246,254,247,254,249,254,0,21,254,0,25,
+  254,0,27,254,0,29,254,0,79,254,0,83,254,19,102,254,112,254,233,254,
+  234,254,235,254,236,254,243,254,244,254,245,254,246,254,247,254,
+  249,254,0,21,254,0,25,254,0,27,254,0,29,254,0,79,254,0,83,254,19,
+  102,254,112,254,233,254,234,254,235,254,236,254,243,254,244,254,
+  245,254,246,254,247,254,249,254,0,21,254,0,25,254,0,27,254,0,29,
+  254,0,79,254,0,83,254,3,45,254,47,254,4,45,254,47,254,120,252,2,
+  1,32,24,247,14,33,245,101,249,115,249,116,249,0,19,249,0,87,249,
+  0,89,249,0,91,249,0,93,249,0,97,249,0,99,249,1,2,25,249,1,32,25,
+  247,2,33,250
+};
+static afm_cuint16 afm_Helvetica_Oblique_highchars_index[] = { /* 220 */
+  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
+  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
+  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
+  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
+  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
+  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
+  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
+  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
+  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
+  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
+  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
+  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
+  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
+  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
+  64257,64258
+};
+static afm_cunicode afm_Helvetica_Oblique_ligatures[] = { /* 3 */
+  102,105,64257
+};
+
+
+/* ------------------------------------------------------------------*/
+/* FontName: ZapfDingbats */
+/* FullName: ITC Zapf Dingbats */
+/* FamilyName: ZapfDingbats */
+static afm_cuint8 afm_ZapfDingbats_widths[] = { /* 202 */
+  46,162,160,162,163,120,132,132,132,115,160,157,92,143,152,156,152,
+  158,162,126,141,127,127,95,113,127,127,127,126,82,92,90,96,115,131,
+  131,131,132,132,132,136,137,132,140,137,139,136,139,154,124,121,
+  125,132,132,116,129,128,132,127,118,118,114,117,138,136,132,132,
+  118,115,116,115,131,131,119,132,131,132,146,127,127,127,127,127,
+  149,149,131,131,73,23,46,69,65,65,111,111,65,65,53,53,46,46,85,85,
+  68,68,39,39,56,56,122,91,91,152,111,127,127,129,99,116,104,131,131,
+  131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
+  131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
+  131,131,131,131,131,131,149,140,169,76,125,154,125,153,155,155,155,
+  139,146,138,154,154,153,155,155,77,147,139,139,145,145,116,116,146,
+  146,127,158,129,144,129,148,161,148,139,146,155,162,153
+};
+static afm_cuint16 afm_ZapfDingbats_highchars_index[] = { /* 107 */
+  128,129,130,131,132,133,134,135,136,137,138,139,140,141,161,162,
+  163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,
+  179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,
+  195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,
+  211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,
+  227,228,229,230,231,232,233,234,235,236,237,238,239,241,242,243,
+  244,245,246,247,248,249,250,251,252,253,254
+};
+
+
+/* ------------------------------------------------------------------*/
+/* FontName: Symbol */
+/* FullName: Symbol */
+/* FamilyName: Symbol */
+static afm_cuint8 afm_Symbol_widths[] = { /* 251 */
+  42,56,0,83,0,139,130,0,56,56,0,92,42,0,42,46,83,83,83,83,83,83,83,
+  83,83,83,46,46,92,92,92,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,0,0,0,0,0,0,56,0,56,0,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,0,0,0,0,0,0,0,80,33,80,0,119,67,92,96,92,92,83,120,111,101,102,
+  102,120,124,56,120,114,148,120,108,120,128,93,99,102,115,127,120,
+  133,105,92,69,82,73,82,101,87,55,92,92,87,82,92,92,92,73,101,73,
+  96,87,92,114,114,105,103,101,119,77,167,41,69,28,125,114,165,133,
+  128,137,165,101,165,101,174,110,165,101,165,101,174,119,82,92,137,
+  102,119,119,119,73,137,119,92,83,92,119,119,128,101,101,128,128,
+  46,144,92,92,92,92,92,92,92,119,119,119,119,119,128,128,110,42,114,
+  114,55,55,82,126,126,126,126,132,132,148,83,101,167,132,132,131,
+  64,64,64,64,64,64,82,82,82,82,114,64,64,64,64,64,64,82,82,82
+};
+static afm_cuint16 afm_Symbol_highchars_index[] = { /* 156 */
+  172,176,177,181,215,247,402,913,914,915,917,918,919,920,921,922,
+  923,924,925,926,927,928,929,931,932,933,934,935,936,945,946,947,
+  948,949,950,951,952,953,954,955,957,958,959,960,961,962,963,964,
+  965,966,967,968,969,977,978,981,982,8226,8230,8242,8243,8260,8364,
+  8465,8472,8476,8486,8501,8592,8593,8594,8595,8596,8629,8656,8657,
+  8658,8659,8660,8704,8706,8707,8709,8710,8711,8712,8713,8715,8719,
+  8721,8722,8727,8730,8733,8734,8736,8743,8744,8745,8746,8747,8756,
+  8764,8773,8776,8800,8801,8804,8805,8834,8835,8836,8838,8839,8853,
+  8855,8869,8901,8992,8993,9001,9002,9674,9824,9827,9829,9830,63193,
+  63194,63195,63717,63718,63719,63720,63721,63722,63723,63724,63725,
+  63726,63727,63728,63729,63730,63731,63732,63733,63734,63735,63736,
+  63737,63738,63739,63740,63741,63742
+};
+
+
+/* ------------------------------------------------------------------*/
+/* FontName: Times-Bold */
+/* FullName: Times Bold */
+/* FamilyName: Times */
+static afm_cuint8 afm_Times_Bold_widths[] = { /* 315 */
+  42,56,93,83,83,167,139,46,56,56,83,95,42,56,42,46,83,83,83,83,83,
+  83,83,83,83,83,56,56,95,95,95,83,155,120,111,120,120,111,102,130,
+  130,65,83,130,111,157,120,130,102,130,120,93,111,120,120,167,120,
+  120,111,56,46,56,97,83,56,83,93,74,93,74,56,83,93,46,56,93,46,139,
+  93,83,93,93,74,65,56,93,83,120,83,83,74,66,37,66,87,56,83,83,83,
+  83,37,83,56,125,50,83,95,125,56,67,95,50,50,56,93,90,42,56,50,55,
+  83,125,125,125,83,120,120,120,120,120,120,167,120,111,111,111,111,
+  65,65,65,65,120,120,130,130,130,130,130,95,130,120,120,120,120,120,
+  102,93,83,83,83,83,83,83,120,74,74,74,74,74,46,46,46,46,83,93,83,
+  83,83,83,83,95,83,93,93,93,93,83,93,83,120,83,120,83,120,83,120,
+  74,120,74,120,112,120,93,111,74,111,74,111,74,111,74,130,83,130,
+  83,65,46,65,46,65,46,130,93,111,46,111,46,111,66,111,46,120,93,120,
+  93,120,93,130,83,130,83,167,120,120,74,120,74,120,74,93,65,93,65,
+  93,65,111,56,111,69,120,93,120,93,120,93,120,93,120,111,74,111,74,
+  111,74,83,93,65,56,56,56,56,56,56,56,56,83,167,56,56,56,83,83,83,
+  83,83,58,167,167,56,56,28,83,167,82,102,100,95,92,92,92,92,82,42,
+  93,93
+};
+static afm_sint16 afm_Times_Bold_kerning_index[] = { /* 315 */
+  1,0,0,0,0,0,0,0,0,0,0,0,44,0,53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,62,183,0,229,0,266,0,0,0,359,472,564,0,599,623,668,761,786,0,
+  848,1016,1044,1209,0,1364,0,0,0,0,0,0,0,1512,1515,0,1544,1547,1550,
+  1588,1591,1599,0,1602,0,0,1652,1655,0,0,1660,0,0,0,1746,1816,0,1841,
+  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,0,1888,2009,2130,2251,2372,2493,0,0,0,0,0,0,0,0,0,0,0,2614,2638,
+  2683,2728,2773,2818,0,2863,2908,2936,2964,2992,3020,0,0,3168,3171,
+  3174,3177,3180,3183,0,0,3186,3189,3192,3195,3198,3201,3204,3207,
+  0,3210,3213,3218,3223,3228,3233,0,3238,0,0,0,0,3243,0,3290,3337,
+  3458,3461,3582,3585,3706,0,0,0,0,3709,0,3746,3783,0,3786,0,3789,
+  0,3792,0,3795,0,3798,0,3801,0,3804,0,3807,0,0,3810,3902,3952,0,3987,
+  0,0,0,4022,0,4057,4081,4084,4108,4111,4135,4138,4183,4188,4233,0,
+  0,4238,4300,4386,4448,4534,4596,0,0,0,0,0,0,4682,0,4850,0,5018,0,
+  5046,0,5074,0,5102,0,5130,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  5278,5306,0,5346,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+};
+static afm_cuint8 afm_Times_Bold_kerning_data[] = { /* 5370 */
+  42,19,66,248,85,252,87,249,88,252,90,248,193,248,194,248,195,248,
+  196,248,197,248,198,248,222,248,0,2,248,0,4,248,0,6,248,0,100,252,
+  0,102,252,0,122,248,3,1,32,25,248,1,32,29,249,3,1,32,25,248,1,32,
+  29,248,51,68,248,72,248,80,249,82,249,85,241,86,249,87,233,88,235,
+  90,240,113,253,118,249,119,240,120,242,122,245,200,248,211,249,212,
+  249,213,249,214,249,215,249,217,249,218,249,219,249,220,249,221,
+  249,222,240,250,249,251,249,252,249,253,249,254,245,0,1,245,0,8,
+  248,0,14,248,0,32,248,0,36,248,0,78,249,0,82,249,0,100,241,0,102,
+  241,0,108,249,0,109,249,0,112,249,0,113,249,0,114,249,0,115,249,
+  0,116,249,0,117,249,0,122,240,1,32,25,245,20,66,252,86,255,193,252,
+  194,252,195,252,196,252,197,252,198,252,218,255,219,255,220,255,
+  221,255,0,2,252,0,4,252,0,6,252,0,108,255,0,112,255,0,114,255,0,
+  116,255,17,47,254,66,251,87,250,88,250,90,250,193,251,194,251,195,
+  251,196,251,197,251,198,251,222,250,0,2,251,0,4,251,0,6,251,0,122,
+  250,41,45,242,47,239,66,242,98,253,102,253,112,253,193,242,194,242,
+  195,242,196,242,197,242,198,242,225,253,226,253,227,253,228,253,
+  229,253,230,253,233,253,234,253,235,253,236,253,243,253,244,253,
+  245,253,246,253,247,253,249,253,0,2,242,0,3,253,0,4,242,0,5,253,
+  0,6,242,0,7,253,0,21,253,0,25,253,0,27,253,0,29,253,0,79,253,0,83,
+  253,49,47,254,66,252,98,254,102,254,112,254,118,254,193,252,194,
+  252,195,252,196,252,197,252,198,252,225,254,226,254,227,254,228,
+  254,229,254,230,254,233,254,234,254,235,254,236,254,243,254,244,
+  254,245,254,246,254,247,254,249,254,250,254,251,254,252,254,253,
+  254,0,2,252,0,3,254,0,4,252,0,5,254,0,6,252,0,7,254,0,21,254,0,25,
+  254,0,27,254,0,29,254,0,79,254,0,83,254,0,109,254,0,113,254,0,115,
+  254,0,117,254,40,80,252,102,253,112,253,118,254,122,249,211,252,
+  212,252,213,252,214,252,215,252,217,252,233,253,234,253,235,253,
+  236,253,243,253,244,253,245,253,246,253,247,253,249,253,250,254,
+  251,254,252,254,253,254,254,249,0,1,249,0,21,253,0,25,253,0,27,253,
+  0,29,253,0,78,252,0,79,253,0,82,252,0,83,253,0,109,254,0,113,254,
+  0,115,254,0,117,254,14,85,242,87,242,88,242,90,242,122,248,222,242,
+  254,248,0,1,248,0,100,242,0,102,242,0,122,242,1,32,25,239,1,32,29,
+  254,11,66,254,193,254,194,254,195,254,196,254,197,254,198,254,0,
+  2,254,0,4,254,0,6,254,20,66,250,85,250,87,249,88,249,89,250,90,249,
+  193,250,194,250,195,250,196,250,197,250,198,250,222,249,0,2,250,
+  0,4,250,0,6,250,0,100,250,0,102,250,0,122,249,41,45,242,47,239,66,
+  245,98,255,102,254,112,254,193,245,194,245,195,245,196,245,197,245,
+  198,245,225,255,226,255,227,255,228,255,229,255,230,255,233,254,
+  234,254,235,254,236,254,243,254,244,254,245,254,246,254,247,254,
+  249,254,0,2,245,0,3,255,0,4,245,0,5,255,0,6,245,0,7,255,0,21,254,
+  0,25,254,0,27,254,0,29,254,0,79,254,0,83,254,11,47,254,86,255,218,
+  255,219,255,220,255,221,255,0,108,255,0,112,255,0,114,255,0,116,
+  255,27,80,252,85,250,86,252,87,248,88,251,90,251,211,252,212,252,
+  213,252,214,252,215,252,217,252,218,252,219,252,220,252,221,252,
+  222,251,0,78,252,0,82,252,0,100,250,0,102,250,0,108,252,0,112,252,
+  0,114,252,0,116,252,0,122,251,73,45,245,46,242,47,242,59,245,60,
+  245,66,242,80,254,98,242,102,242,106,254,112,242,115,245,118,242,
+  120,245,122,251,193,242,194,242,195,242,196,242,197,242,198,242,
+  211,254,212,254,213,254,214,254,215,254,217,254,225,248,226,242,
+  227,248,228,248,229,248,230,242,233,248,234,242,235,242,236,248,
+  238,254,243,242,244,242,245,242,246,242,247,242,249,242,250,242,
+  251,242,252,242,253,242,254,251,0,1,251,0,2,242,0,3,248,0,4,242,
+  0,5,248,0,6,242,0,7,242,0,21,248,0,25,242,0,27,242,0,29,242,0,49,
+  254,0,78,254,0,79,242,0,82,254,0,83,242,0,87,245,0,89,245,0,91,245,
+  0,109,242,0,113,242,0,115,242,0,117,242,13,45,249,47,249,66,247,
+  193,247,194,247,195,247,196,247,197,247,198,247,0,2,247,0,4,247,
+  0,6,247,72,45,235,46,245,47,233,59,242,60,242,66,234,72,252,80,249,
+  98,242,102,240,106,251,112,240,118,242,193,234,194,234,195,234,196,
+  234,197,234,198,234,211,249,212,249,213,249,214,249,215,249,217,
+  249,225,242,226,242,227,242,228,242,229,242,230,242,233,240,234,
+  240,235,240,236,240,237,251,238,251,239,251,240,251,243,240,244,
+  240,245,240,246,240,247,240,249,240,250,242,251,242,252,242,253,
+  242,0,2,234,0,3,242,0,4,234,0,5,242,0,6,234,0,7,242,0,21,240,0,25,
+  240,0,27,240,0,29,240,0,32,252,0,36,252,0,45,251,0,49,251,0,78,249,
+  0,79,240,0,82,249,0,83,240,0,109,242,0,113,242,0,115,242,0,117,242,
+  68,45,242,46,251,47,242,59,248,60,248,66,237,80,255,98,246,102,246,
+  106,254,112,244,118,249,122,247,193,237,194,237,195,237,196,237,
+  197,237,198,237,211,255,212,255,213,255,214,255,215,255,217,255,
+  225,246,226,246,227,246,228,246,229,246,230,246,233,246,234,246,
+  235,246,236,246,238,254,243,244,244,244,245,244,246,244,247,244,
+  249,244,250,249,251,249,252,249,253,249,254,247,0,1,247,0,2,237,
+  0,3,246,0,4,237,0,5,246,0,6,237,0,7,246,0,21,246,0,25,246,0,27,246,
+  0,29,246,0,49,254,0,78,255,0,79,244,0,82,255,0,83,244,0,109,249,
+  0,113,249,0,115,249,0,117,249,65,45,242,46,242,47,242,59,242,60,
+  242,66,239,80,251,98,243,102,238,106,251,112,238,118,242,193,239,
+  194,239,195,239,196,239,197,239,198,239,211,251,212,251,213,251,
+  214,251,215,251,217,251,225,243,226,243,227,243,228,243,229,243,
+  230,243,233,245,234,238,235,238,236,245,238,251,243,238,244,238,
+  245,238,246,238,247,238,249,238,250,242,251,242,252,242,253,242,
+  0,2,239,0,3,243,0,4,239,0,5,243,0,6,239,0,7,243,0,21,245,0,25,238,
+  0,27,238,0,29,238,0,49,251,0,78,251,0,79,238,0,82,251,0,83,238,0,
+  109,242,0,113,242,0,115,242,0,117,242,2,119,253,13,47,250,99,255,
+  118,254,119,254,250,254,251,254,252,254,253,254,0,109,254,0,113,
+  254,0,115,254,0,117,254,2,120,254,2,119,254,16,45,254,47,254,106,
+  253,112,253,243,253,244,253,245,253,246,253,247,253,249,253,0,51,
+  251,0,79,253,0,83,253,1,32,25,9,1,32,29,8,2,47,254,4,122,254,254,
+  254,0,1,254,2,119,255,22,102,255,112,254,122,254,233,255,234,255,
+  235,255,236,255,243,254,244,254,245,254,246,254,247,254,249,254,
+  254,254,0,1,254,0,21,255,0,25,255,0,27,255,0,29,255,0,79,254,0,83,
+  254,2,119,250,3,119,255,120,255,37,45,242,46,251,47,240,100,254,
+  102,254,104,255,111,254,112,254,113,255,114,254,119,255,232,254,
+  233,254,234,254,235,254,236,254,242,254,243,254,244,254,245,254,
+  246,254,247,254,249,254,0,9,254,0,15,254,0,21,254,0,25,254,0,27,
+  254,0,29,254,0,33,255,0,37,255,0,70,254,0,72,254,0,74,254,0,79,254,
+  0,83,254,31,45,248,47,245,98,255,102,255,112,255,225,255,226,255,
+  227,255,228,255,229,255,230,255,233,255,234,255,235,255,236,255,
+  243,255,244,255,245,255,246,255,247,255,249,255,0,3,255,0,5,255,
+  0,7,255,0,21,255,0,25,255,0,27,255,0,29,255,0,79,255,0,83,255,12,
+  45,248,47,245,112,255,243,255,244,255,245,255,246,255,247,255,249,
+  255,0,79,255,0,83,255,21,45,248,47,245,102,255,112,253,233,255,234,
+  255,235,255,236,255,243,253,244,253,245,253,246,253,247,253,249,
+  253,0,21,255,0,25,255,0,27,255,0,29,255,0,79,253,0,83,253,51,68,
+  248,72,248,80,249,82,249,85,241,86,249,87,233,88,235,90,240,113,
+  253,118,249,119,240,120,242,122,245,200,248,211,249,212,249,213,
+  249,214,249,215,249,217,249,218,249,219,249,220,249,221,249,222,
+  240,250,249,251,249,252,249,253,249,254,245,0,1,245,0,8,248,0,14,
+  248,0,32,248,0,36,248,0,78,249,0,82,249,0,100,241,0,102,241,0,108,
+  249,0,109,249,0,112,249,0,113,249,0,114,249,0,115,249,0,116,249,
+  0,117,249,0,122,240,1,32,25,245,51,68,248,72,248,80,249,82,249,85,
+  241,86,249,87,233,88,235,90,240,113,253,118,249,119,240,120,242,
+  122,245,200,248,211,249,212,249,213,249,214,249,215,249,217,249,
+  218,249,219,249,220,249,221,249,222,240,250,249,251,249,252,249,
+  253,249,254,245,0,1,245,0,8,248,0,14,248,0,32,248,0,36,248,0,78,
+  249,0,82,249,0,100,241,0,102,241,0,108,249,0,109,249,0,112,249,0,
+  113,249,0,114,249,0,115,249,0,116,249,0,117,249,0,122,240,1,32,25,
+  245,51,68,248,72,248,80,249,82,249,85,241,86,249,87,233,88,235,90,
+  240,113,253,118,249,119,240,120,242,122,245,200,248,211,249,212,
+  249,213,249,214,249,215,249,217,249,218,249,219,249,220,249,221,
+  249,222,240,250,249,251,249,252,249,253,249,254,245,0,1,245,0,8,
+  248,0,14,248,0,32,248,0,36,248,0,78,249,0,82,249,0,100,241,0,102,
+  241,0,108,249,0,109,249,0,112,249,0,113,249,0,114,249,0,115,249,
+  0,116,249,0,117,249,0,122,240,1,32,25,245,51,68,248,72,248,80,249,
+  82,249,85,241,86,249,87,233,88,235,90,240,113,253,118,249,119,240,
+  120,242,122,245,200,248,211,249,212,249,213,249,214,249,215,249,
+  217,249,218,249,219,249,220,249,221,249,222,240,250,249,251,249,
+  252,249,253,249,254,245,0,1,245,0,8,248,0,14,248,0,32,248,0,36,248,
+  0,78,249,0,82,249,0,100,241,0,102,241,0,108,249,0,109,249,0,112,
+  249,0,113,249,0,114,249,0,115,249,0,116,249,0,117,249,0,122,240,
+  1,32,25,245,51,68,248,72,248,80,249,82,249,85,241,86,249,87,233,
+  88,235,90,240,113,253,118,249,119,240,120,242,122,245,200,248,211,
+  249,212,249,213,249,214,249,215,249,217,249,218,249,219,249,220,
+  249,221,249,222,240,250,249,251,249,252,249,253,249,254,245,0,1,
+  245,0,8,248,0,14,248,0,32,248,0,36,248,0,78,249,0,82,249,0,100,241,
+  0,102,241,0,108,249,0,109,249,0,112,249,0,113,249,0,114,249,0,115,
+  249,0,116,249,0,117,249,0,122,240,1,32,25,245,51,68,248,72,248,80,
+  249,82,249,85,241,86,249,87,233,88,235,90,240,113,253,118,249,119,
+  240,120,242,122,245,200,248,211,249,212,249,213,249,214,249,215,
+  249,217,249,218,249,219,249,220,249,221,249,222,240,250,249,251,
+  249,252,249,253,249,254,245,0,1,245,0,8,248,0,14,248,0,32,248,0,
+  36,248,0,78,249,0,82,249,0,100,241,0,102,241,0,108,249,0,109,249,
+  0,112,249,0,113,249,0,114,249,0,115,249,0,116,249,0,117,249,0,122,
+  240,1,32,25,245,11,66,254,193,254,194,254,195,254,196,254,197,254,
+  198,254,0,2,254,0,4,254,0,6,254,20,66,250,85,250,87,249,88,249,89,
+  250,90,249,193,250,194,250,195,250,196,250,197,250,198,250,222,249,
+  0,2,250,0,4,250,0,6,250,0,100,250,0,102,250,0,122,249,20,66,250,
+  85,250,87,249,88,249,89,250,90,249,193,250,194,250,195,250,196,250,
+  197,250,198,250,222,249,0,2,250,0,4,250,0,6,250,0,100,250,0,102,
+  250,0,122,249,20,66,250,85,250,87,249,88,249,89,250,90,249,193,250,
+  194,250,195,250,196,250,197,250,198,250,222,249,0,2,250,0,4,250,
+  0,6,250,0,100,250,0,102,250,0,122,249,20,66,250,85,250,87,249,88,
+  249,89,250,90,249,193,250,194,250,195,250,196,250,197,250,198,250,
+  222,249,0,2,250,0,4,250,0,6,250,0,100,250,0,102,250,0,122,249,20,
+  66,250,85,250,87,249,88,249,89,250,90,249,193,250,194,250,195,250,
+  196,250,197,250,198,250,222,249,0,2,250,0,4,250,0,6,250,0,100,250,
+  0,102,250,0,122,249,20,66,250,85,250,87,249,88,249,89,250,90,249,
+  193,250,194,250,195,250,196,250,197,250,198,250,222,249,0,2,250,
+  0,4,250,0,6,250,0,100,250,0,102,250,0,122,249,13,45,249,47,249,66,
+  247,193,247,194,247,195,247,196,247,197,247,198,247,0,2,247,0,4,
+  247,0,6,247,13,45,249,47,249,66,247,193,247,194,247,195,247,196,
+  247,197,247,198,247,0,2,247,0,4,247,0,6,247,13,45,249,47,249,66,
+  247,193,247,194,247,195,247,196,247,197,247,198,247,0,2,247,0,4,
+  247,0,6,247,13,45,249,47,249,66,247,193,247,194,247,195,247,196,
+  247,197,247,198,247,0,2,247,0,4,247,0,6,247,65,45,242,46,242,47,
+  242,59,242,60,242,66,239,80,251,98,243,102,238,106,251,112,238,118,
+  242,193,239,194,239,195,239,196,239,197,239,198,239,211,251,212,
+  251,213,251,214,251,215,251,217,251,225,243,226,243,227,243,228,
+  243,229,243,230,243,233,245,234,238,235,238,236,245,238,251,243,
+  238,244,238,245,238,246,238,247,238,249,238,250,242,251,242,252,
+  242,253,242,0,2,239,0,3,243,0,4,239,0,5,243,0,6,239,0,7,243,0,21,
+  245,0,25,238,0,27,238,0,29,238,0,49,251,0,78,251,0,79,238,0,82,251,
+  0,83,238,0,109,242,0,113,242,0,115,242,0,117,242,2,119,253,2,119,
+  253,2,119,253,2,119,253,2,119,253,2,119,253,2,119,254,2,119,254,
+  2,119,254,2,119,254,2,119,255,2,119,255,2,119,255,2,119,255,2,119,
+  250,3,119,255,120,255,3,119,255,120,255,3,119,255,120,255,3,119,
+  255,120,255,3,119,255,120,255,3,119,255,120,255,21,45,248,47,245,
+  102,255,112,253,233,255,234,255,235,255,236,255,243,253,244,253,
+  245,253,246,253,247,253,249,253,0,21,255,0,25,255,0,27,255,0,29,
+  255,0,79,253,0,83,253,21,45,248,47,245,102,255,112,253,233,255,234,
+  255,235,255,236,255,243,253,244,253,245,253,246,253,247,253,249,
+  253,0,21,255,0,25,255,0,27,255,0,29,255,0,79,253,0,83,253,51,68,
+  248,72,248,80,249,82,249,85,241,86,249,87,233,88,235,90,240,113,
+  253,118,249,119,240,120,242,122,245,200,248,211,249,212,249,213,
+  249,214,249,215,249,217,249,218,249,219,249,220,249,221,249,222,
+  240,250,249,251,249,252,249,253,249,254,245,0,1,245,0,8,248,0,14,
+  248,0,32,248,0,36,248,0,78,249,0,82,249,0,100,241,0,102,241,0,108,
+  249,0,109,249,0,112,249,0,113,249,0,114,249,0,115,249,0,116,249,
+  0,117,249,0,122,240,1,32,25,245,2,119,253,51,68,248,72,248,80,249,
+  82,249,85,241,86,249,87,233,88,235,90,240,113,253,118,249,119,240,
+  120,242,122,245,200,248,211,249,212,249,213,249,214,249,215,249,
+  217,249,218,249,219,249,220,249,221,249,222,240,250,249,251,249,
+  252,249,253,249,254,245,0,1,245,0,8,248,0,14,248,0,32,248,0,36,248,
+  0,78,249,0,82,249,0,100,241,0,102,241,0,108,249,0,109,249,0,112,
+  249,0,113,249,0,114,249,0,115,249,0,116,249,0,117,249,0,122,240,
+  1,32,25,245,2,119,253,51,68,248,72,248,80,249,82,249,85,241,86,249,
+  87,233,88,235,90,240,113,253,118,249,119,240,120,242,122,251,200,
+  248,211,249,212,249,213,249,214,249,215,249,217,249,218,249,219,
+  249,220,249,221,249,222,240,250,249,251,249,252,249,253,249,254,
+  251,0,1,251,0,8,248,0,14,248,0,32,248,0,36,248,0,78,249,0,82,249,
+  0,100,241,0,102,241,0,108,249,0,109,249,0,112,249,0,113,249,0,114,
+  249,0,115,249,0,116,249,0,117,249,0,122,240,1,32,25,245,2,119,253,
+  17,47,254,66,251,87,250,88,250,90,250,193,251,194,251,195,251,196,
+  251,197,251,198,251,222,250,0,2,251,0,4,251,0,6,251,0,122,250,17,
+  47,254,66,251,87,250,88,250,90,250,193,251,194,251,195,251,196,251,
+  197,251,198,251,222,250,0,2,251,0,4,251,0,6,251,0,122,250,2,120,
+  254,2,119,254,2,119,254,2,119,254,2,119,254,2,47,254,2,47,254,2,
+  119,255,2,119,255,40,80,252,102,253,112,253,118,254,122,249,211,
+  252,212,252,213,252,214,252,215,252,217,252,233,253,234,253,235,
+  253,236,253,243,253,244,253,245,253,246,253,247,253,249,253,250,
+  254,251,254,252,254,253,254,254,249,0,1,249,0,21,253,0,25,253,0,
+  27,253,0,29,253,0,78,252,0,79,253,0,82,252,0,83,253,0,109,254,0,
+  113,254,0,115,254,0,117,254,22,102,255,112,254,122,254,233,255,234,
+  255,235,255,236,255,243,254,244,254,245,254,246,254,247,254,249,
+  254,254,254,0,1,254,0,21,255,0,25,255,0,27,255,0,29,255,0,79,254,
+  0,83,254,14,85,242,87,242,88,242,90,242,122,248,222,242,254,248,
+  0,1,248,0,100,242,0,102,242,0,122,242,1,32,25,239,1,32,29,254,14,
+  85,242,87,242,88,242,90,242,122,248,222,242,254,248,0,1,248,0,100,
+  242,0,102,242,0,122,242,1,32,25,239,1,32,29,254,14,85,242,87,242,
+  88,242,90,242,122,248,222,242,254,248,0,1,248,0,100,242,0,102,242,
+  0,122,242,1,32,25,239,1,32,29,254,11,66,254,193,254,194,254,195,
+  254,196,254,197,254,198,254,0,2,254,0,4,254,0,6,254,2,119,250,11,
+  66,254,193,254,194,254,195,254,196,254,197,254,198,254,0,2,254,0,
+  4,254,0,6,254,2,119,250,11,66,254,193,254,194,254,195,254,196,254,
+  197,254,198,254,0,2,254,0,4,254,0,6,254,2,119,250,20,66,250,85,250,
+  87,249,88,249,89,250,90,249,193,250,194,250,195,250,196,250,197,
+  250,198,250,222,249,0,2,250,0,4,250,0,6,250,0,100,250,0,102,250,
+  0,122,249,3,119,255,120,255,20,66,250,85,250,87,249,88,249,89,250,
+  90,249,193,250,194,250,195,250,196,250,197,250,198,250,222,249,0,
+  2,250,0,4,250,0,6,250,0,100,250,0,102,250,0,122,249,3,119,255,120,
+  255,27,80,252,85,250,86,252,87,248,88,251,90,251,211,252,212,252,
+  213,252,214,252,215,252,217,252,218,252,219,252,220,252,221,252,
+  222,251,0,78,252,0,82,252,0,100,250,0,102,250,0,108,252,0,112,252,
+  0,114,252,0,116,252,0,122,251,37,45,242,46,251,47,240,100,254,102,
+  254,104,255,111,254,112,254,113,255,114,254,119,255,232,254,233,
+  254,234,254,235,254,236,254,242,254,243,254,244,254,245,254,246,
+  254,247,254,249,254,0,9,254,0,15,254,0,21,254,0,25,254,0,27,254,
+  0,29,254,0,33,255,0,37,255,0,70,254,0,72,254,0,74,254,0,79,254,0,
+  83,254,27,80,252,85,250,86,252,87,248,88,251,90,251,211,252,212,
+  252,213,252,214,252,215,252,217,252,218,252,219,252,220,252,221,
+  252,222,251,0,78,252,0,82,252,0,100,250,0,102,250,0,108,252,0,112,
+  252,0,114,252,0,116,252,0,122,251,37,45,242,46,251,47,240,100,254,
+  102,254,104,255,111,254,112,254,113,255,114,254,119,255,232,254,
+  233,254,234,254,235,254,236,254,242,254,243,254,244,254,245,254,
+  246,254,247,254,249,254,0,9,254,0,15,254,0,21,254,0,25,254,0,27,
+  254,0,29,254,0,33,255,0,37,255,0,70,254,0,72,254,0,74,254,0,79,254,
+  0,83,254,27,80,252,85,250,86,252,87,248,88,251,90,251,211,252,212,
+  252,213,252,214,252,215,252,217,252,218,252,219,252,220,252,221,
+  252,222,251,0,78,252,0,82,252,0,100,250,0,102,250,0,108,252,0,112,
+  252,0,114,252,0,116,252,0,122,251,37,45,242,46,251,47,240,100,254,
+  102,254,104,255,111,254,112,254,113,255,114,254,119,255,232,254,
+  233,254,234,254,235,254,236,254,242,254,243,254,244,254,245,254,
+  246,254,247,254,249,254,0,9,254,0,15,254,0,21,254,0,25,254,0,27,
+  254,0,29,254,0,33,255,0,37,255,0,70,254,0,72,254,0,74,254,0,79,254,
+  0,83,254,73,45,245,46,242,47,242,59,245,60,245,66,242,80,254,98,
+  242,102,242,106,254,112,242,115,245,118,242,120,245,122,251,193,
+  242,194,242,195,242,196,242,197,242,198,242,211,254,212,254,213,
+  254,214,254,215,254,217,254,225,248,226,242,227,248,228,248,229,
+  248,230,242,233,248,234,242,235,242,236,248,238,254,243,242,244,
+  242,245,242,246,242,247,242,249,242,250,242,251,242,252,242,253,
+  242,254,251,0,1,251,0,2,242,0,3,248,0,4,242,0,5,248,0,6,242,0,7,
+  242,0,21,248,0,25,242,0,27,242,0,29,242,0,49,254,0,78,254,0,79,242,
+  0,82,254,0,83,242,0,87,245,0,89,245,0,91,245,0,109,242,0,113,242,
+  0,115,242,0,117,242,73,45,245,46,242,47,242,59,245,60,245,66,242,
+  80,254,98,242,102,242,106,254,112,242,115,245,118,242,120,245,122,
+  251,193,242,194,242,195,242,196,242,197,242,198,242,211,254,212,
+  254,213,254,214,254,215,254,217,254,225,248,226,242,227,248,228,
+  248,229,248,230,242,233,248,234,242,235,242,236,248,238,254,243,
+  242,244,242,245,242,246,242,247,242,249,242,250,242,251,242,252,
+  242,253,242,254,251,0,1,251,0,2,242,0,3,248,0,4,242,0,5,248,0,6,
+  242,0,7,242,0,21,248,0,25,242,0,27,242,0,29,242,0,49,254,0,78,254,
+  0,79,242,0,82,254,0,83,242,0,87,245,0,89,245,0,91,245,0,109,242,
+  0,113,242,0,115,242,0,117,242,13,45,249,47,249,66,247,193,247,194,
+  247,195,247,196,247,197,247,198,247,0,2,247,0,4,247,0,6,247,13,45,
+  249,47,249,66,247,193,247,194,247,195,247,196,247,197,247,198,247,
+  0,2,247,0,4,247,0,6,247,13,45,249,47,249,66,247,193,247,194,247,
+  195,247,196,247,197,247,198,247,0,2,247,0,4,247,0,6,247,13,45,249,
+  47,249,66,247,193,247,194,247,195,247,196,247,197,247,198,247,0,
+  2,247,0,4,247,0,6,247,65,45,242,46,242,47,242,59,242,60,242,66,239,
+  80,251,98,243,102,238,106,251,112,238,118,242,193,239,194,239,195,
+  239,196,239,197,239,198,239,211,251,212,251,213,251,214,251,215,
+  251,217,251,225,243,226,243,227,243,228,243,229,243,230,243,233,
+  245,234,238,235,238,236,245,238,251,243,238,244,238,245,238,246,
+  238,247,238,249,238,250,242,251,242,252,242,253,242,0,2,239,0,3,
+  243,0,4,239,0,5,243,0,6,239,0,7,243,0,21,245,0,25,238,0,27,238,0,
+  29,238,0,49,251,0,78,251,0,79,238,0,82,251,0,83,238,0,109,242,0,
+  113,242,0,115,242,0,117,242,12,66,255,193,255,194,255,195,255,196,
+  255,197,255,198,255,0,2,255,0,4,255,0,6,255,1,32,24,246,15,33,245,
+  101,254,115,254,116,251,119,254,0,19,254,0,87,254,0,89,254,0,91,
+  254,0,93,251,0,97,251,0,99,251,1,2,25,251,1,32,25,246,11,66,255,
+  193,255,194,255,195,255,196,255,197,255,198,255,0,2,255,0,4,255,
+  0,6,255
+};
+static afm_cuint16 afm_Times_Bold_highchars_index[] = { /* 220 */
+  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
+  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
+  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
+  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
+  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
+  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
+  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
+  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
+  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
+  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
+  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
+  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
+  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
+  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
+  64257,64258
+};
+static afm_cunicode afm_Times_Bold_ligatures[] = { /* 3 */
+  102,105,64257
+};
+
+
+/* ------------------------------------------------------------------*/
+/* FontName: Times-BoldItalic */
+/* FullName: Times Bold Italic */
+/* FamilyName: Times */
+static afm_cuint8 afm_Times_BoldItalic_widths[] = { /* 315 */
+  42,65,93,83,83,139,130,46,56,56,83,95,42,56,42,46,83,83,83,83,83,
+  83,83,83,83,83,56,56,95,95,95,83,139,111,111,111,120,111,111,120,
+  130,65,83,111,102,148,120,120,102,120,111,93,102,120,111,148,111,
+  102,102,56,46,56,95,83,56,83,83,74,83,74,56,83,93,46,46,83,46,130,
+  93,83,83,83,65,65,46,93,74,111,83,74,65,58,37,58,95,65,83,83,83,
+  83,37,83,56,125,44,83,101,125,56,67,95,50,50,56,96,83,42,56,50,50,
+  83,125,125,125,83,111,111,111,111,111,111,157,111,111,111,111,111,
+  65,65,65,65,120,120,120,120,120,120,120,95,120,120,120,120,120,102,
+  102,83,83,83,83,83,83,83,120,74,74,74,74,74,46,46,46,46,83,93,83,
+  83,83,83,83,95,83,93,93,93,93,74,83,74,111,83,111,83,111,83,111,
+  74,111,74,120,101,120,83,111,74,111,74,111,74,111,74,120,83,120,
+  83,65,46,65,46,65,46,111,83,102,46,102,46,102,64,102,46,120,93,120,
+  93,120,93,120,83,120,83,157,120,111,65,111,65,111,65,93,65,93,65,
+  93,65,102,46,102,61,120,93,120,93,120,93,120,93,102,102,65,102,65,
+  102,65,83,93,65,56,56,56,56,56,56,56,56,83,167,56,56,56,83,83,83,
+  83,83,58,167,167,56,56,28,83,167,82,102,100,101,92,92,92,92,82,42,
+  93,93
+};
+static afm_sint16 afm_Times_BoldItalic_kerning_index[] = { /* 315 */
+  1,0,0,0,0,0,0,0,0,0,0,0,36,0,45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,54,173,0,219,0,254,0,0,0,374,489,581,0,612,636,681,774,797,0,
+  859,1027,1051,1207,0,1362,0,0,0,0,0,0,0,0,1510,1537,0,1545,1548,
+  0,0,0,0,1587,0,0,1630,1633,0,0,1647,0,0,0,1652,1699,1769,1792,0,
+  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,1797,1916,2035,2154,2273,2392,0,0,0,0,0,0,0,0,0,0,0,2511,2535,
+  2580,2625,2670,2715,0,2760,2805,2829,2853,2877,2901,0,0,0,0,0,0,
+  0,0,0,3049,3057,3060,3063,3066,0,0,0,0,0,3069,3072,3086,3100,3114,
+  3128,0,3142,0,0,0,0,3156,0,3161,3166,0,3285,0,3404,0,0,3523,0,3531,
+  3539,0,3574,0,0,3609,0,3612,0,3615,0,3618,0,0,0,0,0,0,0,0,0,0,3621,
+  3713,3756,0,3787,0,0,0,3818,0,3849,3873,3876,3900,3903,3927,3930,
+  3975,3989,4034,0,0,4048,4110,4115,4177,4182,4244,0,0,0,0,0,0,4249,
+  0,4417,0,4585,0,4609,0,4633,0,4657,0,4681,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,0,0,0,0,0,0,4829,4834,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,0,0,0,0,0
+};
+static afm_cuint8 afm_Times_BoldItalic_kerning_data[] = { /* 4879 */
+  42,16,66,251,87,245,88,245,90,245,193,251,194,251,195,251,196,251,
+  197,251,198,251,222,245,0,2,251,0,4,251,0,6,251,0,122,245,3,1,32,
+  25,241,1,32,29,241,3,1,32,25,241,1,32,29,241,50,68,246,72,247,80,
+  249,82,248,85,248,86,249,87,241,88,240,90,245,118,252,119,245,120,
+  245,122,245,200,246,211,249,212,249,213,249,214,249,215,249,217,
+  249,218,249,219,249,220,249,221,249,222,245,250,252,251,252,252,
+  252,253,252,254,245,0,1,245,0,8,246,0,14,246,0,32,247,0,36,247,0,
+  78,249,0,82,249,0,100,248,0,102,248,0,108,249,0,109,252,0,112,249,
+  0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,245,1,32,
+  25,245,20,66,253,86,255,193,253,194,253,195,253,196,253,197,253,
+  198,253,218,255,219,255,220,255,221,255,0,2,253,0,4,253,0,6,253,
+  0,108,255,0,112,255,0,114,255,0,116,255,16,66,253,87,249,88,250,
+  90,249,193,253,194,253,195,253,196,253,197,253,198,253,222,249,0,
+  2,253,0,4,253,0,6,253,0,122,249,52,45,235,47,235,66,240,98,241,102,
+  240,106,250,112,245,115,249,193,240,194,240,195,240,196,240,197,
+  240,198,240,225,241,226,241,227,241,228,241,229,241,230,241,233,
+  240,234,240,235,240,236,240,237,250,238,250,239,250,240,250,243,
+  245,244,245,245,245,246,245,247,245,249,245,0,2,240,0,3,241,0,4,
+  240,0,5,241,0,6,240,0,7,241,0,21,240,0,25,240,0,27,240,0,29,240,
+  0,45,250,0,49,250,0,79,245,0,83,245,0,87,249,0,89,249,0,91,249,50,
+  45,255,47,255,66,253,98,250,102,250,112,250,118,250,193,253,194,
+  253,195,253,196,253,197,253,198,253,225,250,226,250,227,250,228,
+  250,229,250,230,250,233,250,234,250,235,250,236,250,243,250,244,
+  250,245,250,246,250,247,250,249,250,250,250,251,250,252,250,253,
+  250,0,2,253,0,3,250,0,4,253,0,5,250,0,6,253,0,7,250,0,21,250,0,25,
+  250,0,27,250,0,29,250,0,79,250,0,83,250,0,109,250,0,113,250,0,115,
+  250,0,117,250,40,80,252,102,253,112,253,118,254,122,254,211,252,
+  212,252,213,252,214,252,215,252,217,252,233,253,234,253,235,253,
+  236,253,243,253,244,253,245,253,246,253,247,253,249,253,250,254,
+  251,254,252,254,253,254,254,254,0,1,254,0,21,253,0,25,253,0,27,253,
+  0,29,253,0,78,252,0,79,253,0,82,252,0,83,253,0,109,254,0,113,254,
+  0,115,254,0,117,254,13,85,254,87,251,88,251,90,251,122,251,222,251,
+  254,251,0,1,251,0,100,254,0,102,254,0,122,251,1,32,25,248,11,66,
+  252,193,252,194,252,195,252,196,252,197,252,198,252,0,2,252,0,4,
+  252,0,6,252,20,66,250,85,250,87,249,88,249,89,250,90,249,193,250,
+  194,250,195,250,196,250,197,250,198,250,222,249,0,2,250,0,4,250,
+  0,6,250,0,100,250,0,102,250,0,122,249,41,45,235,47,235,66,243,98,
+  250,102,249,112,248,193,243,194,243,195,243,196,243,197,243,198,
+  243,225,250,226,250,227,250,228,250,229,250,230,250,233,249,234,
+  249,235,249,236,249,243,248,244,248,245,248,246,248,247,248,249,
+  248,0,2,243,0,3,250,0,4,243,0,5,250,0,6,243,0,7,250,0,21,249,0,25,
+  249,0,27,249,0,29,249,0,79,248,0,83,248,10,86,255,218,255,219,255,
+  220,255,221,255,0,108,255,0,112,255,0,114,255,0,116,255,27,80,250,
+  85,252,86,250,87,254,88,254,90,254,211,250,212,250,213,250,214,250,
+  215,250,217,250,218,250,219,250,220,250,221,250,222,254,0,78,250,
+  0,82,250,0,100,252,0,102,252,0,108,250,0,112,250,0,114,250,0,116,
+  250,0,122,254,73,45,242,46,242,47,242,59,245,60,245,66,248,80,254,
+  98,242,102,242,106,251,112,241,115,251,118,251,120,251,122,251,193,
+  248,194,248,195,248,196,248,197,248,198,248,211,254,212,254,213,
+  254,214,254,215,254,217,254,225,242,226,242,227,242,228,242,229,
+  242,230,242,233,248,234,242,235,242,236,248,238,251,243,241,244,
+  241,245,241,246,241,247,241,249,241,250,251,251,251,252,251,253,
+  251,254,251,0,1,251,0,2,248,0,3,242,0,4,248,0,5,242,0,6,248,0,7,
+  242,0,21,248,0,25,242,0,27,242,0,29,242,0,49,251,0,78,254,0,79,241,
+  0,82,254,0,83,241,0,87,251,0,89,251,0,91,251,0,109,251,0,113,251,
+  0,115,251,0,117,251,11,66,249,193,249,194,249,195,249,196,249,197,
+  249,198,249,0,2,249,0,4,249,0,6,249,68,45,235,46,245,47,235,59,245,
+  60,245,66,243,72,255,80,252,98,238,102,238,106,248,112,238,118,248,
+  193,243,194,243,195,243,196,243,197,243,198,243,211,252,212,252,
+  213,252,214,252,215,252,217,252,225,238,226,238,227,238,228,238,
+  229,238,230,238,233,245,234,238,235,238,236,245,238,248,243,238,
+  244,238,245,238,246,238,247,238,249,238,250,248,251,248,252,248,
+  253,248,0,2,243,0,3,238,0,4,243,0,5,238,0,6,243,0,7,238,0,21,245,
+  0,25,238,0,27,238,0,29,238,0,32,255,0,36,255,0,49,248,0,78,252,0,
+  79,238,0,82,252,0,83,238,0,109,248,0,113,248,0,115,248,0,117,248,
+  68,45,245,46,249,47,245,59,248,60,248,66,245,80,254,98,243,102,242,
+  106,251,112,244,118,248,122,248,193,245,194,245,195,245,196,245,
+  197,245,198,245,211,254,212,254,213,254,214,254,215,254,217,254,
+  225,243,226,243,227,243,228,243,229,243,230,243,233,249,234,242,
+  235,242,236,249,238,251,243,244,244,244,245,244,246,244,247,244,
+  249,244,250,248,251,248,252,248,253,248,254,248,0,1,248,0,2,245,
+  0,3,243,0,4,245,0,5,243,0,6,245,0,7,243,0,21,249,0,25,242,0,27,242,
+  0,29,242,0,49,251,0,78,254,0,79,244,0,82,254,0,83,244,0,109,248,
+  0,113,248,0,115,248,0,117,248,65,45,242,46,242,47,245,59,242,60,
+  242,66,245,80,253,98,242,102,238,106,248,112,238,118,242,193,245,
+  194,245,195,245,196,245,197,245,198,245,211,253,212,253,213,253,
+  214,253,215,253,217,253,225,242,226,242,227,242,228,242,229,242,
+  230,242,233,245,234,238,235,245,236,245,238,248,243,238,244,238,
+  245,238,246,238,247,238,249,238,250,242,251,242,252,242,253,242,
+  0,2,245,0,3,242,0,4,245,0,5,242,0,6,245,0,7,242,0,21,245,0,25,238,
+  0,27,238,0,29,238,0,49,248,0,78,253,0,79,238,0,82,253,0,83,238,0,
+  109,242,0,113,242,0,115,242,0,117,242,12,47,250,99,255,118,254,250,
+  254,251,254,252,254,253,254,0,109,254,0,113,254,0,115,254,0,117,
+  254,4,105,255,108,255,0,57,255,2,99,255,17,45,255,47,255,102,255,
+  103,254,112,255,234,255,243,255,244,255,245,255,246,255,249,255,
+  0,25,255,0,27,255,0,51,252,0,83,255,1,32,25,9,19,102,252,112,255,
+  233,252,234,252,235,252,236,252,243,255,244,255,245,255,246,255,
+  247,255,249,255,0,21,252,0,25,252,0,27,252,0,29,252,0,79,255,0,83,
+  255,2,119,250,7,119,254,120,253,121,255,122,255,254,255,0,1,255,
+  3,45,246,47,246,21,45,251,47,251,102,254,112,254,233,254,234,254,
+  235,254,236,254,243,254,244,254,245,254,246,254,247,254,249,254,
+  0,21,254,0,25,254,0,27,254,0,29,254,0,79,254,0,83,254,31,45,251,
+  47,251,98,255,102,255,112,254,225,255,226,255,227,255,228,255,229,
+  255,230,255,233,255,234,255,235,255,236,255,243,254,244,254,245,
+  254,246,254,247,254,249,254,0,3,255,0,5,255,0,7,255,0,21,255,0,25,
+  255,0,27,255,0,29,255,0,79,254,0,83,254,10,102,255,233,255,234,255,
+  235,255,236,255,0,21,255,0,25,255,0,27,255,0,29,255,3,45,251,47,
+  251,50,68,246,72,247,80,249,82,248,85,248,86,249,87,241,88,240,90,
+  245,118,252,119,245,120,245,122,245,200,246,211,249,212,249,213,
+  249,214,249,215,249,217,249,218,249,219,249,220,249,221,249,222,
+  245,250,252,251,252,252,252,253,252,254,245,0,1,245,0,8,246,0,14,
+  246,0,32,247,0,36,247,0,78,249,0,82,249,0,100,248,0,102,248,0,108,
+  249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,
+  0,117,252,0,122,245,1,32,25,245,50,68,246,72,247,80,249,82,248,85,
+  248,86,249,87,241,88,240,90,245,118,252,119,245,120,245,122,245,
+  200,246,211,249,212,249,213,249,214,249,215,249,217,249,218,249,
+  219,249,220,249,221,249,222,245,250,252,251,252,252,252,253,252,
+  254,245,0,1,245,0,8,246,0,14,246,0,32,247,0,36,247,0,78,249,0,82,
+  249,0,100,248,0,102,248,0,108,249,0,109,252,0,112,249,0,113,252,
+  0,114,249,0,115,252,0,116,249,0,117,252,0,122,245,1,32,25,245,50,
+  68,246,72,247,80,249,82,248,85,248,86,249,87,241,88,240,90,245,118,
+  252,119,245,120,245,122,245,200,246,211,249,212,249,213,249,214,
+  249,215,249,217,249,218,249,219,249,220,249,221,249,222,245,250,
+  252,251,252,252,252,253,252,254,245,0,1,245,0,8,246,0,14,246,0,32,
+  247,0,36,247,0,78,249,0,82,249,0,100,248,0,102,248,0,108,249,0,109,
+  252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,
+  0,122,245,1,32,25,245,50,68,246,72,247,80,249,82,248,85,248,86,249,
+  87,241,88,240,90,245,118,252,119,245,120,245,122,245,200,246,211,
+  249,212,249,213,249,214,249,215,249,217,249,218,249,219,249,220,
+  249,221,249,222,245,250,252,251,252,252,252,253,252,254,245,0,1,
+  245,0,8,246,0,14,246,0,32,247,0,36,247,0,78,249,0,82,249,0,100,248,
+  0,102,248,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,
+  252,0,116,249,0,117,252,0,122,245,1,32,25,245,50,68,246,72,247,80,
+  249,82,248,85,248,86,249,87,241,88,240,90,245,118,252,119,245,120,
+  245,122,245,200,246,211,249,212,249,213,249,214,249,215,249,217,
+  249,218,249,219,249,220,249,221,249,222,245,250,252,251,252,252,
+  252,253,252,254,245,0,1,245,0,8,246,0,14,246,0,32,247,0,36,247,0,
+  78,249,0,82,249,0,100,248,0,102,248,0,108,249,0,109,252,0,112,249,
+  0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,245,1,32,
+  25,245,50,68,246,72,247,80,249,82,248,85,248,86,249,87,241,88,240,
+  90,245,118,252,119,245,120,245,122,245,200,246,211,249,212,249,213,
+  249,214,249,215,249,217,249,218,249,219,249,220,249,221,249,222,
+  245,250,252,251,252,252,252,253,252,254,245,0,1,245,0,8,246,0,14,
+  246,0,32,247,0,36,247,0,78,249,0,82,249,0,100,248,0,102,248,0,108,
+  249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,
+  0,117,252,0,122,245,1,32,25,245,11,66,252,193,252,194,252,195,252,
+  196,252,197,252,198,252,0,2,252,0,4,252,0,6,252,20,66,250,85,250,
+  87,249,88,249,89,250,90,249,193,250,194,250,195,250,196,250,197,
+  250,198,250,222,249,0,2,250,0,4,250,0,6,250,0,100,250,0,102,250,
+  0,122,249,20,66,250,85,250,87,249,88,249,89,250,90,249,193,250,194,
+  250,195,250,196,250,197,250,198,250,222,249,0,2,250,0,4,250,0,6,
+  250,0,100,250,0,102,250,0,122,249,20,66,250,85,250,87,249,88,249,
+  89,250,90,249,193,250,194,250,195,250,196,250,197,250,198,250,222,
+  249,0,2,250,0,4,250,0,6,250,0,100,250,0,102,250,0,122,249,20,66,
+  250,85,250,87,249,88,249,89,250,90,249,193,250,194,250,195,250,196,
+  250,197,250,198,250,222,249,0,2,250,0,4,250,0,6,250,0,100,250,0,
+  102,250,0,122,249,20,66,250,85,250,87,249,88,249,89,250,90,249,193,
+  250,194,250,195,250,196,250,197,250,198,250,222,249,0,2,250,0,4,
+  250,0,6,250,0,100,250,0,102,250,0,122,249,20,66,250,85,250,87,249,
+  88,249,89,250,90,249,193,250,194,250,195,250,196,250,197,250,198,
+  250,222,249,0,2,250,0,4,250,0,6,250,0,100,250,0,102,250,0,122,249,
+  11,66,249,193,249,194,249,195,249,196,249,197,249,198,249,0,2,249,
+  0,4,249,0,6,249,11,66,249,193,249,194,249,195,249,196,249,197,249,
+  198,249,0,2,249,0,4,249,0,6,249,11,66,249,193,249,194,249,195,249,
+  196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,11,66,249,193,249,
+  194,249,195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,
+  65,45,242,46,242,47,245,59,242,60,242,66,245,80,253,98,242,102,238,
+  106,248,112,238,118,242,193,245,194,245,195,245,196,245,197,245,
+  198,245,211,253,212,253,213,253,214,253,215,253,217,253,225,242,
+  226,242,227,242,228,242,229,242,230,242,233,245,234,238,235,245,
+  236,245,238,248,243,238,244,238,245,238,246,238,247,238,249,238,
+  250,242,251,242,252,242,253,242,0,2,245,0,3,242,0,4,245,0,5,242,
+  0,6,245,0,7,242,0,21,245,0,25,238,0,27,238,0,29,238,0,49,248,0,78,
+  253,0,79,238,0,82,253,0,83,238,0,109,242,0,113,242,0,115,242,0,117,
+  242,4,105,255,108,255,0,57,255,2,99,255,2,99,255,2,99,255,2,99,255,
+  2,119,250,7,119,254,120,253,121,255,122,255,254,255,0,1,255,7,119,
+  254,120,253,121,255,122,255,254,255,0,1,255,7,119,254,120,253,121,
+  255,122,255,254,255,0,1,255,7,119,254,120,253,121,255,122,255,254,
+  255,0,1,255,7,119,254,120,253,121,255,122,255,254,255,0,1,255,7,
+  119,254,120,253,121,255,122,255,254,255,0,1,255,3,45,251,47,251,
+  3,45,251,47,251,50,68,246,72,247,80,249,82,248,85,248,86,249,87,
+  241,88,240,90,245,118,252,119,245,120,245,122,245,200,246,211,249,
+  212,249,213,249,214,249,215,249,217,249,218,249,219,249,220,249,
+  221,249,222,245,250,252,251,252,252,252,253,252,254,245,0,1,245,
+  0,8,246,0,14,246,0,32,247,0,36,247,0,78,249,0,82,249,0,100,248,0,
+  102,248,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,
+  252,0,116,249,0,117,252,0,122,245,1,32,25,245,50,68,246,72,247,80,
+  249,82,248,85,248,86,249,87,241,88,240,90,245,118,252,119,245,120,
+  245,122,245,200,246,211,249,212,249,213,249,214,249,215,249,217,
+  249,218,249,219,249,220,249,221,249,222,245,250,252,251,252,252,
+  252,253,252,254,245,0,1,245,0,8,246,0,14,246,0,32,247,0,36,247,0,
+  78,249,0,82,249,0,100,248,0,102,248,0,108,249,0,109,252,0,112,249,
+  0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,245,1,32,
+  25,245,50,68,246,72,247,80,249,82,248,85,248,86,249,87,241,88,240,
+  90,245,118,252,119,245,120,245,122,251,200,246,211,249,212,249,213,
+  249,214,249,215,249,217,249,218,249,219,249,220,249,221,249,222,
+  245,250,252,251,252,252,252,253,252,254,251,0,1,251,0,8,246,0,14,
+  246,0,32,247,0,36,247,0,78,249,0,82,249,0,100,248,0,102,248,0,108,
+  249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,
+  0,117,252,0,122,245,1,32,25,245,4,105,255,108,255,0,57,255,4,105,
+  255,108,255,0,57,255,16,66,253,87,249,88,250,90,249,193,253,194,
+  253,195,253,196,253,197,253,198,253,222,249,0,2,253,0,4,253,0,6,
+  253,0,122,249,16,66,253,87,249,88,250,90,249,193,253,194,253,195,
+  253,196,253,197,253,198,253,222,249,0,2,253,0,4,253,0,6,253,0,122,
+  249,2,99,255,2,99,255,2,99,255,2,99,255,40,80,252,102,253,112,253,
+  118,254,122,254,211,252,212,252,213,252,214,252,215,252,217,252,
+  233,253,234,253,235,253,236,253,243,253,244,253,245,253,246,253,
+  247,253,249,253,250,254,251,254,252,254,253,254,254,254,0,1,254,
+  0,21,253,0,25,253,0,27,253,0,29,253,0,78,252,0,79,253,0,82,252,0,
+  83,253,0,109,254,0,113,254,0,115,254,0,117,254,19,102,252,112,255,
+  233,252,234,252,235,252,236,252,243,255,244,255,245,255,246,255,
+  247,255,249,255,0,21,252,0,25,252,0,27,252,0,29,252,0,79,255,0,83,
+  255,13,85,254,87,251,88,251,90,251,122,251,222,251,254,251,0,1,251,
+  0,100,254,0,102,254,0,122,251,1,32,25,248,13,85,254,87,251,88,251,
+  90,251,122,251,222,251,254,251,0,1,251,0,100,254,0,102,254,0,122,
+  251,1,32,25,248,13,85,254,87,251,88,251,90,251,122,251,222,251,254,
+  251,0,1,251,0,100,254,0,102,254,0,122,251,1,32,25,248,11,66,252,
+  193,252,194,252,195,252,196,252,197,252,198,252,0,2,252,0,4,252,
+  0,6,252,2,119,250,11,66,252,193,252,194,252,195,252,196,252,197,
+  252,198,252,0,2,252,0,4,252,0,6,252,2,119,250,11,66,252,193,252,
+  194,252,195,252,196,252,197,252,198,252,0,2,252,0,4,252,0,6,252,
+  2,119,250,20,66,250,85,250,87,249,88,249,89,250,90,249,193,250,194,
+  250,195,250,196,250,197,250,198,250,222,249,0,2,250,0,4,250,0,6,
+  250,0,100,250,0,102,250,0,122,249,7,119,254,120,253,121,255,122,
+  255,254,255,0,1,255,20,66,250,85,250,87,249,88,249,89,250,90,249,
+  193,250,194,250,195,250,196,250,197,250,198,250,222,249,0,2,250,
+  0,4,250,0,6,250,0,100,250,0,102,250,0,122,249,7,119,254,120,253,
+  121,255,122,255,254,255,0,1,255,27,80,250,85,252,86,250,87,254,88,
+  254,90,254,211,250,212,250,213,250,214,250,215,250,217,250,218,250,
+  219,250,220,250,221,250,222,254,0,78,250,0,82,250,0,100,252,0,102,
+  252,0,108,250,0,112,250,0,114,250,0,116,250,0,122,254,3,45,246,47,
+  246,27,80,250,85,252,86,250,87,254,88,254,90,254,211,250,212,250,
+  213,250,214,250,215,250,217,250,218,250,219,250,220,250,221,250,
+  222,254,0,78,250,0,82,250,0,100,252,0,102,252,0,108,250,0,112,250,
+  0,114,250,0,116,250,0,122,254,3,45,246,47,246,27,80,250,85,252,86,
+  250,87,254,88,254,90,254,211,250,212,250,213,250,214,250,215,250,
+  217,250,218,250,219,250,220,250,221,250,222,254,0,78,250,0,82,250,
+  0,100,252,0,102,252,0,108,250,0,112,250,0,114,250,0,116,250,0,122,
+  254,3,45,246,47,246,73,45,242,46,242,47,242,59,245,60,245,66,248,
+  80,254,98,242,102,242,106,251,112,241,115,251,118,251,120,251,122,
+  251,193,248,194,248,195,248,196,248,197,248,198,248,211,254,212,
+  254,213,254,214,254,215,254,217,254,225,242,226,242,227,242,228,
+  242,229,242,230,242,233,248,234,242,235,242,236,248,238,251,243,
+  241,244,241,245,241,246,241,247,241,249,241,250,251,251,251,252,
+  251,253,251,254,251,0,1,251,0,2,248,0,3,242,0,4,248,0,5,242,0,6,
+  248,0,7,242,0,21,248,0,25,242,0,27,242,0,29,242,0,49,251,0,78,254,
+  0,79,241,0,82,254,0,83,241,0,87,251,0,89,251,0,91,251,0,109,251,
+  0,113,251,0,115,251,0,117,251,73,45,242,46,242,47,242,59,245,60,
+  245,66,248,80,254,98,242,102,242,106,251,112,241,115,251,118,251,
+  120,251,122,251,193,248,194,248,195,248,196,248,197,248,198,248,
+  211,254,212,254,213,254,214,254,215,254,217,254,225,242,226,242,
+  227,242,228,242,229,242,230,242,233,248,234,242,235,242,236,248,
+  238,251,243,241,244,241,245,241,246,241,247,241,249,241,250,251,
+  251,251,252,251,253,251,254,251,0,1,251,0,2,248,0,3,242,0,4,248,
+  0,5,242,0,6,248,0,7,242,0,21,248,0,25,242,0,27,242,0,29,242,0,49,
+  251,0,78,254,0,79,241,0,82,254,0,83,241,0,87,251,0,89,251,0,91,251,
+  0,109,251,0,113,251,0,115,251,0,117,251,11,66,249,193,249,194,249,
+  195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,11,66,249,
+  193,249,194,249,195,249,196,249,197,249,198,249,0,2,249,0,4,249,
+  0,6,249,11,66,249,193,249,194,249,195,249,196,249,197,249,198,249,
+  0,2,249,0,4,249,0,6,249,11,66,249,193,249,194,249,195,249,196,249,
+  197,249,198,249,0,2,249,0,4,249,0,6,249,65,45,242,46,242,47,245,
+  59,242,60,242,66,245,80,253,98,242,102,238,106,248,112,238,118,242,
+  193,245,194,245,195,245,196,245,197,245,198,245,211,253,212,253,
+  213,253,214,253,215,253,217,253,225,242,226,242,227,242,228,242,
+  229,242,230,242,233,245,234,238,235,245,236,245,238,248,243,238,
+  244,238,245,238,246,238,247,238,249,238,250,242,251,242,252,242,
+  253,242,0,2,245,0,3,242,0,4,245,0,5,242,0,6,245,0,7,242,0,21,245,
+  0,25,238,0,27,238,0,29,238,0,49,248,0,78,253,0,79,238,0,82,253,0,
+  83,238,0,109,242,0,113,242,0,115,242,0,117,242,2,1,32,24,245,17,
+  33,245,101,254,115,254,116,245,117,251,119,254,0,19,254,0,87,254,
+  0,89,254,0,91,254,0,93,245,0,97,245,0,99,245,0,101,251,1,2,25,245,
+  1,32,25,245
+};
+static afm_cuint16 afm_Times_BoldItalic_highchars_index[] = { /* 220 */
+  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
+  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
+  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
+  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
+  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
+  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
+  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
+  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
+  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
+  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
+  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
+  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
+  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
+  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
+  64257,64258
+};
+static afm_cunicode afm_Times_BoldItalic_ligatures[] = { /* 3 */
+  102,105,64257
+};
+
+
+/* ------------------------------------------------------------------*/
+/* FontName: Times-Italic */
+/* FullName: Times Italic */
+/* FamilyName: Times */
+static afm_cuint8 afm_Times_Italic_widths[] = { /* 315 */
+  42,56,70,83,83,139,130,36,56,56,83,113,42,56,42,46,83,83,83,83,83,
+  83,83,83,83,83,56,56,113,113,113,83,153,102,102,111,120,102,102,
+  120,120,56,74,111,93,139,111,120,102,120,102,83,93,120,102,139,102,
+  93,93,65,46,65,70,83,56,83,83,74,83,74,46,83,83,46,46,74,46,120,
+  83,83,83,83,65,65,46,83,74,111,74,74,65,67,46,67,90,65,83,83,83,
+  83,46,83,56,127,46,83,113,127,56,67,113,50,50,56,83,87,42,56,50,
+  52,83,125,125,125,83,102,102,102,102,102,102,148,111,102,102,102,
+  102,56,56,56,56,120,111,120,120,120,120,120,113,120,120,120,120,
+  120,93,102,83,83,83,83,83,83,83,111,74,74,74,74,74,46,46,46,46,83,
+  83,83,83,83,83,83,113,83,83,83,83,83,74,83,74,102,83,102,83,102,
+  83,111,74,111,74,120,91,120,83,102,74,102,74,102,74,102,74,120,83,
+  120,83,56,46,56,46,56,46,111,74,93,46,93,46,102,50,93,46,111,83,
+  111,83,111,83,120,83,120,83,157,111,102,65,102,65,102,65,83,65,83,
+  65,83,65,93,46,93,50,120,83,120,83,120,83,120,83,93,93,65,93,65,
+  93,65,83,83,65,56,56,56,56,56,56,56,56,83,148,56,56,56,93,93,93,
+  83,83,58,148,167,56,56,28,83,163,79,102,100,113,76,92,92,92,79,42,
+  83,83
+};
+static afm_sint16 afm_Times_Italic_kerning_index[] = { /* 315 */
+  1,0,0,0,0,0,0,0,0,0,0,0,44,0,53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,62,181,0,227,0,262,0,0,0,382,497,589,0,620,644,689,782,805,0,
+  859,1027,1055,1212,0,1367,0,0,0,0,0,0,0,1524,1533,1558,0,1566,1592,
+  1611,0,0,0,1646,0,0,1696,1699,0,0,1710,0,0,0,1822,1827,0,1832,0,
+  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,1837,1956,2075,2194,2313,2432,0,0,0,0,0,0,0,0,0,0,0,2551,2575,
+  2620,2665,2710,2755,0,2800,2845,2873,2901,2929,2957,0,0,3114,3123,
+  3132,3141,3150,3159,0,3168,3176,3202,3228,3254,0,0,0,0,0,3280,3283,
+  3294,3305,3316,3327,0,3338,0,0,0,0,3349,0,3354,3359,3478,3487,3606,
+  3615,3734,0,3743,0,3751,3759,0,3794,0,0,3829,0,3855,0,3881,0,3907,
+  0,3933,0,3968,0,0,0,0,0,0,4003,4095,4145,0,4176,0,0,0,4207,0,4238,
+  4262,4265,4289,4292,4316,4319,4364,4375,4420,0,0,4431,4485,4597,
+  4651,4763,4817,0,0,0,0,0,0,4929,0,5097,0,5265,0,5293,0,5321,0,5349,
+  0,5377,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5534,5539,0,0,0,0,0,
+  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+};
+static afm_cuint8 afm_Times_Italic_kerning_data[] = { /* 5584 */
+  42,19,66,254,85,254,87,251,88,250,90,244,193,254,194,254,195,254,
+  196,254,197,254,198,254,222,244,0,2,254,0,4,254,0,6,254,0,100,254,
+  0,102,254,0,122,244,3,1,32,25,234,1,32,29,234,3,1,32,25,234,1,32,
+  29,234,50,68,252,72,251,80,250,82,250,85,251,86,249,87,239,88,241,
+  90,248,118,254,119,248,120,248,122,248,200,252,211,250,212,250,213,
+  250,214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,
+  248,250,254,251,254,252,254,253,254,254,248,0,1,248,0,8,252,0,14,
+  252,0,32,251,0,36,251,0,78,250,0,82,250,0,100,251,0,102,251,0,108,
+  249,0,109,254,0,112,249,0,113,254,0,114,249,0,115,254,0,116,249,
+  0,117,254,0,122,248,1,32,25,251,20,66,253,86,255,193,253,194,253,
+  195,253,196,253,197,253,198,253,218,255,219,255,220,255,221,255,
+  0,2,253,0,4,253,0,6,253,0,108,255,0,112,255,0,114,255,0,116,255,
+  16,66,251,87,250,88,250,90,250,193,251,194,251,195,251,196,251,197,
+  251,198,251,222,250,0,2,251,0,4,251,0,6,251,0,122,250,52,45,234,
+  47,234,66,238,98,244,102,244,106,249,112,239,115,248,193,238,194,
+  238,195,238,196,238,197,238,198,238,225,244,226,244,227,244,228,
+  244,229,244,230,244,233,244,234,244,235,244,236,244,237,249,238,
+  249,239,249,240,249,243,239,244,239,245,239,246,239,247,239,249,
+  239,0,2,238,0,3,244,0,4,238,0,5,244,0,6,238,0,7,244,0,21,244,0,25,
+  244,0,27,244,0,29,244,0,45,249,0,49,249,0,79,239,0,83,239,0,87,248,
+  0,89,248,0,91,248,50,45,253,47,253,66,250,98,251,102,253,112,253,
+  118,251,193,250,194,250,195,250,196,250,197,250,198,250,225,251,
+  226,251,227,251,228,251,229,251,230,251,233,253,234,253,235,253,
+  236,253,243,253,244,253,245,253,246,253,247,253,249,253,250,251,
+  251,251,252,251,253,251,0,2,250,0,3,251,0,4,250,0,5,251,0,6,250,
+  0,7,251,0,21,253,0,25,253,0,27,253,0,29,253,0,79,253,0,83,253,0,
+  109,251,0,113,251,0,115,251,0,117,251,40,80,249,102,251,112,250,
+  118,250,122,250,211,249,212,249,213,249,214,249,215,249,217,249,
+  233,251,234,251,235,251,236,251,243,250,244,250,245,250,246,250,
+  247,250,249,250,250,250,251,250,252,250,253,250,254,250,0,1,250,
+  0,21,251,0,25,251,0,27,251,0,29,251,0,78,249,0,79,250,0,82,249,0,
+  83,250,0,109,250,0,113,250,0,115,250,0,117,250,13,85,254,87,248,
+  88,248,90,254,122,252,222,254,254,252,0,1,252,0,100,254,0,102,254,
+  0,122,254,1,32,25,251,11,66,252,193,252,194,252,195,252,196,252,
+  197,252,198,252,0,2,252,0,4,252,0,6,252,20,66,248,85,250,87,249,
+  88,249,89,250,90,249,193,248,194,248,195,248,196,248,197,248,198,
+  248,222,249,0,2,248,0,4,248,0,6,248,0,100,250,0,102,250,0,122,249,
+  41,45,234,47,234,66,242,98,244,102,244,112,244,193,242,194,242,195,
+  242,196,242,197,242,198,242,225,244,226,244,227,244,228,244,229,
+  244,230,244,233,244,234,244,235,244,236,244,243,244,244,244,245,
+  244,246,244,247,244,249,244,0,2,242,0,3,244,0,4,242,0,5,244,0,6,
+  242,0,7,244,0,21,244,0,25,244,0,27,244,0,29,244,0,79,244,0,83,244,
+  10,86,255,218,255,219,255,220,255,221,255,0,108,255,0,112,255,0,
+  114,255,0,116,255,24,80,250,86,250,87,254,88,254,90,254,211,250,
+  212,250,213,250,214,250,215,250,217,250,218,250,219,250,220,250,
+  221,250,222,254,0,78,250,0,82,250,0,108,250,0,112,250,0,114,250,
+  0,116,250,0,122,254,73,45,245,46,245,47,245,59,248,60,246,66,249,
+  80,254,98,242,102,242,106,248,112,242,115,248,118,248,120,245,122,
+  245,193,249,194,249,195,249,196,249,197,249,198,249,211,254,212,
+  254,213,254,214,254,215,254,217,254,225,242,226,242,227,242,228,
+  242,229,242,230,242,233,248,234,242,235,248,236,248,238,248,243,
+  242,244,242,245,242,246,242,247,242,249,242,250,248,251,248,252,
+  248,253,248,254,245,0,1,251,0,2,249,0,3,242,0,4,249,0,5,242,0,6,
+  249,0,7,242,0,21,248,0,25,242,0,27,242,0,29,242,0,49,248,0,78,254,
+  0,79,242,0,82,254,0,83,242,0,87,248,0,89,248,0,91,248,0,109,248,
+  0,113,248,0,115,248,0,117,248,13,45,253,47,253,66,250,193,250,194,
+  250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,69,45,
+  235,46,248,47,235,59,246,60,245,66,247,80,252,98,238,102,238,106,
+  245,112,238,118,245,193,247,194,247,195,247,196,247,197,247,198,
+  247,211,252,212,252,213,252,214,252,215,252,217,252,225,238,226,
+  238,227,238,228,238,229,238,230,238,233,245,234,238,235,238,236,
+  245,237,251,238,245,239,251,240,251,243,238,244,238,245,238,246,
+  238,247,238,249,238,250,245,251,245,252,245,253,245,0,2,247,0,3,
+  238,0,4,247,0,5,238,0,6,247,0,7,238,0,21,245,0,25,238,0,27,238,0,
+  29,238,0,45,251,0,49,245,0,78,252,0,79,238,0,82,252,0,83,238,0,109,
+  245,0,113,245,0,115,245,0,117,245,68,45,242,46,251,47,242,59,246,
+  60,246,66,247,80,253,98,242,102,242,106,248,112,242,118,248,122,
+  245,193,247,194,247,195,247,196,247,197,247,198,247,211,253,212,
+  253,213,253,214,253,215,253,217,253,225,242,226,242,227,242,228,
+  242,229,242,230,242,233,248,234,242,235,242,236,248,238,248,243,
+  242,244,242,245,242,246,242,247,242,249,242,250,248,251,248,252,
+  248,253,248,254,245,0,1,245,0,2,247,0,3,242,0,4,247,0,5,242,0,6,
+  247,0,7,242,0,21,248,0,25,242,0,27,242,0,29,242,0,49,248,0,78,253,
+  0,79,242,0,82,253,0,83,242,0,109,248,0,113,248,0,115,248,0,117,248,
+  69,45,242,46,245,47,242,59,246,60,246,66,249,80,254,98,242,102,242,
+  106,245,112,242,118,242,193,249,194,249,195,249,196,249,197,249,
+  198,249,211,254,212,254,213,254,214,254,215,254,217,254,225,242,
+  226,242,227,242,228,242,229,242,230,242,233,248,234,242,235,242,
+  236,248,237,251,238,245,239,251,240,251,243,242,244,242,245,242,
+  246,242,247,242,249,242,250,242,251,242,252,242,253,242,0,2,249,
+  0,3,242,0,4,249,0,5,242,0,6,249,0,7,242,0,21,248,0,25,242,0,27,242,
+  0,29,242,0,45,251,0,49,245,0,78,254,0,79,242,0,82,254,0,83,242,0,
+  109,242,0,113,242,0,115,242,0,117,242,4,104,255,0,33,255,0,37,255,
+  11,47,250,118,254,250,254,251,254,252,254,253,254,0,109,254,0,113,
+  254,0,115,254,0,117,254,4,105,254,108,254,0,57,254,12,45,255,47,
+  254,104,250,119,254,120,254,121,254,122,252,254,252,0,1,252,0,33,
+  250,0,37,250,8,45,255,47,254,103,254,106,254,0,49,254,0,51,247,1,
+  32,25,15,15,45,255,47,254,102,255,104,255,233,255,234,255,235,255,
+  236,255,0,21,255,0,25,255,0,27,255,0,29,255,0,33,255,0,37,255,22,
+  102,255,112,255,122,255,233,255,234,255,235,255,236,255,243,255,
+  244,255,245,255,246,255,247,255,249,255,254,255,0,1,255,0,21,255,
+  0,25,255,0,27,255,0,29,255,0,79,255,0,83,255,2,119,250,5,104,255,
+  119,255,0,33,255,0,37,255,47,45,238,46,254,47,238,98,254,100,251,
+  101,251,102,251,104,251,112,249,114,251,116,255,225,254,226,254,
+  227,254,228,254,229,254,230,254,232,251,233,251,234,251,235,251,
+  236,251,243,249,244,249,245,249,246,249,247,249,249,249,0,3,254,
+  0,5,254,0,7,254,0,9,251,0,15,251,0,19,251,0,21,251,0,25,251,0,27,
+  251,0,29,251,0,33,251,0,37,251,0,79,249,0,83,249,0,93,255,0,97,255,
+  0,99,255,1,2,25,255,3,45,245,47,245,3,45,245,47,245,3,45,248,47,
+  248,50,68,252,72,251,80,250,82,250,85,251,86,249,87,239,88,241,90,
+  248,118,254,119,248,120,248,122,248,200,252,211,250,212,250,213,
+  250,214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,
+  248,250,254,251,254,252,254,253,254,254,248,0,1,248,0,8,252,0,14,
+  252,0,32,251,0,36,251,0,78,250,0,82,250,0,100,251,0,102,251,0,108,
+  249,0,109,254,0,112,249,0,113,254,0,114,249,0,115,254,0,116,249,
+  0,117,254,0,122,248,1,32,25,251,50,68,252,72,251,80,250,82,250,85,
+  251,86,249,87,239,88,241,90,248,118,254,119,248,120,248,122,248,
+  200,252,211,250,212,250,213,250,214,250,215,250,217,250,218,249,
+  219,249,220,249,221,249,222,248,250,254,251,254,252,254,253,254,
+  254,248,0,1,248,0,8,252,0,14,252,0,32,251,0,36,251,0,78,250,0,82,
+  250,0,100,251,0,102,251,0,108,249,0,109,254,0,112,249,0,113,254,
+  0,114,249,0,115,254,0,116,249,0,117,254,0,122,248,1,32,25,251,50,
+  68,252,72,251,80,250,82,250,85,251,86,249,87,239,88,241,90,248,118,
+  254,119,248,120,248,122,248,200,252,211,250,212,250,213,250,214,
+  250,215,250,217,250,218,249,219,249,220,249,221,249,222,248,250,
+  254,251,254,252,254,253,254,254,248,0,1,248,0,8,252,0,14,252,0,32,
+  251,0,36,251,0,78,250,0,82,250,0,100,251,0,102,251,0,108,249,0,109,
+  254,0,112,249,0,113,254,0,114,249,0,115,254,0,116,249,0,117,254,
+  0,122,248,1,32,25,251,50,68,252,72,251,80,250,82,250,85,251,86,249,
+  87,239,88,241,90,248,118,254,119,248,120,248,122,248,200,252,211,
+  250,212,250,213,250,214,250,215,250,217,250,218,249,219,249,220,
+  249,221,249,222,248,250,254,251,254,252,254,253,254,254,248,0,1,
+  248,0,8,252,0,14,252,0,32,251,0,36,251,0,78,250,0,82,250,0,100,251,
+  0,102,251,0,108,249,0,109,254,0,112,249,0,113,254,0,114,249,0,115,
+  254,0,116,249,0,117,254,0,122,248,1,32,25,251,50,68,252,72,251,80,
+  250,82,250,85,251,86,249,87,239,88,241,90,248,118,254,119,248,120,
+  248,122,248,200,252,211,250,212,250,213,250,214,250,215,250,217,
+  250,218,249,219,249,220,249,221,249,222,248,250,254,251,254,252,
+  254,253,254,254,248,0,1,248,0,8,252,0,14,252,0,32,251,0,36,251,0,
+  78,250,0,82,250,0,100,251,0,102,251,0,108,249,0,109,254,0,112,249,
+  0,113,254,0,114,249,0,115,254,0,116,249,0,117,254,0,122,248,1,32,
+  25,251,50,68,252,72,251,80,250,82,250,85,251,86,249,87,239,88,241,
+  90,248,118,254,119,248,120,248,122,248,200,252,211,250,212,250,213,
+  250,214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,
+  248,250,254,251,254,252,254,253,254,254,248,0,1,248,0,8,252,0,14,
+  252,0,32,251,0,36,251,0,78,250,0,82,250,0,100,251,0,102,251,0,108,
+  249,0,109,254,0,112,249,0,113,254,0,114,249,0,115,254,0,116,249,
+  0,117,254,0,122,248,1,32,25,251,11,66,252,193,252,194,252,195,252,
+  196,252,197,252,198,252,0,2,252,0,4,252,0,6,252,20,66,248,85,250,
+  87,249,88,249,89,250,90,249,193,248,194,248,195,248,196,248,197,
+  248,198,248,222,249,0,2,248,0,4,248,0,6,248,0,100,250,0,102,250,
+  0,122,249,20,66,248,85,250,87,249,88,249,89,250,90,249,193,248,194,
+  248,195,248,196,248,197,248,198,248,222,249,0,2,248,0,4,248,0,6,
+  248,0,100,250,0,102,250,0,122,249,20,66,248,85,250,87,249,88,249,
+  89,250,90,249,193,248,194,248,195,248,196,248,197,248,198,248,222,
+  249,0,2,248,0,4,248,0,6,248,0,100,250,0,102,250,0,122,249,20,66,
+  248,85,250,87,249,88,249,89,250,90,249,193,248,194,248,195,248,196,
+  248,197,248,198,248,222,249,0,2,248,0,4,248,0,6,248,0,100,250,0,
+  102,250,0,122,249,20,66,248,85,250,87,249,88,249,89,250,90,249,193,
+  248,194,248,195,248,196,248,197,248,198,248,222,249,0,2,248,0,4,
+  248,0,6,248,0,100,250,0,102,250,0,122,249,20,66,248,85,250,87,249,
+  88,249,89,250,90,249,193,248,194,248,195,248,196,248,197,248,198,
+  248,222,249,0,2,248,0,4,248,0,6,248,0,100,250,0,102,250,0,122,249,
+  13,45,253,47,253,66,250,193,250,194,250,195,250,196,250,197,250,
+  198,250,0,2,250,0,4,250,0,6,250,13,45,253,47,253,66,250,193,250,
+  194,250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,
+  13,45,253,47,253,66,250,193,250,194,250,195,250,196,250,197,250,
+  198,250,0,2,250,0,4,250,0,6,250,13,45,253,47,253,66,250,193,250,
+  194,250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,
+  69,45,242,46,245,47,242,59,246,60,246,66,249,80,254,98,242,102,242,
+  106,245,112,242,118,242,193,249,194,249,195,249,196,249,197,249,
+  198,249,211,254,212,254,213,254,214,254,215,254,217,254,225,242,
+  226,242,227,242,228,242,229,242,230,242,233,248,234,242,235,242,
+  236,248,237,251,238,245,239,251,240,251,243,242,244,242,245,242,
+  246,242,247,242,249,242,250,242,251,242,252,242,253,242,0,2,249,
+  0,3,242,0,4,249,0,5,242,0,6,249,0,7,242,0,21,248,0,25,242,0,27,242,
+  0,29,242,0,45,251,0,49,245,0,78,254,0,79,242,0,82,254,0,83,242,0,
+  109,242,0,113,242,0,115,242,0,117,242,4,104,255,0,33,255,0,37,255,
+  4,104,255,0,33,255,0,37,255,4,104,255,0,33,255,0,37,255,4,104,255,
+  0,33,255,0,37,255,4,104,255,0,33,255,0,37,255,4,104,255,0,33,255,
+  0,37,255,4,105,254,108,254,0,57,254,12,45,255,47,254,104,250,119,
+  254,120,254,121,254,122,252,254,252,0,1,252,0,33,250,0,37,250,12,
+  45,255,47,254,104,250,119,254,120,254,121,254,122,252,254,252,0,
+  1,252,0,33,250,0,37,250,12,45,255,47,254,104,250,119,254,120,254,
+  121,254,122,252,254,252,0,1,252,0,33,250,0,37,250,12,45,255,47,254,
+  104,250,119,254,120,254,121,254,122,252,254,252,0,1,252,0,33,250,
+  0,37,250,2,119,250,5,104,255,119,255,0,33,255,0,37,255,5,104,255,
+  119,255,0,33,255,0,37,255,5,104,255,119,255,0,33,255,0,37,255,5,
+  104,255,119,255,0,33,255,0,37,255,5,104,255,119,255,0,33,255,0,37,
+  255,5,104,255,119,255,0,33,255,0,37,255,3,45,248,47,248,3,45,248,
+  47,248,50,68,252,72,251,80,250,82,250,85,251,86,249,87,239,88,241,
+  90,248,118,254,119,248,120,248,122,248,200,252,211,250,212,250,213,
+  250,214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,
+  248,250,254,251,254,252,254,253,254,254,248,0,1,248,0,8,252,0,14,
+  252,0,32,251,0,36,251,0,78,250,0,82,250,0,100,251,0,102,251,0,108,
+  249,0,109,254,0,112,249,0,113,254,0,114,249,0,115,254,0,116,249,
+  0,117,254,0,122,248,1,32,25,251,4,104,255,0,33,255,0,37,255,50,68,
+  252,72,251,80,250,82,250,85,251,86,249,87,239,88,241,90,248,118,
+  254,119,248,120,248,122,248,200,252,211,250,212,250,213,250,214,
+  250,215,250,217,250,218,249,219,249,220,249,221,249,222,248,250,
+  254,251,254,252,254,253,254,254,248,0,1,248,0,8,252,0,14,252,0,32,
+  251,0,36,251,0,78,250,0,82,250,0,100,251,0,102,251,0,108,249,0,109,
+  254,0,112,249,0,113,254,0,114,249,0,115,254,0,116,249,0,117,254,
+  0,122,248,1,32,25,251,4,104,255,0,33,255,0,37,255,50,68,252,72,251,
+  80,250,82,250,85,251,86,249,87,239,88,241,90,248,118,254,119,248,
+  120,248,122,248,200,252,211,250,212,250,213,250,214,250,215,250,
+  217,250,218,249,219,249,220,249,221,249,222,248,250,254,251,254,
+  252,254,253,254,254,248,0,1,248,0,8,252,0,14,252,0,32,251,0,36,251,
+  0,78,250,0,82,250,0,100,251,0,102,251,0,108,249,0,109,254,0,112,
+  249,0,113,254,0,114,249,0,115,254,0,116,249,0,117,254,0,122,248,
+  1,32,25,251,4,104,255,0,33,255,0,37,255,4,105,254,108,254,0,57,254,
+  4,105,254,108,254,0,57,254,16,66,251,87,250,88,250,90,250,193,251,
+  194,251,195,251,196,251,197,251,198,251,222,250,0,2,251,0,4,251,
+  0,6,251,0,122,250,16,66,251,87,250,88,250,90,250,193,251,194,251,
+  195,251,196,251,197,251,198,251,222,250,0,2,251,0,4,251,0,6,251,
+  0,122,250,12,45,255,47,254,104,250,119,254,120,254,121,254,122,252,
+  254,252,0,1,252,0,33,250,0,37,250,12,45,255,47,254,104,250,119,254,
+  120,254,121,254,122,252,254,252,0,1,252,0,33,250,0,37,250,12,45,
+  255,47,254,104,250,119,254,120,254,121,254,122,252,254,252,0,1,252,
+  0,33,250,0,37,250,12,45,255,47,254,104,250,119,254,120,254,121,254,
+  122,252,254,252,0,1,252,0,33,250,0,37,250,15,45,255,47,254,102,255,
+  104,255,233,255,234,255,235,255,236,255,0,21,255,0,25,255,0,27,255,
+  0,29,255,0,33,255,0,37,255,15,45,255,47,254,102,255,104,255,233,
+  255,234,255,235,255,236,255,0,21,255,0,25,255,0,27,255,0,29,255,
+  0,33,255,0,37,255,40,80,249,102,251,112,250,118,250,122,250,211,
+  249,212,249,213,249,214,249,215,249,217,249,233,251,234,251,235,
+  251,236,251,243,250,244,250,245,250,246,250,247,250,249,250,250,
+  250,251,250,252,250,253,250,254,250,0,1,250,0,21,251,0,25,251,0,
+  27,251,0,29,251,0,78,249,0,79,250,0,82,249,0,83,250,0,109,250,0,
+  113,250,0,115,250,0,117,250,22,102,255,112,255,122,255,233,255,234,
+  255,235,255,236,255,243,255,244,255,245,255,246,255,247,255,249,
+  255,254,255,0,1,255,0,21,255,0,25,255,0,27,255,0,29,255,0,79,255,
+  0,83,255,13,85,254,87,248,88,248,90,254,122,252,222,254,254,252,
+  0,1,252,0,100,254,0,102,254,0,122,254,1,32,25,251,13,85,254,87,248,
+  88,248,90,254,122,252,222,254,254,252,0,1,252,0,100,254,0,102,254,
+  0,122,254,1,32,25,251,13,85,254,87,248,88,248,90,254,122,252,222,
+  254,254,252,0,1,252,0,100,254,0,102,254,0,122,254,1,32,25,251,11,
+  66,252,193,252,194,252,195,252,196,252,197,252,198,252,0,2,252,0,
+  4,252,0,6,252,2,119,250,11,66,252,193,252,194,252,195,252,196,252,
+  197,252,198,252,0,2,252,0,4,252,0,6,252,2,119,250,11,66,252,193,
+  252,194,252,195,252,196,252,197,252,198,252,0,2,252,0,4,252,0,6,
+  252,2,119,250,20,66,248,85,250,87,249,88,249,89,250,90,249,193,248,
+  194,248,195,248,196,248,197,248,198,248,222,249,0,2,248,0,4,248,
+  0,6,248,0,100,250,0,102,250,0,122,249,5,104,255,119,255,0,33,255,
+  0,37,255,20,66,248,85,250,87,249,88,249,89,250,90,249,193,248,194,
+  248,195,248,196,248,197,248,198,248,222,249,0,2,248,0,4,248,0,6,
+  248,0,100,250,0,102,250,0,122,249,5,104,255,119,255,0,33,255,0,37,
+  255,24,80,250,86,250,87,254,88,254,90,254,211,250,212,250,213,250,
+  214,250,215,250,217,250,218,250,219,250,220,250,221,250,222,254,
+  0,78,250,0,82,250,0,108,250,0,112,250,0,114,250,0,116,250,0,122,
+  254,47,45,238,46,254,47,238,98,254,100,251,101,251,102,251,104,251,
+  112,249,114,251,116,255,225,254,226,254,227,254,228,254,229,254,
+  230,254,232,251,233,251,234,251,235,251,236,251,243,249,244,249,
+  245,249,246,249,247,249,249,249,0,3,254,0,5,254,0,7,254,0,9,251,
+  0,15,251,0,19,251,0,21,251,0,25,251,0,27,251,0,29,251,0,33,251,0,
+  37,251,0,79,249,0,83,249,0,93,255,0,97,255,0,99,255,1,2,25,255,24,
+  80,250,86,250,87,254,88,254,90,254,211,250,212,250,213,250,214,250,
+  215,250,217,250,218,250,219,250,220,250,221,250,222,254,0,78,250,
+  0,82,250,0,108,250,0,112,250,0,114,250,0,116,250,0,122,254,47,45,
+  238,46,254,47,238,98,254,100,251,101,251,102,251,104,251,112,249,
+  114,251,116,255,225,254,226,254,227,254,228,254,229,254,230,254,
+  232,251,233,251,234,251,235,251,236,251,243,249,244,249,245,249,
+  246,249,247,249,249,249,0,3,254,0,5,254,0,7,254,0,9,251,0,15,251,
+  0,19,251,0,21,251,0,25,251,0,27,251,0,29,251,0,33,251,0,37,251,0,
+  79,249,0,83,249,0,93,255,0,97,255,0,99,255,1,2,25,255,24,80,250,
+  86,250,87,254,88,254,90,254,211,250,212,250,213,250,214,250,215,
+  250,217,250,218,250,219,250,220,250,221,250,222,254,0,78,250,0,82,
+  250,0,108,250,0,112,250,0,114,250,0,116,250,0,122,254,47,45,238,
+  46,254,47,238,98,254,100,251,101,251,102,251,104,251,112,249,114,
+  251,116,255,225,254,226,254,227,254,228,254,229,254,230,254,232,
+  251,233,251,234,251,235,251,236,251,243,249,244,249,245,249,246,
+  249,247,249,249,249,0,3,254,0,5,254,0,7,254,0,9,251,0,15,251,0,19,
+  251,0,21,251,0,25,251,0,27,251,0,29,251,0,33,251,0,37,251,0,79,249,
+  0,83,249,0,93,255,0,97,255,0,99,255,1,2,25,255,73,45,245,46,245,
+  47,245,59,248,60,246,66,249,80,254,98,242,102,242,106,248,112,242,
+  115,248,118,248,120,245,122,245,193,249,194,249,195,249,196,249,
+  197,249,198,249,211,254,212,254,213,254,214,254,215,254,217,254,
+  225,242,226,242,227,242,228,242,229,242,230,242,233,248,234,242,
+  235,248,236,248,238,248,243,242,244,242,245,242,246,242,247,242,
+  249,242,250,248,251,248,252,248,253,248,254,245,0,1,251,0,2,249,
+  0,3,242,0,4,249,0,5,242,0,6,249,0,7,242,0,21,248,0,25,242,0,27,242,
+  0,29,242,0,49,248,0,78,254,0,79,242,0,82,254,0,83,242,0,87,248,0,
+  89,248,0,91,248,0,109,248,0,113,248,0,115,248,0,117,248,73,45,245,
+  46,245,47,245,59,248,60,246,66,249,80,254,98,242,102,242,106,248,
+  112,242,115,248,118,248,120,245,122,245,193,249,194,249,195,249,
+  196,249,197,249,198,249,211,254,212,254,213,254,214,254,215,254,
+  217,254,225,242,226,242,227,242,228,242,229,242,230,242,233,248,
+  234,242,235,248,236,248,238,248,243,242,244,242,245,242,246,242,
+  247,242,249,242,250,248,251,248,252,248,253,248,254,245,0,1,251,
+  0,2,249,0,3,242,0,4,249,0,5,242,0,6,249,0,7,242,0,21,248,0,25,242,
+  0,27,242,0,29,242,0,49,248,0,78,254,0,79,242,0,82,254,0,83,242,0,
+  87,248,0,89,248,0,91,248,0,109,248,0,113,248,0,115,248,0,117,248,
+  13,45,253,47,253,66,250,193,250,194,250,195,250,196,250,197,250,
+  198,250,0,2,250,0,4,250,0,6,250,13,45,253,47,253,66,250,193,250,
+  194,250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,
+  13,45,253,47,253,66,250,193,250,194,250,195,250,196,250,197,250,
+  198,250,0,2,250,0,4,250,0,6,250,13,45,253,47,253,66,250,193,250,
+  194,250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,
+  69,45,242,46,245,47,242,59,246,60,246,66,249,80,254,98,242,102,242,
+  106,245,112,242,118,242,193,249,194,249,195,249,196,249,197,249,
+  198,249,211,254,212,254,213,254,214,254,215,254,217,254,225,242,
+  226,242,227,242,228,242,229,242,230,242,233,248,234,242,235,242,
+  236,248,237,251,238,245,239,251,240,251,243,242,244,242,245,242,
+  246,242,247,242,249,242,250,242,251,242,252,242,253,242,0,2,249,
+  0,3,242,0,4,249,0,5,242,0,6,249,0,7,242,0,21,248,0,25,242,0,27,242,
+  0,29,242,0,45,251,0,49,245,0,78,254,0,79,242,0,82,254,0,83,242,0,
+  109,242,0,113,242,0,115,242,0,117,242,2,1,32,24,238,17,33,238,101,
+  253,115,253,116,250,117,252,119,255,0,19,253,0,87,253,0,89,253,0,
+  91,253,0,93,250,0,97,250,0,99,250,0,101,252,1,2,25,250,1,32,25,238
+};
+static afm_cuint16 afm_Times_Italic_highchars_index[] = { /* 220 */
+  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
+  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
+  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
+  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
+  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
+  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
+  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
+  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
+  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
+  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
+  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
+  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
+  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
+  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
+  64257,64258
+};
+static afm_cunicode afm_Times_Italic_ligatures[] = { /* 3 */
+  102,105,64257
+};
+
+
+/* ------------------------------------------------------------------*/
+/* FontName: Times-Roman */
+/* FullName: Times Roman */
+/* FamilyName: Times */
+static afm_cuint8 afm_Times_Roman_widths[] = { /* 315 */
+  42,56,68,83,83,139,130,30,56,56,83,94,42,56,42,46,83,83,83,83,83,
+  83,83,83,83,83,46,46,94,94,94,74,154,120,111,111,120,102,93,120,
+  120,56,65,120,102,148,120,120,93,120,111,93,102,120,120,157,120,
+  120,102,56,46,56,78,83,56,74,83,74,83,74,56,83,83,46,46,83,46,130,
+  83,83,83,83,56,65,46,83,83,120,83,83,74,80,33,80,90,56,83,83,83,
+  83,33,83,56,127,46,83,94,127,56,67,94,50,50,56,83,76,42,56,50,52,
+  83,125,125,125,74,120,120,120,120,120,120,148,111,102,102,102,102,
+  56,56,56,56,120,120,120,120,120,120,120,94,120,120,120,120,120,120,
+  93,83,74,74,74,74,74,74,111,74,74,74,74,74,46,46,46,46,83,83,83,
+  83,83,83,83,94,83,83,83,83,83,83,83,83,120,74,120,74,120,74,111,
+  74,111,74,120,98,120,83,102,74,102,74,102,74,102,74,120,83,120,83,
+  56,46,56,46,56,46,120,83,102,46,102,46,102,57,102,46,120,83,120,
+  83,120,83,120,83,120,83,148,120,111,56,111,56,111,56,93,65,93,65,
+  93,65,102,46,102,54,120,83,120,83,120,83,120,83,120,102,74,102,74,
+  102,74,83,93,65,56,56,56,56,56,56,56,56,83,167,56,56,56,74,74,74,
+  83,83,58,167,167,56,56,28,83,163,79,102,100,94,76,92,92,92,79,42,
+  93,93
+};
+static afm_sint16 afm_Times_Roman_kerning_index[] = { /* 315 */
+  1,0,0,0,0,0,0,0,0,0,0,0,44,0,53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,62,159,0,205,0,240,0,0,0,311,335,427,0,458,482,527,578,601,0,
+  663,831,855,1020,0,1175,0,0,0,0,0,0,0,1323,1328,1355,0,1363,1385,
+  0,0,1422,0,1425,1475,0,1478,1488,1500,0,1508,0,0,0,1523,1593,1641,
+  1664,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,0,0,0,1669,1766,1863,1960,2057,2154,0,0,0,0,0,0,0,0,0,0,0,2251,
+  2275,2320,2365,2410,2455,0,2500,2545,2569,2593,2617,2641,0,0,2789,
+  2794,2799,2804,2809,2814,0,2819,2827,2849,2871,2893,2915,2918,2921,
+  2924,0,2927,2937,2949,2961,2973,2985,0,2997,0,0,0,0,3009,0,3014,
+  3019,3116,3121,3218,3223,3320,0,3325,0,3333,3341,0,3376,0,0,3411,
+  0,3433,0,3455,0,3477,0,0,0,0,0,3499,0,3502,0,0,3505,3597,3647,3678,
+  3681,3712,3715,0,3727,3758,3761,3785,3795,3819,3829,3853,3863,3908,
+  3920,3965,0,0,3977,4039,4054,4116,4131,4193,0,0,0,0,0,0,4208,0,4376,
+  0,4544,0,4568,0,4592,0,4616,0,4640,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,0,0,4788,4816,0,4872,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+  0,0,0,0
+};
+static afm_cuint8 afm_Times_Roman_kerning_data[] = { /* 4896 */
+  42,19,66,248,85,254,87,249,88,252,90,242,193,248,194,248,195,248,
+  196,248,197,248,198,248,222,242,0,2,248,0,4,248,0,6,248,0,100,254,
+  0,102,254,0,122,242,3,1,32,25,245,1,32,29,245,3,1,32,25,245,1,32,
+  29,245,41,68,250,72,250,80,248,82,248,85,238,86,248,87,234,88,242,
+  90,239,119,245,120,242,122,242,200,250,211,248,212,248,213,248,214,
+  248,215,248,217,248,218,248,219,248,220,248,221,248,222,239,254,
+  242,0,1,242,0,8,250,0,14,250,0,32,250,0,36,250,0,78,248,0,82,248,
+  0,100,238,0,102,238,0,108,248,0,112,248,0,114,248,0,116,248,0,122,
+  239,1,32,25,238,20,66,251,86,255,193,251,194,251,195,251,196,251,
+  197,251,198,251,218,255,219,255,220,255,221,255,0,2,251,0,4,251,
+  0,6,251,0,108,255,0,112,255,0,114,255,0,116,255,16,66,250,87,250,
+  88,252,90,248,193,250,194,250,195,250,196,250,197,250,198,250,222,
+  248,0,2,250,0,4,250,0,6,250,0,122,248,32,45,244,47,244,66,245,98,
+  254,112,254,193,245,194,245,195,245,196,245,197,245,198,245,225,
+  254,226,254,227,254,228,254,229,254,230,254,243,254,244,254,245,
+  254,246,254,247,254,249,254,0,2,245,0,3,254,0,4,245,0,5,254,0,6,
+  245,0,7,254,0,79,254,0,83,254,11,66,247,193,247,194,247,195,247,
+  196,247,197,247,198,247,0,2,247,0,4,247,0,6,247,40,80,252,102,253,
+  112,251,118,254,122,253,211,252,212,252,213,252,214,252,215,252,
+  217,252,233,253,234,253,235,253,236,253,243,251,244,251,245,251,
+  246,251,247,251,249,251,250,254,251,254,252,254,253,254,254,253,
+  0,1,253,0,21,253,0,25,253,0,27,253,0,29,253,0,78,252,0,79,251,0,
+  82,252,0,83,251,0,109,254,0,113,254,0,115,254,0,117,254,13,85,242,
+  87,240,88,245,90,240,122,248,222,240,254,248,0,1,248,0,100,242,0,
+  102,242,0,122,240,1,32,25,242,11,66,251,193,251,194,251,195,251,
+  196,251,197,251,198,251,0,2,251,0,4,251,0,6,251,20,66,251,85,250,
+  87,249,88,251,89,250,90,249,193,251,194,251,195,251,196,251,197,
+  251,198,251,222,249,0,2,251,0,4,251,0,6,251,0,100,250,0,102,250,
+  0,122,249,23,45,238,47,238,66,242,98,254,193,242,194,242,195,242,
+  196,242,197,242,198,242,225,254,226,254,227,254,228,254,229,254,
+  230,254,0,2,242,0,3,254,0,4,242,0,5,254,0,6,242,0,7,254,10,86,255,
+  218,255,219,255,220,255,221,255,0,108,255,0,112,255,0,114,255,0,
+  116,255,27,80,250,85,247,86,250,87,244,88,248,90,246,211,250,212,
+  250,213,250,214,250,215,250,217,250,218,250,219,250,220,250,221,
+  250,222,246,0,78,250,0,82,250,0,100,247,0,102,247,0,108,250,0,112,
+  250,0,114,250,0,116,250,0,122,246,73,45,245,46,242,47,245,59,249,
+  60,248,66,241,80,254,98,244,102,245,106,251,112,244,115,251,118,
+  249,120,244,122,244,193,241,194,241,195,241,196,241,197,241,198,
+  241,211,254,212,254,213,254,214,254,215,254,217,254,225,250,226,
+  244,227,244,228,250,229,250,230,244,233,245,234,245,235,245,236,
+  252,238,251,243,244,244,244,245,244,246,244,247,244,249,244,250,
+  249,251,249,252,249,253,249,254,244,0,1,244,0,2,241,0,3,250,0,4,
+  241,0,5,244,0,6,241,0,7,244,0,21,252,0,25,245,0,27,245,0,29,245,
+  0,49,251,0,78,254,0,79,244,0,82,254,0,83,244,0,87,251,0,89,251,0,
+  91,251,0,109,249,0,113,249,0,115,249,0,117,249,11,66,250,193,250,
+  194,250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,
+  72,45,235,46,240,47,235,59,245,60,245,66,234,72,254,80,250,98,238,
+  102,238,106,247,112,235,118,244,193,234,194,234,195,234,196,234,
+  197,234,198,234,211,250,212,250,213,250,214,250,215,250,217,250,
+  225,245,226,238,227,245,228,245,229,245,230,238,233,245,234,238,
+  235,245,236,245,237,254,238,247,239,254,240,254,243,242,244,235,
+  245,235,246,242,247,242,249,235,250,244,251,244,252,244,253,244,
+  0,2,234,0,3,245,0,4,234,0,5,238,0,6,234,0,7,238,0,21,245,0,25,238,
+  0,27,238,0,29,245,0,32,254,0,36,254,0,45,254,0,49,247,0,78,250,0,
+  79,242,0,82,250,0,83,235,0,109,244,0,113,244,0,115,244,0,117,244,
+  68,45,242,46,246,47,242,59,251,60,251,66,237,80,255,98,244,102,244,
+  106,250,112,244,118,249,122,245,193,237,194,237,195,237,196,237,
+  197,237,198,237,211,255,212,255,213,255,214,255,215,255,217,255,
+  225,244,226,244,227,244,228,244,229,244,230,244,233,250,234,244,
+  235,244,236,250,238,250,243,244,244,244,245,244,246,244,247,244,
+  249,244,250,249,251,249,252,249,253,249,254,245,0,1,245,0,2,237,
+  0,3,244,0,4,237,0,5,244,0,6,237,0,7,244,0,21,250,0,25,244,0,27,244,
+  0,29,244,0,49,250,0,78,255,0,79,244,0,82,255,0,83,244,0,109,249,
+  0,113,249,0,115,249,0,117,249,65,45,235,46,238,47,235,59,242,60,
+  242,66,237,80,252,98,240,102,240,106,248,112,239,118,238,193,237,
+  194,237,195,237,196,237,197,237,198,237,211,252,212,252,213,252,
+  214,252,215,252,217,252,225,247,226,240,227,240,228,247,229,247,
+  230,240,233,247,234,240,235,240,236,247,238,248,243,245,244,239,
+  245,239,246,245,247,245,249,239,250,245,251,238,252,238,253,245,
+  0,2,237,0,3,247,0,4,237,0,5,240,0,6,237,0,7,240,0,21,247,0,25,240,
+  0,27,240,0,29,240,0,49,248,0,78,252,0,79,245,0,82,252,0,83,239,0,
+  109,245,0,113,238,0,115,238,0,117,238,3,119,254,120,254,12,47,250,
+  118,254,119,254,250,254,251,254,252,254,253,254,0,109,254,0,113,
+  254,0,115,254,0,117,254,4,122,254,254,254,0,1,254,10,104,254,119,
+  253,120,253,121,254,122,254,254,254,0,1,254,0,33,254,0,37,254,16,
+  98,255,103,253,106,254,225,255,226,255,227,255,228,255,229,255,230,
+  255,238,254,0,3,255,0,5,255,0,7,255,0,51,249,1,32,25,9,2,119,253,
+  22,102,255,112,255,122,254,233,255,234,255,235,255,236,255,243,255,
+  244,255,245,255,246,255,247,255,249,255,254,254,0,1,254,0,21,255,
+  0,25,255,0,27,255,0,29,255,0,79,255,0,83,255,2,120,255,5,119,250,
+  122,254,254,254,0,1,254,6,119,254,120,253,122,255,254,255,0,1,255,
+  4,122,255,254,255,0,1,255,7,45,250,46,254,47,248,104,254,0,33,254,
+  0,37,254,31,45,246,47,246,98,253,102,254,112,254,225,253,226,253,
+  227,253,228,253,229,253,230,253,233,254,234,254,235,254,236,254,
+  243,254,244,254,245,254,246,254,247,254,249,254,0,3,253,0,5,253,
+  0,7,253,0,21,254,0,25,254,0,27,254,0,29,254,0,79,254,0,83,254,22,
+  45,246,47,246,98,255,112,255,225,255,226,255,227,255,228,255,229,
+  255,230,255,243,255,244,255,245,255,246,255,247,255,249,255,0,3,
+  255,0,5,255,0,7,255,0,79,255,0,83,255,10,102,254,233,254,234,254,
+  235,254,236,254,0,21,254,0,25,254,0,27,254,0,29,254,3,45,246,47,
+  246,41,68,250,72,250,80,248,82,248,85,238,86,248,87,234,88,242,90,
+  239,119,245,120,242,122,242,200,250,211,248,212,248,213,248,214,
+  248,215,248,217,248,218,248,219,248,220,248,221,248,222,239,254,
+  242,0,1,242,0,8,250,0,14,250,0,32,250,0,36,250,0,78,248,0,82,248,
+  0,100,238,0,102,238,0,108,248,0,112,248,0,114,248,0,116,248,0,122,
+  239,1,32,25,238,41,68,250,72,250,80,248,82,248,85,238,86,248,87,
+  234,88,242,90,239,119,245,120,242,122,242,200,250,211,248,212,248,
+  213,248,214,248,215,248,217,248,218,248,219,248,220,248,221,248,
+  222,239,254,242,0,1,242,0,8,250,0,14,250,0,32,250,0,36,250,0,78,
+  248,0,82,248,0,100,238,0,102,238,0,108,248,0,112,248,0,114,248,0,
+  116,248,0,122,239,1,32,25,238,41,68,250,72,250,80,248,82,248,85,
+  238,86,248,87,234,88,242,90,239,119,245,120,242,122,242,200,250,
+  211,248,212,248,213,248,214,248,215,248,217,248,218,248,219,248,
+  220,248,221,248,222,239,254,242,0,1,242,0,8,250,0,14,250,0,32,250,
+  0,36,250,0,78,248,0,82,248,0,100,238,0,102,238,0,108,248,0,112,248,
+  0,114,248,0,116,248,0,122,239,1,32,25,238,41,68,250,72,250,80,248,
+  82,248,85,238,86,248,87,234,88,242,90,239,119,245,120,242,122,242,
+  200,250,211,248,212,248,213,248,214,248,215,248,217,248,218,248,
+  219,248,220,248,221,248,222,239,254,242,0,1,242,0,8,250,0,14,250,
+  0,32,250,0,36,250,0,78,248,0,82,248,0,100,238,0,102,238,0,108,248,
+  0,112,248,0,114,248,0,116,248,0,122,239,1,32,25,238,41,68,250,72,
+  250,80,248,82,248,85,238,86,248,87,234,88,242,90,239,119,245,120,
+  242,122,242,200,250,211,248,212,248,213,248,214,248,215,248,217,
+  248,218,248,219,248,220,248,221,248,222,239,254,242,0,1,242,0,8,
+  250,0,14,250,0,32,250,0,36,250,0,78,248,0,82,248,0,100,238,0,102,
+  238,0,108,248,0,112,248,0,114,248,0,116,248,0,122,239,1,32,25,238,
+  41,68,250,72,250,80,248,82,248,85,238,86,248,87,234,88,242,90,239,
+  119,245,120,242,122,242,200,250,211,248,212,248,213,248,214,248,
+  215,248,217,248,218,248,219,248,220,248,221,248,222,239,254,242,
+  0,1,242,0,8,250,0,14,250,0,32,250,0,36,250,0,78,248,0,82,248,0,100,
+  238,0,102,238,0,108,248,0,112,248,0,114,248,0,116,248,0,122,239,
+  1,32,25,238,11,66,251,193,251,194,251,195,251,196,251,197,251,198,
+  251,0,2,251,0,4,251,0,6,251,20,66,251,85,250,87,249,88,251,89,250,
+  90,249,193,251,194,251,195,251,196,251,197,251,198,251,222,249,0,
+  2,251,0,4,251,0,6,251,0,100,250,0,102,250,0,122,249,20,66,251,85,
+  250,87,249,88,251,89,250,90,249,193,251,194,251,195,251,196,251,
+  197,251,198,251,222,249,0,2,251,0,4,251,0,6,251,0,100,250,0,102,
+  250,0,122,249,20,66,251,85,250,87,249,88,251,89,250,90,249,193,251,
+  194,251,195,251,196,251,197,251,198,251,222,249,0,2,251,0,4,251,
+  0,6,251,0,100,250,0,102,250,0,122,249,20,66,251,85,250,87,249,88,
+  251,89,250,90,249,193,251,194,251,195,251,196,251,197,251,198,251,
+  222,249,0,2,251,0,4,251,0,6,251,0,100,250,0,102,250,0,122,249,20,
+  66,251,85,250,87,249,88,251,89,250,90,249,193,251,194,251,195,251,
+  196,251,197,251,198,251,222,249,0,2,251,0,4,251,0,6,251,0,100,250,
+  0,102,250,0,122,249,20,66,251,85,250,87,249,88,251,89,250,90,249,
+  193,251,194,251,195,251,196,251,197,251,198,251,222,249,0,2,251,
+  0,4,251,0,6,251,0,100,250,0,102,250,0,122,249,11,66,250,193,250,
+  194,250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,
+  11,66,250,193,250,194,250,195,250,196,250,197,250,198,250,0,2,250,
+  0,4,250,0,6,250,11,66,250,193,250,194,250,195,250,196,250,197,250,
+  198,250,0,2,250,0,4,250,0,6,250,11,66,250,193,250,194,250,195,250,
+  196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,65,45,235,46,238,
+  47,235,59,242,60,242,66,237,80,252,98,240,102,240,106,248,112,239,
+  118,238,193,237,194,237,195,237,196,237,197,237,198,237,211,252,
+  212,252,213,252,214,252,215,252,217,252,225,247,226,240,227,240,
+  228,247,229,247,230,240,233,247,234,240,235,240,236,247,238,248,
+  243,245,244,239,245,239,246,245,247,245,249,239,250,245,251,238,
+  252,238,253,245,0,2,237,0,3,247,0,4,237,0,5,240,0,6,237,0,7,240,
+  0,21,247,0,25,240,0,27,240,0,29,240,0,49,248,0,78,252,0,79,245,0,
+  82,252,0,83,239,0,109,245,0,113,238,0,115,238,0,117,238,3,119,254,
+  120,254,3,119,254,120,254,3,119,254,120,254,3,119,254,120,254,3,
+  119,254,120,254,3,119,254,120,254,4,122,254,254,254,0,1,254,10,104,
+  254,119,253,120,253,121,254,122,254,254,254,0,1,254,0,33,254,0,37,
+  254,10,104,254,119,253,120,253,121,254,122,254,254,254,0,1,254,0,
+  33,254,0,37,254,10,104,254,119,253,120,253,121,254,122,254,254,254,
+  0,1,254,0,33,254,0,37,254,10,104,254,119,253,120,253,121,254,122,
+  254,254,254,0,1,254,0,33,254,0,37,254,2,119,253,2,119,253,2,119,
+  253,2,119,253,5,119,250,122,254,254,254,0,1,254,6,119,254,120,253,
+  122,255,254,255,0,1,255,6,119,254,120,253,122,255,254,255,0,1,255,
+  6,119,254,120,253,122,255,254,255,0,1,255,6,119,254,120,253,122,
+  255,254,255,0,1,255,6,119,254,120,253,122,255,254,255,0,1,255,6,
+  119,254,120,253,122,255,254,255,0,1,255,3,45,246,47,246,3,45,246,
+  47,246,41,68,250,72,250,80,248,82,248,85,238,86,248,87,234,88,242,
+  90,239,119,245,120,242,122,242,200,250,211,248,212,248,213,248,214,
+  248,215,248,217,248,218,248,219,248,220,248,221,248,222,239,254,
+  242,0,1,242,0,8,250,0,14,250,0,32,250,0,36,250,0,78,248,0,82,248,
+  0,100,238,0,102,238,0,108,248,0,112,248,0,114,248,0,116,248,0,122,
+  239,1,32,25,238,3,119,254,120,254,41,68,250,72,250,80,248,82,248,
+  85,238,86,248,87,234,88,242,90,239,119,245,120,242,122,242,200,250,
+  211,248,212,248,213,248,214,248,215,248,217,248,218,248,219,248,
+  220,248,221,248,222,239,254,242,0,1,242,0,8,250,0,14,250,0,32,250,
+  0,36,250,0,78,248,0,82,248,0,100,238,0,102,238,0,108,248,0,112,248,
+  0,114,248,0,116,248,0,122,239,1,32,25,238,3,119,254,120,254,41,68,
+  250,72,250,80,248,82,248,85,238,86,248,87,234,88,242,90,239,119,
+  245,120,248,122,248,200,250,211,248,212,248,213,248,214,248,215,
+  248,217,248,218,248,219,248,220,248,221,248,222,239,254,248,0,1,
+  248,0,8,250,0,14,250,0,32,250,0,36,250,0,78,248,0,82,248,0,100,238,
+  0,102,238,0,108,248,0,112,248,0,114,248,0,116,248,0,122,239,1,32,
+  25,238,3,119,254,120,254,4,122,254,254,254,0,1,254,4,122,254,254,
+  254,0,1,254,16,66,250,87,250,88,252,90,248,193,250,194,250,195,250,
+  196,250,197,250,198,250,222,248,0,2,250,0,4,250,0,6,250,0,122,248,
+  16,66,250,87,250,88,252,90,248,193,250,194,250,195,250,196,250,197,
+  250,198,250,222,248,0,2,250,0,4,250,0,6,250,0,122,248,10,104,254,
+  119,253,120,253,121,254,122,254,254,254,0,1,254,0,33,254,0,37,254,
+  10,104,254,119,253,120,253,121,254,122,254,254,254,0,1,254,0,33,
+  254,0,37,254,10,104,254,119,253,120,253,121,254,122,254,254,254,
+  0,1,254,0,33,254,0,37,254,10,104,254,119,253,120,253,121,254,122,
+  254,254,254,0,1,254,0,33,254,0,37,254,2,119,253,2,119,253,40,80,
+  252,102,253,112,251,118,254,122,253,211,252,212,252,213,252,214,
+  252,215,252,217,252,233,253,234,253,235,253,236,253,243,251,244,
+  251,245,251,246,251,247,251,249,251,250,254,251,254,252,254,253,
+  254,254,253,0,1,253,0,21,253,0,25,253,0,27,253,0,29,253,0,78,252,
+  0,79,251,0,82,252,0,83,251,0,109,254,0,113,254,0,115,254,0,117,254,
+  22,102,255,112,255,122,254,233,255,234,255,235,255,236,255,243,255,
+  244,255,245,255,246,255,247,255,249,255,254,254,0,1,254,0,21,255,
+  0,25,255,0,27,255,0,29,255,0,79,255,0,83,255,13,85,242,87,240,88,
+  245,90,240,122,248,222,240,254,248,0,1,248,0,100,242,0,102,242,0,
+  122,240,1,32,25,242,2,120,255,13,85,242,87,240,88,245,90,240,122,
+  248,222,240,254,248,0,1,248,0,100,242,0,102,242,0,122,240,1,32,25,
+  242,2,120,255,5,122,248,254,248,0,1,248,1,32,25,242,13,85,242,87,
+  240,88,245,90,240,122,248,222,240,254,248,0,1,248,0,100,242,0,102,
+  242,0,122,240,1,32,25,242,2,120,255,11,66,251,193,251,194,251,195,
+  251,196,251,197,251,198,251,0,2,251,0,4,251,0,6,251,5,119,250,122,
+  254,254,254,0,1,254,11,66,251,193,251,194,251,195,251,196,251,197,
+  251,198,251,0,2,251,0,4,251,0,6,251,5,119,250,122,254,254,254,0,
+  1,254,11,66,251,193,251,194,251,195,251,196,251,197,251,198,251,
+  0,2,251,0,4,251,0,6,251,5,119,250,122,254,254,254,0,1,254,20,66,
+  251,85,250,87,249,88,251,89,250,90,249,193,251,194,251,195,251,196,
+  251,197,251,198,251,222,249,0,2,251,0,4,251,0,6,251,0,100,250,0,
+  102,250,0,122,249,6,119,254,120,253,122,255,254,255,0,1,255,20,66,
+  251,85,250,87,249,88,251,89,250,90,249,193,251,194,251,195,251,196,
+  251,197,251,198,251,222,249,0,2,251,0,4,251,0,6,251,0,100,250,0,
+  102,250,0,122,249,6,119,254,120,253,122,255,254,255,0,1,255,27,80,
+  250,85,247,86,250,87,244,88,248,90,246,211,250,212,250,213,250,214,
+  250,215,250,217,250,218,250,219,250,220,250,221,250,222,246,0,78,
+  250,0,82,250,0,100,247,0,102,247,0,108,250,0,112,250,0,114,250,0,
+  116,250,0,122,246,7,45,250,46,254,47,248,104,254,0,33,254,0,37,254,
+  27,80,250,85,247,86,250,87,244,88,248,90,246,211,250,212,250,213,
+  250,214,250,215,250,217,250,218,250,219,250,220,250,221,250,222,
+  246,0,78,250,0,82,250,0,100,247,0,102,247,0,108,250,0,112,250,0,
+  114,250,0,116,250,0,122,246,7,45,250,46,254,47,248,104,254,0,33,
+  254,0,37,254,27,80,250,85,247,86,250,87,244,88,248,90,246,211,250,
+  212,250,213,250,214,250,215,250,217,250,218,250,219,250,220,250,
+  221,250,222,246,0,78,250,0,82,250,0,100,247,0,102,247,0,108,250,
+  0,112,250,0,114,250,0,116,250,0,122,246,7,45,250,46,254,47,248,104,
+  254,0,33,254,0,37,254,73,45,245,46,242,47,245,59,249,60,248,66,241,
+  80,254,98,244,102,245,106,251,112,244,115,251,118,249,120,244,122,
+  244,193,241,194,241,195,241,196,241,197,241,198,241,211,254,212,
+  254,213,254,214,254,215,254,217,254,225,250,226,244,227,244,228,
+  250,229,250,230,244,233,252,234,245,235,252,236,252,238,251,243,
+  244,244,244,245,244,246,244,247,244,249,244,250,249,251,249,252,
+  249,253,249,254,244,0,1,244,0,2,241,0,3,250,0,4,241,0,5,244,0,6,
+  241,0,7,244,0,21,245,0,25,245,0,27,245,0,29,245,0,49,251,0,78,254,
+  0,79,244,0,82,254,0,83,244,0,87,251,0,89,251,0,91,251,0,109,249,
+  0,113,249,0,115,249,0,117,249,73,45,245,46,242,47,245,59,249,60,
+  248,66,241,80,254,98,244,102,245,106,251,112,244,115,251,118,249,
+  120,244,122,244,193,241,194,241,195,241,196,241,197,241,198,241,
+  211,254,212,254,213,254,214,254,215,254,217,254,225,250,226,244,
+  227,244,228,250,229,250,230,244,233,245,234,245,235,252,236,252,
+  238,251,243,244,244,244,245,244,246,244,247,244,249,244,250,249,
+  251,249,252,249,253,249,254,244,0,1,244,0,2,241,0,3,250,0,4,241,
+  0,5,244,0,6,241,0,7,244,0,21,252,0,25,245,0,27,245,0,29,245,0,49,
+  251,0,78,254,0,79,244,0,82,254,0,83,244,0,87,251,0,89,251,0,91,251,
+  0,109,249,0,113,249,0,115,249,0,117,249,11,66,250,193,250,194,250,
+  195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,11,66,250,
+  193,250,194,250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,
+  0,6,250,11,66,250,193,250,194,250,195,250,196,250,197,250,198,250,
+  0,2,250,0,4,250,0,6,250,11,66,250,193,250,194,250,195,250,196,250,
+  197,250,198,250,0,2,250,0,4,250,0,6,250,65,45,235,46,238,47,235,
+  59,242,60,242,66,237,80,252,98,240,102,240,106,248,112,239,118,238,
+  193,237,194,237,195,237,196,237,197,237,198,237,211,252,212,252,
+  213,252,214,252,215,252,217,252,225,247,226,240,227,240,228,240,
+  229,247,230,240,233,247,234,240,235,240,236,247,238,248,243,245,
+  244,239,245,239,246,245,247,245,249,239,250,245,251,238,252,238,
+  253,245,0,2,237,0,3,247,0,4,237,0,5,240,0,6,237,0,7,240,0,21,247,
+  0,25,240,0,27,240,0,29,240,0,49,248,0,78,252,0,79,245,0,82,252,0,
+  83,239,0,109,245,0,113,238,0,115,238,0,117,238,12,66,244,193,244,
+  194,244,195,244,196,244,197,244,198,244,0,2,244,0,4,244,0,6,244,
+  1,32,24,245,21,33,245,101,249,109,255,115,249,116,248,117,254,119,
+  249,0,19,249,0,60,255,0,62,255,0,68,255,0,87,249,0,89,249,0,91,249,
+  0,93,248,0,97,248,0,99,248,0,101,254,1,2,25,248,1,32,25,245,11,66,
+  244,193,244,194,244,195,244,196,244,197,244,198,244,0,2,244,0,4,
+  244,0,6,244
+};
+static afm_cuint16 afm_Times_Roman_highchars_index[] = { /* 220 */
+  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
+  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
+  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
+  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
+  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
+  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
+  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
+  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
+  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
+  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
+  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
+  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
+  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
+  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
+  64257,64258
+};
+static afm_cunicode afm_Times_Roman_ligatures[] = { /* 3 */
+  102,105,64257
+};
+const afm_fontinfo afm_fontinfolist[] = {
+  { /* Courier.afm   761 bytes */
+      "Courier", "Courier",
+      629, -157,
+      afm_Courier_widths,
+      NULL,
+      NULL,
+      afm_Courier_highchars_index, 220,
+      afm_Courier_ligatures, 1},
+  { /* Courier-Bold.afm   761 bytes */
+      "Courier-Bold", "Courier Bold",
+      629, -157,
+      afm_Courier_Bold_widths,
+      NULL,
+      NULL,
+      afm_Courier_Bold_highchars_index, 220,
+      afm_Courier_Bold_ligatures, 1},
+  { /* Courier-BoldOblique.afm   761 bytes */
+      "Courier-BoldOblique", "Courier Bold Oblique",
+      629, -157,
+      afm_Courier_BoldOblique_widths,
+      NULL,
+      NULL,
+      afm_Courier_BoldOblique_highchars_index, 220,
+      afm_Courier_BoldOblique_ligatures, 1},
+  { /* Courier-Oblique.afm   761 bytes */
+      "Courier-Oblique", "Courier Oblique",
+      629, -157,
+      afm_Courier_Oblique_widths,
+      NULL,
+      NULL,
+      afm_Courier_Oblique_highchars_index, 220,
+      afm_Courier_Oblique_ligatures, 1},
+  { /* Helvetica.afm   7841 bytes */
+      "Helvetica", "Helvetica",
+      718, -207,
+      afm_Helvetica_widths,
+      afm_Helvetica_kerning_index,
+      afm_Helvetica_kerning_data,
+      afm_Helvetica_highchars_index, 220,
+      afm_Helvetica_ligatures, 1},
+  { /* Helvetica-Bold.afm   7336 bytes */
+      "Helvetica-Bold", "Helvetica Bold",
+      718, -207,
+      afm_Helvetica_Bold_widths,
+      afm_Helvetica_Bold_kerning_index,
+      afm_Helvetica_Bold_kerning_data,
+      afm_Helvetica_Bold_highchars_index, 220,
+      afm_Helvetica_Bold_ligatures, 1},
+  { /* Helvetica-BoldOblique.afm   7336 bytes */
+      "Helvetica-BoldOblique", "Helvetica Bold Oblique",
+      718, -207,
+      afm_Helvetica_BoldOblique_widths,
+      afm_Helvetica_BoldOblique_kerning_index,
+      afm_Helvetica_BoldOblique_kerning_data,
+      afm_Helvetica_BoldOblique_highchars_index, 220,
+      afm_Helvetica_BoldOblique_ligatures, 1},
+  { /* Helvetica-Oblique.afm   7841 bytes */
+      "Helvetica-Oblique", "Helvetica Oblique",
+      718, -207,
+      afm_Helvetica_Oblique_widths,
+      afm_Helvetica_Oblique_kerning_index,
+      afm_Helvetica_Oblique_kerning_data,
+      afm_Helvetica_Oblique_highchars_index, 220,
+      afm_Helvetica_Oblique_ligatures, 1},
+  { /* ZapfDingbats.afm   416 bytes */
+      "ZapfDingbats", "ITC Zapf Dingbats",
+      0, 0,
+      afm_ZapfDingbats_widths,
+      NULL,
+      NULL,
+      afm_ZapfDingbats_highchars_index, 107,
+      NULL, 0},
+  { /* Symbol.afm   563 bytes */
+      "Symbol", "Symbol",
+      0, 0,
+      afm_Symbol_widths,
+      NULL,
+      NULL,
+      afm_Symbol_highchars_index, 156,
+      NULL, 0},
+  { /* Times-Bold.afm   6761 bytes */
+      "Times-Bold", "Times Bold",
+      683, -217,
+      afm_Times_Bold_widths,
+      afm_Times_Bold_kerning_index,
+      afm_Times_Bold_kerning_data,
+      afm_Times_Bold_highchars_index, 220,
+      afm_Times_Bold_ligatures, 1},
+  { /* Times-BoldItalic.afm   6270 bytes */
+      "Times-BoldItalic", "Times Bold Italic",
+      683, -217,
+      afm_Times_BoldItalic_widths,
+      afm_Times_BoldItalic_kerning_index,
+      afm_Times_BoldItalic_kerning_data,
+      afm_Times_BoldItalic_highchars_index, 220,
+      afm_Times_BoldItalic_ligatures, 1},
+  { /* Times-Italic.afm   6975 bytes */
+      "Times-Italic", "Times Italic",
+      683, -217,
+      afm_Times_Italic_widths,
+      afm_Times_Italic_kerning_index,
+      afm_Times_Italic_kerning_data,
+      afm_Times_Italic_highchars_index, 220,
+      afm_Times_Italic_ligatures, 1},
+  { /* Times-Roman.afm   6287 bytes */
+      "Times-Roman", "Times Roman",
+      683, -217,
+      afm_Times_Roman_widths,
+      afm_Times_Roman_kerning_index,
+      afm_Times_Roman_kerning_data,
+      afm_Times_Roman_highchars_index, 220,
+      afm_Times_Roman_ligatures, 1},
+  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+};
+const int afm_fontinfo_count = 14;
diff --git a/src/rrd_afm_data.h b/src/rrd_afm_data.h
new file mode 100644 (file)
index 0000000..6be2607
--- /dev/null
@@ -0,0 +1,191 @@
+/****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ ****************************************************************************
+ * rrd_afm_data.h  Encoded afm (Adobe Font Metrics) for selected fonts.
+ ****************************************************************************/
+
+#ifndef  RRD_AFM_DATA_H
+#define RRD_AFM_DATA_H
+
+/*
+Description of data structures:
+
+  Ideally, the struct should be a list of fonts, and each font
+  is a list of character-info.
+  Each character has a structure:
+    struct charinfo {
+      char16 thechar;
+      int width;
+      struct {
+       char16 nextchar;
+       int deltawidth;
+      } kernings[];
+      struct {
+       char16 nextchar;
+       char16 resultingchar;
+      } ligatures[];
+    }
+
+    The data for typical fonts makes this a very sparse data structure.
+    For most fonts, only the letter "f" has ligatures.
+    All fonts have all (or almost all) of the characters 32-126,
+    most fonts have all 161-255,
+    and all fonts have very few 256-65535.
+    Most kerning pairs have both chars 32-126.
+
+    The most basic design decisionÊis to have all this data as 
+    const C globals all set up by array/struct initialisers
+    so runtime setup overhead is minimal.
+    The complete other possibility would be to parse and load
+    this info at runtime, but for rrdtool I have preferred
+    speed for flexibility as the same few fonts will be used 
+    zillions of times.
+
+    So the idea is to rewrite the above structure into
+    something which:
+    1) uses/wastes minimal memory
+    2) is fast for most characters
+    3) supports at least Iso-Latin-1, prefer full unicode.
+    4) doesn't need full precision in char width
+       (we can afford to loose 0.2% as rrdtool only needs to calculate
+       overall layout of elements, not positioning individual
+       characters)
+    5) can be written as constant initialisers to C structs/arrays
+       so we don't have runtime overhead starting rrdtool.
+    6) can be easily generated by some script so it is easy
+       to select a set of fonts and have the C data updated.
+       So adding/removing fonts is a matter of a recompile.
+
+Implementation design:
+    All character structs are sorted by unicode value. Info for
+    characters below 32 is discarded and the chars are treated 
+    as a space. Missing characters in the 32-126 range are 
+    substituted with default values so we can use direct array 
+    access for those. For characters above 126, binary search 
+    is used (not yet, liniar now but uses good guess for most latin 1
+    characters).
+
+    Ligature handling can be discarded as ligatures have very small
+    effects on string width. The width of the "fi" ligature
+    is the same (or very close) to the width of "f" plus the width 
+    of "i".
+    If implemented, it can be a simple list (global for the font,
+    not for each character) because all fonts I've seen that have
+    ligatures has max 3 pairs: "fi", "fl", "ffl" and no other. 
+
+    Most characters has less than 10 kern pairs, few 10-20, and
+    extremly few 20-30. This is implemented as a simple
+    linear search with characters 256-65536 encoding using a prefix
+    so most kern pairs only take 2 bytes:
+    unsigned 8 bit char value and signed 8 bit kern width.
+    Using a non-packed format would enable binary search, but
+    would use almost twice as much memory for a yet unknown
+    gain in speed.
+
+    Character widths are stored as unsigned bytes. Width of
+    one character is font-size * bytevalue * (1000 / 6)
+    AFM specifies widths as integers with 1000 representing 1 * font-size.
+    Kerning delta widths has same scaling factor, but the value
+    is a signed byte as many kerning widths are negative and smaller
+    than avarage character width.
+
+    Kerning info is stored in a shared packed int8 array
+    to reduce the number of structs and memory usage.
+    This sets the maximum number of kerning pairs to
+    approx 15000.
+      The font I have seen with most kern pairs is
+      "Bodoni Old Face BE Bold Italic Oldstyle Figures"
+      which has 1718 pairs for 62 chars.
+      Typical fonts have 100-150 pairs.
+    For each character needs then only a 16 bit index
+    into this shared table.
+    The format of the sub-arrays are:
+      count ( unicode deltawidth )
+    with the (...) repeated count times.
+    The count and the unicode is packed because a lot
+    entries is less than 256, and most below 400.
+    Therefore an escape sequence is used.
+    If the value is >= 510
+      1, high-8bits, low-8bits
+    else if the value is >= 254
+      0, value minus 254
+    else
+      value plus 1
+    An index of zero is treated as a NULL pointer,
+    and the first byte in a shared array is
+    therefore not used (and filled with a dummy value).
+    The array is only created if non-empty.
+       No entries can be zero (they are redundant),
+       and no subarray can be empty (as the index pointer
+       then is 0 meaning no sub array).
+       The deltawidth is stored as a non-escaped signed byte.
+
+    So for each character needed info is:
+      width: unsigned 8 bit int.
+      kerning-subarray-index: unsigned 16 bit int.
+
+    The first 126-32+1 entries are for the characters
+    32-126. If any is missing, a dummy entry is created.
+    For characters 126-65535 a font-global
+    array of struct {unicode, char-index} is
+    used for binary search (not yet, liniar now).
+
+    Ligatures can be implemented as a font-global
+    array of struct {
+      unicode char1, char2, resultingchar;
+    }
+
+    Font-global info is stored in a struct afm_fontinfo (see below).
+
+    The highchars_index and ligatures structures are flattened
+    to a simple array to avoid accidental padding between
+    structs if the structsize is problematic for some platforms.
+
+    All fonts are stored in an array of this struct,
+    sorted by fullname for binary search (not yet sorted).
+
+    The .afm files are compiled by a perl script which creates
+    rrd_afm_data.c 
+    The only thing rrd_afm_data.c contains is this compiled data.
+
+    Compiled on Mac OS X the size of rrd_afm_data.o
+    is 67 Kb for the standard 14 postscript fonts,
+    and 490 Kb for a set of 276 Adobe fonts.
+*/
+
+typedef unsigned char  afm_uint8;
+typedef signed   char  afm_sint8;
+typedef unsigned short afm_uint16;
+typedef signed   short afm_sint16;
+typedef unsigned short afm_unicode;
+
+typedef const afm_uint8   afm_cuint8;
+typedef const afm_sint8   afm_csint8;
+typedef const afm_uint16  afm_cuint16;
+typedef const afm_sint16  afm_csint16;
+typedef const afm_unicode afm_cunicode;
+
+typedef struct afm_fontinfo {
+  const char   *fullname; /* e.g. "Futura Bold Oblique" */
+  const char   *postscript_name; /* e.g. "Futura-BoldOblique" */
+  afm_cuint16 ascender, descender;
+  afm_cuint8   *widths;
+  afm_csint16  *kerning_index;
+  afm_cuint8   *kerning_data;
+  afm_cuint16  *highchars_index;
+  afm_cuint16   highchars_count;
+  afm_cunicode *ligatures;
+  afm_cuint16   ligatures_count;
+}      afm_fontinfo;
+
+typedef struct old_afm_fontinfo {
+  const char *fontname, *fullname;
+  const unsigned short *charinfo, *intarray;
+  const unsigned short charinfocount;
+  const unsigned short fixedpitch;
+} old_afm_fontinfo;
+
+extern const afm_fontinfo afm_fontinfolist[];
+extern const int afm_fontinfo_count;
+
+#endif
diff --git a/src/rrd_cgi.c b/src/rrd_cgi.c
new file mode 100644 (file)
index 0000000..8038a30
--- /dev/null
@@ -0,0 +1,1412 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_cgi.c  RRD Web Page Generator
+ *****************************************************************************/
+
+#include "rrd_tool.h"
+
+
+#define MEMBLK 1024
+/*#define DEBUG_PARSER
+#define DEBUG_VARS*/
+
+typedef struct var_s {
+       char    *name, *value;
+} s_var;
+
+typedef struct cgi_s {
+       s_var **vars;
+} s_cgi;
+
+/* in arg[0] find tags beginning with arg[1] call arg[2] on them
+   and replace by result of arg[2] call */
+int parse(char **, long, char *, char *(*)(long , const char **));
+
+/**************************************************/
+/* tag replacers ... they are called from parse   */
+/* through function pointers                      */
+/**************************************************/
+
+/* return cgi var named arg[0] */ 
+char* cgiget(long , const char **);
+
+/* return a quoted cgi var named arg[0] */ 
+char* cgigetq(long , const char **);
+
+/* return a quoted and sanitized cgi variable */
+char* cgigetqp(long , const char **);
+
+/* call rrd_graph and insert appropriate image tag */
+char* drawgraph(long, const char **);
+
+/* return PRINT functions from last rrd_graph call */
+char* drawprint(long, const char **);
+
+/* pretty-print the <last></last> value for some.rrd via strftime() */
+char* printtimelast(long, const char **);
+
+/* pretty-print current time */
+char* printtimenow(long, const char **);
+
+/* set an environment variable */
+char* rrdsetenv(long, const char **);
+
+/* get an environment variable */
+char* rrdgetenv(long, const char **);
+
+/* include the named file at this point */
+char* includefile(long, const char **);
+
+/* for how long is the output of the cgi valid ? */
+char* rrdgoodfor(long, const char **);
+
+/* return rrdcgi version string */ 
+char* rrdgetinternal(long, const char **);
+
+char* rrdstrip(char *buf);
+char* scanargs(char *line, int *argc, char ***args);
+
+/* format at-time specified times using strftime */
+char* printstrftime(long, const char**);
+
+/** HTTP protocol needs special format, and GMT time **/
+char *http_time(time_t *);
+
+/* return a pointer to newly allocated copy of this string */
+char *stralloc(const char *);
+
+/* global variable for rrdcgi */
+s_cgi *rrdcgiArg;
+
+/* rrdcgiHeader
+ * 
+ *  Prints a valid CGI Header (Content-type...) etc.
+ */
+void rrdcgiHeader(void);
+
+/* rrdcgiDecodeString
+ * decode html escapes
+ */
+char *rrdcgiDecodeString(char *text);
+
+/* rrdcgiDebug
+ * 
+ *  Set/unsets debugging
+ */
+void rrdcgiDebug(int level, int where);
+
+/* rrdcgiInit
+ *
+ *  Reads in variables set via POST or stdin.
+ */
+s_cgi *rrdcgiInit (void);
+
+/* rrdcgiGetValue
+ *
+ *  Returns the value of the specified variable or NULL if it's empty
+ *  or doesn't exist.
+ */
+char *rrdcgiGetValue (s_cgi *parms, const char *name);
+
+/* rrdcgiFreeList
+ *
+ * Frees a list as returned by rrdcgiGetVariables()
+ */
+void rrdcgiFreeList (char **list);
+
+/* rrdcgiFree
+ *
+ * Frees the internal data structures
+ */
+void rrdcgiFree (s_cgi *parms);
+
+/*  rrdcgiReadVariables()
+ *
+ *  Read from stdin if no string is provided via CGI.  Variables that
+ *  doesn't have a value associated with it doesn't get stored.
+ */
+s_var **rrdcgiReadVariables(void);
+
+
+int rrdcgiDebugLevel = 0;
+int rrdcgiDebugStderr = 1;
+char *rrdcgiHeaderString = NULL;
+char *rrdcgiType = NULL;
+
+/* rrd interface to the variable functions {put,get}var() */
+char* rrdgetvar(long argc, const char **args);
+char* rrdsetvar(long argc, const char **args);
+char* rrdsetvarconst(long argc, const char **args);
+
+
+/* variable store: put/get key-value pairs */
+static int   initvar();
+static void  donevar();
+static const char* getvar(const char* varname);
+static const char* putvar(const char* name, const char* value, int is_const);
+
+/* key value pair that makes up an entry in the variable store */
+typedef struct
+{
+       int is_const;           /* const variable or not */
+       const char* name;       /* variable name */
+       const char* value;      /* variable value */
+} vardata;
+
+/* the variable heap: 
+   start with a heapsize of 10 variables */
+#define INIT_VARSTORE_SIZE     10
+static vardata* varheap    = NULL;
+static size_t varheap_size = 0;
+
+/* allocate and initialize variable heap */
+static int
+initvar()
+{
+       varheap = (vardata*)malloc(sizeof(vardata) * INIT_VARSTORE_SIZE);
+       if (varheap == NULL) {
+               fprintf(stderr, "ERROR: unable to initialize variable store\n");
+               return -1;
+       }
+       memset(varheap, 0, sizeof(vardata) * INIT_VARSTORE_SIZE);
+       varheap_size = INIT_VARSTORE_SIZE;
+       return 0;
+}
+
+/* cleanup: free allocated memory */
+static void
+donevar()
+{
+       int i;
+       if (varheap) {
+               for (i=0; i<(int)varheap_size; i++) {
+                       if (varheap[i].name) {
+                               free((char*)varheap[i].name);
+                       }
+                       if (varheap[i].value) {
+                               free((char*)varheap[i].value);
+                       }
+               }
+               free(varheap);
+       }
+}
+
+/* Get a variable from the variable store.
+   Return NULL in case the requested variable was not found. */
+static const char*
+getvar(const char* name)
+{
+       int i;
+       for (i=0; i<(int)varheap_size && varheap[i].name; i++) {
+               if (0 == strcmp(name, varheap[i].name)) {
+#ifdef         DEBUG_VARS
+                       printf("<!-- getvar(%s) -> %s -->\n", name, varheap[i].value);
+#endif
+                       return varheap[i].value;
+               }
+       }
+#ifdef DEBUG_VARS
+       printf("<!-- getvar(%s) -> Not found-->\n", name);
+#endif
+       return NULL;
+}
+
+/* Put a variable into the variable store. If a variable by that
+   name exists, it's value is overwritten with the new value unless it was
+   marked as 'const' (initialized by RRD::SETCONSTVAR).
+   Returns a copy the newly allocated value on success, NULL on error. */
+static const char*
+putvar(const char* name, const char* value, int is_const)
+{
+       int i;
+       for (i=0; i < (int)varheap_size && varheap[i].name; i++) {
+               if (0 == strcmp(name, varheap[i].name)) {
+                       /* overwrite existing entry */
+                       if (varheap[i].is_const) {
+#ifdef                 DEBUG_VARS
+                               printf("<!-- setver(%s, %s): not assigning: "
+                                               "const variable -->\n", name, value);
+#                              endif
+                               return varheap[i].value;
+                       }
+#ifdef         DEBUG_VARS
+                       printf("<!-- setvar(%s, %s): overwriting old value (%s) -->\n",
+                                       name, value, varheap[i].value);
+#endif
+                       /* make it possible to promote a variable to readonly */
+                       varheap[i].is_const = is_const;
+                       free((char*)varheap[i].value);
+                       varheap[i].value = stralloc(value);
+                       return varheap[i].value;
+               }
+       }
+
+       /* no existing variable found by that name, add it */
+       if (i == (int)varheap_size) {
+               /* ran out of heap: resize heap to double size */
+               size_t new_size = varheap_size * 2;
+               varheap = (vardata*)(realloc(varheap, sizeof(vardata) * new_size));
+               if (!varheap) {
+                       fprintf(stderr, "ERROR: Unable to realloc variable heap\n");
+                       return NULL;
+               }
+               /* initialize newly allocated memory */;
+               memset(&varheap[varheap_size], 0, sizeof(vardata) * varheap_size);
+               varheap_size = new_size;
+       }
+       varheap[i].is_const = is_const;
+       varheap[i].name  = stralloc(name);
+       varheap[i].value = stralloc(value);
+
+#ifdef         DEBUG_VARS
+       printf("<!-- setvar(%s, %s): adding new variable -->\n", name, value);
+#endif
+       return varheap[i].value;
+}
+
+/* expand those RRD:* directives that can be used recursivly */
+static char*
+rrd_expand_vars(char* buffer)
+{
+       int i;
+
+#ifdef DEBUG_PARSER
+       printf("expanding variables in '%s'\n", buffer);
+#endif
+
+       for (i=0; buffer[i]; i++) {
+               if (buffer[i] != '<')
+                       continue;
+               parse(&buffer, i, "<RRD::CV", cgiget);
+               parse(&buffer, i, "<RRD::CV::QUOTE", cgigetq);
+               parse(&buffer, i, "<RRD::CV::PATH", cgigetqp);
+               parse(&buffer, i, "<RRD::GETENV", rrdgetenv);    
+               parse(&buffer, i, "<RRD::GETVAR", rrdgetvar);    
+                parse(&buffer, i, "<RRD::TIME::LAST", printtimelast);
+                parse(&buffer, i, "<RRD::TIME::NOW", printtimenow);
+                parse(&buffer, i, "<RRD::TIME::STRFTIME", printstrftime);
+               parse(&buffer, i, "<RRD::INTERNAL", rrdgetinternal);
+       }
+       return buffer;
+}
+
+static long goodfor=0;
+static char **calcpr=NULL;
+static void calfree (void){
+  if (calcpr) {
+    long i;
+    for(i=0;calcpr[i];i++){
+      if (calcpr[i]){
+             free(calcpr[i]);
+      }
+    } 
+    if (calcpr) {
+           free(calcpr);
+    }
+  }
+}
+
+/* create freeable version of the string */
+char * stralloc(const char *str){
+  char* nstr;
+  if (!str) {
+         return NULL;
+  }
+  nstr = malloc((strlen(str)+1));
+  strcpy(nstr,str);
+  return(nstr);
+}
+
+int main(int argc, char *argv[]) {
+       long length;
+       char *buffer;
+       char *server_url = NULL;
+       long i;
+       long filter=0;
+#ifdef MUST_DISABLE_SIGFPE
+       signal(SIGFPE,SIG_IGN);
+#endif
+#ifdef MUST_DISABLE_FPMASK
+       fpsetmask(0);
+#endif
+        optind = 0; opterr = 0;  /* initialize getopt */
+
+       /* what do we get for cmdline arguments?
+       for (i=0;i<argc;i++)
+       printf("%d-'%s'\n",i,argv[i]); */
+       while (1) {
+               static struct option long_options[] = {
+                       { "filter", no_argument, 0, 'f' },
+                       { 0, 0, 0, 0}
+               };
+               int option_index = 0;
+               int opt;
+               opt = getopt_long(argc, argv, "f", long_options, &option_index);
+               if (opt == EOF) {
+                       break;
+               }
+
+               switch(opt) {
+               case 'f':
+                               filter=1;
+                       break;
+               case '?':
+                       printf("unknown commandline option '%s'\n",argv[optind-1]);
+                       return -1;
+               }
+       }
+
+       if (!filter) {
+               rrdcgiDebug(0,0);
+               rrdcgiArg = rrdcgiInit();
+               server_url = getenv("SERVER_URL");
+       }
+
+       /* make sure we have one extra argument, 
+          if there are others, we do not care Apache gives several */
+
+       /* if ( (optind != argc-2 
+          && strstr( getenv("SERVER_SOFTWARE"),"Apache/2") != NULL) 
+          && optind != argc-1) { */
+
+       if ( optind >= argc ) { 
+               fprintf(stderr, "ERROR: expected a filename\n");
+               exit(1);
+       } else {
+               length = readfile(argv[optind], &buffer, 1);
+       }
+
+       if(rrd_test_error()) {
+               fprintf(stderr, "ERROR: %s\n",rrd_get_error());
+               exit(1);
+       }
+
+       /* initialize variable heap */
+       initvar();
+
+#ifdef DEBUG_PARSER
+       /* some fake header for testing */
+       printf ("Content-Type: text/html\nContent-Length: 10000000\n\n\n");
+#endif
+
+
+       /* expand rrd directives in buffer recursivly */
+       for (i=0; buffer[i]; i++) {
+               if (buffer[i] != '<')
+                       continue;
+               if (!filter) {
+                       parse(&buffer, i, "<RRD::CV", cgiget);
+                       parse(&buffer, i, "<RRD::CV::PATH", cgigetqp);
+                       parse(&buffer, i, "<RRD::CV::QUOTE", cgigetq);
+                       parse(&buffer, i, "<RRD::GETENV", rrdgetenv);
+               }
+               parse(&buffer, i, "<RRD::GETVAR", rrdgetvar);
+               parse(&buffer, i, "<RRD::GOODFOR", rrdgoodfor);
+               parse(&buffer, i, "<RRD::GRAPH", drawgraph);
+               parse(&buffer, i, "<RRD::INCLUDE", includefile);
+               parse(&buffer, i, "<RRD::PRINT", drawprint);
+               parse(&buffer, i, "<RRD::SETCONSTVAR", rrdsetvarconst);
+               parse(&buffer, i, "<RRD::SETENV", rrdsetenv);
+               parse(&buffer, i, "<RRD::SETVAR", rrdsetvar);
+               parse(&buffer, i, "<RRD::TIME::LAST", printtimelast);
+               parse(&buffer, i, "<RRD::TIME::NOW", printtimenow);
+               parse(&buffer, i, "<RRD::TIME::STRFTIME", printstrftime);
+               parse(&buffer, i, "<RRD::INTERNAL", rrdgetinternal);
+       }
+
+       if (!filter) {
+               printf ("Content-Type: text/html\n" 
+                               "Content-Length: %d\n", 
+                               strlen(buffer));
+
+               if (labs(goodfor) > 0) {
+                       time_t now;
+                       now = time(NULL);
+                       printf("Last-Modified: %s\n", http_time(&now));
+                       now += labs(goodfor);
+                       printf("Expires: %s\n", http_time(&now));
+                       if (goodfor < 0) {
+                               printf("Refresh: %ld\n", labs(goodfor));
+                       }
+               }
+               printf("\n");
+       }
+
+       /* output result */
+       printf("%s", buffer);
+
+       /* cleanup */
+       calfree();
+       if (buffer){
+               free(buffer);
+       }
+       donevar();
+       exit(0);
+}
+
+/* remove occurrences of .. this is a general measure to make
+   paths which came in via cgi do not go UP ... */
+
+char* rrdsetenv(long argc, const char **args) {
+       if (argc >= 2) {
+               char *xyz = malloc((strlen(args[0]) + strlen(args[1]) + 2));
+               if (xyz == NULL) {
+                       return stralloc("[ERROR: allocating setenv buffer]");
+               };
+               sprintf(xyz, "%s=%s", args[0], args[1]);
+               if(putenv(xyz) == -1) {
+                       free(xyz);
+                       return stralloc("[ERROR: failed to do putenv]");
+               };
+               return stralloc("");
+       }
+       return stralloc("[ERROR: setenv failed because not enough "
+                                       "arguments were defined]");
+}
+
+/* rrd interface to the variable function putvar() */
+char*
+rrdsetvar(long argc, const char **args)
+{
+       if (argc >= 2)
+       {
+               const char* result = putvar(args[0], args[1], 0 /* not const */);
+               if (result) {
+                       /* setvar does not return the value set */
+                       return stralloc("");
+               }
+               return stralloc("[ERROR: putvar failed]");
+       }
+       return stralloc("[ERROR: putvar failed because not enough arguments "
+                                       "were defined]");
+}
+
+/* rrd interface to the variable function putvar() */
+char*
+rrdsetvarconst(long argc, const char **args)
+{
+       if (argc >= 2)
+       {
+               const char* result = putvar(args[0], args[1], 1 /* const */);
+               if (result) {
+                       /* setvar does not return the value set */
+                       return stralloc("");
+               }
+               return stralloc("[ERROR: putvar failed]");
+       }
+       return stralloc("[ERROR: putvar failed because not enough arguments "
+                                       "were defined]");
+}
+
+char* rrdgetenv(long argc, const char **args) {
+       char buf[128];
+       const char* envvar;
+       if (argc != 1) {
+               return stralloc("[ERROR: getenv failed because it did not "
+                                               "get 1 argument only]");
+       };
+       envvar = getenv(args[0]);
+       if (envvar) {
+               return stralloc(envvar);
+       } else {
+                snprintf(buf, sizeof(buf), "[ERROR:_getenv_'%s'_failed", args[0]);
+                return stralloc(buf);
+       }
+}
+
+char* rrdgetvar(long argc, const char **args) {
+       char buf[128];
+       const char* value;
+       if (argc != 1) {
+               return stralloc("[ERROR: getvar failed because it did not "
+                                               "get 1 argument only]");
+       };
+       value = getvar(args[0]);
+       if (value) {
+               return stralloc(value);
+       } else {
+                snprintf(buf, sizeof(buf), "[ERROR:_getvar_'%s'_failed", args[0]);
+               return stralloc(buf);
+       }
+}
+
+char* rrdgoodfor(long argc, const char **args){
+  if (argc == 1) {
+      goodfor = atol(args[0]);
+  } else {
+    return stralloc("[ERROR: goodfor expected 1 argument]");
+  }
+   
+  if (goodfor == 0){
+     return stralloc("[ERROR: goodfor value must not be 0]");
+  }
+   
+  return stralloc("");
+}
+
+char* rrdgetinternal(long argc, const char **args){
+  if (argc == 1) {
+    if( strcasecmp( args[0], "VERSION") == 0) {
+      return stralloc(PACKAGE_VERSION);
+    } else if( strcasecmp( args[0], "COMPILETIME") == 0) {
+      return stralloc(__DATE__ " " __TIME__);
+    } else {
+      return stralloc("[ERROR: internal unknown argument]");
+    }
+  } else {
+    return stralloc("[ERROR: internal expected 1 argument]");
+  }
+}
+
+/* Format start or end times using strftime.  We always need both the
+ * start and end times, because, either might be relative to the other.
+ * */
+#define MAX_STRFTIME_SIZE 256
+char* printstrftime(long argc, const char **args){
+       struct  rrd_time_value start_tv, end_tv;
+       char    *parsetime_error = NULL;
+       char    formatted[MAX_STRFTIME_SIZE];
+       struct tm *the_tm;
+       time_t  start_tmp, end_tmp;
+
+       /* Make sure that we were given the right number of args */
+       if( argc != 4) {
+               rrd_set_error( "wrong number of args %d", argc);
+               return stralloc("");
+       }
+
+       /* Init start and end time */
+       parsetime("end-24h", &start_tv);
+       parsetime("now", &end_tv);
+
+       /* Parse the start and end times we were given */
+       if( (parsetime_error = parsetime( args[1], &start_tv))) {
+               rrd_set_error( "start time: %s", parsetime_error);
+               return stralloc("");
+       }
+       if( (parsetime_error = parsetime( args[2], &end_tv))) {
+               rrd_set_error( "end time: %s", parsetime_error);
+               return stralloc("");
+       }
+       if( proc_start_end( &start_tv, &end_tv, &start_tmp, &end_tmp) == -1) {
+               return stralloc("");
+       }
+
+       /* Do we do the start or end */
+       if( strcasecmp( args[0], "START") == 0) {
+               the_tm = localtime( &start_tmp);
+       }
+       else if( strcasecmp( args[0], "END") == 0) {
+               the_tm = localtime( &end_tmp);
+       }
+       else {
+               rrd_set_error( "start/end not found in '%s'", args[0]);
+               return stralloc("");
+       }
+
+       /* now format it */
+       if( strftime( formatted, MAX_STRFTIME_SIZE, args[3], the_tm)) {
+               return( stralloc( formatted));
+       }
+       else {
+               rrd_set_error( "strftime failed");
+               return stralloc("");
+       }
+}
+
+char* includefile(long argc, const char **args){
+  char *buffer;
+  if (argc >= 1) {
+      const char* filename = args[0];
+      readfile(filename, &buffer, 0);
+      if (rrd_test_error()) {
+               char *err = malloc((strlen(rrd_get_error())+DS_NAM_SIZE));
+         sprintf(err, "[ERROR: %s]",rrd_get_error());
+         rrd_clear_error();
+         return err;
+      } else {
+       return buffer;
+      }
+  }
+  else
+  {
+      return stralloc("[ERROR: No Inclue file defined]");
+  }
+}
+
+/* make a copy of buf and replace open/close brackets with '_' */
+char* rrdstrip(char *buf) {
+  char* p;
+  if (buf == NULL) {
+         return NULL;
+  }
+  /* make a copy of the buffer */
+  buf = stralloc(buf);
+  if (buf == NULL) {
+         return NULL;
+  }
+
+  p = buf;
+  while (*p) {
+         if (*p == '<' || *p == '>') {
+                 *p = '_';
+         }
+         p++;
+  }
+  return buf;
+}
+
+char* cgigetq(long argc, const char **args){
+  if (argc>= 1){
+    char *buf = rrdstrip(rrdcgiGetValue(rrdcgiArg,args[0]));
+    char *buf2;
+    char *c,*d;
+    int  qc=0;
+    if (buf==NULL) return NULL;
+
+    for(c=buf;*c != '\0';c++)
+      if (*c == '"') qc++;
+    if ((buf2 = malloc((strlen(buf) + 4 * qc + 4))) == NULL) {
+       perror("Malloc Buffer");
+       exit(1);
+    };
+    c=buf;
+    d=buf2;
+    *(d++) = '"';
+    while(*c != '\0'){
+       if (*c == '"') {
+           *(d++) = '"';
+           *(d++) = '\'';
+           *(d++) = '"';
+           *(d++) = '\'';
+       } 
+       *(d++) = *(c++);
+    }
+    *(d++) = '"';
+    *(d) = '\0';
+    free(buf);
+    return buf2;
+  }
+
+  return stralloc("[ERROR: not enough argument for RRD::CV::QUOTE]");
+}
+
+/* remove occurrences of .. this is a general measure to make
+   paths which came in via cgi do not go UP ... */
+
+char* cgigetqp(long argc, const char **args){
+       char* buf;
+    char* buf2;
+    char* p;
+        char* d;
+
+        if (argc < 1)
+        {
+                return stralloc("[ERROR: not enough arguments for RRD::CV::PATH]");
+        }
+
+        buf = rrdstrip(rrdcgiGetValue(rrdcgiArg, args[0]));
+    if (!buf)
+        {
+                return NULL;
+        }
+
+        buf2 = malloc(strlen(buf)+1);
+    if (!buf2)
+        {
+                perror("cgigetqp(): Malloc Path Buffer");
+                exit(1);
+    };
+
+    p = buf;
+    d = buf2;
+
+    while (*p)
+        {
+                /* prevent mallicious paths from entering the system */
+                if (p[0] == '.' && p[1] == '.')
+                {
+                        p += 2;
+                        *d++ = '_';
+                        *d++ = '_';     
+                }
+                else
+                {
+                        *d++ = *p++;
+                }
+    }
+
+    *d = 0;
+    free(buf);
+
+    /* Make sure the path is relative, e.g. does not start with '/' */
+    p = buf2;
+    while ('/' == *p)
+        {
+            *p++ = '_';
+    }
+
+    return buf2;
+}
+
+
+char* cgiget(long argc, const char **args){
+  if (argc>= 1)
+    return rrdstrip(rrdcgiGetValue(rrdcgiArg,args[0]));
+  else
+    return stralloc("[ERROR: not enough arguments for RRD::CV]");
+}
+
+
+
+char* drawgraph(long argc, const char **args){
+  int i,xsize, ysize;
+  double ymin,ymax;
+  for(i=0;i<argc;i++)
+    if(strcmp(args[i],"--imginfo")==0 || strcmp(args[i],"-g")==0) break;
+  if(i==argc) {
+    args[argc++] = "--imginfo";
+    args[argc++] = "<IMG SRC=\"./%s\" WIDTH=\"%lu\" HEIGHT=\"%lu\">";
+  }
+  calfree();
+  if( rrd_graph(argc+1, (char **) args-1, &calcpr, &xsize, &ysize,NULL,&ymin,&ymax) != -1 ) {
+    return stralloc(calcpr[0]);
+  } else {
+    if (rrd_test_error()) {
+      char *err = malloc((strlen(rrd_get_error())+DS_NAM_SIZE)*sizeof(char));
+      sprintf(err, "[ERROR: %s]",rrd_get_error());
+      rrd_clear_error();
+      calfree();
+      return err;
+    }
+  }
+  return NULL;
+}
+
+char* drawprint(long argc, const char **args){
+  if (argc==1 && calcpr){
+    long i=0;
+    while (calcpr[i] != NULL) i++; /*determine number lines in calcpr*/
+    if (atol(args[0])<i-1)
+      return stralloc(calcpr[atol(args[0])+1]);    
+  }
+  return stralloc("[ERROR: RRD::PRINT argument error]");
+}
+
+char* printtimelast(long argc, const char **args) {
+  time_t last;
+  struct tm tm_last;
+  char *buf;
+  if ( argc == 2 ) {
+    buf = malloc(255);
+    if (buf == NULL){  
+       return stralloc("[ERROR: allocating strftime buffer]");
+    };
+    last = rrd_last(argc+1, (char **) args-1); 
+    if (rrd_test_error()) {
+      char *err = malloc((strlen(rrd_get_error())+DS_NAM_SIZE)*sizeof(char));
+      sprintf(err, "[ERROR: %s]",rrd_get_error());
+      rrd_clear_error();
+      return err;
+    }
+    tm_last = *localtime(&last);
+    strftime(buf,254,args[1],&tm_last);
+    return buf;
+  }
+  if ( argc < 2 ) {
+    return stralloc("[ERROR: too few arguments for RRD::TIME::LAST]");
+  }
+  return stralloc("[ERROR: not enough arguments for RRD::TIME::LAST]");
+}
+
+char* printtimenow(long argc, const char **args) {
+  time_t now = time(NULL);
+  struct tm tm_now;
+  char *buf;
+  if ( argc == 1 ) {
+    buf = malloc(255);
+    if (buf == NULL){  
+       return stralloc("[ERROR: allocating strftime buffer]");
+    };
+    tm_now = *localtime(&now);
+    strftime(buf,254,args[0],&tm_now);
+    return buf;
+  }
+  if ( argc < 1 ) {
+    return stralloc("[ERROR: too few arguments for RRD::TIME::NOW]");
+  }
+  return stralloc("[ERROR: not enough arguments for RRD::TIME::NOW]");
+}
+
+/* Scan buffer until an unescaped '>' arives.
+ * Update argument array with arguments found.
+ * Return end cursor where parsing stopped, or NULL in case of failure.
+ *
+ * FIXME:
+ * To allow nested constructs, we call rrd_expand_vars() for arguments
+ * that contain RRD::x directives. These introduce a small memory leak
+ * since we have to stralloc the arguments the way parse() works.
+ */
+char*
+scanargs(char *line, int *argument_count, char ***arguments)
+{
+       char    *getP;          /* read cursor */
+       char    *putP;          /* write cursor */
+       char    Quote;          /* type of quote if in quoted string, 0 otherwise */
+       int     tagcount;       /* open tag count */
+       int     in_arg;         /* if we currently are parsing an argument or not */
+       int     argsz;          /* argument array size */
+       int             curarg_contains_rrd_directives;
+
+       /* local array of arguments while parsing */
+       int argc = 0;
+       char** argv;
+
+#ifdef DEBUG_PARSER
+       printf("<-- scanargs(%s) -->\n", line);
+#endif
+
+       *arguments = NULL;
+       *argument_count = 0;
+
+       /* create initial argument array of char pointers */
+       argsz = 32;
+       argv = (char **)malloc(argsz * sizeof(char *));
+       if (!argv) {
+               return NULL;
+       }
+
+       /* skip leading blanks */
+       while (isspace((int)*line)) {
+               line++;
+       }
+
+       getP = line;
+       putP = line;
+
+       Quote    = 0;
+       in_arg   = 0;
+       tagcount = 0;
+
+       curarg_contains_rrd_directives = 0;
+
+       /* start parsing 'line' for arguments */
+       while (*getP)
+       {
+               unsigned char c = *getP++;
+
+               if (c == '>' && !Quote && !tagcount) {
+                       /* this is our closing tag, quit scanning */
+                       break;
+               }
+
+               /* remove all special chars */
+               if (c < ' ') {
+                       c = ' ';
+               }
+
+               switch (c)
+               {
+               case ' ': 
+                       if (Quote || tagcount) {
+                               /* copy quoted/tagged (=RRD expanded) string */
+                               *putP++ = c;
+                       }
+                       else if (in_arg)
+                       {
+                               /* end argument string */
+                               *putP++ = 0;
+                               in_arg = 0;
+                               if (curarg_contains_rrd_directives) {
+                                       argv[argc-1] = rrd_expand_vars(stralloc(argv[argc-1]));
+                                       curarg_contains_rrd_directives = 0;
+                               }
+                       }
+                       break;
+
+               case '"': /* Fall through */
+               case '\'':
+                       if (Quote != 0) {
+                               if (Quote == c) {
+                                       Quote = 0;
+                               } else {
+                                       /* copy quoted string */
+                                       *putP++ = c;
+                               }
+                       } else {
+                               if (!in_arg) {
+                                       /* reference start of argument string in argument array */
+                                       argv[argc++] = putP;
+                                       in_arg=1;
+                               }
+                               Quote = c;
+                       }
+                       break;
+
+               default:
+                               if (!in_arg) {
+                                       /* start new argument */
+                                       argv[argc++] = putP;
+                                       in_arg = 1;
+                               }
+                               if (c == '>') {
+                                       if (tagcount) {
+                                               tagcount--;
+                                       }
+                               }
+                               if (c == '<') {
+                                       tagcount++;
+                                       if (0 == strncmp(getP, "RRD::", strlen("RRD::"))) {
+                                               curarg_contains_rrd_directives = 1;
+                                       }
+                               }
+                       *putP++ = c;
+                       break;
+               }
+
+               /* check if our argument array is still large enough */
+               if (argc == argsz) {
+                       /* resize argument array */
+                       argsz *= 2;
+                       argv = rrd_realloc(argv, argsz * sizeof(char *));
+                       if (*argv == NULL) {
+                               return NULL;
+                       }
+               }
+       }
+
+       /* terminate last argument found */
+       *putP = '\0';
+       if (curarg_contains_rrd_directives) {
+               argv[argc-1] = rrd_expand_vars(stralloc(argv[argc-1]));
+       }
+
+#ifdef DEBUG_PARSER
+       if (argc > 0) {
+               int n;
+               printf("<-- arguments found [%d]\n", argc);
+               for (n=0; n<argc; n++) {
+                       printf("arg %02d: '%s'\n", n, argv[n]);
+               }
+               printf("-->\n");
+       } else {
+               printf("<!-- No arguments found -->\n");
+       }
+#endif
+
+       /* update caller's notion of the argument array and it's size */
+       *arguments = argv;
+       *argument_count = argc;
+
+       if (Quote) {
+               return NULL;
+       }
+
+       /* Return new scanning cursor:
+          pointer to char after closing bracket */
+       return getP;
+}
+
+
+/*
+ * Parse(): scan current portion of buffer for given tag.
+ * If found, parse tag arguments and call 'func' for it.
+ * The result of func is inserted at the current position
+ * in the buffer.
+ */
+int
+parse(
+       char **buf,     /* buffer */
+       long i,                 /* offset in buffer */
+       char *tag,      /* tag to handle  */
+       char *(*func)(long , const char **) /* function to call for 'tag' */
+       )
+{
+       /* the name of the vairable ... */
+       char *val;
+       long valln;  
+       char **args;
+       char *end;
+       long end_offset;
+       int  argc;
+       size_t taglen = strlen(tag);
+
+       /* Current position in buffer should start with 'tag' */
+       if (strncmp((*buf)+i, tag, taglen) != 0) {
+               return 0;
+       }
+       /* .. and match exactly (a whitespace following 'tag') */
+       if (! isspace(*((*buf) + i + taglen)) ) {
+               return 0;
+       }
+
+#ifdef DEBUG_PARSER
+       printf("parse(): handling tag '%s'\n", tag);
+#endif
+
+       /* Scan for arguments following the tag;
+          scanargs() puts \0 into *buf ... so after scanargs it is probably
+          not a good time to use strlen on buf */
+       end = scanargs((*buf) + i + taglen, &argc, &args);
+       if (end)
+       {
+               /* got arguments, call function for 'tag' with arguments */
+               val = func(argc, (const char **) args);
+               free(args);
+       }
+       else
+       {
+               /* unable to parse arguments, undo 0-termination by scanargs */
+               for (; argc > 0; argc--) {
+                       *((args[argc-1])-1) = ' ';
+               }
+
+               /* next call, try parsing at current offset +1 */
+               end = (*buf) + i + 1;
+
+               val = stralloc("[ERROR: Parsing Problem with the following text\n"
+                                               " Check original file. This may have been altered "
+                                               "by parsing.]\n\n");
+       }
+
+       /* remember offset where we have to continue parsing */
+       end_offset = end - (*buf);
+
+       valln = 0;
+       if (val) {
+               valln = strlen(val);
+       }
+
+       /* Optionally resize buffer to hold the replacement value:
+          Calculating the new length of the buffer is simple. add current
+          buffer pos (i) to length of string after replaced tag to length
+          of replacement string and add 1 for the final zero ... */
+       if (end - (*buf) < (i + valln)) {
+               /* make sure we do not shrink the mallocd block */
+               size_t newbufsize = i + strlen(end) + valln + 1;
+               *buf = rrd_realloc(*buf, newbufsize);
+
+               if (*buf == NULL) {
+                       perror("Realoc buf:");
+                       exit(1);
+               };
+       }
+
+       /* Update new end pointer:
+          make sure the 'end' pointer gets moved along with the 
+          buf pointer when realloc moves memory ... */
+       end = (*buf) + end_offset; 
+
+       /* splice the variable:
+          step 1. Shift pending data to make room for 'val' */
+       memmove((*buf) + i + valln, end, strlen(end) + 1);
+
+       /* step 2. Insert val */
+       if (val) {
+               memmove((*buf)+i, val, valln);
+               free(val);
+       }
+       return (valln > 0 ? valln-1: valln);
+}
+
+char *
+http_time(time_t *now) {
+        struct tm *tmptime;
+        static char buf[60];
+
+        tmptime=gmtime(now);
+        strftime(buf,sizeof(buf),"%a, %d %b %Y %H:%M:%S GMT",tmptime);
+        return(buf);
+}
+
+void rrdcgiHeader(void)
+{
+    if (rrdcgiType)
+       printf ("Content-type: %s\n", rrdcgiType);
+    else
+       printf ("Content-type: text/html\n");
+    if (rrdcgiHeaderString)
+       printf ("%s", rrdcgiHeaderString);
+    printf ("\n");
+}
+
+void rrdcgiDebug(int level, int where)
+{
+    if (level > 0)
+       rrdcgiDebugLevel = level;
+    else
+       rrdcgiDebugLevel = 0;
+    if (where)
+       rrdcgiDebugStderr = 0;
+    else
+       rrdcgiDebugStderr = 1;
+}
+
+char *rrdcgiDecodeString(char *text)
+{
+    char *cp, *xp;
+
+    for (cp=text,xp=text; *cp; cp++) {
+       if (*cp == '%') {
+           if (strchr("0123456789ABCDEFabcdef", *(cp+1))
+               && strchr("0123456789ABCDEFabcdef", *(cp+2))) {
+               if (islower(*(cp+1)))
+                   *(cp+1) = toupper(*(cp+1));
+               if (islower(*(cp+2)))
+                   *(cp+2) = toupper(*(cp+2));
+               *(xp) = (*(cp+1) >= 'A' ? *(cp+1) - 'A' + 10 : *(cp+1) - '0' ) * 16
+                   + (*(cp+2) >= 'A' ? *(cp+2) - 'A' + 10 : *(cp+2) - '0');
+               xp++;cp+=2;
+           }
+       } else {
+           *(xp++) = *cp;
+       }
+    }
+    memset(xp, 0, cp-xp);
+    return text;
+}
+
+/*  rrdcgiReadVariables()
+ *
+ *  Read from stdin if no string is provided via CGI.  Variables that
+ *  doesn't have a value associated with it doesn't get stored.
+ */
+s_var **rrdcgiReadVariables(void)
+{
+    int length;
+    char *line = NULL;
+    int numargs;
+    char *cp, *ip, *esp, *sptr;
+    s_var **result;
+    int i, k, len;
+    char tmp[101];
+
+    cp = getenv("REQUEST_METHOD");
+    ip = getenv("CONTENT_LENGTH");
+
+    if (cp && !strcmp(cp, "POST")) {
+       if (ip) {
+           length = atoi(ip);
+           if ((line = (char *)malloc (length+2)) == NULL)
+               return NULL;
+           fgets(line, length+1, stdin);
+       } else
+           return NULL;
+    } else if (cp && !strcmp(cp, "GET")) {
+       esp = getenv("QUERY_STRING");
+       if (esp && strlen(esp)) {
+           if ((line = (char *)malloc (strlen(esp)+2)) == NULL)
+               return NULL;
+           sprintf (line, "%s", esp);
+       } else
+           return NULL;
+    } else {
+        length = 0;
+       printf ("(offline mode: enter name=value pairs on standard input)\n");
+       memset (tmp, 0, sizeof(tmp));
+       while((cp = fgets (tmp, 100, stdin)) != NULL) {
+           if (strlen(tmp)) {
+               if (tmp[strlen(tmp)-1] == '\n')
+                   tmp[strlen(tmp)-1] = '&';
+               if (length) {
+                   length += strlen(tmp);
+                   len = (length+1) * sizeof(char);
+                   if ((line = (char *)realloc (line, len)) == NULL)
+                       return NULL;
+                   strcat (line, tmp);
+               } else {
+                   length = strlen(tmp);
+                   len = (length+1) * sizeof(char);
+                   if ((line = (char *)malloc (len)) == NULL)
+                       return NULL;
+                   memset (line, 0, len);
+                   strcpy (line, tmp);
+               }
+           }
+           memset (tmp, 0, sizeof(tmp));
+       }
+       if (!line)
+           return NULL;
+       if (line[strlen(line)-1] == '&')
+           line[strlen(line)-1] = '\0';
+    }
+
+    /*
+     *  From now on all cgi variables are stored in the variable line
+     *  and look like  foo=bar&foobar=barfoo&foofoo=
+     */
+
+    if (rrdcgiDebugLevel > 0) {
+       if (rrdcgiDebugStderr)
+           fprintf (stderr, "Received cgi input: %s\n", line);
+       else
+           printf ("<b>Received cgi input</b><br>\n<pre>\n--\n%s\n--\n</pre>\n\n", line);
+    }
+
+    for (cp=line; *cp; cp++)
+       if (*cp == '+')
+           *cp = ' ';
+
+    if (strlen(line)) {
+       for (numargs=1,cp=line; *cp; cp++)
+           if (*cp == '&') numargs++;
+    } else
+       numargs = 0;
+    if (rrdcgiDebugLevel > 0) {
+       if (rrdcgiDebugStderr)
+           fprintf (stderr, "%d cgi variables found.\n", numargs);
+       else
+           printf ("%d cgi variables found.<br>\n", numargs);
+    }
+
+    len = (numargs+1) * sizeof(s_var *);
+    if ((result = (s_var **)malloc (len)) == NULL)
+       return NULL;
+    memset (result, 0, len);
+
+    cp = line;
+    i=0;
+    while (*cp) {
+       if ((ip = (char *)strchr(cp, '&')) != NULL) {
+           *ip = '\0';
+       }else
+           ip = cp + strlen(cp);
+
+       if ((esp=(char *)strchr(cp, '=')) == NULL) {
+           cp = ++ip;
+           continue;
+       }
+
+       if (!strlen(esp)) {
+           cp = ++ip;
+           continue;
+       }
+
+       if (i<numargs) {
+
+           /* try to find out if there's already such a variable */
+           for (k=0; k<i && (strncmp (result[k]->name,cp, esp-cp) || !(strlen (result[k]->name) == esp-cp)); k++);
+
+           if (k == i) {       /* No such variable yet */
+               if ((result[i] = (s_var *)malloc(sizeof(s_var))) == NULL)
+                   return NULL;
+               if ((result[i]->name = (char *)malloc((esp-cp+1) * sizeof(char))) == NULL)
+                   return NULL;
+               memset (result[i]->name, 0, esp-cp+1);
+               strncpy(result[i]->name, cp, esp-cp);
+               cp = ++esp;
+               if ((result[i]->value = (char *)malloc((ip-esp+1) * sizeof(char))) == NULL)
+                   return NULL;
+               memset (result[i]->value, 0, ip-esp+1);
+               strncpy(result[i]->value, cp, ip-esp);
+               result[i]->value = rrdcgiDecodeString(result[i]->value);
+               if (rrdcgiDebugLevel) {
+                   if (rrdcgiDebugStderr)
+                       fprintf (stderr, "%s: %s\n", result[i]->name, result[i]->value);
+                   else
+                       printf ("<h3>Variable %s</h3>\n<pre>\n%s\n</pre>\n\n", result[i]->name, result[i]->value);
+               }
+               i++;
+           } else {    /* There is already such a name, suppose a mutiple field */
+               cp = ++esp;
+               len = (strlen(result[k]->value)+(ip-esp)+2) * sizeof (char);
+               if ((sptr = (char *)malloc(len)) == NULL)
+                   return NULL;
+               memset (sptr, 0, len);
+               sprintf (sptr, "%s\n", result[k]->value);
+               strncat(sptr, cp, ip-esp);
+               free(result[k]->value);
+               result[k]->value = rrdcgiDecodeString (sptr);
+           }
+       }
+       cp = ++ip;
+    }
+    return result;
+}
+
+/*  rrdcgiInit()
+ *
+ *  Read from stdin if no string is provided via CGI.  Variables that
+ *  doesn't have a value associated with it doesn't get stored.
+ */
+s_cgi *rrdcgiInit(void)
+{
+    s_cgi *res;
+    s_var **vars;
+
+    vars = rrdcgiReadVariables();
+
+    if (!vars)
+       return NULL;
+
+    if ((res = (s_cgi *)malloc (sizeof (s_cgi))) == NULL)
+       return NULL;
+    res->vars = vars;
+
+    return res;
+}
+
+char *rrdcgiGetValue(s_cgi *parms, const char *name)
+{
+    int i;
+
+    if (!parms || !parms->vars)
+       return NULL;
+    for (i=0;parms->vars[i]; i++)
+       if (!strcmp(name,parms->vars[i]->name)) {
+           if (rrdcgiDebugLevel > 0) {
+               if (rrdcgiDebugStderr)
+                   fprintf (stderr, "%s found as %s\n", name, parms->vars[i]->value);
+               else
+                   printf ("%s found as %s<br>\n", name, parms->vars[i]->value);
+           }
+           return parms->vars[i]->value;
+       }
+    if (rrdcgiDebugLevel) {
+       if (rrdcgiDebugStderr)
+           fprintf (stderr, "%s not found\n", name);
+       else
+           printf ("%s not found<br>\n", name);
+    }
+    return NULL;
+}
+
+void rrdcgiFreeList (char **list)
+{
+    int i;
+
+    for (i=0; list[i] != NULL; i++)
+       free (list[i]);
+       free (list);
+}
+
+void rrdcgiFree (s_cgi *parms)
+{
+    int i;
+
+    if (!parms)
+       return;
+    if (parms->vars) {
+               for (i=0;parms->vars[i]; i++) {
+                       if (parms->vars[i]->name)
+                               free (parms->vars[i]->name);
+                       if (parms->vars[i]->value)
+                               free (parms->vars[i]->value);
+           free (parms->vars[i]);
+               }
+               free (parms->vars);
+    }
+    free (parms);
+
+    if (rrdcgiHeaderString) {
+       free (rrdcgiHeaderString);
+       rrdcgiHeaderString = NULL;
+    }
+    if (rrdcgiType) {
+       free (rrdcgiType);
+       rrdcgiType = NULL;
+    }
+}
+
diff --git a/src/rrd_create.c b/src/rrd_create.c
new file mode 100644 (file)
index 0000000..05b372d
--- /dev/null
@@ -0,0 +1,688 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_create.c  creates new rrds
+ *****************************************************************************/
+
+#include "rrd_tool.h"
+#include "rrd_rpncalc.h"
+#include "rrd_hw.h"
+
+#include "rrd_is_thread_safe.h"
+
+unsigned long FnvHash(const char *str);
+int create_hw_contingent_rras(rrd_t *rrd, unsigned short period, unsigned long hashed_name);
+void parseGENERIC_DS(const char *def,rrd_t *rrd, int ds_idx);
+
+int
+rrd_create(int argc, char **argv) 
+{
+    time_t            last_up = time(NULL)-10;
+    unsigned long     pdp_step = 300;
+    struct rrd_time_value last_up_tv;
+    char *parsetime_error = NULL;
+    long              long_tmp;
+    int               rc;
+    optind = 0; opterr = 0;  /* initialize getopt */
+
+    while (1){
+       static struct option long_options[] =
+       {
+           {"start",      required_argument, 0, 'b'},
+           {"step",        required_argument,0,'s'},
+           {0,0,0,0}
+       };
+       int option_index = 0;
+       int opt;
+       opt = getopt_long(argc, argv, "b:s:", 
+                         long_options, &option_index);
+       
+       if (opt == EOF)
+           break;
+       
+       switch(opt) {
+       case 'b':
+            if ((parsetime_error = parsetime(optarg, &last_up_tv))) {
+                rrd_set_error("start time: %s", parsetime_error );
+                return(-1);
+           }
+           if (last_up_tv.type == RELATIVE_TO_END_TIME ||
+               last_up_tv.type == RELATIVE_TO_START_TIME) {
+               rrd_set_error("specifying time relative to the 'start' "
+                              "or 'end' makes no sense here");
+               return(-1);
+           }
+
+           last_up = mktime(&last_up_tv.tm) + last_up_tv.offset;
+           
+           if (last_up < 3600*24*365*10){
+               rrd_set_error("the first entry to the RRD should be after 1980");
+               return(-1);
+           }   
+           break;
+
+       case 's':
+           long_tmp = atol(optarg);
+           if (long_tmp < 1){
+               rrd_set_error("step size should be no less than one second");
+               return(-1);
+           }
+           pdp_step = long_tmp;
+           break;
+
+       case '?':
+            if (optopt != 0)
+                rrd_set_error("unknown option '%c'", optopt);
+            else
+                rrd_set_error("unknown option '%s'",argv[optind-1]);
+           return(-1);
+       }
+    }
+    if (optind == argc) {
+         rrd_set_error("what is the name of the rrd file you want to create?");
+         return -1;
+    }
+    rc = rrd_create_r(argv[optind],
+                     pdp_step, last_up,
+                     argc - optind - 1, (const char **)(argv + optind + 1));
+    
+    return rc;
+}
+
+/* #define DEBUG */
+int
+rrd_create_r(const char *filename,
+            unsigned long pdp_step, time_t last_up,
+            int argc, const char **argv) 
+{
+    rrd_t             rrd;
+    long              i;
+    int               offset;
+    char *token;
+    char dummychar1[2], dummychar2[2];
+    unsigned short token_idx, error_flag, period=0;
+    unsigned long hashed_name;
+
+    /* init rrd clean */
+    rrd_init(&rrd);
+    /* static header */
+    if((rrd.stat_head = calloc(1,sizeof(stat_head_t)))==NULL){
+       rrd_set_error("allocating rrd.stat_head");
+       rrd_free(&rrd);
+       return(-1);
+    }
+
+    /* live header */
+    if((rrd.live_head = calloc(1,sizeof(live_head_t)))==NULL){
+       rrd_set_error("allocating rrd.live_head");
+       rrd_free(&rrd);
+       return(-1);
+    }
+
+    /* set some defaults */
+    strcpy(rrd.stat_head->cookie,RRD_COOKIE);
+    strcpy(rrd.stat_head->version,RRD_VERSION);
+    rrd.stat_head->float_cookie = FLOAT_COOKIE;
+    rrd.stat_head->ds_cnt = 0; /* this will be adjusted later */
+    rrd.stat_head->rra_cnt = 0; /* ditto */
+    rrd.stat_head->pdp_step = pdp_step; /* 5 minute default */
+
+    /* a default value */
+    rrd.ds_def = NULL;
+    rrd.rra_def = NULL;
+
+    rrd.live_head->last_up = last_up;
+       
+       /* optind points to the first non-option command line arg,
+        * in this case, the file name. */
+       /* Compute the FNV hash value (used by SEASONAL and DEVSEASONAL
+        * arrays. */
+    hashed_name = FnvHash(filename);
+    for(i=0;i<argc;i++){
+       unsigned int ii;
+       if (strncmp(argv[i],"DS:",3)==0){
+           size_t old_size = sizeof(ds_def_t)*(rrd.stat_head->ds_cnt);
+           if((rrd.ds_def = rrd_realloc(rrd.ds_def,
+                                         old_size+sizeof(ds_def_t)))==NULL){
+               rrd_set_error("allocating rrd.ds_def");
+               rrd_free(&rrd);
+               return(-1);     
+           }
+           memset(&rrd.ds_def[rrd.stat_head->ds_cnt], 0, sizeof(ds_def_t));
+            /* extract the name and type */
+           switch (sscanf(&argv[i][3],
+                       DS_NAM_FMT "%1[:]" DST_FMT "%1[:]%n",
+                       rrd.ds_def[rrd.stat_head->ds_cnt].ds_nam,
+                       dummychar1,
+                       rrd.ds_def[rrd.stat_head->ds_cnt].dst,
+                       dummychar2,
+                       &offset)) {
+               case 0:
+               case 1: rrd_set_error("Invalid DS name"); break;
+               case 2:
+               case 3: rrd_set_error("Invalid DS type"); break;
+               case 4: /* (%n may or may not be counted) */
+               case 5: /* check for duplicate datasource names */
+                   for (ii=0;ii<rrd.stat_head->ds_cnt;ii++)
+                       if(strcmp(rrd.ds_def[rrd.stat_head->ds_cnt].ds_nam,
+                               rrd.ds_def[ii].ds_nam) == 0)
+                           rrd_set_error("Duplicate DS name: %s",
+                                       rrd.ds_def[ii].ds_nam);
+                   /* DS_type may be valid or not. Checked later */
+                   break;
+               default: rrd_set_error("invalid DS format");
+            }
+           if (rrd_test_error()) {
+                rrd_free(&rrd);
+                return -1;
+            }
+            
+            /* parse the remainder of the arguments */
+            switch(dst_conv(rrd.ds_def[rrd.stat_head->ds_cnt].dst))
+           {
+            case DST_COUNTER:
+            case DST_ABSOLUTE:
+            case DST_GAUGE:
+            case DST_DERIVE:
+                parseGENERIC_DS(&argv[i][offset+3],&rrd, rrd.stat_head->ds_cnt);
+                break;
+            case DST_CDEF:
+                parseCDEF_DS(&argv[i][offset+3],&rrd, rrd.stat_head->ds_cnt);
+                break;
+            default:
+                rrd_set_error("invalid DS type specified");
+                break;
+            }
+            
+            if (rrd_test_error()) {
+                rrd_free(&rrd);
+                return -1;
+            }
+            rrd.stat_head -> ds_cnt++;
+       } else if (strncmp(argv[i],"RRA:",4)==0){
+            char *argvcopy;
+           char *tokptr;
+           size_t old_size = sizeof(rra_def_t)*(rrd.stat_head->rra_cnt);
+           if((rrd.rra_def = rrd_realloc(rrd.rra_def,
+                                          old_size+sizeof(rra_def_t)))==NULL)
+           {
+                rrd_set_error("allocating rrd.rra_def");
+                rrd_free(&rrd);
+                return(-1);    
+           }
+           memset(&rrd.rra_def[rrd.stat_head->rra_cnt], 0, sizeof(rra_def_t));
+
+            argvcopy = strdup(argv[i]);
+           token = strtok_r(&argvcopy[4],":", &tokptr);
+           token_idx = error_flag = 0;
+           while (token != NULL)
+           {
+                switch(token_idx)
+                {
+                case 0:
+                    if (sscanf(token,CF_NAM_FMT,
+                               rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam) != 1)
+                        rrd_set_error("Failed to parse CF name");
+                    switch(cf_conv(rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam))
+                    {
+                    case CF_HWPREDICT:
+                        /* initialize some parameters */
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_alpha].u_val = 0.1;
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_beta].u_val = 1.0/288;
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt = 
+                            rrd.stat_head -> rra_cnt;
+                        break;
+                    case CF_DEVSEASONAL:
+                    case CF_SEASONAL:
+                        /* initialize some parameters */
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_seasonal_gamma].u_val = 0.1;
+                        /* fall through */
+                    case CF_DEVPREDICT:
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt = -1;
+                        break;
+                    case CF_FAILURES:
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_delta_pos].u_val = 2.0;
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_delta_neg].u_val = 2.0;
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_window_len].u_cnt = 3;
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_failure_threshold].u_cnt = 2;
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt = -1;
+                        break;
+                        /* invalid consolidation function */
+                    case -1:
+                        rrd_set_error("Unrecognized consolidation function %s",
+                                      rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam);
+                    default:
+                        break;
+                    }
+                    /* default: 1 pdp per cdp */ 
+                    rrd.rra_def[rrd.stat_head->rra_cnt].pdp_cnt = 1;
+                    break;
+                case 1:
+                    switch(cf_conv(rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam))
+                    {
+                    case CF_HWPREDICT:
+                    case CF_DEVSEASONAL:
+                    case CF_SEASONAL:
+                    case CF_DEVPREDICT:
+                    case CF_FAILURES:
+                        rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt = atoi(token);
+                        break;
+                    default:
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_cdp_xff_val].u_val = atof(token);
+                        if (rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_cdp_xff_val].u_val<0.0 ||
+                            rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_cdp_xff_val].u_val>=1.0)
+                            rrd_set_error("Invalid xff: must be between 0 and 1");
+                        break;
+                    }
+                    break;
+                case 2:
+                    switch(cf_conv(rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam))
+                    {
+                    case CF_HWPREDICT:
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_alpha].u_val = atof(token);
+                        if (atof(token) <= 0.0 || atof(token) >= 1.0)
+                            rrd_set_error("Invalid alpha: must be between 0 and 1");
+                        break;
+                    case CF_DEVSEASONAL:
+                    case CF_SEASONAL:
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_seasonal_gamma].u_val = 
+                            atof(token);
+                        if (atof(token) <= 0.0 || atof(token) >= 1.0)
+                            rrd_set_error("Invalid gamma: must be between 0 and 1");
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_seasonal_smooth_idx].u_cnt
+                            = hashed_name % rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt; 
+                        break;
+                    case CF_FAILURES:
+                        /* specifies the # of violations that constitutes the failure threshold */
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_failure_threshold].u_cnt =
+                            atoi(token);
+                        if (atoi(token) < 1 || atoi(token) > MAX_FAILURES_WINDOW_LEN)
+                            rrd_set_error("Failure threshold is out of range %d, %d",1,
+                                          MAX_FAILURES_WINDOW_LEN);
+                        break;
+                    case CF_DEVPREDICT:
+                        /* specifies the index (1-based) of CF_DEVSEASONAL array
+                         * associated with this CF_DEVPREDICT array. */
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt =
+                            atoi(token) - 1;
+                        break;
+                    default:
+                        rrd.rra_def[rrd.stat_head->rra_cnt].pdp_cnt = atoi(token);
+                        break;
+                    }
+                    break;
+                case 3:
+                    switch(cf_conv(rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam))
+                    {
+                    case CF_HWPREDICT:
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_beta].u_val = atof(token);
+                        if (atof(token) < 0.0 || atof(token) > 1.0)
+                            rrd_set_error("Invalid beta: must be between 0 and 1");
+                        break;
+                    case CF_DEVSEASONAL:
+                    case CF_SEASONAL:
+                        /* specifies the index (1-based) of CF_HWPREDICT array
+                         * associated with this CF_DEVSEASONAL or CF_SEASONAL array. 
+                         * */
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt =
+                            atoi(token) - 1;
+                        break;
+                    case CF_FAILURES:
+                        /* specifies the window length */
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_window_len].u_cnt =
+                            atoi(token);
+                        if (atoi(token) < 1 || atoi(token) > MAX_FAILURES_WINDOW_LEN)
+                            rrd_set_error("Window length is out of range %d, %d",1,
+                                          MAX_FAILURES_WINDOW_LEN);
+                        /* verify that window length exceeds the failure threshold */
+                        if (rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_window_len].u_cnt <
+                            rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_failure_threshold].u_cnt)
+                            rrd_set_error("Window length is shorter than the failure threshold");
+                        break;
+                    case CF_DEVPREDICT:
+                        /* shouldn't be any more arguments */
+                        rrd_set_error("Unexpected extra argument for consolidation function DEVPREDICT");
+                        break;
+                    default:
+                        rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt = atoi(token);
+                        break;
+                    }
+                    break;
+                case 4:
+                    switch(cf_conv(rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam))
+                    {
+                    case CF_FAILURES:
+                        /* specifies the index (1-based) of CF_DEVSEASONAL array
+                         * associated with this CF_DEVFAILURES array. */
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt =
+                            atoi(token) - 1;
+                        break;
+                    case CF_HWPREDICT:
+                        /* length of the associated CF_SEASONAL and CF_DEVSEASONAL arrays. */
+                        period = atoi(token);
+                        if (period > rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt)
+                            rrd_set_error("Length of seasonal cycle exceeds length of HW prediction array");
+                        break;
+                    default:
+                        /* shouldn't be any more arguments */
+                        rrd_set_error("Unexpected extra argument for consolidation function %s",
+                                      rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam);
+                        break;
+                    }
+                    break;
+                case 5:
+                    /* If we are here, this must be a CF_HWPREDICT RRA.
+                     * Specifies the index (1-based) of CF_SEASONAL array
+                     * associated with this CF_HWPREDICT array. If this argument 
+                     * is missing, then the CF_SEASONAL, CF_DEVSEASONAL, CF_DEVPREDICT,
+                     * CF_FAILURES.
+                     * arrays are created automatically. */
+                    rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt =
+                        atoi(token) - 1;
+                    break;
+                default:
+                    /* should never get here */
+                    rrd_set_error("Unknown error");
+                    break;
+                } /* end switch */
+                if (rrd_test_error())
+                {
+                    /* all errors are unrecoverable */
+                    free(argvcopy);
+                    rrd_free(&rrd);
+                    return (-1);
+                }
+                token = strtok_r(NULL,":", &tokptr);
+                token_idx++;
+           } /* end while */
+           free(argvcopy);
+#ifdef DEBUG
+           fprintf(stderr,"Creating RRA CF: %s, dep idx %lu, current idx %lu\n",
+                   rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam,
+                   rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt, 
+                   rrd.stat_head -> rra_cnt);
+#endif
+           /* should we create CF_SEASONAL, CF_DEVSEASONAL, and CF_DEVPREDICT? */
+           if (cf_conv(rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam) == CF_HWPREDICT
+               && rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt 
+               == rrd.stat_head -> rra_cnt)
+           {
+#ifdef DEBUG
+                fprintf(stderr,"Creating HW contingent RRAs\n");
+#endif
+                if (create_hw_contingent_rras(&rrd,period,hashed_name) == -1) {
+                    rrd_set_error("creating contingent RRA");
+                    rrd_free(&rrd);
+                    return -1;
+                }
+           }
+           rrd.stat_head->rra_cnt++;                   
+       } else {
+           rrd_set_error("can't parse argument '%s'",argv[i]);
+           rrd_free(&rrd);
+            return -1;
+       }
+    }
+    
+    
+    if (rrd.stat_head->rra_cnt < 1){
+       rrd_set_error("you must define at least one Round Robin Archive");
+       rrd_free(&rrd);
+       return(-1);
+    }
+    
+    if (rrd.stat_head->ds_cnt < 1){
+       rrd_set_error("you must define at least one Data Source");
+       rrd_free(&rrd);
+       return(-1);
+    }
+    return rrd_create_fn(filename, &rrd);
+}
+
+void parseGENERIC_DS(const char *def,rrd_t *rrd, int ds_idx)
+{
+    char minstr[DS_NAM_SIZE], maxstr[DS_NAM_SIZE];     
+    /*
+      int temp;
+      
+      temp = sscanf(def,"%lu:%18[^:]:%18[^:]", 
+      &(rrd -> ds_def[ds_idx].par[DS_mrhb_cnt].u_cnt),
+      minstr,maxstr);
+    */
+    if (sscanf(def,"%lu:%18[^:]:%18[^:]",      
+               &(rrd -> ds_def[ds_idx].par[DS_mrhb_cnt].u_cnt),
+               minstr,maxstr) == 3)
+    {
+        if (minstr[0] == 'U' && minstr[1] == 0)
+            rrd -> ds_def[ds_idx].par[DS_min_val].u_val = DNAN;
+        else
+            rrd -> ds_def[ds_idx].par[DS_min_val].u_val = atof(minstr);
+        
+        if (maxstr[0] == 'U' && maxstr[1] == 0)
+            rrd -> ds_def[ds_idx].par[DS_max_val].u_val = DNAN;
+        else
+            rrd -> ds_def[ds_idx].par[DS_max_val].u_val  = atof(maxstr);
+        
+        if (! isnan(rrd -> ds_def[ds_idx].par[DS_min_val].u_val) &&
+            ! isnan(rrd -> ds_def[ds_idx].par[DS_max_val].u_val) &&
+            rrd -> ds_def[ds_idx].par[DS_min_val].u_val
+            >= rrd -> ds_def[ds_idx].par[DS_max_val].u_val ) {
+            rrd_set_error("min must be less than max in DS definition");
+            return;            
+        }
+    } else {
+        rrd_set_error("failed to parse data source %s", def);
+    }
+}
+
+/* Create the CF_DEVPREDICT, CF_DEVSEASONAL, CF_SEASONAL, and CF_FAILURES RRAs
+ * associated with a CF_HWPREDICT RRA. */
+int
+create_hw_contingent_rras(rrd_t *rrd, unsigned short period, unsigned long hashed_name)
+{
+    size_t old_size;
+    rra_def_t* current_rra;
+    
+    /* save index to CF_HWPREDICT */
+    unsigned long hw_index = rrd -> stat_head -> rra_cnt;
+    /* advance the pointer */
+    (rrd -> stat_head -> rra_cnt)++;                   
+    /* allocate the memory for the 4 contingent RRAs */
+    old_size = sizeof(rra_def_t)*(rrd -> stat_head->rra_cnt);
+    if ((rrd -> rra_def = rrd_realloc(rrd -> rra_def,
+                                      old_size+4*sizeof(rra_def_t)))==NULL)
+    {
+        rrd_set_error("allocating rrd.rra_def");
+        return(-1);    
+    }
+    /* clear memory */
+    memset(&(rrd -> rra_def[rrd -> stat_head->rra_cnt]), 0, 4*sizeof(rra_def_t));
+    
+    /* create the CF_SEASONAL RRA */
+    current_rra = &(rrd -> rra_def[rrd -> stat_head -> rra_cnt]);
+    strcpy(current_rra -> cf_nam,"SEASONAL");
+    current_rra -> row_cnt = period;
+    current_rra -> par[RRA_seasonal_smooth_idx].u_cnt = hashed_name % period;
+    current_rra -> pdp_cnt = 1;
+    current_rra -> par[RRA_seasonal_gamma].u_val = 
+        rrd -> rra_def[hw_index].par[RRA_hw_alpha].u_val;
+    current_rra -> par[RRA_dependent_rra_idx].u_cnt = hw_index; 
+    rrd -> rra_def[hw_index].par[RRA_dependent_rra_idx].u_cnt = rrd -> stat_head -> rra_cnt;
+    
+    /* create the CF_DEVSEASONAL RRA */
+    (rrd -> stat_head -> rra_cnt)++; 
+    current_rra = &(rrd -> rra_def[rrd -> stat_head -> rra_cnt]);
+    strcpy(current_rra -> cf_nam,"DEVSEASONAL");
+    current_rra -> row_cnt = period;
+    current_rra -> par[RRA_seasonal_smooth_idx].u_cnt = hashed_name % period;
+    current_rra -> pdp_cnt = 1;
+    current_rra -> par[RRA_seasonal_gamma].u_val = 
+        rrd -> rra_def[hw_index].par[RRA_hw_alpha].u_val;
+    current_rra -> par[RRA_dependent_rra_idx].u_cnt = hw_index; 
+    
+    /* create the CF_DEVPREDICT RRA */
+    (rrd -> stat_head -> rra_cnt)++; 
+    current_rra = &(rrd -> rra_def[rrd -> stat_head -> rra_cnt]);
+    strcpy(current_rra -> cf_nam,"DEVPREDICT");
+    current_rra -> row_cnt = (rrd -> rra_def[hw_index]).row_cnt;
+    current_rra -> pdp_cnt = 1;
+    current_rra -> par[RRA_dependent_rra_idx].u_cnt 
+        = hw_index + 2; /* DEVSEASONAL */
+    
+    /* create the CF_FAILURES RRA */
+    (rrd -> stat_head -> rra_cnt)++; 
+    current_rra = &(rrd -> rra_def[rrd -> stat_head -> rra_cnt]);
+    strcpy(current_rra -> cf_nam,"FAILURES");
+    current_rra -> row_cnt = period; 
+    current_rra -> pdp_cnt = 1;
+    current_rra -> par[RRA_delta_pos].u_val = 2.0;
+    current_rra -> par[RRA_delta_neg].u_val = 2.0;
+    current_rra -> par[RRA_failure_threshold].u_cnt = 7;
+    current_rra -> par[RRA_window_len].u_cnt = 9;
+    current_rra -> par[RRA_dependent_rra_idx].u_cnt = 
+        hw_index + 2; /* DEVSEASONAL */
+    return 0;
+}
+
+/* create and empty rrd file according to the specs given */
+
+int
+rrd_create_fn(const char *file_name, rrd_t *rrd)
+{
+    unsigned long    i,ii;
+    FILE             *rrd_file;
+    rrd_value_t      *unknown;
+    int        unkn_cnt;
+    
+    if ((rrd_file = fopen(file_name,"wb")) == NULL ) {
+       rrd_set_error("creating '%s': %s",file_name, rrd_strerror(errno));
+        rrd_free(rrd);
+       return(-1);
+    }
+    
+    fwrite(rrd->stat_head,
+          sizeof(stat_head_t), 1, rrd_file);
+    
+    fwrite(rrd->ds_def,
+          sizeof(ds_def_t), rrd->stat_head->ds_cnt, rrd_file);
+    
+    fwrite(rrd->rra_def,
+          sizeof(rra_def_t), rrd->stat_head->rra_cnt, rrd_file);
+    
+    fwrite(rrd->live_head,
+          sizeof(live_head_t),1, rrd_file);
+
+    if((rrd->pdp_prep = calloc(1,sizeof(pdp_prep_t))) == NULL){
+       rrd_set_error("allocating pdp_prep");
+       rrd_free(rrd);
+       fclose(rrd_file);
+       return(-1);
+    }
+
+    strcpy(rrd->pdp_prep->last_ds,"UNKN");
+
+    rrd->pdp_prep->scratch[PDP_val].u_val = 0.0;
+    rrd->pdp_prep->scratch[PDP_unkn_sec_cnt].u_cnt = 
+       rrd->live_head->last_up % rrd->stat_head->pdp_step;
+
+    for(i=0; i < rrd->stat_head->ds_cnt; i++)
+       fwrite( rrd->pdp_prep,sizeof(pdp_prep_t),1,rrd_file);
+    
+    if((rrd->cdp_prep = calloc(1,sizeof(cdp_prep_t))) == NULL){
+       rrd_set_error("allocating cdp_prep");
+       rrd_free(rrd);
+       fclose(rrd_file);
+       return(-1);
+    }
+
+
+    for(i=0; i < rrd->stat_head->rra_cnt; i++) {
+       switch (cf_conv(rrd->rra_def[i].cf_nam))
+          {
+           case CF_HWPREDICT:
+               init_hwpredict_cdp(rrd->cdp_prep);
+               break;
+           case CF_SEASONAL:
+           case CF_DEVSEASONAL:
+               init_seasonal_cdp(rrd->cdp_prep);
+               break;
+           case CF_FAILURES:
+               /* initialize violation history to 0 */
+               for (ii = 0; ii < MAX_CDP_PAR_EN; ii++)
+               {
+                               /* We can zero everything out, by setting u_val to the
+                                * NULL address. Each array entry in scratch is 8 bytes
+                                * (a double), but u_cnt only accessed 4 bytes (long) */
+                   rrd->cdp_prep->scratch[ii].u_val = 0.0;
+               }
+               break;
+           default:
+               /* can not be zero because we don't know anything ... */
+               rrd->cdp_prep->scratch[CDP_val].u_val = DNAN;
+               /* startup missing pdp count */
+               rrd->cdp_prep->scratch[CDP_unkn_pdp_cnt].u_cnt = 
+                   ((rrd->live_head->last_up -
+                rrd->pdp_prep->scratch[PDP_unkn_sec_cnt].u_cnt)
+                    % (rrd->stat_head->pdp_step 
+                       * rrd->rra_def[i].pdp_cnt)) / rrd->stat_head->pdp_step; 
+               break;
+          }
+       
+       for(ii=0; ii < rrd->stat_head->ds_cnt; ii++) 
+       {
+           fwrite( rrd->cdp_prep,sizeof(cdp_prep_t),1,rrd_file);
+       }
+    }
+    
+    /* now, we must make sure that the rest of the rrd
+       struct is properly initialized */
+    
+    if((rrd->rra_ptr = calloc(1,sizeof(rra_ptr_t))) == NULL) {
+       rrd_set_error("allocating rra_ptr");
+       rrd_free(rrd);
+       fclose(rrd_file);
+       return(-1);
+    }
+    
+    /* changed this initialization to be consistent with
+     * rrd_restore. With the old value (0), the first update
+     * would occur for cur_row = 1 because rrd_update increments
+     * the pointer a priori. */
+    for (i=0; i < rrd->stat_head->rra_cnt; i++)
+    {
+        rrd->rra_ptr->cur_row = rrd->rra_def[i].row_cnt - 1;
+        fwrite( rrd->rra_ptr, sizeof(rra_ptr_t),1,rrd_file);
+    }
+    
+    /* write the empty data area */
+    if ((unknown = (rrd_value_t *)malloc(512 * sizeof(rrd_value_t))) == NULL) {
+       rrd_set_error("allocating unknown");
+       rrd_free(rrd);
+       fclose(rrd_file);
+       return(-1);
+    }
+    for (i = 0; i < 512; ++i)
+       unknown[i] = DNAN;
+    
+    unkn_cnt = 0;
+    for (i = 0; i < rrd->stat_head->rra_cnt; i++)
+        unkn_cnt += rrd->stat_head->ds_cnt * rrd->rra_def[i].row_cnt;
+                     
+    while (unkn_cnt > 0) {
+       fwrite(unknown, sizeof(rrd_value_t), min(unkn_cnt, 512), rrd_file);
+       unkn_cnt -= 512;
+     }
+    free(unknown);
+    
+    /* lets see if we had an error */
+    if(ferror(rrd_file)){
+       rrd_set_error("a file error occurred while creating '%s'",file_name);
+       fclose(rrd_file);       
+       rrd_free(rrd);
+       return(-1);
+    }
+    
+    fclose(rrd_file);    
+    rrd_free(rrd);
+    return (0);
+}
diff --git a/src/rrd_diff.c b/src/rrd_diff.c
new file mode 100644 (file)
index 0000000..3cc2907
--- /dev/null
@@ -0,0 +1,118 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ * This code is stolen from rateup (mrtg-2.x) by Dave Rand
+ *****************************************************************************
+ * diff calculate the difference between two very long integers available as
+ *      strings
+ *****************************************************************************
+ * $Id: rrd_diff.c 1235 2007-11-20 00:15:07Z oetiker $
+ * $Log$
+ * Revision 1.4  2003/03/10 00:30:34  oetiker
+ * handle cases with two negative numbers
+ * --  Sasha Mikheev <sasha@avalon-net.co.il>
+ *
+ * Revision 1.3  2002/04/01 18:31:22  oetiker
+ * "!" takes a higher preference than "||" this means rrd_update N:: would
+ * segfault -- Oliver Cook <ollie@uk.clara.net>
+ *
+ * Revision 1.2  2002/02/01 20:34:49  oetiker
+ * fixed version number and date/time
+ *
+ * Revision 1.1.1.1  2001/02/25 22:25:05  oetiker
+ * checkin
+ *
+ * Revision 1.1  1998/10/08 18:21:45  oetiker
+ * Initial revision
+ *
+ * Revision 1.3  1998/02/06 21:10:52  oetiker
+ * removed max define .. it is now in rrd_tool.h
+ *
+ * Revision 1.2  1997/12/07 20:38:03  oetiker
+ * ansified
+ *
+ * Revision 1.1  1997/11/28 23:31:59  oetiker
+ * Initial revision
+ *
+ *****************************************************************************/
+
+#include "rrd_tool.h"
+
+double
+rrd_diff(char *a, char *b)
+{
+    char res[LAST_DS_LEN+1], *a1, *b1, *r1, *fix;
+    int c,x,m;
+    char a_neg=0, b_neg=0;
+    double result;
+   
+    while (!(isdigit((int)*a) || *a==0)) {
+        if(*a=='-') 
+           a_neg = 1;
+        a++;
+    }
+    fix=a;
+    while (isdigit((int)*fix)) 
+       fix++;
+    *fix = 0; /* maybe there is some non digit data in the string */ 
+    while (!(isdigit((int)*b) || *b==0)) {
+       if(*b=='-') 
+           b_neg = 1;  
+        b++;
+    }
+    fix=b;
+    while (isdigit((int)*fix)) 
+       fix++;
+    *fix = 0; /* maybe there is some non digit data in the string */ 
+    if(!isdigit((int)*a) || !isdigit((int)*b))
+       return DNAN;
+    if(a_neg+b_neg == 1) /* can not handle numbers with different signs yet */
+       return DNAN;
+    a1 = &a[strlen(a)-1];
+    m = max(strlen(a),strlen(b));
+    if (m > LAST_DS_LEN) return DNAN; /* result string too short */
+
+    r1 = &res[m+1];
+    for (b1 = res;b1 <= r1; b1++) *b1 = ' ';
+    b1 = &b[strlen(b)-1];
+    r1[1] = 0;  /* Null terminate result */
+    c = 0;
+    for (x=0; x<m; x++) {
+        if (a1 >= a && b1 >= b) {
+            *r1 = ((*a1 - c) - *b1) + '0';
+        } else if (a1 >= a) {
+            *r1 = (*a1 - c);
+        } else {
+            *r1 = ('0' - *b1 - c) + '0';
+        }
+        if (*r1 < '0') {
+            *r1 += 10;
+            c=1;
+        } else
+         if (*r1 > '9') { /* 0 - 10 */
+           *r1 -= 10;
+           c=1;            
+         } else {
+            c=0;
+        }
+        a1--;b1--;r1--;
+    }
+    if (c) {
+        r1 = &res[m+1];
+        for (x=0; isdigit((int)*r1) && x<m; x++,r1--)  {
+            *r1 = ('9' - *r1 + c) + '0';
+            if (*r1 > '9') {
+                *r1 -= 10;
+                c=1;
+            } else {
+                c=0;
+            }
+        }
+        result = -atof(res);
+    } else
+        result = atof(res);
+
+    if(a_neg+b_neg==2) /* both are negatives, reverse sign */
+        result = -result;
+    
+    return result;
+}                                                       
diff --git a/src/rrd_dump.c b/src/rrd_dump.c
new file mode 100644 (file)
index 0000000..b37e9a1
--- /dev/null
@@ -0,0 +1,367 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_dump  Display a RRD
+ *****************************************************************************
+ * $Id: rrd_dump.c 1235 2007-11-20 00:15:07Z oetiker $
+ * $Log$
+ * Revision 1.7  2004/05/25 20:53:21  oetiker
+ * prevent small leak when resources are exhausted -- Mike Slifcak
+ *
+ * Revision 1.6  2004/05/25 20:51:49  oetiker
+ * Update displayed copyright messages to be consistent. -- Mike Slifcak
+ *
+ * Revision 1.5  2003/02/13 07:05:27  oetiker
+ * Find attached the patch I promised to send to you. Please note that there
+ * are three new source files (src/rrd_is_thread_safe.h, src/rrd_thread_safe.c
+ * and src/rrd_not_thread_safe.c) and the introduction of librrd_th. This
+ * library is identical to librrd, but it contains support code for per-thread
+ * global variables currently used for error information only. This is similar
+ * to how errno per-thread variables are implemented.  librrd_th must be linked
+ * alongside of libpthred
+ *
+ * There is also a new file "THREADS", holding some documentation.
+ *
+ * -- Peter Stamfest <peter@stamfest.at>
+ *
+ * Revision 1.4  2002/02/01 20:34:49  oetiker
+ * fixed version number and date/time
+ *
+ * Revision 1.3  2001/03/10 23:54:39  oetiker
+ * Support for COMPUTE data sources (CDEF data sources). Removes the RPN
+ * parser and calculator from rrd_graph and puts then in a new file,
+ * rrd_rpncalc.c. Changes to core files rrd_create and rrd_update. Some
+ * clean-up of aberrant behavior stuff, including a bug fix.
+ * Documentation update (rrdcreate.pod, rrdupdate.pod). Change xml format.
+ * -- Jake Brutlag <jakeb@corp.webtv.net>
+ *
+ * Revision 1.2  2001/03/04 13:01:55  oetiker
+ *
+ * Revision 1.1.1.1  2001/02/25 22:25:05  oetiker
+ * checkin
+ *
+ *****************************************************************************/
+#include "rrd_tool.h"
+#include "rrd_rpncalc.h"
+
+#if !(defined(NETWARE) || defined(WIN32))
+extern char *tzname[2];
+#endif
+
+int
+rrd_dump(int argc, char **argv) 
+{
+    int                 rc;
+
+    if (argc < 2) {
+       rrd_set_error("Not enough arguments");
+       return -1;
+    }
+
+    if (argc == 3)
+    {
+      rc = rrd_dump_r(argv[1], argv[2]);
+    }
+    else
+    {
+      rc = rrd_dump_r(argv[1], NULL);                  
+    }
+
+    return rc;
+}
+
+int
+rrd_dump_r(const char *filename, char *outname)    
+{   
+    unsigned int i,ii,ix,iii=0;
+    time_t       now;
+    char         somestring[255];
+    rrd_value_t  my_cdp;
+    long         rra_base, rra_start, rra_next;
+    FILE        *in_file;
+               FILE                            *out_file;
+    rrd_t        rrd;
+    rrd_value_t  value;
+    struct tm    tm;
+    if(rrd_open(filename, &in_file,&rrd, RRD_READONLY)==-1){
+       rrd_free(&rrd);
+       return(-1);
+    }
+
+    out_file = NULL;
+    if (outname)
+    {
+      if (!(out_file = fopen(outname, "w")))
+      {
+        return (-1);     
+      }
+    }
+    else 
+    {
+      out_file = stdout;
+    }
+               
+    fputs("<!-- Round Robin Database Dump -->", out_file);
+    fputs("<rrd>", out_file);
+    fprintf(out_file, "\t<version> %s </version>\n",RRD_VERSION);
+    fprintf(out_file, "\t<step> %lu </step> <!-- Seconds -->\n",rrd.stat_head->pdp_step);
+#if HAVE_STRFTIME
+    localtime_r(&rrd.live_head->last_up, &tm);
+    strftime(somestring,200,"%Y-%m-%d %H:%M:%S %Z",
+            &tm);
+#else
+# error "Need strftime"
+#endif
+    fprintf(out_file, "\t<lastupdate> %ld </lastupdate> <!-- %s -->\n\n",
+          rrd.live_head->last_up,somestring);
+    for(i=0;i<rrd.stat_head->ds_cnt;i++){
+          fprintf(out_file, "\t<ds>\n");
+          fprintf(out_file, "\t\t<name> %s </name>\n",rrd.ds_def[i].ds_nam);
+          fprintf(out_file, "\t\t<type> %s </type>\n",rrd.ds_def[i].dst);
+       if (dst_conv(rrd.ds_def[i].dst) != DST_CDEF) {
+          fprintf(out_file, "\t\t<minimal_heartbeat> %lu </minimal_heartbeat>\n",rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt);
+             if (isnan(rrd.ds_def[i].par[DS_min_val].u_val)){
+                 fprintf(out_file, "\t\t<min> NaN </min>\n");
+             } else {
+                 fprintf(out_file, "\t\t<min> %0.10e </min>\n",rrd.ds_def[i].par[DS_min_val].u_val);
+             }
+             if (isnan(rrd.ds_def[i].par[DS_max_val].u_val)){
+                 fprintf(out_file, "\t\t<max> NaN </max>\n");
+             } else {
+                 fprintf(out_file, "\t\t<max> %0.10e </max>\n",rrd.ds_def[i].par[DS_max_val].u_val);
+             }
+       } else { /* DST_CDEF */
+             char *str=NULL;
+             rpn_compact2str((rpn_cdefds_t *) &(rrd.ds_def[i].par[DS_cdef]),rrd.ds_def,&str);
+             fprintf(out_file, "\t\t<cdef> %s </cdef>\n", str);
+             free(str);
+          }
+          fprintf(out_file, "\n\t\t<!-- PDP Status -->\n");
+          fprintf(out_file, "\t\t<last_ds> %s </last_ds>\n",rrd.pdp_prep[i].last_ds);
+          if (isnan(rrd.pdp_prep[i].scratch[PDP_val].u_val)){
+             fprintf(out_file, "\t\t<value> NaN </value>\n");
+          } else {
+             fprintf(out_file, "\t\t<value> %0.10e </value>\n",rrd.pdp_prep[i].scratch[PDP_val].u_val);
+          }
+             fprintf(out_file, "\t\t<unknown_sec> %lu </unknown_sec>\n",
+                     rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt);
+       
+             fprintf(out_file, "\t</ds>\n\n");
+       }
+
+    fputs("<!-- Round Robin Archives -->", out_file);
+
+    rra_base=ftell(in_file);    
+    rra_next = rra_base;
+
+    for(i=0;i<rrd.stat_head->rra_cnt;i++){
+       
+       long timer=0;
+       rra_start= rra_next;
+       rra_next +=  ( rrd.stat_head->ds_cnt
+                      * rrd.rra_def[i].row_cnt
+                      * sizeof(rrd_value_t));
+       fprintf(out_file, "\t<rra>\n");
+       fprintf(out_file, "\t\t<cf> %s </cf>\n",rrd.rra_def[i].cf_nam);
+       fprintf(out_file, "\t\t<pdp_per_row> %lu </pdp_per_row> <!-- %lu seconds -->\n\n",
+              rrd.rra_def[i].pdp_cnt, rrd.rra_def[i].pdp_cnt
+              *rrd.stat_head->pdp_step);
+       /* support for RRA parameters */
+       fprintf(out_file, "\t\t<params>\n");
+       switch(cf_conv(rrd.rra_def[i].cf_nam)) {
+       case CF_HWPREDICT:
+          fprintf(out_file, "\t\t<hw_alpha> %0.10e </hw_alpha>\n", 
+                 rrd.rra_def[i].par[RRA_hw_alpha].u_val);
+          fprintf(out_file, "\t\t<hw_beta> %0.10e </hw_beta>\n", 
+                 rrd.rra_def[i].par[RRA_hw_beta].u_val);
+          fprintf(out_file, "\t\t<dependent_rra_idx> %lu </dependent_rra_idx>\n",
+                 rrd.rra_def[i].par[RRA_dependent_rra_idx].u_cnt);
+          break;
+       case CF_SEASONAL:
+       case CF_DEVSEASONAL:
+          fprintf(out_file, "\t\t<seasonal_gamma> %0.10e </seasonal_gamma>\n", 
+                 rrd.rra_def[i].par[RRA_seasonal_gamma].u_val);
+          fprintf(out_file, "\t\t<seasonal_smooth_idx> %lu </seasonal_smooth_idx>\n",
+                 rrd.rra_def[i].par[RRA_seasonal_smooth_idx].u_cnt);
+          fprintf(out_file, "\t\t<dependent_rra_idx> %lu </dependent_rra_idx>\n",
+                 rrd.rra_def[i].par[RRA_dependent_rra_idx].u_cnt);
+          break;
+       case CF_FAILURES:
+          fprintf(out_file, "\t\t<delta_pos> %0.10e </delta_pos>\n", 
+                 rrd.rra_def[i].par[RRA_delta_pos].u_val);
+          fprintf(out_file, "\t\t<delta_neg> %0.10e </delta_neg>\n", 
+                 rrd.rra_def[i].par[RRA_delta_neg].u_val);
+          fprintf(out_file, "\t\t<window_len> %lu </window_len>\n",
+                 rrd.rra_def[i].par[RRA_window_len].u_cnt);
+          fprintf(out_file, "\t\t<failure_threshold> %lu </failure_threshold>\n",
+                 rrd.rra_def[i].par[RRA_failure_threshold].u_cnt);
+                 /* fall thru */
+       case CF_DEVPREDICT:
+          fprintf(out_file, "\t\t<dependent_rra_idx> %lu </dependent_rra_idx>\n",
+                 rrd.rra_def[i].par[RRA_dependent_rra_idx].u_cnt);
+          break;
+       case CF_AVERAGE:
+       case CF_MAXIMUM:
+       case CF_MINIMUM:
+       case CF_LAST:
+       default:
+          fprintf(out_file, "\t\t<xff> %0.10e </xff>\n", rrd.rra_def[i].par[RRA_cdp_xff_val].u_val);
+          break;
+       }
+       fprintf(out_file, "\t\t</params>\n");
+       fprintf(out_file, "\t\t<cdp_prep>\n");
+       for(ii=0;ii<rrd.stat_head->ds_cnt;ii++){
+               unsigned long ivalue;
+               fprintf(out_file, "\t\t\t<ds>\n");
+               /* support for exporting all CDP parameters */
+               /* parameters common to all CFs */
+                   /* primary_val and secondary_val do not need to be saved between updates
+                        * so strictly speaking they could be omitted.
+                        * However, they can be useful for diagnostic purposes, so are included here. */
+               value = rrd.cdp_prep[i*rrd.stat_head->ds_cnt
+                          +ii].scratch[CDP_primary_val].u_val;
+                       if (isnan(value)) {
+                          fprintf(out_file, "\t\t\t<primary_value> NaN </primary_value>\n");
+                       } else {
+                          fprintf(out_file, "\t\t\t<primary_value> %0.10e </primary_value>\n", value);
+                       }
+               value = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_secondary_val].u_val;
+                       if (isnan(value)) {
+                          fprintf(out_file, "\t\t\t<secondary_value> NaN </secondary_value>\n");
+                       } else {
+                          fprintf(out_file, "\t\t\t<secondary_value> %0.10e </secondary_value>\n", value);
+                       }
+               switch(cf_conv(rrd.rra_def[i].cf_nam)) {
+               case CF_HWPREDICT:
+               value = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_hw_intercept].u_val;
+                       if (isnan(value)) {
+                          fprintf(out_file, "\t\t\t<intercept> NaN </intercept>\n");
+                       } else {
+                          fprintf(out_file, "\t\t\t<intercept> %0.10e </intercept>\n", value);
+                       }
+               value = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_hw_last_intercept].u_val;
+                       if (isnan(value)) {
+                          fprintf(out_file, "\t\t\t<last_intercept> NaN </last_intercept>\n");
+                       } else {
+                          fprintf(out_file, "\t\t\t<last_intercept> %0.10e </last_intercept>\n", value);
+                       }
+               value = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_hw_slope].u_val;
+                       if (isnan(value)) {
+                          fprintf(out_file, "\t\t\t<slope> NaN </slope>\n");
+                       } else {
+                          fprintf(out_file, "\t\t\t<slope> %0.10e </slope>\n", value);
+                       }
+               value = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_hw_last_slope].u_val;
+                       if (isnan(value)) {
+                          fprintf(out_file, "\t\t\t<last_slope> NaN </last_slope>\n");
+                       } else {
+                          fprintf(out_file, "\t\t\t<last_slope> %0.10e </last_slope>\n", value);
+                       }
+                       ivalue = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_null_count].u_cnt;
+                       fprintf(out_file, "\t\t\t<nan_count> %lu </nan_count>\n", ivalue);
+                       ivalue = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_last_null_count].u_cnt;
+                       fprintf(out_file, "\t\t\t<last_nan_count> %lu </last_nan_count>\n", ivalue);
+                       break;
+               case CF_SEASONAL:
+               case CF_DEVSEASONAL:
+               value = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_hw_seasonal].u_val;
+                       if (isnan(value)) {
+                          fprintf(out_file, "\t\t\t<seasonal> NaN </seasonal>\n");
+                       } else {
+                          fprintf(out_file, "\t\t\t<seasonal> %0.10e </seasonal>\n", value);
+                       }
+               value = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_hw_last_seasonal].u_val;
+                       if (isnan(value)) {
+                          fprintf(out_file, "\t\t\t<last_seasonal> NaN </last_seasonal>\n");
+                       } else {
+                          fprintf(out_file, "\t\t\t<last_seasonal> %0.10e </last_seasonal>\n", value);
+                       }
+               ivalue = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_init_seasonal].u_cnt;
+                       fprintf(out_file, "\t\t\t<init_flag> %lu </init_flag>\n", ivalue);
+                       break;
+               case CF_DEVPREDICT:
+                       break;
+               case CF_FAILURES:
+                   {
+            unsigned short vidx;
+                       char *violations_array = (char *) ((void*) 
+                          rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch);
+                       fprintf(out_file, "\t\t\t<history> ");
+                       for (vidx = 0; vidx < rrd.rra_def[i].par[RRA_window_len].u_cnt; ++vidx)
+                       {
+                               fprintf(out_file, "%d",violations_array[vidx]);
+                       }
+                       fprintf(out_file, " </history>\n");
+                       }
+                       break;
+               case CF_AVERAGE:
+               case CF_MAXIMUM:
+               case CF_MINIMUM:
+               case CF_LAST:
+               default:
+               value = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_val].u_val;
+                       if (isnan(value)) {
+                          fprintf(out_file, "\t\t\t<value> NaN </value>\n");
+                       } else {
+                          fprintf(out_file, "\t\t\t<value> %0.10e </value>\n", value);
+                       }
+                   fprintf(out_file, "\t\t\t<unknown_datapoints> %lu </unknown_datapoints>\n",
+                      rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_unkn_pdp_cnt].u_cnt);
+                       break;
+               }
+        fprintf(out_file, "\t\t\t</ds>\n");     
+    }
+       fprintf(out_file, "\t\t</cdp_prep>\n");
+
+       fprintf(out_file, "\t\t<database>\n");
+       fseek(in_file,(rra_start
+                      +(rrd.rra_ptr[i].cur_row+1)
+                      * rrd.stat_head->ds_cnt
+                      * sizeof(rrd_value_t)),SEEK_SET);
+       timer = - (rrd.rra_def[i].row_cnt-1);
+       ii=rrd.rra_ptr[i].cur_row;
+       for(ix=0;ix<rrd.rra_def[i].row_cnt;ix++){           
+           ii++;
+           if (ii>=rrd.rra_def[i].row_cnt) {
+               fseek(in_file,rra_start,SEEK_SET);
+               ii=0; /* wrap if max row cnt is reached */
+           }
+           now = (rrd.live_head->last_up 
+                  - rrd.live_head->last_up 
+                  % (rrd.rra_def[i].pdp_cnt*rrd.stat_head->pdp_step)) 
+               + (timer*rrd.rra_def[i].pdp_cnt*rrd.stat_head->pdp_step);
+
+           timer++;
+#if HAVE_STRFTIME
+           localtime_r(&now, &tm);
+           strftime(somestring,200,"%Y-%m-%d %H:%M:%S %Z", &tm);
+#else
+# error "Need strftime"
+#endif
+           fprintf(out_file, "\t\t\t<!-- %s / %d --> <row>",somestring,(int)now);
+           for(iii=0;iii<rrd.stat_head->ds_cnt;iii++){                  
+               fread(&my_cdp,sizeof(rrd_value_t),1,in_file);           
+               if (isnan(my_cdp)){
+                 fprintf(out_file, "<v> NaN </v>");
+               } else {
+                 fprintf(out_file, "<v> %0.10e </v>",my_cdp);
+               };
+           }
+           fprintf(out_file, "</row>\n");
+       }
+       fprintf(out_file, "\t\t</database>\n\t</rra>\n");
+       
+    }
+    fprintf(out_file, "</rrd>\n");
+    rrd_free(&rrd);
+    fclose(in_file);
+    if (out_file != stdout)
+    {
+      fclose(out_file);
+    }
+    return(0);
+}
+
+
+
+
diff --git a/src/rrd_error.c b/src/rrd_error.c
new file mode 100644 (file)
index 0000000..a3c958c
--- /dev/null
@@ -0,0 +1,145 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_error.c   Common Header File
+ *****************************************************************************
+ * $Id: rrd_error.c 1235 2007-11-20 00:15:07Z oetiker $
+ * $Log$
+ * Revision 1.4  2003/02/22 21:57:03  oetiker
+ * a patch to avoid a memory leak and a Makefile.am patch to
+ * distribute all required source files -- Peter Stamfest <peter@stamfest.at>
+ *
+ * Revision 1.3  2003/02/13 07:05:27  oetiker
+ * Find attached the patch I promised to send to you. Please note that there
+ * are three new source files (src/rrd_is_thread_safe.h, src/rrd_thread_safe.c
+ * and src/rrd_not_thread_safe.c) and the introduction of librrd_th. This
+ * library is identical to librrd, but it contains support code for per-thread
+ * global variables currently used for error information only. This is similar
+ * to how errno per-thread variables are implemented.  librrd_th must be linked
+ * alongside of libpthred
+ *
+ * There is also a new file "THREADS", holding some documentation.
+ *
+ * -- Peter Stamfest <peter@stamfest.at>
+ *
+ * Revision 1.2  2002/02/01 20:34:49  oetiker
+ * fixed version number and date/time
+ *
+ * Revision 1.1.1.1  2001/02/25 22:25:05  oetiker
+ * checkin
+ *
+ *************************************************************************** */
+
+#include "rrd_tool.h"
+#include <stdarg.h>
+
+#define MAXLEN 4096
+#define ERRBUFLEN 256
+#define CTX (rrd_get_context())
+
+void
+rrd_set_error(char *fmt, ...)
+{
+    va_list argp;
+    rrd_clear_error();
+    va_start(argp, fmt);
+#ifdef HAVE_VSNPRINTF
+    vsnprintf(CTX->rrd_error, CTX->len, fmt, argp);
+#else
+    vsprintf(CTX->rrd_error, fmt, argp);
+#endif
+    va_end(argp);
+}
+
+int
+rrd_test_error(void) {
+    return CTX->rrd_error[0] != '\0';
+}
+
+void
+rrd_clear_error(void){
+    CTX->rrd_error[0] = '\0';
+}
+
+char *
+rrd_get_error(void){
+    return CTX->rrd_error;
+}
+
+#if 0
+/* PS: Keep this stuff around, maybe we want it again if we use
+   rrd_contexts to really associate them with single RRD files and
+   operations on them... Then a single thread may use more than one
+   context. Using these functions would require to change each and
+   every function containing any of the non _r versions... */
+void
+rrd_set_error_r(struct rrd_context *rrd_ctx, char *fmt, ...)
+{
+    va_list argp;
+    rrd_clear_error_r(rrd_ctx);
+    va_start(argp, fmt);
+#ifdef HAVE_VSNPRINTF
+    vsnprintf((char *)rrd_ctx->rrd_error, rrd_ctx->len, fmt, argp);
+    rrd_ctx->rrd_error[rrd_ctx->len]='\0';
+#else
+    vsprintf((char *)rrd_ctx->rrd_error, fmt, argp);
+#endif
+    va_end(argp);
+}
+
+int
+rrd_test_error_r(struct rrd_context *rrd_ctx) {
+    return rrd_ctx->rrd_error[0] != '\0';
+}
+
+void
+rrd_clear_error_r(struct rrd_context *rrd_ctx) {
+    rrd_ctx->rrd_error[0] = '\0';
+}
+
+char *
+rrd_get_error_r(struct rrd_context *rrd_ctx) {
+    return (char *)rrd_ctx->rrd_error;
+}
+#endif
+
+/* PS: Should we move this to some other file? It is not really error
+   related. */
+struct rrd_context *
+rrd_new_context(void) {
+    struct rrd_context *rrd_ctx = 
+       (struct rrd_context *) malloc(sizeof(struct rrd_context));
+
+    if (rrd_ctx) {
+       rrd_ctx->rrd_error = malloc(MAXLEN+10);
+       rrd_ctx->lib_errstr = malloc(ERRBUFLEN+10);
+       if (rrd_ctx->rrd_error && rrd_ctx->lib_errstr) {
+           *rrd_ctx->rrd_error = 0;
+           *rrd_ctx->lib_errstr = 0;
+           rrd_ctx->len = MAXLEN;
+           rrd_ctx->errlen = ERRBUFLEN;
+           return rrd_ctx;
+       }
+       if (rrd_ctx->rrd_error) free(rrd_ctx->rrd_error);
+       if (rrd_ctx->lib_errstr) free(rrd_ctx->lib_errstr);
+       free(rrd_ctx);
+    }
+    return NULL;
+}
+
+void
+rrd_free_context(struct rrd_context *rrd_ctx) {
+    if (rrd_ctx) {
+       if (rrd_ctx->rrd_error) free(rrd_ctx->rrd_error);
+       if (rrd_ctx->lib_errstr) free(rrd_ctx->lib_errstr);
+       free(rrd_ctx);
+    }
+}
+
+#if 0
+void rrd_globalize_error(struct rrd_context *rrd_ctx) {
+    if (rrd_ctx) {
+       rrd_set_error(rrd_ctx->rrd_error);
+    }
+}
+#endif
diff --git a/src/rrd_fetch.c b/src/rrd_fetch.c
new file mode 100644 (file)
index 0000000..5dfcaab
--- /dev/null
@@ -0,0 +1,472 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_fetch.c  read date from an rrd to use for further processing
+ *****************************************************************************
+ * $Id: rrd_fetch.c 1235 2007-11-20 00:15:07Z oetiker $
+ * $Log$
+ * Revision 1.8  2004/05/18 18:53:03  oetiker
+ * big spell checking patch -- slif@bellsouth.net
+ *
+ * Revision 1.7  2003/11/11 19:46:21  oetiker
+ * replaced time_value with rrd_time_value as MacOS X introduced a struct of that name in their standard headers
+ *
+ * Revision 1.6  2003/01/16 23:27:54  oetiker
+ * fix border condition in rra selection of rrd_fetch
+ * -- Stanislav Sinyagin <ssinyagin@yahoo.com>
+ *
+ * Revision 1.5  2002/06/23 22:29:40  alex
+ * Added "step=1800" and such to "DEF"
+ * Cleaned some of the signed vs. unsigned problems
+ *
+ * Revision 1.4  2002/02/01 20:34:49  oetiker
+ * fixed version number and date/time
+ *
+ * Revision 1.3  2001/12/24 06:51:49  alex
+ * A patch of size 44Kbytes... in short:
+ *
+ * Found and repaired the off-by-one error in rrd_fetch_fn().
+ * As a result I had to remove the hacks in rrd_fetch_fn(),
+ * rrd_tool.c, vdef_calc(), data_calc(), data_proc() and
+ * reduce_data().  There may be other places which I didn't
+ * find so be careful.
+ *
+ * Enhanced debugging in rrd_fetch_fn(), it shows the RRA selection
+ * process.
+ *
+ * Added the ability to print VDEF timestamps.  At the moment it
+ * is a hack, I needed it now to fix the off-by-one error.
+ * If the format string is "%c" (and nothing else!), the time
+ * will be printed by both ctime() and as a long int.
+ *
+ * Moved some code around (slightly altering it) from rrd_graph()
+ *   initializing     now in rrd_graph_init()
+ *   options parsing  now in rrd_graph_options()
+ *   script parsing   now in rrd_graph_script()
+ *
+ * Revision 1.2  2001/12/17 12:48:43  oetiker
+ * fix overflow error ...
+ *
+ * Revision 1.1.1.1  2001/02/25 22:25:05  oetiker
+ * checkin
+ *
+ *****************************************************************************/
+
+#include "rrd_tool.h"
+
+#include "rrd_is_thread_safe.h"
+/*#define DEBUG*/
+
+int
+rrd_fetch(int argc, 
+         char **argv,
+         time_t         *start,
+         time_t         *end,       /* which time frame do you want ?
+                                     * will be changed to represent reality */
+         unsigned long  *step,      /* which stepsize do you want? 
+                                     * will be changed to represent reality */
+         unsigned long  *ds_cnt,    /* number of data sources in file */
+         char           ***ds_namv,   /* names of data sources */
+         rrd_value_t    **data)     /* two dimensional array containing the data */
+{
+
+
+    long     step_tmp =1;
+    time_t   start_tmp=0, end_tmp=0;
+    const char *cf;
+
+    struct rrd_time_value start_tv, end_tv;
+    char     *parsetime_error = NULL;
+    optind = 0; opterr = 0;  /* initialize getopt */
+
+    /* init start and end time */
+    parsetime("end-24h", &start_tv);
+    parsetime("now", &end_tv);
+
+    while (1){
+       static struct option long_options[] =
+       {
+           {"resolution",      required_argument, 0, 'r'},
+           {"start",      required_argument, 0, 's'},
+           {"end",      required_argument, 0, 'e'},
+           {0,0,0,0}
+       };
+       int option_index = 0;
+       int opt;
+       opt = getopt_long(argc, argv, "r:s:e:", 
+                         long_options, &option_index);
+
+       if (opt == EOF)
+           break;
+
+       switch(opt) {
+       case 's':
+            if ((parsetime_error = parsetime(optarg, &start_tv))) {
+                rrd_set_error( "start time: %s", parsetime_error );
+                return -1;
+           }
+           break;
+       case 'e':
+            if ((parsetime_error = parsetime(optarg, &end_tv))) {
+                rrd_set_error( "end time: %s", parsetime_error );
+                return -1;
+           }
+           break;
+       case 'r':
+           step_tmp = atol(optarg);
+           break;
+       case '?':
+           rrd_set_error("unknown option '-%c'",optopt);
+           return(-1);
+       }
+    }
+
+    
+    if (proc_start_end(&start_tv,&end_tv,&start_tmp,&end_tmp) == -1){
+       return -1;
+    }  
+
+    
+    if (start_tmp < 3600*24*365*10){
+       rrd_set_error("the first entry to fetch should be after 1980");
+       return(-1);
+    }
+    
+    if (end_tmp < start_tmp) {
+       rrd_set_error("start (%ld) should be less than end (%ld)", start_tmp, end_tmp);
+       return(-1);
+    }
+    
+    *start = start_tmp;
+    *end = end_tmp;
+
+    if (step_tmp < 1) {
+       rrd_set_error("step must be >= 1 second");
+       return -1;
+    }
+    *step = step_tmp;
+    
+    if (optind + 1 >= argc){
+       rrd_set_error("not enough arguments");
+       return -1;
+    }
+
+    cf = argv[optind+1];
+
+    if (rrd_fetch_r(argv[optind],cf,start,end,step,ds_cnt,ds_namv,data) == -1)
+       return(-1);
+    return (0);
+}
+
+int
+rrd_fetch_r(
+    const char           *filename,  /* name of the rrd */
+    const char           *cf,        /* which consolidation function ?*/
+    time_t         *start,
+    time_t         *end,       /* which time frame do you want ?
+                                * will be changed to represent reality */
+    unsigned long  *step,      /* which stepsize do you want? 
+                                * will be changed to represent reality */
+    unsigned long  *ds_cnt,    /* number of data sources in file */
+    char           ***ds_namv, /* names of data_sources */
+    rrd_value_t    **data)     /* two dimensional array containing the data */
+{
+    enum     cf_en cf_idx;
+
+    if ((int)(cf_idx=cf_conv(cf)) == -1 ){
+        return -1;
+    }
+
+    return (rrd_fetch_fn(filename,cf_idx,start,end,step,ds_cnt,ds_namv,data));
+}
+
+int
+rrd_fetch_fn(
+    const char     *filename,  /* name of the rrd */
+    enum cf_en     cf_idx,         /* which consolidation function ?*/
+    time_t         *start,
+    time_t         *end,       /* which time frame do you want ?
+                               * will be changed to represent reality */
+    unsigned long  *step,      /* which stepsize do you want? 
+                               * will be changed to represent reality */
+    unsigned long  *ds_cnt,    /* number of data sources in file */
+    char           ***ds_namv,   /* names of data_sources */
+    rrd_value_t    **data)     /* two dimensional array containing the data */
+{
+    long           i,ii;
+    FILE           *in_file;
+    time_t         cal_start,cal_end, rra_start_time,rra_end_time;
+    long  best_full_rra=0, best_part_rra=0, chosen_rra=0, rra_pointer=0;
+    long  best_full_step_diff=0, best_part_step_diff=0, tmp_step_diff=0, tmp_match=0, best_match=0;
+    long  full_match, rra_base;
+    long           start_offset, end_offset;
+    int            first_full = 1;
+    int            first_part = 1;
+    rrd_t     rrd;
+    rrd_value_t    *data_ptr;
+    unsigned long  rows;
+
+#ifdef DEBUG
+fprintf(stderr,"Entered rrd_fetch_fn() searching for the best match\n");
+fprintf(stderr,"Looking for: start %10lu end %10lu step %5lu\n",
+                                               *start,*end,*step);
+#endif
+
+    if(rrd_open(filename,&in_file,&rrd, RRD_READONLY)==-1)
+       return(-1);
+    
+    /* when was the really last update of this file ? */
+
+    if (((*ds_namv) = (char **) malloc(rrd.stat_head->ds_cnt * sizeof(char*)))==NULL){
+       rrd_set_error("malloc fetch ds_namv array");
+       rrd_free(&rrd);
+       fclose(in_file);
+       return(-1);
+    }
+    
+    for(i=0;(unsigned long)i<rrd.stat_head->ds_cnt;i++){
+       if ((((*ds_namv)[i]) = malloc(sizeof(char) * DS_NAM_SIZE))==NULL){
+           rrd_set_error("malloc fetch ds_namv entry");
+           rrd_free(&rrd);
+           free(*ds_namv);
+           fclose(in_file);
+           return(-1);
+       }
+       strncpy((*ds_namv)[i],rrd.ds_def[i].ds_nam,DS_NAM_SIZE-1);
+       (*ds_namv)[i][DS_NAM_SIZE-1]='\0';
+
+    }
+    
+    /* find the rra which best matches the requirements */
+    for(i=0;(unsigned)i<rrd.stat_head->rra_cnt;i++){
+       if(cf_conv(rrd.rra_def[i].cf_nam) == cf_idx){
+           
+           cal_end = (rrd.live_head->last_up - (rrd.live_head->last_up 
+                         % (rrd.rra_def[i].pdp_cnt 
+                            * rrd.stat_head->pdp_step)));
+           cal_start = (cal_end 
+                        - (rrd.rra_def[i].pdp_cnt 
+                           * rrd.rra_def[i].row_cnt
+                           * rrd.stat_head->pdp_step));
+
+           full_match = *end -*start;
+#ifdef DEBUG
+fprintf(stderr,"Considering: start %10lu end %10lu step %5lu ",
+                                                       cal_start,cal_end,
+                       rrd.stat_head->pdp_step * rrd.rra_def[i].pdp_cnt);
+#endif
+           /* we need step difference in either full or partial case */
+           tmp_step_diff = labs(*step - (rrd.stat_head->pdp_step
+                                          * rrd.rra_def[i].pdp_cnt));
+           /* best full match */
+           if(cal_end >= *end 
+              && cal_start <= *start){
+               if (first_full || (tmp_step_diff < best_full_step_diff)){
+                   first_full=0;
+                   best_full_step_diff = tmp_step_diff;
+                   best_full_rra=i;
+#ifdef DEBUG
+fprintf(stderr,"best full match so far\n");
+#endif
+               } else {
+#ifdef DEBUG
+fprintf(stderr,"full match, not best\n");
+#endif
+               }
+               
+           } else {
+               /* best partial match */
+               tmp_match = full_match;
+               if (cal_start>*start)
+                   tmp_match -= (cal_start-*start);
+               if (cal_end<*end)
+                   tmp_match -= (*end-cal_end);                
+               if (first_part ||
+                    (best_match < tmp_match) ||
+                    (best_match == tmp_match && 
+                     tmp_step_diff < best_part_step_diff)){ 
+#ifdef DEBUG
+fprintf(stderr,"best partial so far\n");
+#endif
+                   first_part=0;
+                   best_match = tmp_match;
+                   best_part_step_diff = tmp_step_diff;
+                   best_part_rra =i;
+               } else {
+#ifdef DEBUG
+fprintf(stderr,"partial match, not best\n");
+#endif
+               }
+           }
+       }
+    }
+
+    /* lets see how the matching went. */
+    if (first_full==0)
+       chosen_rra = best_full_rra;
+    else if (first_part==0)
+       chosen_rra = best_part_rra;
+    else {
+       rrd_set_error("the RRD does not contain an RRA matching the chosen CF");
+       rrd_free(&rrd);
+       fclose(in_file);
+       return(-1);
+    }
+       
+    /* set the wish parameters to their real values */
+    *step = rrd.stat_head->pdp_step * rrd.rra_def[chosen_rra].pdp_cnt;
+    *start -= (*start % *step);
+    *end += (*step - *end % *step);
+    rows = (*end - *start) / *step + 1;
+
+#ifdef DEBUG
+    fprintf(stderr,"We found:    start %10lu end %10lu step %5lu rows  %lu\n",
+                                               *start,*end,*step,rows);
+#endif
+
+/* Start and end are now multiples of the step size.  The amount of
+** steps we want is (end-start)/step and *not* an extra one.
+** Reasoning:  if step is s and we want to graph from t to t+s,
+** we need exactly ((t+s)-t)/s rows.  The row to collect from the
+** database is the one with time stamp (t+s) which means t to t+s.
+*/
+    *ds_cnt =   rrd.stat_head->ds_cnt; 
+    if (((*data) = malloc(*ds_cnt * rows * sizeof(rrd_value_t)))==NULL){
+       rrd_set_error("malloc fetch data area");
+       for (i=0;(unsigned long)i<*ds_cnt;i++)
+             free((*ds_namv)[i]);
+       free(*ds_namv);
+       rrd_free(&rrd);
+       fclose(in_file);
+       return(-1);
+    }
+    
+    data_ptr=(*data);
+    
+    /* find base address of rra */
+    rra_base=ftell(in_file);
+    for(i=0;i<chosen_rra;i++)
+       rra_base += ( *ds_cnt
+                     * rrd.rra_def[i].row_cnt
+                     * sizeof(rrd_value_t));
+
+    /* find start and end offset */
+    rra_end_time = (rrd.live_head->last_up 
+                   - (rrd.live_head->last_up % *step));
+    rra_start_time = (rra_end_time
+                - ( *step * (rrd.rra_def[chosen_rra].row_cnt-1)));
+    /* here's an error by one if we don't be careful */
+    start_offset =(long)(*start + *step - rra_start_time) / (long)*step;
+    end_offset = (long)(rra_end_time - *end ) / (long)*step; 
+#ifdef DEBUG
+    fprintf(stderr,"rra_start %lu, rra_end %lu, start_off %li, end_off %li\n",
+           rra_start_time,rra_end_time,start_offset,end_offset);
+#endif
+
+    /* fill the gap at the start if needs be */
+
+    if (start_offset <= 0)
+       rra_pointer = rrd.rra_ptr[chosen_rra].cur_row+1;
+    else 
+       rra_pointer = rrd.rra_ptr[chosen_rra].cur_row+1+start_offset;
+    
+    if(fseek(in_file,(rra_base 
+                  + (rra_pointer
+                     * *ds_cnt
+                     * sizeof(rrd_value_t))),SEEK_SET) != 0){
+       rrd_set_error("seek error in RRA");
+       for (i=0;(unsigned)i<*ds_cnt;i++)
+             free((*ds_namv)[i]);
+       free(*ds_namv);
+       rrd_free(&rrd);
+       free(*data);
+       *data = NULL;
+       fclose(in_file);
+       return(-1);
+
+    }
+#ifdef DEBUG
+    fprintf(stderr,"First Seek: rra_base %lu rra_pointer %lu\n",
+           rra_base, rra_pointer);
+#endif
+    /* step trough the array */
+
+    for (i=start_offset;
+        i< (signed)rrd.rra_def[chosen_rra].row_cnt - end_offset;
+        i++){
+       /* no valid data yet */
+       if (i<0) {
+#ifdef DEBUG
+           fprintf(stderr,"pre fetch %li -- ",i);
+#endif
+           for(ii=0;(unsigned)ii<*ds_cnt;ii++){
+               *(data_ptr++) = DNAN;
+#ifdef DEBUG
+               fprintf(stderr,"%10.2f ",*(data_ptr-1));
+#endif
+           }
+       } 
+       /* past the valid data area */
+       else if (i >= (signed)rrd.rra_def[chosen_rra].row_cnt) {
+#ifdef DEBUG
+           fprintf(stderr,"post fetch %li -- ",i);
+#endif
+           for(ii=0;(unsigned)ii<*ds_cnt;ii++){
+               *(data_ptr++) = DNAN;
+#ifdef DEBUG
+               fprintf(stderr,"%10.2f ",*(data_ptr-1));
+#endif
+           }
+       } else {
+           /* OK we are inside the valid area but the pointer has to 
+            * be wrapped*/
+           if (rra_pointer >= (signed)rrd.rra_def[chosen_rra].row_cnt) {
+               rra_pointer -= rrd.rra_def[chosen_rra].row_cnt;
+               if(fseek(in_file,(rra_base+rra_pointer
+                              * *ds_cnt
+                              * sizeof(rrd_value_t)),SEEK_SET) != 0){
+                   rrd_set_error("wrap seek in RRA did fail");
+                   for (ii=0;(unsigned)ii<*ds_cnt;ii++)
+                       free((*ds_namv)[ii]);
+                   free(*ds_namv);
+                   rrd_free(&rrd);
+                   free(*data);
+                   *data = NULL;
+                   fclose(in_file);
+                   return(-1);
+               }
+#ifdef DEBUG
+               fprintf(stderr,"wrap seek ...\n");
+#endif     
+           }
+           
+           if(fread(data_ptr,
+                    sizeof(rrd_value_t),
+                    *ds_cnt,in_file) != rrd.stat_head->ds_cnt){
+               rrd_set_error("fetching cdp from rra");
+               for (ii=0;(unsigned)ii<*ds_cnt;ii++)
+                   free((*ds_namv)[ii]);
+               free(*ds_namv);
+               rrd_free(&rrd);
+               free(*data);
+               *data = NULL;
+               fclose(in_file);
+               return(-1);
+           }
+#ifdef DEBUG
+           fprintf(stderr,"post fetch %li -- ",i);
+           for(ii=0;ii<*ds_cnt;ii++)
+               fprintf(stderr,"%10.2f ",*(data_ptr+ii));
+#endif
+           data_ptr += *ds_cnt;
+           rra_pointer ++;
+       }
+#ifdef DEBUG
+           fprintf(stderr,"\n");
+#endif     
+       
+    }
+    rrd_free(&rrd);
+    fclose(in_file);
+    return(0);
+}
diff --git a/src/rrd_first.c b/src/rrd_first.c
new file mode 100644 (file)
index 0000000..f1267af
--- /dev/null
@@ -0,0 +1,100 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_first Return
+ *****************************************************************************
+ * Initial version by Burton Strauss, ntopSupport.com - 3/2005
+ *****************************************************************************/
+
+#include "rrd_tool.h"
+
+
+time_t
+rrd_first(int argc, char **argv)
+{
+    int target_rraindex=0;
+    char *endptr;
+    optind = 0; opterr = 0;  /* initialize getopt */
+
+    while (1){
+        static struct option long_options[] =
+        {
+            {"rraindex", required_argument, 0, 129},
+            {0,0,0,0}
+        };
+        int option_index = 0;
+        int opt;
+        opt = getopt_long(argc, argv, "", long_options, &option_index);
+
+        if(opt == EOF)
+            break;
+
+        switch(opt) {
+          case 129:
+            target_rraindex=strtol(optarg,&endptr,0);
+            if(target_rraindex < 0) {
+                rrd_set_error("invalid rraindex number");
+                return(-1);
+            }
+            break;
+          default:
+            rrd_set_error("usage rrdtool %s [--rraindex number] file.rrd", argv[0]);
+            return(-1);
+        }
+    }
+
+    if(optind >= argc){
+        rrd_set_error("not enough arguments");
+        return -1;       
+    }     
+
+    return(rrd_first_r(argv[optind], target_rraindex));
+}
+
+
+time_t
+rrd_first_r(const char *filename, const int rraindex)
+{
+    long rra_start,
+         timer;
+    time_t then;
+    FILE *in_file;
+    rrd_t rrd;
+
+    if(rrd_open(filename,&in_file,&rrd, RRD_READONLY)==-1){
+        rrd_set_error("could not open RRD");
+        return(-1);
+    }
+
+    if((rraindex < 0) || (rraindex >= (int)rrd.stat_head->rra_cnt)) {
+        rrd_set_error("invalid rraindex number");
+        rrd_free(&rrd);
+        fclose(in_file);
+        return(-1);
+    }
+
+    rra_start = ftell(in_file);    
+    fseek(in_file,
+          (rra_start +
+           (rrd.rra_ptr[rraindex].cur_row+1) *
+           rrd.stat_head->ds_cnt *
+           sizeof(rrd_value_t)),
+          SEEK_SET);
+    timer = - (rrd.rra_def[rraindex].row_cnt-1);
+    if (rrd.rra_ptr[rraindex].cur_row + 1 > rrd.rra_def[rraindex].row_cnt) {
+      fseek(in_file,rra_start,SEEK_SET);
+    }
+    then = (rrd.live_head->last_up -
+            rrd.live_head->last_up %
+            (rrd.rra_def[rraindex].pdp_cnt*rrd.stat_head->pdp_step)) +
+           (timer * 
+            rrd.rra_def[rraindex].pdp_cnt*rrd.stat_head->pdp_step);
+
+    rrd_free(&rrd);
+    fclose(in_file);
+    return(then);
+}
+
+
+
+
diff --git a/src/rrd_format.c b/src/rrd_format.c
new file mode 100644 (file)
index 0000000..bccc0d4
--- /dev/null
@@ -0,0 +1,94 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_format.c  RRD Database Format helper functions
+ *****************************************************************************
+ * $Id: rrd_format.c 1235 2007-11-20 00:15:07Z oetiker $
+ * $Log$
+ * Revision 1.5  2004/05/18 18:53:03  oetiker
+ * big spell checking patch -- slif@bellsouth.net
+ *
+ * Revision 1.4  2003/02/13 07:05:27  oetiker
+ * Find attached the patch I promised to send to you. Please note that there
+ * are three new source files (src/rrd_is_thread_safe.h, src/rrd_thread_safe.c
+ * and src/rrd_not_thread_safe.c) and the introduction of librrd_th. This
+ * library is identical to librrd, but it contains support code for per-thread
+ * global variables currently used for error information only. This is similar
+ * to how errno per-thread variables are implemented.  librrd_th must be linked
+ * alongside of libpthred
+ *
+ * There is also a new file "THREADS", holding some documentation.
+ *
+ * -- Peter Stamfest <peter@stamfest.at>
+ *
+ * Revision 1.3  2002/02/01 20:34:49  oetiker
+ * fixed version number and date/time
+ *
+ * Revision 1.2  2001/03/10 23:54:39  oetiker
+ * Support for COMPUTE data sources (CDEF data sources). Removes the RPN
+ * parser and calculator from rrd_graph and puts then in a new file,
+ * rrd_rpncalc.c. Changes to core files rrd_create and rrd_update. Some
+ * clean-up of aberrant behavior stuff, including a bug fix.
+ * Documentation update (rrdcreate.pod, rrdupdate.pod). Change xml format.
+ * -- Jake Brutlag <jakeb@corp.webtv.net>
+ *
+ * Revision 1.1.1.1  2001/02/25 22:25:05  oetiker
+ * checkin
+ *
+ * Revision 1.3  1998/03/08 12:35:11  oetiker
+ * checkpointing things because the current setup seems to work
+ * according to the things said in the manpages
+ *
+ * Revision 1.2  1998/02/26 22:58:22  oetiker
+ * fixed define
+ *
+ * Revision 1.1  1998/02/21 16:14:41  oetiker
+ * Initial revision
+ *
+ *
+ *****************************************************************************/
+#include "rrd_tool.h"
+
+#define converter(VV,VVV) \
+   if (strcmp(#VV, string) == 0) return VVV;
+
+/* conversion functions to allow symbolic entry of enumerations */
+enum dst_en dst_conv(char *string)
+{
+    converter(COUNTER,DST_COUNTER)
+    converter(ABSOLUTE,DST_ABSOLUTE)
+    converter(GAUGE,DST_GAUGE)
+    converter(DERIVE,DST_DERIVE)
+    converter(COMPUTE,DST_CDEF)
+    rrd_set_error("unknown data acquisition function '%s'",string);
+    return(-1);
+}
+
+
+enum cf_en cf_conv(const char *string)
+{
+
+    converter(AVERAGE,CF_AVERAGE)
+    converter(MIN,CF_MINIMUM)
+    converter(MAX,CF_MAXIMUM)
+    converter(LAST,CF_LAST)
+    converter(HWPREDICT,CF_HWPREDICT)
+    converter(DEVPREDICT,CF_DEVPREDICT)
+    converter(SEASONAL,CF_SEASONAL)
+    converter(DEVSEASONAL,CF_DEVSEASONAL)
+    converter(FAILURES,CF_FAILURES)
+    rrd_set_error("unknown consolidation function '%s'",string);
+    return(-1);
+}
+
+#undef converter       
+
+long
+ds_match(rrd_t *rrd,char *ds_nam){
+    unsigned long i;
+    for(i=0;i<rrd->stat_head->ds_cnt;i++)
+       if ((strcmp(ds_nam,rrd->ds_def[i].ds_nam))==0)
+           return i;
+    rrd_set_error("unknown data source name '%s'",ds_nam);
+    return -1;
+}
diff --git a/src/rrd_format.h b/src/rrd_format.h
new file mode 100644 (file)
index 0000000..34022f2
--- /dev/null
@@ -0,0 +1,398 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_format.h  RRD Database Format header
+ *****************************************************************************/
+
+#ifndef _RRD_FORMAT_H
+#define _RRD_FORMAT_H
+
+#include "rrd.h"
+
+/*****************************************************************************
+ * put this in your /usr/lib/magic file (/etc/magic on HPUX)
+ *
+ *  # rrd database format
+ *  0       string          RRD\0           rrd file
+ *  >5      string          >\0             version '%s'
+ *
+ *****************************************************************************/
+
+#define RRD_COOKIE    "RRD"
+/* #define RRD_VERSION   "0002" */
+/* changed because microsecond precision requires another field */
+#define RRD_VERSION   "0003"
+#define FLOAT_COOKIE  8.642135E130
+
+#include "rrd_nan_inf.h"
+
+typedef union unival { 
+    unsigned long u_cnt; 
+    rrd_value_t   u_val;
+} unival;
+
+
+/****************************************************************************
+ * The RRD Database Structure
+ * ---------------------------
+ * 
+ * In oder to properly describe the database structure lets define a few
+ * new words:
+ *
+ * ds - Data Source (ds) providing input to the database. A Data Source (ds)
+ *       can be a traffic counter, a temperature, the number of users logged
+ *       into a system. The rrd database format can handle the input of
+ *       several Data Sources (ds) in a singe database.
+ *  
+ * dst - Data Source Type (dst). The Data Source Type (dst) defines the rules
+ *       applied to Build Primary Data Points from the input provided by the
+ *       data sources (ds).
+ *
+ * pdp - Primary Data Point (pdp). After the database has accepted the
+ *       input from the data sources (ds). It starts building Primary
+ *       Data Points (pdp) from the data. Primary Data Points (pdp)
+ *       are evenly spaced along the time axis (pdp_step). The values
+ *       of the Primary Data Points are calculated from the values of
+ *       the data source (ds) and the exact time these values were
+ *       provided by the data source (ds).
+ *
+ * pdp_st - PDP Start (pdp_st). The moments (pdp_st) in time where
+ *       these steps occur are defined by the moments where the
+ *       number of seconds since 1970-jan-1 modulo pdp_step equals
+ *       zero (pdp_st). 
+ *
+ * cf -  Consolidation Function (cf). An arbitrary Consolidation Function (cf)
+ *       (averaging, min, max) is applied to the primary data points (pdp) to
+ *       calculate the consolidated data point.
+ *
+ * cdp - Consolidated Data Point (cdp) is the long term storage format for data
+ *       in the rrd database. Consolidated Data Points represent one or
+ *       several primary data points collected along the time axis. The
+ *       Consolidated Data Points (cdp) are stored in Round Robin Archives
+ *       (rra).
+ *
+ * rra - Round Robin Archive (rra). This is the place where the
+ *       consolidated data points (cdp) get stored. The data is
+ *       organized in rows (row) and columns (col). The Round Robin
+ *       Archive got its name from the method data is stored in
+ *       there. An RRD database can contain several Round Robin
+ *       Archives. Each Round Robin Archive can have a different row
+ *       spacing along the time axis (pdp_cnt) and a different
+ *       consolidation function (cf) used to build its consolidated
+ *       data points (cdp).  
+ * 
+ * rra_st - RRA Start (rra_st). The moments (rra_st) in time where
+ *       Consolidated Data Points (cdp) are added to an rra are
+ *       defined by the moments where the number of seconds since
+ *       1970-jan-1 modulo pdp_cnt*pdp_step equals zero (rra_st).
+ *
+ * row - Row (row). A row represent all consolidated data points (cdp)
+ *       in a round robin archive who are of the same age.
+ *       
+ * col - Column (col). A column (col) represent all consolidated
+ *       data points (cdp) in a round robin archive (rra) who
+ *       originated from the same data source (ds).
+ *
+ */
+
+/****************************************************************************
+ * POS 1: stat_head_t                           static header of the database
+ ****************************************************************************/
+
+typedef struct stat_head_t {
+
+    /* Data Base Identification Section ***/
+    char             cookie[4];          /* RRD */
+    char             version[5];         /* version of the format */
+    double           float_cookie;       /* is it the correct double
+                                         * representation ?  */
+
+    /* Data Base Structure Definition *****/
+    unsigned long    ds_cnt;             /* how many different ds provide
+                                         * input to the rrd */
+    unsigned long    rra_cnt;            /* how many rras will be maintained
+                                         * in the rrd */
+    unsigned long    pdp_step;           /* pdp interval in seconds */
+
+    unival           par[10];            /* global parameters ... unused
+                                           at the moment */
+} stat_head_t;
+
+
+/****************************************************************************
+ * POS 2: ds_def_t  (* ds_cnt)                        Data Source definitions
+ ****************************************************************************/
+
+enum dst_en          { DST_COUNTER=0,     /* data source types available */
+                       DST_ABSOLUTE, 
+                       DST_GAUGE,
+                       DST_DERIVE,
+                                          DST_CDEF};
+
+enum ds_param_en {   DS_mrhb_cnt=0,       /* minimum required heartbeat. A
+                                          * data source must provide input at
+                                          * least every ds_mrhb seconds,
+                                          * otherwise it is regarded dead and
+                                          * will be set to UNKNOWN */             
+                    DS_min_val,          /* the processed input of a ds must */
+                     DS_max_val,      /* be between max_val and min_val
+                                          * both can be set to UNKNOWN if you
+                                          * do not care. Data outside the limits
+                                          * set to UNKNOWN */
+                     DS_cdef = DS_mrhb_cnt}; /* pointer to encoded rpn
+                                          * expression only applies to DST_CDEF */
+
+/* The magic number here is one less than DS_NAM_SIZE */
+#define DS_NAM_FMT    "%19[a-zA-Z0-9_-]"
+#define DS_NAM_SIZE   20
+
+#define DST_FMT    "%19[A-Z]"
+#define DST_SIZE   20
+
+typedef struct ds_def_t {
+    char             ds_nam[DS_NAM_SIZE]; /* Name of the data source (null terminated)*/
+    char             dst[DST_SIZE];       /* Type of data source (null terminated)*/
+    unival           par[10];             /* index of this array see ds_param_en */
+} ds_def_t;
+
+/****************************************************************************
+ * POS 3: rra_def_t ( *  rra_cnt)         one for each store to be maintained
+ ****************************************************************************/
+enum cf_en           { CF_AVERAGE=0,     /* data consolidation functions */ 
+                       CF_MINIMUM, 
+                       CF_MAXIMUM,
+                       CF_LAST,
+                      CF_HWPREDICT, 
+                                          /* An array of predictions using the seasonal 
+                                               * Holt-Winters algorithm. Requires an RRA of type
+                                               * CF_SEASONAL for this data source. */
+                                          CF_SEASONAL,
+                                          /* An array of seasonal effects. Requires an RRA of
+                                               * type CF_HWPREDICT for this data source. */
+                                          CF_DEVPREDICT,
+                                          /* An array of deviation predictions based upon
+                                               * smoothed seasonal deviations. Requires an RRA of
+                                               * type CF_DEVSEASONAL for this data source. */
+                                          CF_DEVSEASONAL,
+                                          /* An array of smoothed seasonal deviations. Requires
+                                               * an RRA of type CF_HWPREDICT for this data source.
+                                               * */
+                                          CF_FAILURES};
+                                          /* A binary array of failure indicators: 1 indicates
+                                               * that the number of violations in the prescribed
+                                               * window exceeded the prescribed threshold. */
+
+#define MAX_RRA_PAR_EN 10
+enum rra_par_en {   RRA_cdp_xff_val=0,  /* what part of the consolidated
+                     * datapoint must be known, to produce a
+                                        * valid entry in the rra */
+                                       RRA_hw_alpha,
+                                       /* exponential smoothing parameter for the intercept in
+                                        * the Holt-Winters prediction algorithm. */
+                                       RRA_hw_beta,
+                                       /* exponential smoothing parameter for the slope in
+                                        * the Holt-Winters prediction algorithm. */
+                                       RRA_dependent_rra_idx,
+                                       /* For CF_HWPREDICT: index of the RRA with the seasonal 
+                                        * effects of the Holt-Winters algorithm (of type
+                                        * CF_SEASONAL).
+                                        * For CF_DEVPREDICT: index of the RRA with the seasonal
+                                        * deviation predictions (of type CF_DEVSEASONAL).
+                                        * For CF_SEASONAL: index of the RRA with the Holt-Winters
+                                        * intercept and slope coefficient (of type CF_HWPREDICT).
+                                        * For CF_DEVSEASONAL: index of the RRA with the 
+                                        * Holt-Winters prediction (of type CF_HWPREDICT).
+                                        * For CF_FAILURES: index of the CF_DEVSEASONAL array.
+                                        * */
+                                       RRA_seasonal_smooth_idx,
+                                       /* For CF_SEASONAL and CF_DEVSEASONAL:
+                                        * an integer between 0 and row_count - 1 which
+                                        * is index in the seasonal cycle for applying
+                                        * the period smoother. */
+                                   RRA_failure_threshold,
+                                       /* For CF_FAILURES, number of violations within the last
+                                        * window required to mark a failure. */
+                    RRA_seasonal_gamma = RRA_hw_alpha,
+                                       /* exponential smoothing parameter for seasonal effects.
+                                        * */
+                    RRA_delta_pos = RRA_hw_alpha,
+                    RRA_delta_neg = RRA_hw_beta,
+                                       /* confidence bound scaling parameters for the
+                                        * the FAILURES RRA. */
+                    RRA_window_len = RRA_seasonal_smooth_idx};
+                                       /* For CF_FAILURES, the length of the window for measuring
+                                        * failures. */
+                       
+#define CF_NAM_FMT    "%19[A-Z]"
+#define CF_NAM_SIZE   20
+
+typedef struct rra_def_t {
+    char             cf_nam[CF_NAM_SIZE];/* consolidation function (null term) */
+    unsigned long    row_cnt;            /* number of entries in the store */
+    unsigned long    pdp_cnt;            /* how many primary data points are
+                                         * required for a consolidated data
+                                         * point?*/
+    unival           par[MAX_RRA_PAR_EN];            /* index see rra_param_en */
+
+} rra_def_t;
+
+
+/****************************************************************************
+ ****************************************************************************
+ ****************************************************************************
+ * LIVE PART OF THE HEADER. THIS WILL BE WRITTEN ON EVERY UPDATE         *
+ ****************************************************************************
+ ****************************************************************************
+ ****************************************************************************/
+/****************************************************************************
+ * POS 4: live_head_t                    
+ ****************************************************************************/
+
+typedef struct live_head_t {
+    time_t           last_up;            /* when was rrd last updated */
+    long            last_up_usec;       /* micro seconds part of the
+                                           update timestamp. Always >= 0 */
+} live_head_t;
+
+
+/****************************************************************************
+ * POS 5: pdp_prep_t  (* ds_cnt)                     here we prepare the pdps 
+ ****************************************************************************/
+#define LAST_DS_LEN 30 /* DO NOT CHANGE THIS ... */
+
+enum pdp_par_en {   PDP_unkn_sec_cnt=0,  /* how many seconds of the current
+                                         * pdp value is unknown data? */
+
+                   PDP_val};            /* current value of the pdp.
+                                           this depends on dst */
+
+typedef struct pdp_prep_t{    
+    char last_ds[LAST_DS_LEN];           /* the last reading from the data
+                                         * source.  this is stored in ASCII
+                                         * to cater for very large counters
+                                         * we might encounter in connection
+                                         * with SNMP. */
+    unival          scratch[10];         /* contents according to pdp_par_en */
+} pdp_prep_t;
+
+/* data is passed from pdp to cdp when seconds since epoch modulo pdp_step == 0
+   obviously the updates do not occur at these times only. Especially does the
+   format allow for updates to occur at different times for each data source.
+   The rules which makes this work is as follows:
+
+   * DS updates may only occur at ever increasing points in time
+   * When any DS update arrives after a cdp update time, the *previous*
+     update cycle gets executed. All pdps are transfered to cdps and the
+     cdps feed the rras where necessary. Only then the new DS value
+     is loaded into the PDP.                                                   */
+
+
+/****************************************************************************
+ * POS 6: cdp_prep_t (* rra_cnt * ds_cnt )      data prep area for cdp values
+ ****************************************************************************/
+#define MAX_CDP_PAR_EN 10
+#define MAX_CDP_FAILURES_IDX 8 
+/* max CDP scratch entries avail to record violations for a FAILURES RRA */
+#define MAX_FAILURES_WINDOW_LEN 28
+enum cdp_par_en {  CDP_val=0,          
+                   /* the base_interval is always an
+                                       * average */
+                          CDP_unkn_pdp_cnt,       
+                                  /* how many unknown pdp were
+                           * integrated. This and the cdp_xff
+                                       * will decide if this is going to
+                                       * be a UNKNOWN or a valid value */
+                                  CDP_hw_intercept,
+                                  /* Current intercept coefficient for the Holt-Winters
+                                       * prediction algorithm. */
+                                  CDP_hw_last_intercept,
+                                  /* Last iteration intercept coefficient for the Holt-Winters
+                                       * prediction algorihtm. */
+                                  CDP_hw_slope,
+                                  /* Current slope coefficient for the Holt-Winters
+                                       * prediction algorithm. */
+                                  CDP_hw_last_slope,
+                                  /* Last iteration slope coeffient. */
+                                  CDP_null_count,
+                                  /* Number of sequential Unknown (DNAN) values + 1 preceding
+                                   * the current prediction.
+                                       * */
+                                  CDP_last_null_count,
+                                  /* Last iteration count of Unknown (DNAN) values. */
+                                  CDP_primary_val = 8,
+                                  /* optimization for bulk updates: the value of the first CDP
+                                       * value to be written in the bulk update. */
+                                  CDP_secondary_val = 9,
+                                  /* optimization for bulk updates: the value of subsequent
+                                       * CDP values to be written in the bulk update. */
+                   CDP_hw_seasonal = CDP_hw_intercept,
+                   /* Current seasonal coefficient for the Holt-Winters
+                    * prediction algorithm. This is stored in CDP prep to avoid
+                    * redundant seek operations. */
+                   CDP_hw_last_seasonal = CDP_hw_last_intercept,
+                   /* Last iteration seasonal coeffient. */
+                   CDP_seasonal_deviation = CDP_hw_intercept,
+                   CDP_last_seasonal_deviation = CDP_hw_last_intercept,
+                   CDP_init_seasonal = CDP_null_count};
+                   /* init_seasonal is a flag which when > 0, forces smoothing updates
+                    * to occur when rra_ptr.cur_row == 0 */
+
+typedef struct cdp_prep_t{
+    unival         scratch[MAX_CDP_PAR_EN];          
+                                                                                /* contents according to cdp_par_en *
+                                          * init state should be NAN */
+
+} cdp_prep_t;
+
+/****************************************************************************
+ * POS 7: rra_ptr_t (* rra_cnt)       pointers to the current row in each rra
+ ****************************************************************************/
+
+typedef struct rra_ptr_t {
+    unsigned long    cur_row;            /* current row in the rra*/
+} rra_ptr_t;
+
+
+/****************************************************************************
+ ****************************************************************************
+ * One single struct to hold all the others. For convenience.
+ ****************************************************************************
+ ****************************************************************************/
+typedef struct rrd_t {
+    stat_head_t      *stat_head;          /* the static header */
+    ds_def_t         *ds_def;             /* list of data source definitions */
+    rra_def_t        *rra_def;            /* list of round robin archive def */
+    live_head_t      *live_head;
+    pdp_prep_t       *pdp_prep;           /* pdp data prep area */  
+    cdp_prep_t       *cdp_prep;           /* cdp prep area */
+    rra_ptr_t        *rra_ptr;            /* list of rra pointers */
+    rrd_value_t      *rrd_value;          /* list of rrd values */
+} rrd_t;
+
+/****************************************************************************
+ ****************************************************************************
+ * AFTER the header section we have the DATA STORAGE AREA it is made up from
+ * Consolidated Data Points organized in Round Robin Archives.
+ ****************************************************************************
+ ****************************************************************************
+
+ *RRA 0
+ (0,0) .................... ( ds_cnt -1 , 0)
+ .
+ . 
+ .
+ (0, row_cnt -1) ... (ds_cnt -1, row_cnt -1)
+
+ *RRA 1
+ *RRA 2
+
+ *RRA rra_cnt -1
+ ****************************************************************************/
+
+
+#endif
+
+
+
+
diff --git a/src/rrd_getopt.c b/src/rrd_getopt.c
new file mode 100644 (file)
index 0000000..b715ab0
--- /dev/null
@@ -0,0 +1,1002 @@
+/* Getopt for GNU.
+   NOTE: getopt is now part of the C library, so if you don't know what
+   "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
+   before changing it!
+
+   Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97
+   Free Software Foundation, Inc.
+
+   This file is part of the GNU C Library.  Its master source is NOT part of
+   the C library, however.  The master source lives in /gd/gnu/lib.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+\f
+/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
+   Ditto for AIX 3.2 and <stdlib.h>.  */
+#ifndef _NO_PROTO
+#define _NO_PROTO
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "../rrd_config.h"
+#endif
+
+#if !defined (__STDC__) || !__STDC__
+/* This is a separate conditional since some stdc systems
+   reject `defined (const)'.  */
+#ifndef const
+#define const
+#endif
+#endif
+
+#include <stdio.h>
+
+/* Comment out all this code if we are using the GNU C Library, and are not
+   actually compiling the library itself.  This code is part of the GNU C
+   Library, but also included in many other GNU distributions.  Compiling
+   and linking in this code is a waste when using the GNU C library
+   (especially if it is a shared library).  Rather than having every GNU
+   program understand `configure --with-gnu-libc' and omit the object files,
+   it is simpler to just do this in the source for each such file.  */
+
+#define GETOPT_INTERFACE_VERSION 2
+#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
+#include <gnu-versions.h>
+#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
+#define ELIDE_CODE
+#endif
+#endif
+
+#ifndef ELIDE_CODE
+
+
+/* This needs to come after some library #include
+   to get __GNU_LIBRARY__ defined.  */
+#ifdef __GNU_LIBRARY__
+/* Don't include stdlib.h for non-GNU C libraries because some of them
+   contain conflicting prototypes for getopt.  */
+#include <stdlib.h>
+#include <unistd.h>
+#endif /* GNU C library.  */
+
+#ifdef VMS
+#include <unixlib.h>
+#if HAVE_STRING_H - 0
+#include <string.h>
+#endif
+#endif
+
+#if defined (_WIN32) && !defined (__CYGWIN32__)
+/* It's not Unix, really.  See?  Capital letters.  */
+#include <windows.h>
+#define getpid() GetCurrentProcessId()
+#endif
+
+#ifndef _
+/* This is for other GNU distributions with internationalized messages.
+   When compiling libc, the _ macro is predefined.  */
+#ifdef HAVE_LIBINTL_H
+# include <libintl.h>
+# define _(msgid)      gettext (msgid)
+#else
+# define _(msgid)      (msgid)
+#endif
+#endif
+
+/* This version of `getopt' appears to the caller like standard Unix `getopt'
+   but it behaves differently for the user, since it allows the user
+   to intersperse the options with the other arguments.
+
+   As `getopt' works, it permutes the elements of ARGV so that,
+   when it is done, all the options precede everything else.  Thus
+   all application programs are extended to handle flexible argument order.
+
+   Setting the environment variable POSIXLY_CORRECT disables permutation.
+   Then the behavior is completely standard.
+
+   GNU application programs can use a third alternative mode in which
+   they can distinguish the relative order of options and other arguments.  */
+
+#include "rrd_getopt.h"
+
+/* For communication from `getopt' to the caller.
+   When `getopt' finds an option that takes an argument,
+   the argument value is returned here.
+   Also, when `ordering' is RETURN_IN_ORDER,
+   each non-option ARGV-element is returned here.  */
+
+char *optarg = NULL;
+
+/* Index in ARGV of the next element to be scanned.
+   This is used for communication to and from the caller
+   and for communication between successive calls to `getopt'.
+
+   On entry to `getopt', zero means this is the first call; initialize.
+
+   When `getopt' returns -1, this is the index of the first of the
+   non-option elements that the caller should itself scan.
+
+   Otherwise, `optind' communicates from one call to the next
+   how much of ARGV has been scanned so far.  */
+
+/* 1003.2 says this must be 1 before any call.  */
+int optind = 1;
+
+/* Formerly, initialization of getopt depended on optind==0, which
+   causes problems with re-calling getopt as programs generally don't
+   know that. */
+
+int __getopt_initialized = 0;
+
+/* The next char to be scanned in the option-element
+   in which the last option character we returned was found.
+   This allows us to pick up the scan where we left off.
+
+   If this is zero, or a null string, it means resume the scan
+   by advancing to the next ARGV-element.  */
+
+static char *nextchar;
+
+/* Callers store zero here to inhibit the error message
+   for unrecognized options.  */
+
+int opterr = 1;
+
+/* Set to an option character which was unrecognized.
+   This must be initialized on some systems to avoid linking in the
+   system's own getopt implementation.  */
+
+int optopt = '?';
+
+/* Describe how to deal with options that follow non-option ARGV-elements.
+
+   If the caller did not specify anything,
+   the default is REQUIRE_ORDER if the environment variable
+   POSIXLY_CORRECT is defined, PERMUTE otherwise.
+
+   REQUIRE_ORDER means don't recognize them as options;
+   stop option processing when the first non-option is seen.
+   This is what Unix does.
+   This mode of operation is selected by either setting the environment
+   variable POSIXLY_CORRECT, or using `+' as the first character
+   of the list of option characters.
+
+   PERMUTE is the default.  We permute the contents of ARGV as we scan,
+   so that eventually all the non-options are at the end.  This allows options
+   to be given in any order, even with programs that were not written to
+   expect this.
+
+   RETURN_IN_ORDER is an option available to programs that were written
+   to expect options and other ARGV-elements in any order and that care about
+   the ordering of the two.  We describe each non-option ARGV-element
+   as if it were the argument of an option with character code 1.
+   Using `-' as the first character of the list of option characters
+   selects this mode of operation.
+
+   The special argument `--' forces an end of option-scanning regardless
+   of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
+   `--' can cause `getopt' to return -1 with `optind' != ARGC.  */
+
+static enum
+{
+  REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
+} ordering;
+
+/* Value of POSIXLY_CORRECT environment variable.  */
+static char *posixly_correct;
+\f
+/* we must include string as there are warnings without it ... */
+#include <string.h>
+
+#ifdef __GNU_LIBRARY__
+/* We want to avoid inclusion of string.h with non-GNU libraries
+   because there are many ways it can cause trouble.
+   On some systems, it contains special magic macros that don't work
+   in GCC.  */
+#define        my_index        strchr
+#else
+
+/* Avoid depending on library functions or files
+   whose names are inconsistent.  */
+
+char *getenv ();
+
+static char *
+my_index (str, chr)
+     const char *str;
+     int chr;
+{
+  while (*str)
+    {
+      if (*str == chr)
+       return (char *) str;
+      str++;
+    }
+  return 0;
+}
+
+/* If using GCC, we can safely declare strlen this way.
+   If not using GCC, it is ok not to declare it.  */
+#ifdef __GNUC__
+/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
+   That was relevant to code that was here before.  */
+#if !defined (__STDC__) || !__STDC__
+/* gcc with -traditional declares the built-in strlen to return int,
+   and has done so at least since version 2.4.5. -- rms.  */
+extern int strlen (const char *);
+#endif /* not __STDC__ */
+#endif /* __GNUC__ */
+
+#endif /* not __GNU_LIBRARY__ */
+\f
+/* Handle permutation of arguments.  */
+
+/* Describe the part of ARGV that contains non-options that have
+   been skipped.  `first_nonopt' is the index in ARGV of the first of them;
+   `last_nonopt' is the index after the last of them.  */
+
+static int first_nonopt;
+static int last_nonopt;
+
+#ifdef _LIBC
+/* Bash 2.0 gives us an environment variable containing flags
+   indicating ARGV elements that should not be considered arguments.  */
+
+static const char *nonoption_flags;
+static int nonoption_flags_len;
+
+static int original_argc;
+static char *const *original_argv;
+
+/* Make sure the environment variable bash 2.0 puts in the environment
+   is valid for the getopt call we must make sure that the ARGV passed
+   to getopt is that one passed to the process.  */
+static void store_args (int argc, char *const *argv) __attribute__ ((unused));
+static void
+store_args (int argc, char *const *argv)
+{
+  /* XXX This is no good solution.  We should rather copy the args so
+     that we can compare them later.  But we must not use malloc(3).  */
+  original_argc = argc;
+  original_argv = argv;
+}
+text_set_element (__libc_subinit, store_args);
+#endif
+
+/* Exchange two adjacent subsequences of ARGV.
+   One subsequence is elements [first_nonopt,last_nonopt)
+   which contains all the non-options that have been skipped so far.
+   The other is elements [last_nonopt,optind), which contains all
+   the options processed since those non-options were skipped.
+
+   `first_nonopt' and `last_nonopt' are relocated so that they describe
+   the new indices of the non-options in ARGV after they are moved.  */
+
+#if defined (__STDC__) && __STDC__
+static void exchange (char **);
+#endif
+
+static void
+exchange (argv)
+     char **argv;
+{
+  int bottom = first_nonopt;
+  int middle = last_nonopt;
+  int top = optind;
+  char *tem;
+
+  /* Exchange the shorter segment with the far end of the longer segment.
+     That puts the shorter segment into the right place.
+     It leaves the longer segment in the right place overall,
+     but it consists of two parts that need to be swapped next.  */
+
+  while (top > middle && middle > bottom)
+    {
+      if (top - middle > middle - bottom)
+       {
+         /* Bottom segment is the short one.  */
+         int len = middle - bottom;
+         register int i;
+
+         /* Swap it with the top part of the top segment.  */
+         for (i = 0; i < len; i++)
+           {
+             tem = argv[bottom + i];
+             argv[bottom + i] = argv[top - (middle - bottom) + i];
+             argv[top - (middle - bottom) + i] = tem;
+           }
+         /* Exclude the moved bottom segment from further swapping.  */
+         top -= len;
+       }
+      else
+       {
+         /* Top segment is the short one.  */
+         int len = top - middle;
+         register int i;
+
+         /* Swap it with the bottom part of the bottom segment.  */
+         for (i = 0; i < len; i++)
+           {
+             tem = argv[bottom + i];
+             argv[bottom + i] = argv[middle + i];
+             argv[middle + i] = tem;
+           }
+         /* Exclude the moved top segment from further swapping.  */
+         bottom += len;
+       }
+    }
+
+  /* Update records for the slots the non-options now occupy.  */
+
+  first_nonopt += (optind - last_nonopt);
+  last_nonopt = optind;
+}
+
+/* Initialize the internal data when the first call is made.  */
+
+#if defined (__STDC__) && __STDC__
+static const char *_getopt_initialize (int, char *const *, const char *);
+#endif
+static const char *
+_getopt_initialize (argc, argv, optstring)
+     int argc;
+     char *const *argv;
+     const char *optstring;
+{
+  /* Start processing options with ARGV-element 1 (since ARGV-element 0
+     is the program name); the sequence of previously skipped
+     non-option ARGV-elements is empty.  */
+
+  first_nonopt = last_nonopt = optind = 1;
+
+  nextchar = NULL;
+
+  posixly_correct = getenv ("POSIXLY_CORRECT");
+
+  /* Determine how to handle the ordering of options and nonoptions.  */
+
+  if (optstring[0] == '-')
+    {
+      ordering = RETURN_IN_ORDER;
+      ++optstring;
+    }
+  else if (optstring[0] == '+')
+    {
+      ordering = REQUIRE_ORDER;
+      ++optstring;
+    }
+  else if (posixly_correct != NULL)
+    ordering = REQUIRE_ORDER;
+  else
+    ordering = PERMUTE;
+
+#ifdef _LIBC
+  if (posixly_correct == NULL
+      && argc == original_argc && argv == original_argv)
+    {
+      /* Bash 2.0 puts a special variable in the environment for each
+        command it runs, specifying which ARGV elements are the results of
+        file name wildcard expansion and therefore should not be
+        considered as options.  */
+      char var[100];
+      sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ());
+      nonoption_flags = getenv (var);
+      if (nonoption_flags == NULL)
+       nonoption_flags_len = 0;
+      else
+       nonoption_flags_len = strlen (nonoption_flags);
+    }
+  else
+    nonoption_flags_len = 0;
+#endif
+
+  return optstring;
+}
+\f
+/* Scan elements of ARGV (whose length is ARGC) for option characters
+   given in OPTSTRING.
+
+   If an element of ARGV starts with '-', and is not exactly "-" or "--",
+   then it is an option element.  The characters of this element
+   (aside from the initial '-') are option characters.  If `getopt'
+   is called repeatedly, it returns successively each of the option characters
+   from each of the option elements.
+
+   If `getopt' finds another option character, it returns that character,
+   updating `optind' and `nextchar' so that the next call to `getopt' can
+   resume the scan with the following option character or ARGV-element.
+
+   If there are no more option characters, `getopt' returns -1.
+   Then `optind' is the index in ARGV of the first ARGV-element
+   that is not an option.  (The ARGV-elements have been permuted
+   so that those that are not options now come last.)
+
+   OPTSTRING is a string containing the legitimate option characters.
+   If an option character is seen that is not listed in OPTSTRING,
+   return '?' after printing an error message.  If you set `opterr' to
+   zero, the error message is suppressed but we still return '?'.
+
+   If a char in OPTSTRING is followed by a colon, that means it wants an arg,
+   so the following text in the same ARGV-element, or the text of the following
+   ARGV-element, is returned in `optarg'.  Two colons mean an option that
+   wants an optional arg; if there is text in the current ARGV-element,
+   it is returned in `optarg', otherwise `optarg' is set to zero.
+
+   If OPTSTRING starts with `-' or `+', it requests different methods of
+   handling the non-option ARGV-elements.
+   See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
+
+   Long-named options begin with `--' instead of `-'.
+   Their names may be abbreviated as long as the abbreviation is unique
+   or is an exact match for some defined option.  If they have an
+   argument, it follows the option name in the same ARGV-element, separated
+   from the option name by a `=', or else the in next ARGV-element.
+   When `getopt' finds a long-named option, it returns 0 if that option's
+   `flag' field is nonzero, the value of the option's `val' field
+   if the `flag' field is zero.
+
+   The elements of ARGV aren't really const, because we permute them.
+   But we pretend they're const in the prototype to be compatible
+   with other systems.
+
+   LONGOPTS is a vector of `struct option' terminated by an
+   element containing a name which is zero.
+
+   LONGIND returns the index in LONGOPT of the long-named option found.
+   It is only valid when a long-named option has been found by the most
+   recent call.
+
+   If LONG_ONLY is nonzero, '-' as well as '--' can introduce
+   long-named options.  */
+
+int
+_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
+     int argc;
+     char *const *argv;
+     const char *optstring;
+     const struct option *longopts;
+     int *longind;
+     int long_only;
+{
+  optarg = NULL;
+
+  if (!__getopt_initialized || optind == 0)
+    {
+      optstring = _getopt_initialize (argc, argv, optstring);
+      optind = 1;              /* Don't scan ARGV[0], the program name.  */
+      __getopt_initialized = 1;
+    }
+
+  /* Test whether ARGV[optind] points to a non-option argument.
+     Either it does not have option syntax, or there is an environment flag
+     from the shell indicating it is not an option.  The later information
+     is only used when the used in the GNU libc.  */
+#ifdef _LIBC
+#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0'       \
+                    || (optind < nonoption_flags_len                         \
+                        && nonoption_flags[optind] == '1'))
+#else
+#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
+#endif
+
+  if (nextchar == NULL || *nextchar == '\0')
+    {
+      /* Advance to the next ARGV-element.  */
+
+      /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
+        moved back by the user (who may also have changed the arguments).  */
+      if (last_nonopt > optind)
+       last_nonopt = optind;
+      if (first_nonopt > optind)
+       first_nonopt = optind;
+
+      if (ordering == PERMUTE)
+       {
+         /* If we have just processed some options following some non-options,
+            exchange them so that the options come first.  */
+
+         if (first_nonopt != last_nonopt && last_nonopt != optind)
+           exchange ((char **) argv);
+         else if (last_nonopt != optind)
+           first_nonopt = optind;
+
+         /* Skip any additional non-options
+            and extend the range of non-options previously skipped.  */
+
+         while (optind < argc && NONOPTION_P)
+           optind++;
+         last_nonopt = optind;
+       }
+
+      /* The special ARGV-element `--' means premature end of options.
+        Skip it like a null option,
+        then exchange with previous non-options as if it were an option,
+        then skip everything else like a non-option.  */
+
+      if (optind != argc && !strcmp (argv[optind], "--"))
+       {
+         optind++;
+
+         if (first_nonopt != last_nonopt && last_nonopt != optind)
+           exchange ((char **) argv);
+         else if (first_nonopt == last_nonopt)
+           first_nonopt = optind;
+         last_nonopt = argc;
+
+         optind = argc;
+       }
+
+      /* If we have done all the ARGV-elements, stop the scan
+        and back over any non-options that we skipped and permuted.  */
+
+      if (optind == argc)
+       {
+         /* Set the next-arg-index to point at the non-options
+            that we previously skipped, so the caller will digest them.  */
+         if (first_nonopt != last_nonopt)
+           optind = first_nonopt;
+         return -1;
+       }
+
+      /* If we have come to a non-option and did not permute it,
+        either stop the scan or describe it to the caller and pass it by.  */
+
+      if (NONOPTION_P)
+       {
+         if (ordering == REQUIRE_ORDER)
+           return -1;
+         optarg = argv[optind++];
+         return 1;
+       }
+
+      /* We have found another option-ARGV-element.
+        Skip the initial punctuation.  */
+
+      nextchar = (argv[optind] + 1
+                 + (longopts != NULL && argv[optind][1] == '-'));
+    }
+
+  /* Decode the current option-ARGV-element.  */
+
+  /* Check whether the ARGV-element is a long option.
+
+     If long_only and the ARGV-element has the form "-f", where f is
+     a valid short option, don't consider it an abbreviated form of
+     a long option that starts with f.  Otherwise there would be no
+     way to give the -f short option.
+
+     On the other hand, if there's a long option "fubar" and
+     the ARGV-element is "-fu", do consider that an abbreviation of
+     the long option, just like "--fu", and not "-f" with arg "u".
+
+     This distinction seems to be the most useful approach.  */
+
+  if (longopts != NULL
+      && (argv[optind][1] == '-'
+         || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
+    {
+      char *nameend;
+      const struct option *p;
+      const struct option *pfound = NULL;
+      int exact = 0;
+      int ambig = 0;
+      int indfound = -1;
+      int option_index;
+
+      for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
+       /* Do nothing.  */ ;
+
+      /* Test all long options for either exact match
+        or abbreviated matches.  */
+      for (p = longopts, option_index = 0; p->name; p++, option_index++)
+       if (!strncmp (p->name, nextchar, nameend - nextchar))
+         {
+           if ((unsigned int) (nameend - nextchar)
+               == (unsigned int) strlen (p->name))
+             {
+               /* Exact match found.  */
+               pfound = p;
+               indfound = option_index;
+               exact = 1;
+               break;
+             }
+           else if (pfound == NULL)
+             {
+               /* First nonexact match found.  */
+               pfound = p;
+               indfound = option_index;
+             }
+           else
+             /* Second or later nonexact match found.  */
+             ambig = 1;
+         }
+
+      if (ambig && !exact)
+       {
+         if (opterr)
+           fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
+                    argv[0], argv[optind]);
+         nextchar += strlen (nextchar);
+         optind++;
+         optopt = 0;
+         return '?';
+       }
+
+      if (pfound != NULL)
+       {
+         option_index = indfound;
+         optind++;
+         if (*nameend)
+           {
+             /* Don't test has_arg with >, because some C compilers don't
+                allow it to be used on enums.  */
+             if (pfound->has_arg)
+               optarg = nameend + 1;
+             else
+               {
+                 if (opterr) {
+                  if (argv[optind - 1][1] == '-')
+                   /* --option */
+                   fprintf (stderr,
+                    _("%s: option `--%s' doesn't allow an argument\n"),
+                    argv[0], pfound->name);
+                  else
+                   /* +option or -option */
+                   fprintf (stderr,
+                    _("%s: option `%c%s' doesn't allow an argument\n"),
+                    argv[0], argv[optind - 1][0], pfound->name);
+                 }
+                 nextchar += strlen (nextchar);
+
+                 optopt = pfound->val;
+                 return '?';
+               }
+           }
+         else if (pfound->has_arg == 1)
+           {
+             if (optind < argc)
+               optarg = argv[optind++];
+             else
+               {
+                 if (opterr)
+                   fprintf (stderr,
+                          _("%s: option `%s' requires an argument\n"),
+                          argv[0], argv[optind - 1]);
+                 nextchar += strlen (nextchar);
+                 optopt = pfound->val;
+                 return optstring[0] == ':' ? ':' : '?';
+               }
+           }
+         nextchar += strlen (nextchar);
+         if (longind != NULL)
+           *longind = option_index;
+         if (pfound->flag)
+           {
+             *(pfound->flag) = pfound->val;
+             return 0;
+           }
+         return pfound->val;
+       }
+
+      /* Can't find it as a long option.  If this is not getopt_long_only,
+        or the option starts with '--' or is not a valid short
+        option, then it's an error.
+        Otherwise interpret it as a short option.  */
+      if (!long_only || argv[optind][1] == '-'
+         || my_index (optstring, *nextchar) == NULL)
+       {
+         if (opterr)
+           {
+             if (argv[optind][1] == '-')
+               /* --option */
+               fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
+                        argv[0], nextchar);
+             else
+               /* +option or -option */
+               fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
+                        argv[0], argv[optind][0], nextchar);
+           }
+         nextchar = (char *) "";
+         optind++;
+         optopt = 0;
+         return '?';
+       }
+    }
+
+  /* Look at and handle the next short option-character.  */
+
+  {
+    char c = *nextchar++;
+    char *temp = my_index (optstring, c);
+
+    /* Increment `optind' when we start to process its last character.  */
+    if (*nextchar == '\0')
+      ++optind;
+
+    if (temp == NULL || c == ':')
+      {
+       if (opterr)
+         {
+           if (posixly_correct)
+             /* 1003.2 specifies the format of this message.  */
+             fprintf (stderr, _("%s: illegal option -- %c\n"),
+                      argv[0], c);
+           else
+             fprintf (stderr, _("%s: invalid option -- %c\n"),
+                      argv[0], c);
+         }
+       optopt = c;
+       return '?';
+      }
+    /* Convenience. Treat POSIX -W foo same as long option --foo */
+    if (temp[0] == 'W' && temp[1] == ';')
+      {
+       char *nameend;
+       const struct option *p;
+       const struct option *pfound = NULL;
+       int exact = 0;
+       int ambig = 0;
+       int indfound = 0;
+       int option_index;
+
+       /* This is an option that requires an argument.  */
+       if (*nextchar != '\0')
+         {
+           optarg = nextchar;
+           /* If we end this ARGV-element by taking the rest as an arg,
+              we must advance to the next element now.  */
+           optind++;
+         }
+       else if (optind == argc)
+         {
+           if (opterr)
+             {
+               /* 1003.2 specifies the format of this message.  */
+               fprintf (stderr, _("%s: option requires an argument -- %c\n"),
+                        argv[0], c);
+             }
+           optopt = c;
+           if (optstring[0] == ':')
+             c = ':';
+           else
+             c = '?';
+           return c;
+         }
+       else
+         /* We already incremented `optind' once;
+            increment it again when taking next ARGV-elt as argument.  */
+         optarg = argv[optind++];
+
+       /* optarg is now the argument, see if it's in the
+          table of longopts.  */
+
+       for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
+         /* Do nothing.  */ ;
+
+       /* Test all long options for either exact match
+          or abbreviated matches.  */
+       for (p = longopts, option_index = 0; p->name; p++, option_index++)
+         if (!strncmp (p->name, nextchar, nameend - nextchar))
+           {
+             if ((unsigned int) (nameend - nextchar) == strlen (p->name))
+               {
+                 /* Exact match found.  */
+                 pfound = p;
+                 indfound = option_index;
+                 exact = 1;
+                 break;
+               }
+             else if (pfound == NULL)
+               {
+                 /* First nonexact match found.  */
+                 pfound = p;
+                 indfound = option_index;
+               }
+             else
+               /* Second or later nonexact match found.  */
+               ambig = 1;
+           }
+       if (ambig && !exact)
+         {
+           if (opterr)
+             fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
+                      argv[0], argv[optind]);
+           nextchar += strlen (nextchar);
+           optind++;
+           return '?';
+         }
+       if (pfound != NULL)
+         {
+           option_index = indfound;
+           if (*nameend)
+             {
+               /* Don't test has_arg with >, because some C compilers don't
+                  allow it to be used on enums.  */
+               if (pfound->has_arg)
+                 optarg = nameend + 1;
+               else
+                 {
+                   if (opterr)
+                     fprintf (stderr, _("\
+%s: option `-W %s' doesn't allow an argument\n"),
+                              argv[0], pfound->name);
+
+                   nextchar += strlen (nextchar);
+                   return '?';
+                 }
+             }
+           else if (pfound->has_arg == 1)
+             {
+               if (optind < argc)
+                 optarg = argv[optind++];
+               else
+                 {
+                   if (opterr)
+                     fprintf (stderr,
+                              _("%s: option `%s' requires an argument\n"),
+                              argv[0], argv[optind - 1]);
+                   nextchar += strlen (nextchar);
+                   return optstring[0] == ':' ? ':' : '?';
+                 }
+             }
+           nextchar += strlen (nextchar);
+           if (longind != NULL)
+             *longind = option_index;
+           if (pfound->flag)
+             {
+               *(pfound->flag) = pfound->val;
+               return 0;
+             }
+           return pfound->val;
+         }
+         nextchar = NULL;
+         return 'W';   /* Let the application handle it.   */
+      }
+    if (temp[1] == ':')
+      {
+       if (temp[2] == ':')
+         {
+           /* This is an option that accepts an argument optionally.  */
+           if (*nextchar != '\0')
+             {
+               optarg = nextchar;
+               optind++;
+             }
+           else
+             optarg = NULL;
+           nextchar = NULL;
+         }
+       else
+         {
+           /* This is an option that requires an argument.  */
+           if (*nextchar != '\0')
+             {
+               optarg = nextchar;
+               /* If we end this ARGV-element by taking the rest as an arg,
+                  we must advance to the next element now.  */
+               optind++;
+             }
+           else if (optind == argc)
+             {
+               if (opterr)
+                 {
+                   /* 1003.2 specifies the format of this message.  */
+                   fprintf (stderr,
+                          _("%s: option requires an argument -- %c\n"),
+                          argv[0], c);
+                 }
+               optopt = c;
+               if (optstring[0] == ':')
+                 c = ':';
+               else
+                 c = '?';
+             }
+           else
+             /* We already incremented `optind' once;
+                increment it again when taking next ARGV-elt as argument.  */
+             optarg = argv[optind++];
+           nextchar = NULL;
+         }
+      }
+    return c;
+  }
+}
+
+int
+getopt (argc, argv, optstring)
+     int argc;
+     char *const *argv;
+     const char *optstring;
+{
+  return _getopt_internal (argc, argv, optstring,
+                          (const struct option *) 0,
+                          (int *) 0,
+                          0);
+}
+
+#endif /* Not ELIDE_CODE.  */
+\f
+#ifdef TEST
+
+/* Compile with -DTEST to make an executable for use in testing
+   the above definition of `getopt'.  */
+
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  int c;
+  int digit_optind = 0;
+
+  while (1)
+    {
+      int this_option_optind = optind ? optind : 1;
+
+      c = getopt (argc, argv, "abc:d:0123456789");
+      if (c == -1)
+       break;
+
+      switch (c)
+       {
+       case '0':
+       case '1':
+       case '2':
+       case '3':
+       case '4':
+       case '5':
+       case '6':
+       case '7':
+       case '8':
+       case '9':
+         if (digit_optind != 0 && digit_optind != this_option_optind)
+           printf ("digits occur in two different argv-elements.\n");
+         digit_optind = this_option_optind;
+         printf ("option %c\n", c);
+         break;
+
+       case 'a':
+         printf ("option a\n");
+         break;
+
+       case 'b':
+         printf ("option b\n");
+         break;
+
+       case 'c':
+         printf ("option c with value `%s'\n", optarg);
+         break;
+
+       case '?':
+         break;
+
+       default:
+         printf ("?? getopt returned character code 0%o ??\n", c);
+       }
+    }
+
+  if (optind < argc)
+    {
+      printf ("non-option ARGV-elements: ");
+      while (optind < argc)
+       printf ("%s ", argv[optind++]);
+      printf ("\n");
+    }
+
+  exit (0);
+}
+
+#endif /* TEST */
diff --git a/src/rrd_getopt.h b/src/rrd_getopt.h
new file mode 100644 (file)
index 0000000..7dad11b
--- /dev/null
@@ -0,0 +1,133 @@
+/* Declarations for getopt.
+   Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc.
+
+   This file is part of the GNU C Library.  Its master source is NOT part of
+   the C library, however.  The master source lives in /gd/gnu/lib.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _GETOPT_H
+#define _GETOPT_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* For communication from `getopt' to the caller.
+   When `getopt' finds an option that takes an argument,
+   the argument value is returned here.
+   Also, when `ordering' is RETURN_IN_ORDER,
+   each non-option ARGV-element is returned here.  */
+
+extern char *optarg;
+
+/* Index in ARGV of the next element to be scanned.
+   This is used for communication to and from the caller
+   and for communication between successive calls to `getopt'.
+
+   On entry to `getopt', zero means this is the first call; initialize.
+
+   When `getopt' returns -1, this is the index of the first of the
+   non-option elements that the caller should itself scan.
+
+   Otherwise, `optind' communicates from one call to the next
+   how much of ARGV has been scanned so far.  */
+
+extern int optind;
+
+/* Callers store zero here to inhibit the error message `getopt' prints
+   for unrecognized options.  */
+
+extern int opterr;
+
+/* Set to an option character which was unrecognized.  */
+
+extern int optopt;
+
+/* Describe the long-named options requested by the application.
+   The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
+   of `struct option' terminated by an element containing a name which is
+   zero.
+
+   The field `has_arg' is:
+   no_argument         (or 0) if the option does not take an argument,
+   required_argument   (or 1) if the option requires an argument,
+   optional_argument   (or 2) if the option takes an optional argument.
+
+   If the field `flag' is not NULL, it points to a variable that is set
+   to the value given in the field `val' when the option is found, but
+   left unchanged if the option is not found.
+
+   To have a long-named option do something other than set an `int' to
+   a compiled-in constant, such as set a value from `optarg', set the
+   option's `flag' field to zero and its `val' field to a nonzero
+   value (the equivalent single-letter option character, if there is
+   one).  For long options that have a zero `flag' field, `getopt'
+   returns the contents of the `val' field.  */
+
+struct option
+{
+#if defined (__STDC__) && __STDC__
+  const char *name;
+#else
+  char *name;
+#endif
+  /* has_arg can't be an enum because some compilers complain about
+     type mismatches in all the code that assumes it is an int.  */
+  int has_arg;
+  int *flag;
+  int val;
+};
+
+/* Names for the values of the `has_arg' field of `struct option'.  */
+
+#define        no_argument             0
+#define required_argument      1
+#define optional_argument      2
+
+#if defined (__STDC__) && __STDC__
+#ifdef __GNU_LIBRARY__
+/* Many other libraries have conflicting prototypes for getopt, with
+   differences in the consts, in stdlib.h.  To avoid compilation
+   errors, only prototype getopt for the GNU C library.  */
+extern int getopt (int argc, char *const *argv, const char *shortopts);
+#else /* not __GNU_LIBRARY__ */
+extern int getopt ();
+#endif /* __GNU_LIBRARY__ */
+extern int getopt_long (int argc, char *const *argv, const char *shortopts,
+                       const struct option *longopts, int *longind);
+extern int getopt_long_only (int argc, char *const *argv,
+                            const char *shortopts,
+                            const struct option *longopts, int *longind);
+
+/* Internal only.  Users should not call this directly.  */
+extern int _getopt_internal (int argc, char *const *argv,
+                            const char *shortopts,
+                            const struct option *longopts, int *longind,
+                            int long_only);
+#else /* not __STDC__ */
+extern int getopt ();
+extern int getopt_long ();
+extern int getopt_long_only ();
+
+extern int _getopt_internal ();
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GETOPT_H */
diff --git a/src/rrd_getopt1.c b/src/rrd_getopt1.c
new file mode 100644 (file)
index 0000000..14e1e88
--- /dev/null
@@ -0,0 +1,189 @@
+/* getopt_long and getopt_long_only entry points for GNU getopt.
+   Copyright (C) 1987,88,89,90,91,92,93,94,96,97 Free Software Foundation, Inc.
+
+   This file is part of the GNU C Library.  Its master source is NOT part of
+   the C library, however.  The master source lives in /gd/gnu/lib.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+\f
+#ifdef HAVE_CONFIG_H
+#include "../rrd_config.h"
+#endif
+
+#include "rrd_getopt.h"
+
+#if !defined (__STDC__) || !__STDC__
+/* This is a separate conditional since some stdc systems
+   reject `defined (const)'.  */
+#ifndef const
+#define const
+#endif
+#endif
+
+#include <stdio.h>
+
+/* Comment out all this code if we are using the GNU C Library, and are not
+   actually compiling the library itself.  This code is part of the GNU C
+   Library, but also included in many other GNU distributions.  Compiling
+   and linking in this code is a waste when using the GNU C library
+   (especially if it is a shared library).  Rather than having every GNU
+   program understand `configure --with-gnu-libc' and omit the object files,
+   it is simpler to just do this in the source for each such file.  */
+
+#define GETOPT_INTERFACE_VERSION 2
+#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
+#include <gnu-versions.h>
+#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
+#define ELIDE_CODE
+#endif
+#endif
+
+#ifndef ELIDE_CODE
+
+
+/* This needs to come after some library #include
+   to get __GNU_LIBRARY__ defined.  */
+#ifdef __GNU_LIBRARY__
+#include <stdlib.h>
+#endif
+
+#ifndef        NULL
+#define NULL 0
+#endif
+
+int
+getopt_long (argc, argv, options, long_options, opt_index)
+     int argc;
+     char *const *argv;
+     const char *options;
+     const struct option *long_options;
+     int *opt_index;
+{
+  return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
+}
+
+/* Like getopt_long, but '-' as well as '--' can indicate a long option.
+   If an option that starts with '-' (not '--') doesn't match a long option,
+   but does match a short option, it is parsed as a short option
+   instead.  */
+
+int
+getopt_long_only (argc, argv, options, long_options, opt_index)
+     int argc;
+     char *const *argv;
+     const char *options;
+     const struct option *long_options;
+     int *opt_index;
+{
+  return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
+}
+
+
+#endif /* Not ELIDE_CODE.  */
+\f
+#ifdef TEST
+
+#include <stdio.h>
+
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  int c;
+  int digit_optind = 0;
+
+  while (1)
+    {
+      int this_option_optind = optind ? optind : 1;
+      int option_index = 0;
+      static struct option long_options[] =
+      {
+       {"add", 1, 0, 0},
+       {"append", 0, 0, 0},
+       {"delete", 1, 0, 0},
+       {"verbose", 0, 0, 0},
+       {"create", 0, 0, 0},
+       {"file", 1, 0, 0},
+       {0, 0, 0, 0}
+      };
+
+      c = getopt_long (argc, argv, "abc:d:0123456789",
+                      long_options, &option_index);
+      if (c == -1)
+       break;
+
+      switch (c)
+       {
+       case 0:
+         printf ("option %s", long_options[option_index].name);
+         if (optarg)
+           printf (" with arg %s", optarg);
+         printf ("\n");
+         break;
+
+       case '0':
+       case '1':
+       case '2':
+       case '3':
+       case '4':
+       case '5':
+       case '6':
+       case '7':
+       case '8':
+       case '9':
+         if (digit_optind != 0 && digit_optind != this_option_optind)
+           printf ("digits occur in two different argv-elements.\n");
+         digit_optind = this_option_optind;
+         printf ("option %c\n", c);
+         break;
+
+       case 'a':
+         printf ("option a\n");
+         break;
+
+       case 'b':
+         printf ("option b\n");
+         break;
+
+       case 'c':
+         printf ("option c with value `%s'\n", optarg);
+         break;
+
+       case 'd':
+         printf ("option d with value `%s'\n", optarg);
+         break;
+
+       case '?':
+         break;
+
+       default:
+         printf ("?? getopt returned character code 0%o ??\n", c);
+       }
+    }
+
+  if (optind < argc)
+    {
+      printf ("non-option ARGV-elements: ");
+      while (optind < argc)
+       printf ("%s ", argv[optind++]);
+      printf ("\n");
+    }
+
+  exit (0);
+}
+
+#endif /* TEST */
diff --git a/src/rrd_gfx.c b/src/rrd_gfx.c
new file mode 100644 (file)
index 0000000..3db7bdf
--- /dev/null
@@ -0,0 +1,2520 @@
+/****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ ****************************************************************************
+ * rrd_gfx.c  graphics wrapper for rrdtool
+  **************************************************************************/
+
+/* #define DEBUG */
+
+/* stupid MSVC doesnt support variadic macros = no debug for now! */
+#ifdef _MSC_VER
+# define RRDPRINTF()
+#else 
+# ifdef DEBUG
+#  define RRDPRINTF(...)  fprintf(stderr, __VA_ARGS__);
+# else
+#  define RRDPRINTF(...)
+# endif /* DEBUG */
+#endif /* _MSC_VER */
+#include "rrd_tool.h"
+#include <png.h>
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_GLYPH_H
+
+#include "rrd_gfx.h"
+#include "rrd_afm.h"
+#include "unused.h"
+
+/* lines are better drawn on the pixle than between pixles */
+#define LINEOFFSET 0.5
+
+#define USE_PDF_FAKE_ALPHA 1
+#define USE_EPS_FAKE_ALPHA 1
+
+typedef struct gfx_char_s *gfx_char;
+struct gfx_char_s {
+  FT_UInt     index;    /* glyph index */
+  FT_Vector   pos;      /* location from baseline in 26.6 */
+  FT_Glyph    image;    /* glyph bitmap */
+};
+
+typedef struct gfx_string_s *gfx_string;
+struct gfx_string_s {
+  unsigned int    width;
+  unsigned int    height;
+  int            count;  /* number of characters */
+  gfx_char        glyphs;
+  size_t          num_glyphs;
+  FT_BBox         bbox;
+  FT_Matrix       transform;
+};
+
+/* compute string bbox */
+static void compute_string_bbox(gfx_string string);
+
+/* create a freetype glyph string */
+gfx_string gfx_string_create ( gfx_canvas_t *canvas, FT_Face face,
+                               const char *text, int rotation, double tabwidth, double size);
+
+/* create a freetype glyph string */
+static void gfx_string_destroy ( gfx_string string );
+
+static
+gfx_node_t *gfx_new_node( gfx_canvas_t *canvas,enum gfx_en type){
+  gfx_node_t *node = art_new(gfx_node_t,1);
+  if (node == NULL) return NULL;
+  node->type = type;
+  node->color = 0x0;        /* color of element  0xRRGGBBAA  alpha 0xff is solid*/
+  node->size =0.0;         /* font size, line width */
+  node->path = NULL;        /* path */
+  node->points = 0;
+  node->points_max =0;
+  node->closed_path = 0;
+  node->filename = NULL;             /* font or image filename */
+  node->text = NULL;
+  node->x = 0.0;
+  node->y = 0.0;          /* position */
+  node->angle = 0;  
+  node->halign = GFX_H_NULL; /* text alignement */
+  node->valign = GFX_V_NULL; /* text alignement */
+  node->tabwidth = 0.0; 
+  node->next = NULL; 
+  if (canvas->lastnode != NULL){
+      canvas->lastnode->next = node;
+  }
+  if (canvas->firstnode == NULL){
+      canvas->firstnode = node;
+  }  
+  canvas->lastnode = node;
+  return node;
+}
+
+gfx_canvas_t *gfx_new_canvas (void) {
+    gfx_canvas_t *canvas = art_new(gfx_canvas_t,1);
+    canvas->firstnode = NULL;
+    canvas->lastnode = NULL;
+    canvas->imgformat = IF_PNG; /* we default to PNG output */
+    canvas->interlaced = 0;
+    canvas->zoom = 1.0;
+    canvas->font_aa_threshold = -1.0;
+    canvas->aa_type = AA_NORMAL;
+    return canvas;
+}
+
+/* create a new line */
+gfx_node_t  *gfx_new_line(gfx_canvas_t *canvas, 
+                          double X0, double Y0, 
+                          double X1, double Y1,
+                          double width, gfx_color_t color){
+  return gfx_new_dashed_line(canvas, X0, Y0, X1, Y1, width, color, 0, 0);
+}
+
+gfx_node_t  *gfx_new_dashed_line(gfx_canvas_t *canvas, 
+                          double X0, double Y0, 
+                          double X1, double Y1,
+                          double width, gfx_color_t color,
+                          double dash_on, double dash_off){
+
+  gfx_node_t *node;
+  ArtVpath *vec;
+  node = gfx_new_node(canvas,GFX_LINE);
+  if (node == NULL) return NULL;
+  vec = art_new(ArtVpath, 3);
+  if (vec == NULL) return NULL;
+  vec[0].code = ART_MOVETO_OPEN; vec[0].x=X0+LINEOFFSET; vec[0].y=Y0+LINEOFFSET;
+  vec[1].code = ART_LINETO; vec[1].x=X1+LINEOFFSET; vec[1].y=Y1+LINEOFFSET;
+  vec[2].code = ART_END; vec[2].x=0;vec[2].y=0;
+  
+  node->points = 3;
+  node->points_max = 3;
+  node->color = color;
+  node->size  = width;
+  node->dash_on = dash_on;
+  node->dash_off = dash_off;
+  node->path  = vec;
+  return node;
+}
+
+/* create a new area */
+gfx_node_t   *gfx_new_area   (gfx_canvas_t *canvas, 
+                             double X0, double Y0,
+                             double X1, double Y1,
+                             double X2, double Y2,
+                             gfx_color_t color) {
+
+  gfx_node_t *node;
+  ArtVpath *vec;
+  node = gfx_new_node(canvas,GFX_AREA);
+  if (node == NULL) return NULL;
+  vec = art_new(ArtVpath, 5);
+  if (vec == NULL) return NULL;
+  vec[0].code = ART_MOVETO; vec[0].x=X0; vec[0].y=Y0;
+  vec[1].code = ART_LINETO; vec[1].x=X1; vec[1].y=Y1;
+  vec[2].code = ART_LINETO; vec[2].x=X2; vec[2].y=Y2;
+  vec[3].code = ART_LINETO; vec[3].x=X0; vec[3].y=Y0;
+  vec[4].code = ART_END; vec[4].x=0; vec[4].y=0;
+  
+  node->points = 5;
+  node->points_max = 5;
+  node->color = color;
+  node->path  = vec;
+
+  return node;
+}
+
+/* add a point to a line or to an area */
+int           gfx_add_point  (gfx_node_t *node, 
+                             double x, double y){
+  if (node == NULL) return 1;
+  if (node->type == GFX_AREA) {
+    double X0 = node->path[0].x;
+    double Y0 = node->path[0].y;
+    node->points -= 2;
+    art_vpath_add_point (&(node->path),
+                         &(node->points),
+                         &(node->points_max),
+                         ART_LINETO,
+                         x,y);
+    art_vpath_add_point (&(node->path),
+                         &(node->points),
+                         &(node->points_max),
+                         ART_LINETO,
+                         X0,Y0);
+    art_vpath_add_point (&(node->path),
+                         &(node->points),
+                         &(node->points_max),
+                         ART_END,
+                         0,0);
+  } else if (node->type == GFX_LINE) {
+    node->points -= 1;
+    art_vpath_add_point (&(node->path),
+                         &(node->points),
+                         &(node->points_max),
+                         ART_LINETO,
+                         x+LINEOFFSET,y+LINEOFFSET);
+    art_vpath_add_point (&(node->path),
+                         &(node->points),
+                         &(node->points_max),
+                         ART_END,
+                         0,0);
+    
+  } else {
+    /* can only add point to areas and lines */
+    return 1;
+  }
+  return 0;
+}
+
+void           gfx_close_path  (gfx_node_t *node) {
+    node->closed_path = 1;
+    if (node->path[0].code == ART_MOVETO_OPEN)
+       node->path[0].code = ART_MOVETO;
+}
+
+/* create a text node */
+gfx_node_t   *gfx_new_text   (gfx_canvas_t *canvas,  
+                             double x, double y, gfx_color_t color,
+                             char* font, double size,                        
+                             double tabwidth, double angle,
+                             enum gfx_h_align_en h_align,
+                             enum gfx_v_align_en v_align,
+                              char* text){
+   gfx_node_t *node = gfx_new_node(canvas,GFX_TEXT);
+   
+   node->text = strdup(text);
+   node->size = size;
+   node->filename = strdup(font);
+   node->x = x;
+   node->y = y;
+   node->angle = angle;   
+   node->color = color;
+   node->tabwidth = tabwidth;
+   node->halign = h_align;
+   node->valign = v_align;
+#if 0
+  /* debugging: show text anchor
+     green is along x-axis, red is downward y-axis */
+   if (1) {
+     double a = 2 * M_PI * -node->angle / 360.0;
+     double cos_a = cos(a);
+     double sin_a = sin(a);
+     double len = 3;
+     gfx_new_line(canvas,
+        x, y,
+        x + len * cos_a, y - len * sin_a,
+        0.2, 0x00FF0000);
+     gfx_new_line(canvas,
+        x, y,
+        x + len * sin_a, y + len * cos_a,
+        0.2, 0xFF000000);
+   }
+#endif
+   return node;
+}
+
+int           gfx_render(gfx_canvas_t *canvas, 
+                             art_u32 width, art_u32 height, 
+                             gfx_color_t background, FILE *fp){
+  switch (canvas->imgformat) {
+  case IF_PNG: 
+    return gfx_render_png (canvas, width, height, background, fp);
+  case IF_SVG: 
+    return gfx_render_svg (canvas, width, height, background, fp);
+  case IF_EPS:
+    return gfx_render_eps (canvas, width, height, background, fp);
+  case IF_PDF:
+    return gfx_render_pdf (canvas, width, height, background, fp);
+  default:
+    return -1;
+  }
+}
+
+static void gfx_string_destroy ( gfx_string string ) {
+  unsigned int n;
+  if (string->glyphs) {
+    for (n=0; n<string->num_glyphs; ++n)
+      FT_Done_Glyph (string->glyphs[n].image);
+    free (string->glyphs);
+  }
+  free (string);
+}
+
+
+double gfx_get_text_width ( gfx_canvas_t *canvas,
+                           double start, char* font, double size,
+                           double tabwidth, char* text, int rotation){
+  switch (canvas->imgformat) {
+  case IF_PNG: 
+    return gfx_get_text_width_libart (canvas, start, font, size, tabwidth, text, rotation);
+  case IF_SVG: /* fall through */ 
+  case IF_EPS:
+  case IF_PDF:
+    return afm_get_text_width(start, font, size, tabwidth, text);
+  default:
+    return size * strlen(text);
+  }
+}
+
+double gfx_get_text_width_libart (
+                           gfx_canvas_t *canvas, double UNUSED(start), char* font, double size,
+                           double tabwidth, char* text, int rotation ){
+
+  int           error;
+  double        text_width=0;
+  FT_Face       face;
+  FT_Library    library=NULL;  
+  gfx_string    string;
+
+  FT_Init_FreeType( &library );
+  error = FT_New_Face( library, font, 0, &face );
+  if ( error ) {
+    FT_Done_FreeType(library);
+    return -1;
+  }
+  error = FT_Set_Char_Size(face,  size*64,size*64,  100,100);
+  if ( error ) {
+    FT_Done_FreeType(library);
+    return -1;
+  }
+  string = gfx_string_create( canvas, face, text, rotation, tabwidth, size );
+  text_width = string->width;
+  gfx_string_destroy(string);
+  FT_Done_FreeType(library);
+  return text_width/64;
+}
+
+static void gfx_libart_close_path(gfx_node_t *node, ArtVpath **vec)
+{
+    /* libart must have end==start for closed paths,
+       even if using ART_MOVETO and not ART_MOVETO_OPEN
+       so add extra point which is the same as the starting point */
+    int points_max = node->points; /* scaled array has exact size */
+    int points = node->points - 1;
+    art_vpath_add_point (vec, &points, &points_max, ART_LINETO,
+           (**vec).x, (**vec).y);
+    art_vpath_add_point (vec, &points, &points_max, ART_END, 0, 0);
+}
+
+
+/* find bbox of a string */
+static void compute_string_bbox(gfx_string string) {
+    unsigned int n;
+    FT_BBox bbox;
+
+    bbox.xMin = bbox.yMin = 32000;
+    bbox.xMax = bbox.yMax = -32000;
+    for ( n = 0; n < string->num_glyphs; n++ ) {
+      FT_BBox glyph_bbox;
+      FT_Glyph_Get_CBox( string->glyphs[n].image, ft_glyph_bbox_gridfit,
+       &glyph_bbox );
+      if (glyph_bbox.xMin < bbox.xMin) {
+         bbox.xMin = glyph_bbox.xMin;
+      }
+      if (glyph_bbox.yMin < bbox.yMin) {
+        bbox.yMin = glyph_bbox.yMin;
+      }
+      if (glyph_bbox.xMax > bbox.xMax) {
+         bbox.xMax = glyph_bbox.xMax;
+      }
+      if (glyph_bbox.yMax > bbox.yMax) {
+         bbox.yMax = glyph_bbox.yMax;
+      }
+    }
+    if ( bbox.xMin > bbox.xMax ) { 
+      bbox.xMin = 0;
+      bbox.yMin = 0;
+      bbox.xMax = 0;
+      bbox.yMax = 0;
+    }
+    string->bbox.xMin = bbox.xMin;
+    string->bbox.xMax = bbox.xMax;
+    string->bbox.yMin = bbox.yMin;
+    string->bbox.yMax = bbox.yMax;
+} 
+
+/* create a free type glyph string */
+gfx_string gfx_string_create(gfx_canvas_t *canvas, FT_Face face,const char *text,
+        int rotation, double tabwidth, double size )
+{
+
+  FT_GlyphSlot  slot = face->glyph;  /* a small shortcut */
+  FT_Bool       use_kerning;
+  FT_UInt       previous;
+  FT_Vector     ft_pen;
+
+  gfx_string    string = (gfx_string) malloc (sizeof(struct gfx_string_s));
+
+  gfx_char      glyph;          /* current glyph in table */
+  int          n;
+  int           error;
+  int        gottab = 0;    
+
+#ifdef HAVE_MBSTOWCS
+  wchar_t      *cstr;
+  size_t       clen = strlen(text)+1;
+  cstr = malloc(sizeof(wchar_t) * clen); /* yes we are allocating probably too much here, I know */
+  string->count=mbstowcs(cstr,text,clen);
+  if ( string->count == -1){
+  /* conversion did not work, so lets fall back to just use what we got */
+       string->count=clen-1;
+        for(n=0;text[n] != '\0';n++){
+            cstr[n]=(unsigned char)text[n];
+        }
+  }
+#else
+  char         *cstr = strdup(text);
+  string->count = strlen (text);
+#endif
+
+  ft_pen.x = 0;   /* start at (0,0) !! */
+  ft_pen.y = 0;
+
+
+  string->width = 0;
+  string->height = 0;
+  string->glyphs = (gfx_char) calloc (string->count,sizeof(struct gfx_char_s));
+  string->num_glyphs = 0;
+  string->transform.xx = (FT_Fixed)( cos(M_PI*(rotation)/180.0)*0x10000);
+  string->transform.xy = (FT_Fixed)(-sin(M_PI*(rotation)/180.0)*0x10000);
+  string->transform.yx = (FT_Fixed)( sin(M_PI*(rotation)/180.0)*0x10000);
+  string->transform.yy = (FT_Fixed)( cos(M_PI*(rotation)/180.0)*0x10000);
+
+  use_kerning = FT_HAS_KERNING(face);
+  previous    = 0;
+  glyph = string->glyphs;
+  for (n=0; n<string->count;glyph++,n++) {
+    FT_Vector   vec;
+    /* handle the tabs ...
+       have a witespace glyph inserted, but set its width such that the distance
+    of the new right edge is x times tabwidth from 0,0 where x is an integer. */    
+    unsigned int letter = cstr[n];
+       letter = afm_fix_osx_charset(letter); /* unsafe macro */
+          
+    gottab = 0;
+    if (letter == '\\' && n+1 < string->count && cstr[n+1] == 't'){
+            /* we have a tab here so skip the backslash and
+               set t to ' ' so that we get a white space */
+            gottab = 1;
+            n++;
+            letter  = ' ';            
+    }            
+    if (letter == '\t'){
+       letter = ' ';
+        gottab = 1 ;
+    }            
+    /* initialize each struct gfx_char_s */
+    glyph->index = 0;
+    glyph->pos.x = 0;
+    glyph->pos.y = 0;
+    glyph->image = NULL;
+    glyph->index = FT_Get_Char_Index( face, letter );
+
+    /* compute glyph origin */
+    if ( use_kerning && previous && glyph->index ) {
+      FT_Vector kerning;
+      FT_Get_Kerning (face, previous, glyph->index,
+          ft_kerning_default, &kerning);
+      ft_pen.x += kerning.x;
+      ft_pen.y += kerning.y;
+    }
+
+    /* load the glyph image (in its native format) */
+    /* for now, we take a monochrome glyph bitmap */
+    error = FT_Load_Glyph (face, glyph->index, size > canvas->font_aa_threshold ?
+                            canvas->aa_type == AA_NORMAL ? FT_LOAD_TARGET_NORMAL :
+                            canvas->aa_type == AA_LIGHT ? FT_LOAD_TARGET_LIGHT :
+                            FT_LOAD_TARGET_MONO : FT_LOAD_TARGET_MONO);
+    if (error) {
+      RRDPRINTF("couldn't load glyph:  %c\n", letter)
+      continue;
+    }
+    error = FT_Get_Glyph (slot, &glyph->image);
+    if (error) {
+      RRDPRINTF("couldn't get glyph %c from slot %d\n", letter, (int)slot)
+      continue;
+    }
+    /* if we are in tabbing mode, we replace the tab with a space and shift the position
+       of the space so that its left edge is where the tab was supposed to land us */
+    if (gottab){
+       /* we are in gridfitting mode so the calculations happen in 1/64 pixles */
+        ft_pen.x = tabwidth*64.0 * (float)(1 + (long)(ft_pen.x / (tabwidth * 64.0))) - slot->advance.x;
+    }
+    /* store current pen position */
+    glyph->pos.x = ft_pen.x;
+    glyph->pos.y = ft_pen.y;
+
+
+    ft_pen.x   += slot->advance.x;    
+    ft_pen.y   += slot->advance.y;
+
+    /* rotate glyph */
+    vec = glyph->pos;
+    FT_Vector_Transform (&vec, &string->transform);
+    error = FT_Glyph_Transform (glyph->image, &string->transform, &vec);
+    if (error) {
+      RRDPRINTF("couldn't transform glyph id %d\n", letter)
+      continue;
+    }
+
+    /* convert to a bitmap - destroy native image */
+    error = FT_Glyph_To_Bitmap (&glyph->image, size > canvas->font_aa_threshold ?
+                            canvas->aa_type == AA_NORMAL ? FT_RENDER_MODE_NORMAL :
+                            canvas->aa_type == AA_LIGHT ? FT_RENDER_MODE_LIGHT :
+                            FT_RENDER_MODE_MONO : FT_RENDER_MODE_MONO, 0, 1);
+    if (error) {
+      RRDPRINTF("couldn't convert glyph id %d to bitmap\n", letter)
+      continue;
+    }
+
+    /* increment number of glyphs */
+    previous = glyph->index;
+    string->num_glyphs++;
+  }
+  free(cstr);
+/*  printf ("number of glyphs = %d\n", string->num_glyphs);*/
+  compute_string_bbox( string );
+  /* the last character was a tab */  
+  /* if (gottab) { */
+      string->width = ft_pen.x;
+  /* } else {
+      string->width = string->bbox.xMax - string->bbox.xMin;
+  } */
+  string->height = string->bbox.yMax - string->bbox.yMin;
+  return string;
+}
+
+
+static int gfx_save_png (art_u8 *buffer, FILE *fp,
+                     long width, long height, long bytes_per_pixel);
+/* render grafics into png image */
+
+int           gfx_render_png (gfx_canvas_t *canvas, 
+                             art_u32 width, art_u32 height, 
+                             gfx_color_t background, FILE *fp){
+    
+    
+    FT_Library    library;
+    gfx_node_t *node = canvas->firstnode;    
+    /*
+    art_u8 red = background >> 24, green = (background >> 16) & 0xff;
+    art_u8 blue = (background >> 8) & 0xff, alpha = ( background & 0xff );
+    */
+    unsigned long pys_width = width * canvas->zoom;
+    unsigned long pys_height = height * canvas->zoom;
+    const int bytes_per_pixel = 4;
+    unsigned long rowstride = pys_width*bytes_per_pixel; /* bytes per pixel */
+    
+    /* fill that buffer with out background color */
+    gfx_color_t *buffp = art_new (gfx_color_t, pys_width*pys_height);
+    art_u8 *buffer = (art_u8 *)buffp;
+    unsigned long i;
+    for (i=0;i<pys_width*pys_height;
+        i++){
+       *(buffp++)=background;
+    }
+    FT_Init_FreeType( &library );
+    while(node){
+        switch (node->type) {
+        case GFX_LINE:
+        case GFX_AREA: {   
+            ArtVpath *vec;
+            double dst[6];     
+            ArtSVP *svp;
+            art_affine_scale(dst,canvas->zoom,canvas->zoom);
+            vec = art_vpath_affine_transform(node->path,dst);
+           if (node->closed_path)
+               gfx_libart_close_path(node, &vec);
+           /* gfx_round_scaled_coordinates(vec); */
+            /* pvec = art_vpath_perturb(vec);
+              art_free(vec); */
+            if(node->type == GFX_LINE){
+                svp = art_svp_vpath_stroke ( vec, ART_PATH_STROKE_JOIN_ROUND,
+                                             ART_PATH_STROKE_CAP_ROUND,
+                                             node->size*canvas->zoom,4,0.25);
+            } else {
+                svp  = art_svp_from_vpath ( vec );
+               /* this takes time and is unnecessary since we make
+                  sure elsewhere that the areas are going clock-whise */
+               /*  svpt = art_svp_uncross( svp );
+                    art_svp_free(svp);
+                   svp  = art_svp_rewind_uncrossed(svpt,ART_WIND_RULE_NONZERO); 
+                    art_svp_free(svpt);
+                 */
+            }
+            art_free(vec);
+           /* this is from gnome since libart does not have this yet */
+            gnome_print_art_rgba_svp_alpha (svp ,0,0, pys_width, pys_height,
+                                node->color, buffer, rowstride, NULL);
+            art_svp_free(svp);
+            break;
+        }
+        case GFX_TEXT: {
+            unsigned int  n;
+            int  error;
+            art_u8 fcolor[4],falpha;
+            FT_Face       face;
+            gfx_char      glyph;
+            gfx_string    string;
+            FT_Vector     vec;  /* 26.6 */
+
+            float pen_x = 0.0 , pen_y = 0.0;
+            /* double x,y; */
+            long   ix,iy;
+            
+            fcolor[0] = node->color >> 24;
+            fcolor[1] = (node->color >> 16) & 0xff;
+            fcolor[2] = (node->color >> 8) & 0xff;
+            falpha = node->color & 0xff;
+            error = FT_New_Face( library,
+                                 (char *)node->filename,
+                                 0,
+                                 &face );
+           if ( error ) {
+               rrd_set_error("failed to load %s",node->filename);
+               
+               break;
+           }
+            error = FT_Set_Char_Size(face,   /* handle to face object            */
+                                     (long)(node->size*64),
+                                     (long)(node->size*64),
+                                     (long)(100*canvas->zoom),
+                                     (long)(100*canvas->zoom));
+            if ( error ) {
+                FT_Done_Face(face);
+                break;
+            }
+            pen_x = node->x * canvas->zoom;
+            pen_y = node->y * canvas->zoom;
+
+            string = gfx_string_create (canvas, face, node->text, node->angle, node->tabwidth, node->size);
+            FT_Done_Face(face);
+
+            switch(node->halign){
+            case GFX_H_RIGHT:  vec.x = -string->bbox.xMax;
+                               break;          
+            case GFX_H_CENTER: vec.x = abs(string->bbox.xMax) >= abs(string->bbox.xMin) ?
+                                       -string->bbox.xMax/2:-string->bbox.xMin/2;
+                               break;          
+            case GFX_H_LEFT:   vec.x = -string->bbox.xMin;
+                              break;
+            case GFX_H_NULL:   vec.x = 0;
+                               break;          
+            }
+
+            switch(node->valign){
+            case GFX_V_TOP:    vec.y = string->bbox.yMax;
+                               break;
+            case GFX_V_CENTER: vec.y = abs(string->bbox.yMax) >= abs(string->bbox.yMin) ?
+                                       string->bbox.yMax/2:string->bbox.yMin/2;
+                               break;
+            case GFX_V_BOTTOM: vec.y = 0;
+                               break;
+            case GFX_V_NULL:   vec.y = 0;
+                               break;
+            }
+           pen_x += vec.x/64;
+           pen_y += vec.y/64;
+            glyph = string->glyphs;
+            for(n=0; n<string->num_glyphs; n++, glyph++) {
+                int gr;
+                FT_Glyph        image;
+                FT_BitmapGlyph  bit;
+               /* long buf_x,comp_n; */
+               /* make copy to transform */
+                if (! glyph->image) {
+                  RRDPRINTF("no image\n")
+                  continue;
+                }
+                error = FT_Glyph_Copy (glyph->image, &image);
+                if (error) {
+                  RRDPRINTF("couldn't copy image\n")
+                  continue;
+                }
+
+                /* transform it */
+                vec = glyph->pos;
+                FT_Vector_Transform (&vec, &string->transform);
+
+                bit = (FT_BitmapGlyph) image;
+                gr = bit->bitmap.num_grays -1;
+/* 
+               buf_x = (pen_x + 0.5) + (double)bit->left;
+               comp_n = buf_x + bit->bitmap.width > pys_width ? pys_width - buf_x : bit->bitmap.width;
+                if (buf_x < 0 || buf_x >= (long)pys_width) continue;
+               buf_x *=  bytes_per_pixel ;
+               for (iy=0; iy < bit->bitmap.rows; iy++){                    
+                   long buf_y = iy+(pen_y+0.5)-(double)bit->top;
+                   if (buf_y < 0 || buf_y >= (long)pys_height) continue;
+                    buf_y *= rowstride;
+                   for (ix=0;ix < bit->bitmap.width;ix++){             
+                       *(letter + (ix*bytes_per_pixel+3)) = *(bit->bitmap.buffer + iy * bit->bitmap.width + ix);
+                   }
+                   art_rgba_rgba_composite(buffer + buf_y + buf_x ,letter,comp_n);
+                }
+                art_free(letter);
+*/
+                switch ( bit->bitmap.pixel_mode ) {
+                    case FT_PIXEL_MODE_GRAY:
+                        for (iy=0; iy < bit->bitmap.rows; iy++){
+                            long buf_y = iy+(pen_y+0.5)-bit->top;
+                            if (buf_y < 0 || buf_y >= (long)pys_height) continue;
+                            buf_y *= rowstride;
+                            for (ix=0;ix < bit->bitmap.width;ix++){
+                                long buf_x = ix + (pen_x + 0.5) + (double)bit->left ;
+                                art_u8 font_alpha;
+
+                                if (buf_x < 0 || buf_x >= (long)pys_width) continue;
+                                buf_x *=  bytes_per_pixel ;
+                                font_alpha =  *(bit->bitmap.buffer + iy * bit->bitmap.pitch + ix);
+                    if (font_alpha > 0){
+                                    fcolor[3] =  (art_u8)((double)font_alpha / gr * falpha);
+                        art_rgba_rgba_composite(buffer + buf_y + buf_x ,fcolor,1);
+                                }
+                            }
+                        }
+                        break;
+
+                    case FT_PIXEL_MODE_MONO:
+                        for (iy=0; iy < bit->bitmap.rows; iy++){
+                            long buf_y = iy+(pen_y+0.5)-bit->top;
+                            if (buf_y < 0 || buf_y >= (long)pys_height) continue;
+                            buf_y *= rowstride;
+                            for (ix=0;ix < bit->bitmap.width;ix++){
+                                long buf_x = ix + (pen_x + 0.5) + (double)bit->left ;
+
+                                if (buf_x < 0 || buf_x >= (long)pys_width) continue;
+                                buf_x *=  bytes_per_pixel ;
+                                if ( (fcolor[3] = falpha * ((*(bit->bitmap.buffer + iy * bit->bitmap.pitch + ix/8) >> (7 - (ix % 8))) & 1)) > 0 )
+                                    art_rgba_rgba_composite(buffer + buf_y + buf_x ,fcolor,1);
+                            }
+                        }
+                        break;
+
+                        default:
+                            rrd_set_error("unknown freetype pixel mode: %d", bit->bitmap.pixel_mode);
+                            break;
+                }
+
+/*
+                for (iy=0; iy < bit->bitmap.rows; iy++){                   
+                    long buf_y = iy+(pen_y+0.5)-bit->top;
+                    if (buf_y < 0 || buf_y >= (long)pys_height) continue;
+                    buf_y *= rowstride;
+                    for (ix=0;ix < bit->bitmap.width;ix++){
+                        long buf_x = ix + (pen_x + 0.5) + (double)bit->left ;
+                        art_u8 font_alpha;
+                        
+                        if (buf_x < 0 || buf_x >= (long)pys_width) continue;
+                        buf_x *=  bytes_per_pixel ;
+                        font_alpha =  *(bit->bitmap.buffer + iy * bit->bitmap.width + ix);
+                        font_alpha =  (art_u8)((double)font_alpha / gr * falpha);
+                        for (iz = 0; iz < 3; iz++){
+                            art_u8 *orig = buffer + buf_y + buf_x + iz;
+                            *orig =  (art_u8)((double)*orig / gr * ( gr - font_alpha) +
+                                              (double)fcolor[iz] / gr * (font_alpha));
+                        }
+                    }
+                }
+*/
+                FT_Done_Glyph (image);
+            }
+            gfx_string_destroy(string);
+        }
+        }
+        node = node->next;
+    }  
+    gfx_save_png(buffer,fp , pys_width,pys_height,bytes_per_pixel);
+    art_free(buffer);
+    FT_Done_FreeType( library );
+    return 0;    
+}
+
+/* free memory used by nodes this will also remove memory required for
+   associated paths and svcs ... but not for text strings */
+int
+gfx_destroy    (gfx_canvas_t *canvas){  
+  gfx_node_t *next,*node = canvas->firstnode;
+  while(node){
+    next = node->next;
+    art_free(node->path);
+    free(node->text);
+    free(node->filename);
+    art_free(node);
+    node = next;
+  }
+  art_free(canvas);
+  return 0;
+}
+static int gfx_save_png (art_u8 *buffer, FILE *fp,  long width, long height, long bytes_per_pixel){
+  png_structp png_ptr = NULL;
+  png_infop   info_ptr = NULL;
+  int i;
+  png_bytep *row_pointers;
+  int rowstride = width * bytes_per_pixel;
+  png_text text[2];
+  
+  if (fp == NULL)
+    return (1);
+
+  png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,NULL,NULL,NULL);
+  if (png_ptr == NULL)
+   {
+      return (1);
+   }
+   row_pointers = (png_bytepp)png_malloc(png_ptr,
+                                     height*sizeof(png_bytep));
+
+  info_ptr = png_create_info_struct(png_ptr);
+
+  if (info_ptr == NULL)
+    {
+      png_free(png_ptr,row_pointers);
+      png_destroy_write_struct(&png_ptr,  (png_infopp)NULL);
+      return (1);
+    }
+
+  if (setjmp(png_jmpbuf(png_ptr)))
+    {
+      /* If we get here, we had a problem writing the file */
+      png_destroy_write_struct(&png_ptr, &info_ptr);
+      return (1);
+    }
+
+  png_init_io(png_ptr, fp);
+  png_set_IHDR (png_ptr, info_ptr,width, height,
+                8, PNG_COLOR_TYPE_RGB_ALPHA,
+                PNG_INTERLACE_NONE,
+                PNG_COMPRESSION_TYPE_DEFAULT,
+                PNG_FILTER_TYPE_DEFAULT);
+
+  text[0].key = "Software";
+  text[0].text = "RRDtool, Tobias Oetiker <tobi@oetiker.ch>, http://tobi.oetiker.ch";
+  text[0].compression = PNG_TEXT_COMPRESSION_NONE;
+  png_set_text (png_ptr, info_ptr, text, 1);
+
+  /* lets make this fast while ending up with some increass in image size */
+  png_set_filter(png_ptr,0,PNG_FILTER_NONE);
+  /* png_set_filter(png_ptr,0,PNG_FILTER_SUB); */
+  png_set_compression_level(png_ptr,1);
+  /* png_set_compression_strategy(png_ptr,Z_HUFFMAN_ONLY); */
+  /* 
+  png_set_filter(png_ptr,PNG_FILTER_TYPE_BASE,PNG_FILTER_SUB);
+  png_set_compression_strategy(png_ptr,Z_HUFFMAN_ONLY);
+  png_set_compression_level(png_ptr,Z_BEST_SPEED); */
+  
+  /* Write header data */
+  png_write_info (png_ptr, info_ptr);
+  for (i = 0; i < height; i++)
+    row_pointers[i] = (png_bytep) (buffer + i*rowstride);
+  
+  png_write_image(png_ptr, row_pointers);
+  png_write_end(png_ptr, info_ptr);
+  png_free(png_ptr,row_pointers);
+  png_destroy_write_struct(&png_ptr, &info_ptr);
+  return 1;
+}
+
+/* ----- COMMON ROUTINES for pdf, svg and eps */
+#define min3(a, b, c) (a < b ? (a < c ? a : c) : (b < c ? b : c))
+#define max3(a, b, c) (a > b ? (a > c ? a : c) : (b > c ? b : c))
+
+#define PDF_CALC_DEBUG 0
+
+typedef struct pdf_point
+{
+       double x, y;
+} pdf_point;
+
+typedef struct
+{
+       double ascender, descender, baselineY;
+       pdf_point sizep, minp, maxp;
+       double x, y, tdx, tdy;
+       double r, cos_r, sin_r;
+       double ma, mb, mc, md, mx, my; /* pdf coord matrix */
+       double tmx, tmy; /* last 2 coords of text coord matrix */
+#if PDF_CALC_DEBUG
+       int debug;
+#endif
+} pdf_coords;
+
+#if PDF_CALC_DEBUG
+static void pdf_dump_calc(gfx_node_t *node, pdf_coords *g)
+{
+       fprintf(stderr, "PDF CALC =============================\n");
+       fprintf(stderr, "   '%s' at %f pt\n", node->text, node->size);
+       fprintf(stderr, "   align h = %s, v = %s,  sizep = %f, %f\n",
+               (node->halign == GFX_H_RIGHT ? "r" :
+                       (node->halign == GFX_H_CENTER ? "c" :
+                               (node->halign == GFX_H_LEFT ? "l" : "N"))),
+               (node->valign == GFX_V_TOP ? "t" :
+                       (node->valign == GFX_V_CENTER ? "c" :
+                               (node->valign == GFX_V_BOTTOM ? "b" : "N"))),
+                       g->sizep.x, g->sizep.y);
+       fprintf(stderr, "   r = %f = %f, cos = %f, sin = %f\n",
+                       g->r, node->angle, g->cos_r, g->sin_r);
+       fprintf(stderr, "   ascender = %f, descender = %f, baselineY = %f\n",
+               g->ascender, g->descender, g->baselineY);
+       fprintf(stderr, "   sizep: %f, %f\n", g->sizep.x, g->sizep.y);
+       fprintf(stderr, "   minp: %f, %f     maxp = %f, %f\n", 
+                       g->minp.x, g->minp.y, g->maxp.x, g->maxp.y);
+       fprintf(stderr, "   x = %f, y = %f\n", g->x, g->y);
+       fprintf(stderr, "   tdx = %f, tdy = %f\n", g->tdx, g->tdy);
+       fprintf(stderr, "   GM = %f, %f, %f, %f, %f, %f\n",
+                       g->ma, g->mb, g->mc, g->md, g->mx, g->my);
+       fprintf(stderr, "   TM = %f, %f, %f, %f, %f, %f\n",
+                       g->ma, g->mb, g->mc, g->md, g->tmx, g->tmy);
+}
+#endif
+#if PDF_CALC_DEBUG
+#define PDF_DD(x) if (g->debug) x;
+#else
+#define PDF_DD(x)
+#endif
+
+static void pdf_rotate(pdf_coords *g, pdf_point *p)
+{
+    double x2 = g->cos_r * p->x - g->sin_r * p->y;
+    double y2 = g->sin_r * p->x + g->cos_r * p->y;
+       PDF_DD( fprintf(stderr, "  rotate(%f, %f) -> %f, %f\n", p->x, p->y, x2, y2))
+    p->x = x2;
+       p->y = y2;
+}
+
+
+static void pdf_calc(int page_height, gfx_node_t *node, pdf_coords *g)
+{
+       pdf_point a, b, c;
+#if PDF_CALC_DEBUG
+       /* g->debug = !!strstr(node->text, "RevProxy-1") || !!strstr(node->text, "08:00"); */
+       g->debug = !!strstr(node->text, "sekunder") || !!strstr(node->text, "Web");
+#endif
+       g->x = node->x;
+       g->y = page_height - node->y;
+       if (node->angle) {
+               g->r = 2 * M_PI * node->angle / 360.0;
+               g->cos_r = cos(g->r);
+               g->sin_r = sin(g->r);
+       } else {
+               g->r = 0;
+               g->cos_r = 1;
+               g->sin_r = 0;
+       }
+       g->ascender = afm_get_ascender(node->filename, node->size);
+       g->descender = afm_get_descender(node->filename, node->size);
+       g->sizep.x = afm_get_text_width(0, node->filename, node->size, node->tabwidth, node->text);
+       /* seems like libart ignores the descender when doing vertial-align = bottom,
+          so we do that too, to get labels v-aligning properly */
+       g->sizep.y = -g->ascender; /* + afm_get_descender(font->ps_font, node->size); */
+       g->baselineY = -g->ascender - g->sizep.y / 2;
+       a.x = g->sizep.x; a.y = g->sizep.y;
+       b.x = g->sizep.x; b.y = 0;
+       c.x = 0; c.y = g->sizep.y;
+       if (node->angle) {
+               pdf_rotate(g, &a);
+               pdf_rotate(g, &b);
+               pdf_rotate(g, &c);
+       }
+       g->minp.x = min3(a.x, b.x, c.x);
+       g->minp.y = min3(a.y, b.y, c.y);
+       g->maxp.x = max3(a.x, b.x, c.x);
+       g->maxp.y = max3(a.y, b.y, c.y);
+  /* The alignment parameters in node->valign and node->halign
+     specifies the alignment in the non-rotated coordinate system
+     (very unlike pdf/postscript), which complicates matters.
+  */
+       switch (node->halign) {
+       case GFX_H_RIGHT:  g->tdx = -g->maxp.x; break;
+       case GFX_H_CENTER: g->tdx = -(g->maxp.x + g->minp.x) / 2; break;
+       case GFX_H_LEFT:   g->tdx = -g->minp.x; break;
+       case GFX_H_NULL:   g->tdx = 0; break;
+       }
+       switch(node->valign){
+       case GFX_V_TOP:    g->tdy = -g->maxp.y; break;
+       case GFX_V_CENTER: g->tdy = -(g->maxp.y + g->minp.y) / 2; break;
+       case GFX_V_BOTTOM: g->tdy = -g->minp.y; break;
+       case GFX_V_NULL:   g->tdy = 0; break;          
+       }
+       g->ma = g->cos_r;
+       g->mb = g->sin_r;
+       g->mc = -g->sin_r;
+       g->md = g->cos_r;
+       g->mx = g->x + g->tdx;
+       g->my = g->y + g->tdy;
+       g->tmx = g->mx - g->ascender * g->mc;
+       g->tmy = g->my - g->ascender * g->md;
+       PDF_DD(pdf_dump_calc(node, g))
+}
+
+/* ------- SVG -------
+   SVG reference:
+   http://www.w3.org/TR/SVG/
+*/
+static int svg_indent = 0;
+static int svg_single_line = 0;
+static const char *svg_default_font = "-dummy-";
+typedef struct svg_dash
+{
+  int dash_enable;
+  double dash_adjust, dash_len, dash_offset;
+  double adjusted_on, adjusted_off;
+} svg_dash;
+
+
+static void svg_print_indent(FILE *fp)
+{
+  int i;
+   for (i = svg_indent - svg_single_line; i > 0; i--) {
+     putc(' ', fp);
+     putc(' ', fp);
+   }
+}
+static void svg_start_tag(FILE *fp, const char *name)
+{
+   svg_print_indent(fp);
+   putc('<', fp);
+   fputs(name, fp);
+   svg_indent++;
+}
+static void svg_close_tag_single_line(FILE *fp)
+{
+   svg_single_line++;
+   putc('>', fp);
+}
+static void svg_close_tag(FILE *fp)
+{
+   putc('>', fp);
+   if (!svg_single_line)
+     putc('\n', fp);
+}
+static void svg_end_tag(FILE *fp, const char *name)
+{
+   /* name is NULL if closing empty-node tag */
+   svg_indent--;
+   if (svg_single_line)
+     svg_single_line--;
+   else if (name)
+     svg_print_indent(fp);
+   if (name != NULL) {
+     fputs("</", fp);
+     fputs(name, fp);
+   } else {
+     putc('/', fp);
+   }
+   svg_close_tag(fp);
+}
+static void svg_close_tag_empty_node(FILE *fp)
+{
+   svg_end_tag(fp, NULL);
+}
+static void svg_write_text(FILE *fp, const char *text)
+{
+#ifdef HAVE_MBSTOWCS
+    size_t clen;
+    wchar_t *p, *cstr, ch;
+    int text_count;
+    if (!text)
+       return;
+    clen = strlen(text) + 1;
+    cstr = malloc(sizeof(wchar_t) * clen);
+    text_count = mbstowcs(cstr, text, clen);
+    if (text_count == -1)
+       text_count = mbstowcs(cstr, "Enc-Err", 6);
+    p = cstr;
+#else
+    unsigned char *p = text;
+    unsigned char *cstr;
+    char ch;
+    if (!p)
+       return;
+#endif
+  while (1) {
+    ch = *p++;
+    ch = afm_fix_osx_charset(ch); /* unsafe macro */
+    switch (ch) {
+    case 0:
+#ifdef HAVE_MBSTOWCS
+    free(cstr);
+#endif
+    return;
+    case '&': fputs("&amp;", fp); break;
+    case '<': fputs("&lt;", fp); break;
+    case '>': fputs("&gt;", fp); break;
+    case '"': fputs("&quot;", fp); break;
+    default:
+        if (ch == 32) {
+#ifdef HAVE_MBSTOWCS
+            if (p <= cstr + 1 || !*p || *p == 32)
+                fputs("&#160;", fp); /* non-breaking space in unicode */
+            else
+#endif
+                fputc(32, fp);
+        } else if (ch < 32 || ch >= 127)
+       fprintf(fp, "&#%d;", (int)ch);
+      else
+       putc((char)ch, fp);
+     }
+   }
+}
+static void svg_format_number(char *buf, int bufsize, double d)
+{
+   /* omit decimals if integer to reduce filesize */
+   char *p;
+   snprintf(buf, bufsize, "%.2f", d);
+   p = buf; /* doesn't trust snprintf return value */
+   while (*p)
+     p++;
+   while (--p > buf) {
+     char ch = *p;
+     if (ch == '0') {
+       *p = '\0'; /* zap trailing zeros */
+       continue;
+     }
+     if (ch == '.')
+       *p = '\0'; /* zap trailing dot */
+     break;
+   }
+}
+static void svg_write_number(FILE *fp, double d)
+{
+   char buf[60];
+   svg_format_number(buf, sizeof(buf), d);
+   fputs(buf, fp);
+}
+
+static int svg_color_is_black(int c)
+{
+  /* gfx_color_t is RRGGBBAA */
+  return c == 0x000000FF;
+}
+static void svg_write_color(FILE *fp, gfx_color_t c, const char *attr)
+{
+  /* gfx_color_t is RRGGBBAA, svg can use #RRGGBB and #RGB like html */
+  gfx_color_t rrggbb = (int)((c >> 8) & 0xFFFFFF);
+  gfx_color_t opacity = c & 0xFF;
+  fprintf(fp, " %s=\"", attr);
+  if ((rrggbb & 0x0F0F0F) == ((rrggbb >> 4) & 0x0F0F0F)) {
+     /* css2 short form, #rgb is #rrggbb, not #r0g0b0 */
+    fprintf(fp, "#%03lX",
+          ( ((rrggbb >> 8) & 0xF00)
+          | ((rrggbb >> 4) & 0x0F0)
+          | ( rrggbb       & 0x00F)));
+   } else {
+    fprintf(fp, "#%06lX", rrggbb);
+   }
+  fputs("\"", fp);
+  if (opacity != 0xFF) {
+    fprintf(fp, " opacity=\"");
+    svg_write_number(fp, opacity / 255.0);
+    fputs("\"", fp);
+ }
+}
+static void svg_get_dash(gfx_node_t *node, svg_dash *d)
+{
+  double offset;
+  int mult;
+  if (node->dash_on <= 0 || node->dash_off <= 0) {
+    d->dash_enable = 0;
+    return;
+  }
+  d->dash_enable = 1;
+  d->dash_len = node->dash_on + node->dash_off;
+  /* dash on/off adjustment due to round caps */
+  d->dash_adjust = 0.8 * node->size;
+  d->adjusted_on = node->dash_on - d->dash_adjust;
+  if (d->adjusted_on < 0.01)
+      d->adjusted_on = 0.01;
+  d->adjusted_off = d->dash_len - d->adjusted_on;
+  /* dash offset calc */
+  if (node->path[0].x == node->path[1].x) /* only good for horz/vert lines */
+    offset = node->path[0].y;
+  else
+    offset = node->path[0].x;
+  mult = (int)fabs(offset / d->dash_len);
+  d->dash_offset = offset - mult * d->dash_len;
+  if (node->path[0].x < node->path[1].x || node->path[0].y < node->path[1].y)
+    d->dash_offset = d->dash_len - d->dash_offset;
+}
+
+static int svg_dash_equal(svg_dash *a, svg_dash *b)
+{
+  if (a->dash_enable != b->dash_enable)
+    return 0;
+  if (a->adjusted_on != b->adjusted_on)
+    return 0;
+  if (a->adjusted_off != b->adjusted_off)
+    return 0;
+  /* rest of properties will be the same when on+off are */
+  return 1;
+}
+
+static void svg_common_path_attributes(FILE *fp, gfx_node_t *node)
+{
+  svg_dash dash_info;
+  svg_get_dash(node, &dash_info);
+  fputs(" stroke-width=\"", fp);
+  svg_write_number(fp, node->size);
+  fputs("\"", fp);
+  svg_write_color(fp, node->color, "stroke");
+  fputs(" fill=\"none\"", fp);
+  if (dash_info.dash_enable) {
+    if (dash_info.dash_offset != 0) {
+      fputs(" stroke-dashoffset=\"", fp);
+      svg_write_number(fp, dash_info.dash_offset);
+      fputs("\"", fp);
+    }
+    fputs(" stroke-dasharray=\"", fp);
+    svg_write_number(fp, dash_info.adjusted_on);
+    fputs(",", fp);
+    svg_write_number(fp, dash_info.adjusted_off);
+    fputs("\"", fp);
+  }
+}
+
+static int svg_is_int_step(double a, double b)
+{
+   double diff = fabs(a - b);
+   return floor(diff) == diff;
+}
+static int svg_path_straight_segment(FILE *fp,
+     double lastA, double currentA, double currentB,
+     gfx_node_t *node,
+     int segment_idx, int isx, char absChar, char relChar)
+{
+   if (!svg_is_int_step(lastA, currentA)) {
+     putc(absChar, fp);
+     svg_write_number(fp, currentA);
+     return 0;
+   }
+   if (segment_idx < node->points - 1) {
+     ArtVpath *vec = node->path + segment_idx + 1;
+     if (vec->code == ART_LINETO) {
+       double nextA = (isx ? vec->x : vec->y) - LINEOFFSET;
+       double nextB = (isx ? vec->y : vec->x) - LINEOFFSET;
+       if (nextB == currentB
+           && ((currentA >= lastA) == (nextA >= currentA))
+           && svg_is_int_step(currentA, nextA)) {
+         return 1; /* skip to next as it is a straight line  */
+       }
+     }
+   }
+   putc(relChar, fp);
+   svg_write_number(fp, currentA - lastA);
+   return 0;
+}
+static void svg_path(FILE *fp, gfx_node_t *node, int multi)
+{
+   int i;
+   double lastX = 0, lastY = 0;
+   /* for straight lines <path..> tags take less space than
+      <line..> tags because of the efficient packing
+      in the 'd' attribute */
+   svg_start_tag(fp, "path");
+  if (!multi)
+    svg_common_path_attributes(fp, node);
+   fputs(" d=\"", fp);
+   /* specification of the 'd' attribute: */
+   /* http://www.w3.org/TR/SVG/paths.html#PathDataGeneralInformation */
+   for (i = 0; i < node->points; i++) {
+     ArtVpath *vec = node->path + i;
+     double x = vec->x - LINEOFFSET;
+     double y = vec->y - LINEOFFSET;
+     switch (vec->code) {
+     case ART_MOVETO_OPEN: /* fall-through */
+     case ART_MOVETO:
+       putc('M', fp);
+       svg_write_number(fp, x);
+       putc(',', fp);
+       svg_write_number(fp, y);
+       break;
+     case ART_LINETO:
+       /* try optimize filesize by using minimal lineto commands */
+       /* without introducing rounding errors. */
+       if (x == lastX) {
+         if (svg_path_straight_segment(fp, lastY, y, x, node, i, 0, 'V', 'v'))
+           continue;
+       } else if (y == lastY) {
+         if (svg_path_straight_segment(fp, lastX, x, y, node, i, 1, 'H', 'h'))
+           continue;
+       } else {
+         putc('L', fp);
+         svg_write_number(fp, x);
+         putc(',', fp);
+         svg_write_number(fp, y);
+       }
+       break;
+     case ART_CURVETO: break; /* unsupported */
+     case ART_END: break; /* nop */
+     }
+     lastX = x;
+     lastY = y;
+   }
+  if (node->closed_path)
+    fputs(" Z", fp);
+   fputs("\"", fp);
+   svg_close_tag_empty_node(fp);
+}
+static void svg_multi_path(FILE *fp, gfx_node_t **nodeR)
+{
+   /* optimize for multiple paths with the same color, penwidth, etc. */
+   int num = 1;
+   gfx_node_t *node = *nodeR;
+   gfx_node_t *next = node->next;
+   while (next) {
+     if (next->type != node->type
+         || next->size != node->size
+        || next->color != node->color
+        || next->dash_on != node->dash_on
+        || next->dash_off != node->dash_off)
+       break;
+     next = next->next;
+     num++;
+   }
+   if (num == 1) {
+     svg_path(fp, node, 0);
+     return;
+   }
+   svg_start_tag(fp, "g");
+  svg_common_path_attributes(fp, node);
+   svg_close_tag(fp);
+   while (num && node) {
+     svg_path(fp, node, 1);
+     if (!--num)
+       break;
+     node = node->next;
+     *nodeR = node;
+   }
+   svg_end_tag(fp, "g");
+}
+static void svg_area(FILE *fp, gfx_node_t *node)
+{
+   int i;
+   double startX = 0, startY = 0;
+   svg_start_tag(fp, "polygon");
+  fputs(" ", fp);
+  svg_write_color(fp, node->color, "fill");
+  fputs(" points=\"", fp);
+   for (i = 0; i < node->points; i++) {
+     ArtVpath *vec = node->path + i;
+     double x = vec->x - LINEOFFSET;
+     double y = vec->y - LINEOFFSET;
+     switch (vec->code) {
+       case ART_MOVETO_OPEN: /* fall-through */
+       case ART_MOVETO:
+         svg_write_number(fp, x);
+         putc(',', fp);
+         svg_write_number(fp, y);
+         startX = x;
+         startY = y;
+         break;
+       case ART_LINETO:
+         if (i == node->points - 2
+                       && node->path[i + 1].code == ART_END
+             && fabs(x - startX) < 0.001 && fabs(y - startY) < 0.001) {
+           break; /* poly area always closed, no need for last point */
+         }
+         putc(' ', fp);
+         svg_write_number(fp, x);
+         putc(',', fp);
+         svg_write_number(fp, y);
+         break;
+       case ART_CURVETO: break; /* unsupported */
+       case ART_END: break; /* nop */
+     }
+   }
+   fputs("\"", fp);
+   svg_close_tag_empty_node(fp);
+}
+static void svg_text(FILE *fp, gfx_node_t *node)
+{
+   pdf_coords g;
+   const char *fontname;
+   /* as svg has 0,0 in top-left corner (like most screens) instead of
+         bottom-left corner like pdf and eps, we have to fake the coords
+         using offset and inverse sin(r) value */
+   int page_height = 1000;
+   pdf_calc(page_height, node, &g);
+   if (node->angle != 0) {
+     svg_start_tag(fp, "g");
+        /* can't use svg_write_number as 2 decimals is far from enough to avoid
+               skewed text */
+     fprintf(fp, " transform=\"matrix(%f,%f,%f,%f,%f,%f)\"",
+                        g.ma, -g.mb, -g.mc, g.md, g.tmx, page_height - g.tmy);
+     svg_close_tag(fp);
+   }
+   svg_start_tag(fp, "text");
+   if (!node->angle) {
+     fputs(" x=\"", fp);
+     svg_write_number(fp, g.tmx);
+     fputs("\" y=\"", fp);
+     svg_write_number(fp, page_height - g.tmy);
+     fputs("\"", fp);
+   }
+   fontname = afm_get_font_name(node->filename);
+   if (strcmp(fontname, svg_default_font))
+     fprintf(fp, " font-family=\"%s\"", fontname);
+   fputs(" font-size=\"", fp);
+   svg_write_number(fp, node->size);
+   fputs("\"", fp);
+  if (!svg_color_is_black(node->color))
+    svg_write_color(fp, node->color, "fill");
+   svg_close_tag_single_line(fp);
+   /* support for node->tabwidth missing */
+   svg_write_text(fp, node->text);
+   svg_end_tag(fp, "text");
+   if (node->angle != 0)
+     svg_end_tag(fp, "g");
+}
+int       gfx_render_svg (gfx_canvas_t *canvas,
+                 art_u32 width, art_u32 height,
+                 gfx_color_t background, FILE *fp){
+   gfx_node_t *node = canvas->firstnode;
+   /* Find the first font used, and assume it is the mostly used
+         one. It reduces the number of font-familty attributes. */
+   while (node) {
+          if (node->type == GFX_TEXT && node->filename) {
+                  svg_default_font = afm_get_font_name(node->filename);
+                  break;
+          }
+          node = node->next;
+   }
+   fputs(
+"<?xml version=\"1.0\" standalone=\"no\"?>\n"
+"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\"\n"
+"   \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n"
+"<!--\n"
+"   SVG file created by\n"
+"        RRDtool " PACKAGE_VERSION " Tobias Oetiker, http://tobi.oetiker.ch\n"
+"\n"
+"   The width/height attributes in the outhermost svg node\n"
+"   are just default sizes for the browser which is used\n"
+"   if the svg file is openened directly without being\n"
+"   embedded in an html file.\n"
+"   The viewBox is the local coord system for rrdtool.\n"
+"-->\n", fp);
+   svg_start_tag(fp, "svg");
+   fputs(" width=\"", fp);
+   svg_write_number(fp, width * canvas->zoom);
+   fputs("\" height=\"", fp);
+   svg_write_number(fp, height * canvas->zoom);
+   fputs("\" x=\"0\" y=\"0\" viewBox=\"", fp);
+   svg_write_number(fp, -LINEOFFSET);
+   fputs(" ", fp);
+   svg_write_number(fp, -LINEOFFSET);
+   fputs(" ", fp);
+   svg_write_number(fp, width - LINEOFFSET);
+   fputs(" ", fp);
+   svg_write_number(fp, height - LINEOFFSET);
+   fputs("\" preserveAspectRatio=\"xMidYMid\"", fp);
+   fprintf(fp, " font-family=\"%s\"", svg_default_font); /* default font */
+   fputs(" stroke-linecap=\"round\" stroke-linejoin=\"round\"", fp);
+   fputs(" xmlns=\"http://www.w3.org/2000/svg\"", fp);
+   fputs(" xmlns:xlink=\"http://www.w3.org/1999/xlink\"", fp);
+   svg_close_tag(fp);
+   svg_start_tag(fp, "rect");
+   fprintf(fp, " x=\"0\" y=\"0\" width=\"%d\" height=\"%d\"", width, height);
+  svg_write_color(fp, background, "fill");
+   svg_close_tag_empty_node(fp);
+   node = canvas->firstnode;
+   while (node) {
+     switch (node->type) {
+     case GFX_LINE:
+       svg_multi_path(fp, &node);
+       break;
+     case GFX_AREA:
+       svg_area(fp, node);
+       break;
+     case GFX_TEXT:
+       svg_text(fp, node);
+     }
+     node = node->next;
+   }
+   svg_end_tag(fp, "svg");
+   return 0;
+}
+
+/* ------- EPS -------
+   EPS and Postscript references:
+   http://partners.adobe.com/asn/developer/technotes/postscript.html
+*/
+
+typedef struct eps_font
+{
+  const char *ps_font;
+  int id;
+  struct eps_font *next;
+} eps_font;
+
+typedef struct eps_state
+{
+  FILE *fp;
+  gfx_canvas_t *canvas;
+  art_u32 page_width, page_height;
+  eps_font *font_list;
+  /*--*/
+  gfx_color_t color;
+  const char *font;
+  double font_size;
+  double line_width;
+  int linecap, linejoin;
+  int has_dash;
+} eps_state;
+
+static void eps_set_color(eps_state *state, gfx_color_t color)
+{
+#if USE_EPS_FAKE_ALPHA
+   double a1, a2;
+#endif
+   /* gfx_color_t is RRGGBBAA */
+  if (state->color == color)
+    return;
+#if USE_EPS_FAKE_ALPHA
+  a1 = (color & 255) / 255.0;
+  a2 = 255 * (1 - a1);
+#define eps_color_calc(x) (int)( ((x) & 255) * a1 + a2)
+#else
+#define eps_color_calc(x) (int)( (x) & 255)
+#endif
+   /* gfx_color_t is RRGGBBAA */
+  if (state->color == color)
+    return;
+  fprintf(state->fp, "%d %d %d Rgb\n",
+      eps_color_calc(color >> 24),
+      eps_color_calc(color >> 16),
+      eps_color_calc(color >>  8));
+  state->color = color;
+}
+
+static int eps_add_font(eps_state *state, gfx_node_t *node)
+{
+  /* The fonts list could be postponed to the end using
+     (atend), but let's be nice and have them in the header. */
+  const char *ps_font = afm_get_font_postscript_name(node->filename);
+  eps_font *ef;
+  for (ef = state->font_list; ef; ef = ef->next) {
+    if (!strcmp(ps_font, ef->ps_font))
+      return 0;
+  }
+  ef = malloc(sizeof(eps_font));
+  if (ef == NULL) {
+    rrd_set_error("malloc for eps_font");
+    return -1;
+  }
+  ef->next = state->font_list;
+  ef->ps_font = ps_font;
+  state->font_list = ef;
+  return 0;
+}
+
+static void eps_list_fonts(eps_state *state, const char *dscName)
+{
+  eps_font *ef;
+  int lineLen = strlen(dscName);
+  if (!state->font_list)
+    return;
+  fputs(dscName, state->fp);
+  for (ef = state->font_list; ef; ef = ef->next) {
+    int nameLen = strlen(ef->ps_font);
+    if (lineLen + nameLen > 100 && lineLen) {
+      fputs("\n", state->fp);
+      fputs("%%- \n", state->fp);
+      lineLen = 5;
+    } else {
+      fputs(" ", state->fp);
+      lineLen++;
+    }
+    fputs(ef->ps_font, state->fp);
+    lineLen += nameLen;
+  }
+  fputs("\n", state->fp);
+}
+
+static void eps_define_fonts(eps_state *state)
+{
+  eps_font *ef;
+  if (!state->font_list)
+    return;
+  for (ef = state->font_list; ef; ef = ef->next) {
+    /* PostScript¨ LANGUAGE REFERENCE third edition
+       page 349 */
+    fprintf(state->fp,
+        "%%\n"
+        "/%s findfont dup length dict begin\n"
+        "{ 1 index /FID ne {def} {pop pop} ifelse } forall\n"
+        "/Encoding ISOLatin1Encoding def\n"
+        "currentdict end\n"
+        "/%s-ISOLatin1 exch definefont pop\n"
+        "/SetFont-%s { /%s-ISOLatin1 findfont exch scalefont setfont } bd\n",
+        ef->ps_font, ef->ps_font, ef->ps_font, ef->ps_font);
+  }
+}
+
+static int eps_prologue(eps_state *state)
+{
+  gfx_node_t *node;
+  fputs(
+    "%!PS-Adobe-3.0 EPSF-3.0\n"
+    "%%Creator: RRDtool " PACKAGE_VERSION " Tobias Oetiker, http://tobi.oetiker.ch\n"
+    /* can't like weird chars here */
+    "%%Title: (RRDtool output)\n"
+    "%%DocumentData: Clean7Bit\n"
+    "", state->fp);
+  fprintf(state->fp, "%%%%BoundingBox: 0 0 %d %d\n",
+    state->page_width, state->page_height);
+  for (node = state->canvas->firstnode; node; node = node->next) {
+    if (node->type == GFX_TEXT && eps_add_font(state, node) == -1)
+      return -1;
+  }
+  eps_list_fonts(state, "%%DocumentFonts:");
+  eps_list_fonts(state, "%%DocumentNeededFonts:");
+  fputs(
+      "%%EndComments\n"
+      "%%BeginProlog\n"
+      "%%EndProlog\n" /* must have, or BoundingBox is ignored */
+      "/bd { bind def } bind def\n"
+      "", state->fp);
+  fprintf(state->fp, "/X { %.2f add } bd\n", LINEOFFSET);
+  fputs(
+      "/X2 {X exch X exch} bd\n"
+      "/M {X2 moveto} bd\n"
+      "/L {X2 lineto} bd\n"
+      "/m {moveto} bd\n"
+      "/l {lineto} bd\n"
+      "/S {stroke} bd\n"
+      "/CP {closepath} bd\n"
+      "/WS {setlinewidth stroke} bd\n"
+      "/F {fill} bd\n"
+      "/T1 {gsave} bd\n"
+      "/T2 {concat 0 0 moveto show grestore} bd\n"
+      "/T   {moveto show} bd\n"
+      "/Rgb { 255.0 div 3 1 roll\n"
+      "       255.0 div 3 1 roll \n"
+      "       255.0 div 3 1 roll setrgbcolor } bd\n"
+      "", state->fp);
+  eps_define_fonts(state);
+  return 0;
+}
+
+static void eps_clear_dash(eps_state *state)
+{
+  if (!state->has_dash)
+    return;
+  state->has_dash = 0;
+  fputs("[1 0] 0 setdash\n", state->fp);
+}
+
+static void eps_write_linearea(eps_state *state, gfx_node_t *node)
+{
+  int i;
+  FILE *fp = state->fp;
+  int useOffset = 0;
+  int clearDashIfAny = 1;
+  eps_set_color(state, node->color);
+  if (node->type == GFX_LINE) {
+    svg_dash dash_info;
+    if (state->linecap != 1) {
+      fputs("1 setlinecap\n", fp);
+      state->linecap = 1;
+    }
+    if (state->linejoin != 1) {
+      fputs("1 setlinejoin\n", fp);
+      state->linejoin = 1;
+    }
+    svg_get_dash(node, &dash_info);
+    if (dash_info.dash_enable) {
+      clearDashIfAny = 0;
+      state->has_dash = 1;
+      fputs("[", fp);
+      svg_write_number(fp, dash_info.adjusted_on);
+      fputs(" ", fp);
+      svg_write_number(fp, dash_info.adjusted_off);
+      fputs("] ", fp);
+      svg_write_number(fp, dash_info.dash_offset);
+      fputs(" setdash\n", fp);
+    }
+  }
+  if (clearDashIfAny)
+    eps_clear_dash(state);
+  for (i = 0; i < node->points; i++) {
+    ArtVpath *vec = node->path + i;
+    double x = vec->x;
+    double y = state->page_height - vec->y;
+    if (vec->code == ART_MOVETO_OPEN || vec->code == ART_MOVETO)
+      useOffset = (fabs(x - floor(x) - 0.5) < 0.01 && fabs(y - floor(y) - 0.5) < 0.01);
+    if (useOffset) {
+      x -= LINEOFFSET;
+      y -= LINEOFFSET;
+    }
+    switch (vec->code) {
+    case ART_MOVETO_OPEN: /* fall-through */
+    case ART_MOVETO:
+      svg_write_number(fp, x);
+      fputc(' ', fp);
+      svg_write_number(fp, y);
+      fputc(' ', fp);
+      fputs(useOffset ? "M\n" : "m\n", fp);
+      break;
+    case ART_LINETO:
+      svg_write_number(fp, x);
+      fputc(' ', fp);
+      svg_write_number(fp, y);
+      fputc(' ', fp);
+      fputs(useOffset ? "L\n" : "l\n", fp);
+      break;
+    case ART_CURVETO: break; /* unsupported */
+    case ART_END: break; /* nop */
+    }
+  }
+  if (node->type == GFX_LINE) {
+    if (node->closed_path)
+      fputs("CP ", fp);
+    if (node->size != state->line_width) {
+      state->line_width = node->size;
+      svg_write_number(fp, state->line_width);
+      fputs(" WS\n", fp);
+    } else {
+      fputs("S\n", fp);
+    }
+   } else {
+    fputs("F\n", fp);
+   }
+}
+
+static void eps_write_text(eps_state *state, gfx_node_t *node)
+{
+  FILE *fp = state->fp;
+  const char *ps_font = afm_get_font_postscript_name(node->filename);
+  int lineLen = 0;
+  pdf_coords g;
+#ifdef HAVE_MBSTOWCS
+    size_t clen;
+    wchar_t *p, *cstr, ch;
+    int text_count;
+    if (!node->text)
+       return;
+    clen = strlen(node->text) + 1;
+    cstr = malloc(sizeof(wchar_t) * clen);
+    text_count = mbstowcs(cstr, node->text, clen);
+    if (text_count == -1)
+       text_count = mbstowcs(cstr, "Enc-Err", 6);
+    p = cstr;
+#else
+    const unsigned char *p = node->text;
+    unsigned char ch;
+    if (!p)
+       return;
+#endif
+  pdf_calc(state->page_height, node, &g);
+  eps_set_color(state, node->color);
+  if (strcmp(ps_font, state->font) || node->size != state->font_size) {
+    state->font = ps_font;
+    state->font_size = node->size;
+    svg_write_number(fp, state->font_size);
+    fprintf(fp, " SetFont-%s\n", state->font);
+  }
+  if (node->angle)
+         fputs("T1 ", fp);
+  fputs("(", fp);
+  lineLen = 20;
+  while (1) {
+    ch = *p;
+    if (!ch)
+      break;
+       ch = afm_fix_osx_charset(ch); /* unsafe macro */
+    if (++lineLen > 70) {
+      fputs("\\\n", fp); /* backslash and \n */
+      lineLen = 0;
+    }
+    switch (ch) {
+      case '%':
+      case '(':
+      case ')':
+      case '\\':
+        fputc('\\', fp);
+        fputc(ch, fp);
+        break;
+      case '\n':
+        fputs("\\n", fp);
+        break;
+      case '\r':
+        fputs("\\r", fp);
+        break;
+      case '\t':
+        fputs("\\t", fp);
+        break;
+      default:
+        if (ch > 255) {
+            fputc('?', fp);
+        } else if (ch >= 126 || ch < 32) {
+          fprintf(fp, "\\%03o", (unsigned int)ch);
+          lineLen += 3;
+        } else {
+          fputc(ch, fp);
+        }
+      }
+      p++;
+  }
+#ifdef HAVE_MBSTOWCS
+  free(cstr);
+#endif
+  if (node->angle) {
+        /* can't use svg_write_number as 2 decimals is far from enough to avoid
+               skewed text */
+         fprintf(fp, ") [%f %f %f %f %f %f] T2\n",
+                         g.ma, g.mb, g.mc, g.md, g.tmx, g.tmy);
+  } else {
+         fputs(") ", fp);
+         svg_write_number(fp, g.tmx);
+         fputs(" ", fp);
+         svg_write_number(fp, g.tmy);
+         fputs(" T\n", fp);
+  }
+}
+
+static int eps_write_content(eps_state *state)
+{
+  gfx_node_t *node;
+  fputs("%\n", state->fp);
+  for (node = state->canvas->firstnode; node; node = node->next) {
+    switch (node->type) {
+    case GFX_LINE:
+    case GFX_AREA:
+      eps_write_linearea(state, node);
+      break;
+    case GFX_TEXT:
+      eps_write_text(state, node);
+      break;
+    }
+  }
+  return 0;
+}
+
+int       gfx_render_eps (gfx_canvas_t *canvas,
+                 art_u32 width, art_u32 height,
+                 gfx_color_t background, FILE *fp){
+  struct eps_state state;
+  state.fp = fp;
+  state.canvas = canvas;
+  state.page_width = width;
+  state.page_height = height;
+  state.font = "no-default-font";
+  state.font_size = -1;
+  state.color = 0; /* black */
+  state.font_list = NULL;
+  state.linecap = -1;
+  state.linejoin = -1;
+  state.has_dash = 0;
+  state.line_width = 1;
+  if (eps_prologue(&state) == -1)
+    return -1;
+  eps_set_color(&state, background);
+  fprintf(fp, "0 0 M 0 %d L %d %d L %d 0 L fill\n",
+      height, width, height, width);
+  if (eps_write_content(&state) == -1)
+    return 0;
+  fputs("showpage\n", fp);
+  fputs("%%EOF\n", fp);
+  while (state.font_list) {
+    eps_font *next = state.font_list->next;
+    free(state.font_list);
+    state.font_list = next;
+  }
+  return 0;
+}
+
+/* ------- PDF -------
+   PDF references page:
+   http://partners.adobe.com/public/developer/pdf/index_reference.html
+*/
+
+typedef struct pdf_buffer
+{
+  int id, is_obj, is_dict, is_stream, pdf_file_pos;
+  char *data;
+  int alloc_size, current_size;
+  struct pdf_buffer *previous_buffer, *next_buffer;
+  struct pdf_state *state;
+} pdf_buffer;
+
+typedef struct pdf_font
+{
+  const char *ps_font;
+  pdf_buffer obj;
+  struct pdf_font *next;
+} pdf_font;
+
+typedef struct pdf_state
+{
+  FILE *fp;
+  gfx_canvas_t *canvas;
+  art_u32 page_width, page_height;
+  pdf_font *font_list;
+  pdf_buffer *first_buffer, *last_buffer;
+  int pdf_file_pos;
+  int has_failed;
+  /*--*/
+  gfx_color_t stroke_color, fill_color;
+  int font_id;
+  double font_size;
+  double line_width;
+  svg_dash dash;
+  int linecap, linejoin;
+  int last_obj_id;
+  /*--*/
+  pdf_buffer pdf_header;
+  pdf_buffer info_obj, catalog_obj, pages_obj, page1_obj;
+  pdf_buffer fontsdict_obj;
+  pdf_buffer graph_stream;
+} pdf_state;
+
+static void pdf_init_buffer(pdf_state *state, pdf_buffer *buf)
+{
+  int initial_size = 32;
+  buf->state = state;
+  buf->id = -42;
+  buf->alloc_size = 0;
+  buf->current_size = 0;
+  buf->data = (char*)malloc(initial_size);
+  buf->is_obj = 0;
+  buf->previous_buffer = NULL;
+  buf->next_buffer = NULL;
+  if (buf->data == NULL) {
+    rrd_set_error("malloc for pdf_buffer data");
+    state->has_failed = 1;
+    return;
+  }
+  buf->alloc_size = initial_size;
+  if (state->last_buffer)
+    state->last_buffer->next_buffer = buf;
+  if (state->first_buffer == NULL)
+    state->first_buffer = buf;
+  buf->previous_buffer = state->last_buffer;
+  state->last_buffer = buf;
+}
+
+static void pdf_put(pdf_buffer *buf, const char *text, int len)
+{
+  if (len <= 0)
+    return;
+  if (buf->alloc_size < buf->current_size + len) {
+    int new_size = buf->alloc_size;
+    char *new_buf;
+    while (new_size < buf->current_size + len)
+      new_size *= 4;
+    new_buf = (char*)malloc(new_size);
+    if (new_buf == NULL) {
+      rrd_set_error("re-malloc for pdf_buffer data");
+      buf->state->has_failed = 1;
+      return;
+    }
+    memcpy(new_buf, buf->data, buf->current_size);
+    free(buf->data);
+    buf->data = new_buf;
+    buf->alloc_size = new_size;
+  }
+  memcpy(buf->data + buf->current_size, text, len);
+  buf->current_size += len;
+}
+
+static void pdf_put_char(pdf_buffer *buf, char c)
+{
+    if (buf->alloc_size >= buf->current_size + 1) {
+       buf->data[buf->current_size++] = c;
+    } else {
+       char tmp[1];
+       tmp[0] = (char)c;
+       pdf_put(buf, tmp, 1);
+    }
+}
+
+static void pdf_puts(pdf_buffer *buf, const char *text)
+{
+  pdf_put(buf, text, strlen(text));
+}
+
+static void pdf_indent(pdf_buffer *buf)
+{
+  pdf_puts(buf, "\t");
+}
+
+static void pdf_putsi(pdf_buffer *buf, const char *text)
+{
+  pdf_indent(buf);
+  pdf_puts(buf, text);
+}
+
+static void pdf_putint(pdf_buffer *buf, int i)
+{
+  char tmp[20];
+  sprintf(tmp, "%d", i);
+  pdf_puts(buf, tmp);
+}
+
+static void pdf_putnumber(pdf_buffer *buf, double d)
+{
+  char tmp[50];
+  svg_format_number(tmp, sizeof(tmp), d);
+  pdf_puts(buf, tmp);
+}
+
+static void pdf_put_string_contents_wide(pdf_buffer *buf, const afm_char *text)
+{
+    const afm_char *p = text;
+    while (1) {
+       afm_char ch = *p;
+       ch = afm_fix_osx_charset(ch); /* unsafe macro */
+       switch (ch) {
+           case 0:
+               return;
+           case '(':
+               pdf_puts(buf, "\\(");
+               break;
+           case ')':
+               pdf_puts(buf, "\\)");
+               break;
+           case '\\':
+               pdf_puts(buf, "\\\\");
+               break;
+           case '\n':
+               pdf_puts(buf, "\\n");
+               break;
+           case '\r':
+               pdf_puts(buf, "\\r");
+               break;
+           case '\t':
+               pdf_puts(buf, "\\t");
+               break;
+           default:
+               if (ch > 255) {
+                   pdf_put_char(buf, '?');
+               } else if (ch > 125 || ch < 32) {
+                   pdf_put_char(buf, ch);
+               } else {
+                   char tmp[10];
+                   snprintf(tmp, sizeof(tmp), "\\%03o", (int)ch);
+                   pdf_puts(buf, tmp);
+               }
+       }
+       p++;
+    }
+}
+
+static void pdf_put_string_contents(pdf_buffer *buf, const char *text)
+{
+#ifdef HAVE_MBSTOWCS
+    size_t clen = strlen(text) + 1;
+    wchar_t *cstr = malloc(sizeof(wchar_t) * clen);
+    int text_count = mbstowcs(cstr, text, clen);
+    if (text_count == -1)
+       text_count = mbstowcs(cstr, "Enc-Err", 6);
+    pdf_put_string_contents_wide(buf, cstr);
+#if 0
+    if (*text == 'W') {
+       fprintf(stderr, "Decoding utf8 for '%s'\n", text);
+       wchar_t *p = cstr;
+       char *pp = text;
+       fprintf(stderr, "sz wc = %d\n", sizeof(wchar_t));
+       while (*p) {
+           fprintf(stderr, "  %d = %c  versus %d = %c\n", *p, (char)*p, 255 & (int)*pp, *pp);
+           p++;
+           pp++;
+       }
+    }
+#endif
+    free(cstr);
+#else
+    pdf_put_string_contents_wide(buf, text);
+#endif
+}
+
+static void pdf_init_object(pdf_state *state, pdf_buffer *buf)
+{
+  pdf_init_buffer(state, buf);
+  buf->id = ++state->last_obj_id;
+  buf->is_obj = 1;
+  buf->is_stream = 0;
+}
+
+static void pdf_init_dict(pdf_state *state, pdf_buffer *buf)
+{
+  pdf_init_object(state, buf);
+  buf->is_dict = 1;
+}
+
+static void pdf_set_color(pdf_buffer *buf, gfx_color_t color,
+       gfx_color_t *current_color, const char *op)
+{
+#if USE_PDF_FAKE_ALPHA
+   double a1, a2;
+#endif
+   /* gfx_color_t is RRGGBBAA */
+  if (*current_color == color)
+    return;
+#if USE_PDF_FAKE_ALPHA
+  a1 = (color & 255) / 255.0;
+  a2 = 1 - a1;
+#define pdf_color_calc(x) ( ((x)  & 255) / 255.0 * a1 + a2)
+#else
+#define pdf_color_calc(x) ( ((x)  & 255) / 255.0)
+#endif
+  pdf_putnumber(buf, pdf_color_calc(color >> 24));
+  pdf_puts(buf, " ");
+  pdf_putnumber(buf, pdf_color_calc(color >> 16));
+  pdf_puts(buf, " ");
+  pdf_putnumber(buf, pdf_color_calc(color >>  8));
+  pdf_puts(buf, " ");
+  pdf_puts(buf, op);
+  pdf_puts(buf, "\n");
+  *current_color = color;
+}
+
+static void pdf_set_stroke_color(pdf_buffer *buf, gfx_color_t color)
+{
+    pdf_set_color(buf, color, &buf->state->stroke_color, "RG");
+}
+
+static void pdf_set_fill_color(pdf_buffer *buf, gfx_color_t color)
+{
+    pdf_set_color(buf, color, &buf->state->fill_color, "rg");
+}
+
+static pdf_font *pdf_find_font(pdf_state *state, gfx_node_t *node)
+{
+  const char *ps_font = afm_get_font_postscript_name(node->filename);
+  pdf_font *ef;
+  for (ef = state->font_list; ef; ef = ef->next) {
+    if (!strcmp(ps_font, ef->ps_font))
+      return ef;
+  }
+  return NULL;
+}
+
+static void pdf_add_font(pdf_state *state, gfx_node_t *node)
+{
+  pdf_font *ef = pdf_find_font(state, node);
+  if (ef)
+    return;
+  ef = malloc(sizeof(pdf_font));
+  if (ef == NULL) {
+    rrd_set_error("malloc for pdf_font");
+    state->has_failed = 1;
+    return;
+  }
+  pdf_init_dict(state, &ef->obj);
+  ef->next = state->font_list;
+  ef->ps_font = afm_get_font_postscript_name(node->filename);
+  state->font_list = ef;
+  /* fonts dict */
+  pdf_putsi(&state->fontsdict_obj, "/F");
+  pdf_putint(&state->fontsdict_obj, ef->obj.id);
+  pdf_puts(&state->fontsdict_obj, " ");
+  pdf_putint(&state->fontsdict_obj, ef->obj.id);
+  pdf_puts(&state->fontsdict_obj, " 0 R\n");
+  /* fonts def */
+  pdf_putsi(&ef->obj, "/Type /Font\n");
+  pdf_putsi(&ef->obj, "/Subtype /Type1\n");
+  pdf_putsi(&ef->obj, "/Name /F");
+  pdf_putint(&ef->obj, ef->obj.id);
+  pdf_puts(&ef->obj, "\n");
+  pdf_putsi(&ef->obj, "/BaseFont /");
+  pdf_puts(&ef->obj, ef->ps_font);
+  pdf_puts(&ef->obj, "\n");
+  pdf_putsi(&ef->obj, "/Encoding /WinAnsiEncoding\n");
+  /*  'Cp1252' (this is latin 1 extended with 27 characters;
+      the encoding is also known as 'winansi')
+      http://www.lowagie.com/iText/tutorial/ch09.html */
+}
+
+static void pdf_create_fonts(pdf_state *state)
+{
+  gfx_node_t *node;
+  for (node = state->canvas->firstnode; node; node = node->next) {
+    if (node->type == GFX_TEXT)
+      pdf_add_font(state, node);
+  }
+}
+
+static void pdf_write_linearea(pdf_state *state, gfx_node_t *node)
+{
+  int i;
+  pdf_buffer *s = &state->graph_stream;
+  if (node->type == GFX_LINE) {
+    svg_dash dash_info;
+    svg_get_dash(node, &dash_info);
+    if (!svg_dash_equal(&dash_info, &state->dash)) {
+      state->dash = dash_info;
+      if (dash_info.dash_enable) {
+       pdf_puts(s, "[");
+       pdf_putnumber(s, dash_info.adjusted_on);
+       pdf_puts(s, " ");
+       pdf_putnumber(s, dash_info.adjusted_off);
+       pdf_puts(s, "] ");
+       pdf_putnumber(s, dash_info.dash_offset);
+       pdf_puts(s, " d\n");
+      } else {
+       pdf_puts(s, "[] 0 d\n");
+      }
+    }
+    pdf_set_stroke_color(s, node->color);
+    if (state->linecap != 1) {
+      pdf_puts(s, "1 j\n");
+      state->linecap = 1;
+    }
+    if (state->linejoin != 1) {
+      pdf_puts(s, "1 J\n");
+      state->linejoin = 1;
+    }
+    if (node->size != state->line_width) {
+      state->line_width = node->size;
+      pdf_putnumber(s, state->line_width);
+      pdf_puts(s, " w\n");
+    }
+  } else {
+    pdf_set_fill_color(s, node->color);
+  }
+  for (i = 0; i < node->points; i++) {
+    ArtVpath *vec = node->path + i;
+    double x = vec->x;
+    double y = state->page_height - vec->y;
+    if (node->type == GFX_AREA) {
+      x += LINEOFFSET; /* adjust for libart handling of areas */
+      y -= LINEOFFSET;
+    }
+    switch (vec->code) {
+    case ART_MOVETO_OPEN: /* fall-through */
+    case ART_MOVETO:
+      pdf_putnumber(s, x);
+      pdf_puts(s, " ");
+      pdf_putnumber(s, y);
+      pdf_puts(s, " m\n");
+      break;
+    case ART_LINETO:
+      pdf_putnumber(s, x);
+      pdf_puts(s, " ");
+      pdf_putnumber(s, y);
+      pdf_puts(s, " l\n");
+      break;
+    case ART_CURVETO: break; /* unsupported */
+    case ART_END: break; /* nop */
+    }
+  }
+  if (node->type == GFX_LINE) {
+    pdf_puts(s, node->closed_path ? "s\n" : "S\n");
+   } else {
+    pdf_puts(s, "f\n");
+   }
+}
+
+
+static void pdf_write_matrix(pdf_state *state, gfx_node_t *node, pdf_coords *g, int useTM)
+{
+       char tmp[150];
+       pdf_buffer *s = &state->graph_stream;
+       if (node->angle == 0) {
+               pdf_puts(s, "1 0 0 1 ");
+               pdf_putnumber(s, useTM ? g->tmx : g->mx);
+               pdf_puts(s, " ");
+               pdf_putnumber(s, useTM ? g->tmy : g->my);
+       } else {
+                /* can't use svg_write_number as 2 decimals is far from enough to avoid
+                       skewed text */
+               sprintf(tmp, "%f %f %f %f %f %f",
+                               g->ma, g->mb, g->mc, g->md, 
+                               useTM ? g->tmx : g->mx,
+                               useTM ? g->tmy : g->my);
+               pdf_puts(s, tmp);
+       }
+}
+
+static void pdf_write_text(pdf_state *state, gfx_node_t *node, 
+    int last_was_text, int next_is_text)
+{
+  pdf_coords g;
+  pdf_buffer *s = &state->graph_stream;
+  pdf_font *font = pdf_find_font(state, node);
+  if (font == NULL) {
+    rrd_set_error("font disappeared");
+    state->has_failed = 1;
+    return;
+  }
+  pdf_calc(state->page_height, node, &g);
+#if PDF_CALC_DEBUG
+  pdf_puts(s, "q % debug green box\n");
+  pdf_write_matrix(state, node, &g, 0);
+  pdf_puts(s, " cm\n");
+  pdf_set_fill_color(s, 0x90FF9000);
+  pdf_puts(s, "0 0.4 0 rg\n");
+  pdf_puts(s, "0 0 ");
+  pdf_putnumber(s, g.sizep.x);
+  pdf_puts(s, " ");
+  pdf_putnumber(s, g.sizep.y);
+  pdf_puts(s, " re\n");
+  pdf_puts(s, "f\n");
+  pdf_puts(s, "Q\n");
+#endif
+  pdf_set_fill_color(s, node->color);
+  if (PDF_CALC_DEBUG || !last_was_text)
+    pdf_puts(s, "BT\n");
+  if (state->font_id != font->obj.id || node->size != state->font_size) {
+    state->font_id = font->obj.id;
+    state->font_size = node->size;
+    pdf_puts(s, "/F");
+    pdf_putint(s, font->obj.id);
+    pdf_puts(s, " ");
+    pdf_putnumber(s, node->size);
+    pdf_puts(s, " Tf\n");
+  }
+  pdf_write_matrix(state, node, &g, 1);
+  pdf_puts(s, " Tm\n");
+  pdf_puts(s, "(");
+  pdf_put_string_contents(s, node->text);
+  pdf_puts(s, ") Tj\n");
+  if (PDF_CALC_DEBUG || !next_is_text)
+    pdf_puts(s, "ET\n");
+}
+static void pdf_write_content(pdf_state *state)
+{
+  gfx_node_t *node;
+  int last_was_text = 0, next_is_text;
+  for (node = state->canvas->firstnode; node; node = node->next) {
+    switch (node->type) {
+    case GFX_LINE:
+    case GFX_AREA:
+      pdf_write_linearea(state, node);
+      break;
+    case GFX_TEXT:
+      next_is_text = node->next && node->next->type == GFX_TEXT;
+      pdf_write_text(state, node, last_was_text, next_is_text);
+      break;
+    }
+    last_was_text = node->type == GFX_TEXT;
+  }
+}
+
+static void pdf_init_document(pdf_state *state)
+{
+  pdf_init_buffer(state, &state->pdf_header);
+  pdf_init_dict(state, &state->catalog_obj);
+  pdf_init_dict(state, &state->info_obj);
+  pdf_init_dict(state, &state->pages_obj);
+  pdf_init_dict(state, &state->page1_obj);
+  pdf_init_dict(state, &state->fontsdict_obj);
+  pdf_create_fonts(state);
+  if (state->has_failed)
+    return;
+  /* make stream last object in file */
+  pdf_init_object(state, &state->graph_stream);
+  state->graph_stream.is_stream = 1;
+}
+
+static void pdf_setup_document(pdf_state *state)
+{
+  const char *creator = "RRDtool " PACKAGE_VERSION " Tobias Oetiker, http://tobi.oetiker.ch";
+  /* all objects created by now, so init code can reference them */
+  /* HEADER */
+  pdf_puts(&state->pdf_header, "%PDF-1.3\n");
+  /* following 8 bit comment is recommended by Adobe for
+     indicating binary file to file transfer applications */
+  pdf_puts(&state->pdf_header, "%\xE2\xE3\xCF\xD3\n");
+  /* INFO */
+  pdf_putsi(&state->info_obj, "/Creator (");
+  pdf_put_string_contents(&state->info_obj, creator);
+  pdf_puts(&state->info_obj, ")\n");
+  /* CATALOG */
+  pdf_putsi(&state->catalog_obj, "/Type /Catalog\n");
+  pdf_putsi(&state->catalog_obj, "/Pages ");
+  pdf_putint(&state->catalog_obj, state->pages_obj.id);
+  pdf_puts(&state->catalog_obj, " 0 R\n");
+  /* PAGES */
+  pdf_putsi(&state->pages_obj, "/Type /Pages\n");
+  pdf_putsi(&state->pages_obj, "/Kids [");
+  pdf_putint(&state->pages_obj, state->page1_obj.id);
+  pdf_puts(&state->pages_obj, " 0 R]\n");
+  pdf_putsi(&state->pages_obj, "/Count 1\n");
+  /* PAGE 1 */
+  pdf_putsi(&state->page1_obj, "/Type /Page\n");
+  pdf_putsi(&state->page1_obj, "/Parent ");
+  pdf_putint(&state->page1_obj, state->pages_obj.id);
+  pdf_puts(&state->page1_obj, " 0 R\n");
+  pdf_putsi(&state->page1_obj, "/MediaBox [0 0 ");
+  pdf_putint(&state->page1_obj, state->page_width);
+  pdf_puts(&state->page1_obj, " ");
+  pdf_putint(&state->page1_obj, state->page_height);
+  pdf_puts(&state->page1_obj, "]\n");
+  pdf_putsi(&state->page1_obj, "/Contents ");
+  pdf_putint(&state->page1_obj, state->graph_stream.id);
+  pdf_puts(&state->page1_obj, " 0 R\n");
+  pdf_putsi(&state->page1_obj, "/Resources << /Font ");
+  pdf_putint(&state->page1_obj, state->fontsdict_obj.id);
+  pdf_puts(&state->page1_obj, " 0 R >>\n");
+}
+
+static void pdf_write_string_to_file(pdf_state *state, const char *text)
+{
+    fputs(text, state->fp);
+    state->pdf_file_pos += strlen(text);
+}
+
+static void pdf_write_buf_to_file(pdf_state *state, pdf_buffer *buf)
+{
+  char tmp[40];
+  buf->pdf_file_pos = state->pdf_file_pos;
+  if (buf->is_obj) {
+    snprintf(tmp, sizeof(tmp), "%d 0 obj\n", buf->id);
+    pdf_write_string_to_file(state, tmp);
+  }
+  if (buf->is_dict)
+    pdf_write_string_to_file(state, "<<\n");
+  if (buf->is_stream) {
+    snprintf(tmp, sizeof(tmp), "<< /Length %d >>\n", buf->current_size);
+    pdf_write_string_to_file(state, tmp);
+    pdf_write_string_to_file(state, "stream\n");
+  }
+  fwrite(buf->data, 1, buf->current_size, state->fp);
+  state->pdf_file_pos += buf->current_size;
+  if (buf->is_stream)
+    pdf_write_string_to_file(state, "endstream\n");
+  if (buf->is_dict)
+    pdf_write_string_to_file(state, ">>\n");
+  if (buf->is_obj)
+    pdf_write_string_to_file(state, "endobj\n");
+}
+
+static void pdf_write_to_file(pdf_state *state)
+{
+  pdf_buffer *buf = state->first_buffer;
+  int xref_pos;
+  state->pdf_file_pos = 0;
+  pdf_write_buf_to_file(state, &state->pdf_header);
+  while (buf) {
+    if (buf->is_obj)
+      pdf_write_buf_to_file(state, buf);
+    buf = buf->next_buffer;
+  }
+  xref_pos = state->pdf_file_pos;
+  fprintf(state->fp, "xref\n");
+  fprintf(state->fp, "%d %d\n", 0, state->last_obj_id + 1);
+  /* TOC lines must be exactly 20 bytes including \n */
+  fprintf(state->fp, "%010d %05d f\x20\n", 0, 65535);
+  for (buf = state->first_buffer; buf; buf = buf->next_buffer) {
+    if (buf->is_obj)
+      fprintf(state->fp, "%010d %05d n\x20\n", buf->pdf_file_pos, 0);
+  }
+  fprintf(state->fp, "trailer\n");
+  fprintf(state->fp, "<<\n");
+  fprintf(state->fp, "\t/Size %d\n", state->last_obj_id + 1);
+  fprintf(state->fp, "\t/Root %d 0 R\n", state->catalog_obj.id);
+  fprintf(state->fp, "\t/Info %d 0 R\n", state->info_obj.id);
+  fprintf(state->fp, ">>\n");
+  fprintf(state->fp, "startxref\n");
+  fprintf(state->fp, "%d\n", xref_pos);
+  fputs("%%EOF\n", state->fp);
+}
+
+static void pdf_free_resources(pdf_state *state)
+{
+  pdf_buffer *buf = state->first_buffer;
+  while (buf) {
+    free(buf->data);
+    buf->data = NULL;
+    buf->alloc_size = buf->current_size = 0;
+    buf = buf->next_buffer;
+  }
+  while (state->font_list) {
+    pdf_font *next = state->font_list->next;
+    free(state->font_list);
+    state->font_list = next;
+  }
+}
+
+int       gfx_render_pdf (gfx_canvas_t *canvas,
+                 art_u32 width, art_u32 height,
+                 gfx_color_t UNUSED(background), FILE *fp){
+  struct pdf_state state;
+  memset(&state, 0, sizeof(pdf_state));
+  state.fp = fp;
+  state.canvas = canvas;
+  state.page_width = width;
+  state.page_height = height;
+  state.font_id = -1;
+  state.font_size = -1;
+  state.font_list = NULL;
+  state.linecap = -1;
+  state.linejoin = -1;
+  pdf_init_document(&state);
+  /*
+  pdf_set_color(&state, background);
+  fprintf(fp, "0 0 M 0 %d L %d %d L %d 0 L fill\n",
+      height, width, height, width);
+  */
+  if (!state.has_failed)
+    pdf_write_content(&state);
+  if (!state.has_failed)
+    pdf_setup_document(&state);
+  if (!state.has_failed)
+    pdf_write_to_file(&state);
+  pdf_free_resources(&state);
+  return state.has_failed ? -1 : 0;
+}
+
diff --git a/src/rrd_gfx.h b/src/rrd_gfx.h
new file mode 100644 (file)
index 0000000..8df3902
--- /dev/null
@@ -0,0 +1,135 @@
+/****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ ****************************************************************************
+ * rrd_gfx.h generic graphics adapter library
+ ****************************************************************************/
+
+#ifndef  RRD_GFX_H
+#define RRD_GFX_H
+#define LIBART_COMPILATION
+
+#define y0 libart_y0
+#define y1 libart_y1
+#define gamma libart_gamma
+#include <libart_lgpl/libart.h>
+#include <libart_lgpl/art_rgba.h>
+#include "art_rgba_svp.h"
+#undef gamma
+#undef y0
+#undef y1
+
+
+enum gfx_if_en {IF_PNG=0,IF_SVG,IF_EPS,IF_PDF};
+enum gfx_en { GFX_LINE=0,GFX_AREA,GFX_TEXT };
+enum gfx_h_align_en { GFX_H_NULL=0, GFX_H_LEFT, GFX_H_RIGHT, GFX_H_CENTER };
+enum gfx_v_align_en { GFX_V_NULL=0, GFX_V_TOP,  GFX_V_BOTTOM, GFX_V_CENTER };
+enum gfx_aa_type_en {AA_NORMAL=0,AA_LIGHT,AA_NONE};
+typedef unsigned long gfx_color_t;
+
+typedef struct  gfx_node_t {
+  enum gfx_en   type;         /* type of graph element */
+  gfx_color_t   color;        /* color of element  0xRRGGBBAA  alpha 0xff is solid*/
+  double        size;         /* font size, line width */
+  double        dash_on, dash_off; /* dash line fragments lengths */
+  int           closed_path;
+  int           points;
+  int           points_max;
+  char *filename;             /* font or image filename */
+  char *text;
+  ArtVpath      *path;        /* path */
+  double        x,y;          /* position */
+  double        angle;        /* text angle */
+  enum gfx_h_align_en halign; /* text alignement */
+  enum gfx_v_align_en valign; /* text alignement */
+  double        tabwidth; 
+  struct gfx_node_t  *next; 
+} gfx_node_t;
+
+
+typedef struct gfx_canvas_t 
+{
+    struct gfx_node_t *firstnode;
+    struct gfx_node_t *lastnode;
+    enum gfx_if_en imgformat;      /* image format */
+    int            interlaced;     /* will the graph be interlaced? */
+    double         zoom;           /* zoom for graph */
+    double         font_aa_threshold; /* no anti-aliasing for sizes <= */
+    enum gfx_aa_type_en aa_type;   /* anti-aliasing type (normal/light/none) */
+} gfx_canvas_t;
+
+gfx_canvas_t *gfx_new_canvas (void);
+
+/* create a new line */
+gfx_node_t   *gfx_new_line   (gfx_canvas_t *canvas, 
+                             double X0, double Y0, 
+                             double X1, double Y1,
+                             double width, gfx_color_t color);
+
+gfx_node_t   *gfx_new_dashed_line   (gfx_canvas_t *canvas, 
+                             double X0, double Y0, 
+                             double X1, double Y1,
+                             double width, gfx_color_t color,
+                             double dash_on, double dash_off);
+
+/* create a new area */
+gfx_node_t   *gfx_new_area   (gfx_canvas_t *canvas, 
+                             double X0, double Y0,
+                             double X1, double Y1,
+                             double X2, double Y2,
+                             gfx_color_t  color);
+
+/* add a point to a line or to an area */
+int           gfx_add_point  (gfx_node_t *node, double x, double y);
+
+/* close current path so it ends at the same point as it started */
+void          gfx_close_path  (gfx_node_t *node);
+
+
+/* create a text node */
+gfx_node_t   *gfx_new_text   (gfx_canvas_t *canvas,  
+                             double x, double y, gfx_color_t color,
+                             char* font, double size,                        
+                             double tabwidth, double angle,
+                             enum gfx_h_align_en h_align,
+                             enum gfx_v_align_en v_align,
+                              char* text);
+
+/* measure width of a text string */
+double gfx_get_text_width ( gfx_canvas_t *canvas,
+                           double start, char* font, double size,
+                           double tabwidth, char* text, int rotation);
+
+/* save image to file */
+int       gfx_render (gfx_canvas_t *canvas,
+                              art_u32 width, art_u32 height,
+                              gfx_color_t background, FILE *fo);
+
+/* free memory used by nodes this will also remove memory required for
+   node chain and associated material */
+int           gfx_destroy    (gfx_canvas_t *canvas); 
+
+
+/* PNG support*/
+int       gfx_render_png (gfx_canvas_t *canvas,
+                              art_u32 width, art_u32 height,
+                              gfx_color_t background, FILE *fo);
+double gfx_get_text_width_libart ( gfx_canvas_t *canvas, double start, 
+                char* font, double size, double tabwidth, 
+                char* text, int rotation );
+
+/* SVG support */
+int       gfx_render_svg (gfx_canvas_t *canvas,
+                              art_u32 width, art_u32 height,
+                              gfx_color_t background, FILE *fo);
+
+/* EPS support */
+int       gfx_render_eps (gfx_canvas_t *canvas,
+                              art_u32 width, art_u32 height,
+                              gfx_color_t background, FILE *fo);
+
+/* PDF support */
+int       gfx_render_pdf (gfx_canvas_t *canvas,
+                              art_u32 width, art_u32 height,
+                              gfx_color_t background, FILE *fo);
+
+#endif
diff --git a/src/rrd_graph.c b/src/rrd_graph.c
new file mode 100644 (file)
index 0000000..b3822d6
--- /dev/null
@@ -0,0 +1,3988 @@
+/****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ ****************************************************************************
+ * rrd__graph.c  produce graphs from data in rrdfiles
+ ****************************************************************************/
+
+
+#include <sys/stat.h>
+
+#ifdef WIN32
+#include "strftime.h"
+#endif
+#include "rrd_tool.h"
+
+#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+#include <io.h>
+#include <fcntl.h>
+#endif
+
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+#include "rrd_graph.h"
+
+/* some constant definitions */
+
+
+
+#ifndef RRD_DEFAULT_FONT
+/* there is special code later to pick Cour.ttf when running on windows */
+#define RRD_DEFAULT_FONT "DejaVuSansMono-Roman.ttf"
+#endif
+
+text_prop_t text_prop[] = {   
+     { 8.0, RRD_DEFAULT_FONT }, /* default */
+     { 9.0, RRD_DEFAULT_FONT }, /* title */
+     { 7.0,  RRD_DEFAULT_FONT }, /* axis */
+     { 8.0, RRD_DEFAULT_FONT }, /* unit */
+     { 8.0, RRD_DEFAULT_FONT }  /* legend */
+};
+
+xlab_t xlab[] = {
+    {0,                 0,   TMT_SECOND,30, TMT_MINUTE,5,  TMT_MINUTE,5,         0,"%H:%M"},
+    {2,                 0,   TMT_MINUTE,1,  TMT_MINUTE,5,  TMT_MINUTE,5,         0,"%H:%M"},
+    {5,                 0,   TMT_MINUTE,2,  TMT_MINUTE,10, TMT_MINUTE,10,        0,"%H:%M"},
+    {10,                0,   TMT_MINUTE,5,  TMT_MINUTE,20, TMT_MINUTE,20,        0,"%H:%M"},
+    {30,                0,   TMT_MINUTE,10, TMT_HOUR,1,    TMT_HOUR,1,           0,"%H:%M"},
+    {60,                0,   TMT_MINUTE,30, TMT_HOUR,2,    TMT_HOUR,2,           0,"%H:%M"},
+    {60,          24*3600,   TMT_MINUTE,30, TMT_HOUR,2,    TMT_HOUR,4,           0,"%a %H:%M"},
+    {180,               0,   TMT_HOUR,1,    TMT_HOUR,6,    TMT_HOUR,6,           0,"%H:%M"},
+    {180,         24*3600,   TMT_HOUR,1,    TMT_HOUR,6,    TMT_HOUR,12,          0,"%a %H:%M"},
+    /*{300,             0,   TMT_HOUR,3,    TMT_HOUR,12,   TMT_HOUR,12,    12*3600,"%a %p"},  this looks silly*/
+    {600,               0,   TMT_HOUR,6,    TMT_DAY,1,     TMT_DAY,1,      24*3600,"%a"},
+    {1200,               0,   TMT_HOUR,6,    TMT_DAY,1,     TMT_DAY,1,      24*3600,"%d"},
+    {1800,              0,   TMT_HOUR,12,   TMT_DAY,1,     TMT_DAY,2,      24*3600,"%a %d"},
+    {2400,              0,   TMT_HOUR,12,   TMT_DAY,1,     TMT_DAY,2,      24*3600,"%a"},
+    {3600,              0,   TMT_DAY,1,     TMT_WEEK,1,    TMT_WEEK,1,   7*24*3600,"Week %V"},
+    {3*3600,            0,   TMT_WEEK,1,    TMT_MONTH,1,   TMT_WEEK,2,   7*24*3600,"Week %V"},
+    {6*3600,            0,   TMT_MONTH,1,   TMT_MONTH,1,   TMT_MONTH,1, 30*24*3600,"%b"},
+    {48*3600,           0,   TMT_MONTH,1,   TMT_MONTH,3,   TMT_MONTH,3, 30*24*3600,"%b"},
+    {315360,            0,   TMT_MONTH,3,   TMT_YEAR,1,    TMT_YEAR,1,  365*24*3600,"%Y"},
+    {10*24*3600,        0,   TMT_YEAR,1,  TMT_YEAR,1,    TMT_YEAR,1, 365*24*3600,"%y"},
+    {-1,0,TMT_MONTH,0,TMT_MONTH,0,TMT_MONTH,0,0,""}
+};
+
+/* sensible y label intervals ...*/
+
+ylab_t ylab[]= {
+    {0.1, {1,2, 5,10}},
+    {0.2, {1,5,10,20}},
+    {0.5, {1,2, 4,10}},
+    {1.0,   {1,2, 5,10}},
+    {2.0,   {1,5,10,20}},
+    {5.0,   {1,2, 4,10}},
+    {10.0,  {1,2, 5,10}},
+    {20.0,  {1,5,10,20}},
+    {50.0,  {1,2, 4,10}},
+    {100.0, {1,2, 5,10}},
+    {200.0, {1,5,10,20}},
+    {500.0, {1,2, 4,10}},
+    {0.0,   {0,0,0,0}}};
+
+
+gfx_color_t graph_col[] =   /* default colors */
+{    0xFFFFFFFF,   /* canvas     */
+     0xF0F0F0FF,   /* background */
+     0xD0D0D0FF,   /* shade A    */
+     0xA0A0A0FF,   /* shade B    */
+     0x90909080,   /* grid       */
+     0xE0505080,   /* major grid */
+     0x000000FF,   /* font       */ 
+     0x802020FF,   /* arrow      */
+     0x202020FF,   /* axis       */
+     0x000000FF    /* frame      */ 
+};     
+
+
+/* #define DEBUG */
+
+#ifdef DEBUG
+# define DPRINT(x)    (void)(printf x, printf("\n"))
+#else
+# define DPRINT(x)
+#endif
+
+
+/* initialize with xtr(im,0); */
+int
+xtr(image_desc_t *im,time_t mytime){
+    static double pixie;
+    if (mytime==0){
+        pixie = (double) im->xsize / (double)(im->end - im->start);
+        return im->xorigin;
+    }
+    return (int)((double)im->xorigin 
+                 + pixie * ( mytime - im->start ) );
+}
+
+/* translate data values into y coordinates */
+double
+ytr(image_desc_t *im, double value){
+    static double pixie;
+    double yval;
+    if (isnan(value)){
+      if(!im->logarithmic)
+        pixie = (double) im->ysize / (im->maxval - im->minval);
+      else 
+        pixie = (double) im->ysize / (log10(im->maxval) - log10(im->minval));
+      yval = im->yorigin;
+    } else if(!im->logarithmic) {
+      yval = im->yorigin - pixie * (value - im->minval);
+    } else {
+      if (value < im->minval) {
+        yval = im->yorigin;
+      } else {
+        yval = im->yorigin - pixie * (log10(value) - log10(im->minval));
+      }
+    }
+    /* make sure we don't return anything too unreasonable. GD lib can
+       get terribly slow when drawing lines outside its scope. This is 
+       especially problematic in connection with the rigid option */
+    if (! im->rigid) {
+      /* keep yval as-is */
+    } else if (yval > im->yorigin) {
+      yval = im->yorigin +0.00001;
+    } else if (yval < im->yorigin - im->ysize){
+      yval = im->yorigin - im->ysize - 0.00001;
+    } 
+    return yval;
+}
+
+
+
+/* conversion function for symbolic entry names */
+
+
+#define conv_if(VV,VVV) \
+   if (strcmp(#VV, string) == 0) return VVV ;
+
+enum gf_en gf_conv(char *string){
+    
+    conv_if(PRINT,GF_PRINT)
+    conv_if(GPRINT,GF_GPRINT)
+    conv_if(COMMENT,GF_COMMENT)
+    conv_if(HRULE,GF_HRULE)
+    conv_if(VRULE,GF_VRULE)
+    conv_if(LINE,GF_LINE)
+    conv_if(AREA,GF_AREA)
+    conv_if(STACK,GF_STACK) 
+    conv_if(TICK,GF_TICK)
+    conv_if(DEF,GF_DEF)
+    conv_if(CDEF,GF_CDEF)
+    conv_if(VDEF,GF_VDEF)
+#ifdef WITH_PIECHART
+    conv_if(PART,GF_PART)
+#endif
+    conv_if(XPORT,GF_XPORT)
+    conv_if(SHIFT,GF_SHIFT)
+    
+    return (-1);
+}
+
+enum gfx_if_en if_conv(char *string){
+    
+    conv_if(PNG,IF_PNG)
+    conv_if(SVG,IF_SVG)
+    conv_if(EPS,IF_EPS)
+    conv_if(PDF,IF_PDF)
+
+    return (-1);
+}
+
+enum tmt_en tmt_conv(char *string){
+
+    conv_if(SECOND,TMT_SECOND)
+    conv_if(MINUTE,TMT_MINUTE)
+    conv_if(HOUR,TMT_HOUR)
+    conv_if(DAY,TMT_DAY)
+    conv_if(WEEK,TMT_WEEK)
+    conv_if(MONTH,TMT_MONTH)
+    conv_if(YEAR,TMT_YEAR)
+    return (-1);
+}
+
+enum grc_en grc_conv(char *string){
+
+    conv_if(BACK,GRC_BACK)
+    conv_if(CANVAS,GRC_CANVAS)
+    conv_if(SHADEA,GRC_SHADEA)
+    conv_if(SHADEB,GRC_SHADEB)
+    conv_if(GRID,GRC_GRID)
+    conv_if(MGRID,GRC_MGRID)
+    conv_if(FONT,GRC_FONT)
+    conv_if(ARROW,GRC_ARROW)
+    conv_if(AXIS,GRC_AXIS)
+    conv_if(FRAME,GRC_FRAME)
+
+    return -1;        
+}
+
+enum text_prop_en text_prop_conv(char *string){
+      
+    conv_if(DEFAULT,TEXT_PROP_DEFAULT)
+    conv_if(TITLE,TEXT_PROP_TITLE)
+    conv_if(AXIS,TEXT_PROP_AXIS)
+    conv_if(UNIT,TEXT_PROP_UNIT)
+    conv_if(LEGEND,TEXT_PROP_LEGEND)
+    return -1;
+}
+
+
+#undef conv_if
+
+int
+im_free(image_desc_t *im)
+{
+    unsigned long        i,ii;
+
+    if (im == NULL) return 0;
+    for(i=0;i<(unsigned)im->gdes_c;i++){
+      if (im->gdes[i].data_first){
+        /* careful here, because a single pointer can occur several times */
+          free (im->gdes[i].data);
+          if (im->gdes[i].ds_namv){
+              for (ii=0;ii<im->gdes[i].ds_cnt;ii++)
+                  free(im->gdes[i].ds_namv[ii]);
+              free(im->gdes[i].ds_namv);
+          }
+      }
+      free (im->gdes[i].p_data);
+      free (im->gdes[i].rpnp);
+    }
+    free(im->gdes);
+    gfx_destroy(im->canvas);
+    return 0;
+}
+
+/* find SI magnitude symbol for the given number*/
+void
+auto_scale(
+           image_desc_t *im,   /* image description */
+           double *value,
+           char **symb_ptr,
+           double *magfact
+           )
+{
+        
+    char *symbol[] = {"a", /* 10e-18 Atto */
+                      "f", /* 10e-15 Femto */
+                      "p", /* 10e-12 Pico */
+                      "n", /* 10e-9  Nano */
+                      "u", /* 10e-6  Micro */
+                      "m", /* 10e-3  Milli */
+                      " ", /* Base */
+                      "k", /* 10e3   Kilo */
+                      "M", /* 10e6   Mega */
+                      "G", /* 10e9   Giga */
+                      "T", /* 10e12  Tera */
+                      "P", /* 10e15  Peta */
+                      "E"};/* 10e18  Exa */
+
+    int symbcenter = 6;
+    int sindex;  
+
+    if (*value == 0.0 || isnan(*value) ) {
+        sindex = 0;
+        *magfact = 1.0;
+    } else {
+        sindex = floor(log(fabs(*value))/log((double)im->base)); 
+        *magfact = pow((double)im->base, (double)sindex);
+        (*value) /= (*magfact);
+    }
+    if ( sindex <= symbcenter && sindex >= -symbcenter) {
+        (*symb_ptr) = symbol[sindex+symbcenter];
+    }
+    else {
+        (*symb_ptr) = "?";
+    }
+}
+
+
+static char si_symbol[] = {
+                     'a', /* 10e-18 Atto */ 
+                     'f', /* 10e-15 Femto */
+                     'p', /* 10e-12 Pico */
+                     'n', /* 10e-9  Nano */
+                     'u', /* 10e-6  Micro */
+                     'm', /* 10e-3  Milli */
+                     ' ', /* Base */
+                     'k', /* 10e3   Kilo */
+                     'M', /* 10e6   Mega */
+                     'G', /* 10e9   Giga */
+                     'T', /* 10e12  Tera */
+                     'P', /* 10e15  Peta */
+                     'E', /* 10e18  Exa */
+};
+static const int si_symbcenter = 6;
+
+/* find SI magnitude symbol for the numbers on the y-axis*/
+void 
+si_unit(
+    image_desc_t *im   /* image description */
+)
+{
+
+    double digits,viewdigits=0;  
+    
+    digits = floor( log( max( fabs(im->minval),fabs(im->maxval)))/log((double)im->base)); 
+
+    if (im->unitsexponent != 9999) {
+        /* unitsexponent = 9, 6, 3, 0, -3, -6, -9, etc */
+        viewdigits = floor(im->unitsexponent / 3);
+    } else {
+        viewdigits = digits;
+    }
+
+    im->magfact = pow((double)im->base , digits);
+    
+#ifdef DEBUG
+    printf("digits %6.3f  im->magfact %6.3f\n",digits,im->magfact);
+#endif
+
+    im->viewfactor = im->magfact / pow((double)im->base , viewdigits);
+
+    if ( ((viewdigits+si_symbcenter) < sizeof(si_symbol)) &&
+                    ((viewdigits+si_symbcenter) >= 0) )
+        im->symbol = si_symbol[(int)viewdigits+si_symbcenter];
+    else
+        im->symbol = '?';
+ }
+
+/*  move min and max values around to become sensible */
+
+void 
+expand_range(image_desc_t *im)
+{
+    double sensiblevalues[] ={1000.0,900.0,800.0,750.0,700.0,
+                              600.0,500.0,400.0,300.0,250.0,
+                              200.0,125.0,100.0,90.0,80.0,
+                              75.0,70.0,60.0,50.0,40.0,30.0,
+                              25.0,20.0,10.0,9.0,8.0,
+                              7.0,6.0,5.0,4.0,3.5,3.0,
+                              2.5,2.0,1.8,1.5,1.2,1.0,
+                              0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1,0.0,-1};
+    
+    double scaled_min,scaled_max;  
+    double adj;
+    int i;
+    
+
+    
+#ifdef DEBUG
+    printf("Min: %6.2f Max: %6.2f MagFactor: %6.2f\n",
+           im->minval,im->maxval,im->magfact);
+#endif
+
+    if (isnan(im->ygridstep)){
+        if(im->extra_flags & ALTAUTOSCALE) {
+            /* measure the amplitude of the function. Make sure that
+               graph boundaries are slightly higher then max/min vals
+               so we can see amplitude on the graph */
+              double delt, fact;
+
+              delt = im->maxval - im->minval;
+              adj = delt * 0.1;
+              fact = 2.0 * pow(10.0,
+                    floor(log10(max(fabs(im->minval), fabs(im->maxval))/im->magfact)) - 2);
+              if (delt < fact) {
+                adj = (fact - delt) * 0.55;
+#ifdef DEBUG
+              printf("Min: %6.2f Max: %6.2f delt: %6.2f fact: %6.2f adj: %6.2f\n", im->minval, im->maxval, delt, fact, adj);
+#endif
+              }
+              im->minval -= adj;
+              im->maxval += adj;
+        }
+       else if(im->extra_flags & ALTAUTOSCALE_MIN) {
+           /* measure the amplitude of the function. Make sure that
+              graph boundaries are slightly lower than min vals
+              so we can see amplitude on the graph */
+             adj = (im->maxval - im->minval) * 0.1;
+             im->minval -= adj;
+       }
+        else if(im->extra_flags & ALTAUTOSCALE_MAX) {
+            /* measure the amplitude of the function. Make sure that
+               graph boundaries are slightly higher than max vals
+               so we can see amplitude on the graph */
+              adj = (im->maxval - im->minval) * 0.1;
+              im->maxval += adj;
+        }
+        else {
+            scaled_min = im->minval / im->magfact;
+            scaled_max = im->maxval / im->magfact;
+            
+            for (i=1; sensiblevalues[i] > 0; i++){
+                if (sensiblevalues[i-1]>=scaled_min &&
+                    sensiblevalues[i]<=scaled_min)        
+                    im->minval = sensiblevalues[i]*(im->magfact);
+                
+                if (-sensiblevalues[i-1]<=scaled_min &&
+                    -sensiblevalues[i]>=scaled_min)
+                    im->minval = -sensiblevalues[i-1]*(im->magfact);
+                
+                if (sensiblevalues[i-1] >= scaled_max &&
+                    sensiblevalues[i] <= scaled_max)
+                    im->maxval = sensiblevalues[i-1]*(im->magfact);
+                
+                if (-sensiblevalues[i-1]<=scaled_max &&
+                    -sensiblevalues[i] >=scaled_max)
+                    im->maxval = -sensiblevalues[i]*(im->magfact);
+            }
+        }
+    } else {
+        /* adjust min and max to the grid definition if there is one */
+        im->minval = (double)im->ylabfact * im->ygridstep * 
+            floor(im->minval / ((double)im->ylabfact * im->ygridstep));
+        im->maxval = (double)im->ylabfact * im->ygridstep * 
+            ceil(im->maxval /( (double)im->ylabfact * im->ygridstep));
+    }
+    
+#ifdef DEBUG
+    fprintf(stderr,"SCALED Min: %6.2f Max: %6.2f Factor: %6.2f\n",
+           im->minval,im->maxval,im->magfact);
+#endif
+}
+
+void
+apply_gridfit(image_desc_t *im)
+{
+  if (isnan(im->minval) || isnan(im->maxval))
+    return;
+  ytr(im,DNAN);
+  if (im->logarithmic) {
+    double ya, yb, ypix, ypixfrac;
+    double log10_range = log10(im->maxval) - log10(im->minval);
+    ya = pow((double)10, floor(log10(im->minval)));
+    while (ya < im->minval)
+      ya *= 10;
+    if (ya > im->maxval)
+      return; /* don't have y=10^x gridline */
+    yb = ya * 10;
+    if (yb <= im->maxval) {
+      /* we have at least 2 y=10^x gridlines.
+         Make sure distance between them in pixels
+         are an integer by expanding im->maxval */
+      double y_pixel_delta = ytr(im, ya) - ytr(im, yb);
+      double factor = y_pixel_delta / floor(y_pixel_delta);
+      double new_log10_range = factor * log10_range;
+      double new_ymax_log10 = log10(im->minval) + new_log10_range;
+      im->maxval = pow(10, new_ymax_log10);
+      ytr(im,DNAN); /* reset precalc */
+      log10_range = log10(im->maxval) - log10(im->minval);
+    }
+    /* make sure first y=10^x gridline is located on 
+       integer pixel position by moving scale slightly 
+       downwards (sub-pixel movement) */
+    ypix = ytr(im, ya) + im->ysize; /* add im->ysize so it always is positive */
+    ypixfrac = ypix - floor(ypix);
+    if (ypixfrac > 0 && ypixfrac < 1) {
+      double yfrac = ypixfrac / im->ysize;
+      im->minval = pow(10, log10(im->minval) - yfrac * log10_range);
+      im->maxval = pow(10, log10(im->maxval) - yfrac * log10_range);
+      ytr(im,DNAN); /* reset precalc */
+    }
+  } else {
+    /* Make sure we have an integer pixel distance between
+       each minor gridline */
+    double ypos1 = ytr(im, im->minval);
+    double ypos2 = ytr(im, im->minval + im->ygrid_scale.gridstep);
+    double y_pixel_delta = ypos1 - ypos2;
+    double factor = y_pixel_delta / floor(y_pixel_delta);
+    double new_range = factor * (im->maxval - im->minval);
+    double gridstep = im->ygrid_scale.gridstep;
+    double minor_y, minor_y_px, minor_y_px_frac;
+
+
+    if (im->maxval > 0.0)
+      im->maxval = im->minval + new_range;
+    else
+      im->minval = im->maxval - new_range;
+    ytr(im,DNAN); /* reset precalc */
+
+    /* make sure first minor gridline is on integer pixel y coord */
+    minor_y = gridstep * floor(im->minval / gridstep);
+    while (minor_y < im->minval)
+      minor_y += gridstep;
+    minor_y_px = ytr(im, minor_y) + im->ysize; /* ensure > 0 by adding ysize */
+    minor_y_px_frac = minor_y_px - floor(minor_y_px);
+    if (minor_y_px_frac > 0 && minor_y_px_frac < 1) {
+      double yfrac = minor_y_px_frac / im->ysize;
+      double range = im->maxval - im->minval;
+      im->minval = im->minval - yfrac * range;
+      im->maxval = im->maxval - yfrac * range;
+      ytr(im,DNAN); /* reset precalc */
+    }
+    calc_horizontal_grid(im); /* recalc with changed im->maxval */
+  }
+}
+
+/* reduce data reimplementation by Alex */
+
+void
+reduce_data(
+    enum cf_en     cf,         /* which consolidation function ?*/
+    unsigned long  cur_step,   /* step the data currently is in */
+    time_t         *start,     /* start, end and step as requested ... */
+    time_t         *end,       /* ... by the application will be   ... */
+    unsigned long  *step,      /* ... adjusted to represent reality    */
+    unsigned long  *ds_cnt,    /* number of data sources in file */
+    rrd_value_t    **data)     /* two dimensional array containing the data */
+{
+    int i,reduce_factor = ceil((double)(*step) / (double)cur_step);
+    unsigned long col,dst_row,row_cnt,start_offset,end_offset,skiprows=0;
+    rrd_value_t    *srcptr,*dstptr;
+
+    (*step) = cur_step*reduce_factor; /* set new step size for reduced data */
+    dstptr = *data;
+    srcptr = *data;
+    row_cnt = ((*end)-(*start))/cur_step;
+
+#ifdef DEBUG
+#define DEBUG_REDUCE
+#endif
+#ifdef DEBUG_REDUCE
+printf("Reducing %lu rows with factor %i time %lu to %lu, step %lu\n",
+                        row_cnt,reduce_factor,*start,*end,cur_step);
+for (col=0;col<row_cnt;col++) {
+    printf("time %10lu: ",*start+(col+1)*cur_step);
+    for (i=0;i<*ds_cnt;i++)
+        printf(" %8.2e",srcptr[*ds_cnt*col+i]);
+    printf("\n");
+}
+#endif
+
+    /* We have to combine [reduce_factor] rows of the source
+    ** into one row for the destination.  Doing this we also
+    ** need to take care to combine the correct rows.  First
+    ** alter the start and end time so that they are multiples
+    ** of the new step time.  We cannot reduce the amount of
+    ** time so we have to move the end towards the future and
+    ** the start towards the past.
+    */
+    end_offset = (*end) % (*step);
+    start_offset = (*start) % (*step);
+
+    /* If there is a start offset (which cannot be more than
+    ** one destination row), skip the appropriate number of
+    ** source rows and one destination row.  The appropriate
+    ** number is what we do know (start_offset/cur_step) of
+    ** the new interval (*step/cur_step aka reduce_factor).
+    */
+#ifdef DEBUG_REDUCE
+printf("start_offset: %lu  end_offset: %lu\n",start_offset,end_offset);
+printf("row_cnt before:  %lu\n",row_cnt);
+#endif
+    if (start_offset) {
+        (*start) = (*start)-start_offset;
+        skiprows=reduce_factor-start_offset/cur_step;
+        srcptr+=skiprows* *ds_cnt;
+        for (col=0;col<(*ds_cnt);col++) *dstptr++ = DNAN;
+        row_cnt-=skiprows;
+    }
+#ifdef DEBUG_REDUCE
+printf("row_cnt between: %lu\n",row_cnt);
+#endif
+
+    /* At the end we have some rows that are not going to be
+    ** used, the amount is end_offset/cur_step
+    */
+    if (end_offset) {
+        (*end) = (*end)-end_offset+(*step);
+        skiprows = end_offset/cur_step;
+        row_cnt-=skiprows;
+    }
+#ifdef DEBUG_REDUCE
+printf("row_cnt after:   %lu\n",row_cnt);
+#endif
+
+/* Sanity check: row_cnt should be multiple of reduce_factor */
+/* if this gets triggered, something is REALLY WRONG ... we die immediately */
+
+    if (row_cnt%reduce_factor) {
+        printf("SANITY CHECK: %lu rows cannot be reduced by %i \n",
+                                row_cnt,reduce_factor);
+        printf("BUG in reduce_data()\n");
+        exit(1);
+    }
+
+    /* Now combine reduce_factor intervals at a time
+    ** into one interval for the destination.
+    */
+
+    for (dst_row=0;(long int)row_cnt>=reduce_factor;dst_row++) {
+        for (col=0;col<(*ds_cnt);col++) {
+            rrd_value_t newval=DNAN;
+            unsigned long validval=0;
+
+            for (i=0;i<reduce_factor;i++) {
+                if (isnan(srcptr[i*(*ds_cnt)+col])) {
+                    continue;
+                }
+                validval++;
+                if (isnan(newval)) newval = srcptr[i*(*ds_cnt)+col];
+                else {
+                    switch (cf) {
+                        case CF_HWPREDICT:
+                        case CF_DEVSEASONAL:
+                        case CF_DEVPREDICT:
+                        case CF_SEASONAL:
+                        case CF_AVERAGE:
+                            newval += srcptr[i*(*ds_cnt)+col];
+                            break;
+                        case CF_MINIMUM:
+                            newval = min (newval,srcptr[i*(*ds_cnt)+col]);
+                            break;
+                        case CF_FAILURES: 
+                        /* an interval contains a failure if any subintervals contained a failure */
+                        case CF_MAXIMUM:
+                            newval = max (newval,srcptr[i*(*ds_cnt)+col]);
+                            break;
+                        case CF_LAST:
+                            newval = srcptr[i*(*ds_cnt)+col];
+                            break;
+                    }
+                }
+            }
+            if (validval == 0){newval = DNAN;} else{
+                switch (cf) {
+                    case CF_HWPREDICT:
+                case CF_DEVSEASONAL:
+                    case CF_DEVPREDICT:
+                    case CF_SEASONAL:
+                    case CF_AVERAGE:                
+                       newval /= validval;
+                        break;
+                    case CF_MINIMUM:
+                    case CF_FAILURES:
+                     case CF_MAXIMUM:
+                    case CF_LAST:
+                        break;
+                }
+            }
+            *dstptr++=newval;
+        }
+        srcptr+=(*ds_cnt)*reduce_factor;
+        row_cnt-=reduce_factor;
+    }
+    /* If we had to alter the endtime, we didn't have enough
+    ** source rows to fill the last row. Fill it with NaN.
+    */
+    if (end_offset) for (col=0;col<(*ds_cnt);col++) *dstptr++ = DNAN;
+#ifdef DEBUG_REDUCE
+    row_cnt = ((*end)-(*start))/ *step;
+    srcptr = *data;
+    printf("Done reducing. Currently %lu rows, time %lu to %lu, step %lu\n",
+                                row_cnt,*start,*end,*step);
+for (col=0;col<row_cnt;col++) {
+    printf("time %10lu: ",*start+(col+1)*(*step));
+    for (i=0;i<*ds_cnt;i++)
+        printf(" %8.2e",srcptr[*ds_cnt*col+i]);
+    printf("\n");
+}
+#endif
+}
+
+
+/* get the data required for the graphs from the 
+   relevant rrds ... */
+
+int
+data_fetch(image_desc_t *im )
+{
+    int i,ii;
+    int                skip;
+
+    /* pull the data from the rrd files ... */
+    for (i=0;i< (int)im->gdes_c;i++){
+        /* only GF_DEF elements fetch data */
+        if (im->gdes[i].gf != GF_DEF) 
+            continue;
+
+        skip=0;
+        /* do we have it already ?*/
+        for (ii=0;ii<i;ii++) {
+            if (im->gdes[ii].gf != GF_DEF) 
+                continue;
+            if ((strcmp(im->gdes[i].rrd, im->gdes[ii].rrd) == 0)
+                        && (im->gdes[i].cf    == im->gdes[ii].cf)
+                        && (im->gdes[i].cf_reduce == im->gdes[ii].cf_reduce)
+                        && (im->gdes[i].start_orig == im->gdes[ii].start_orig)
+                        && (im->gdes[i].end_orig   == im->gdes[ii].end_orig)
+                        && (im->gdes[i].step_orig  == im->gdes[ii].step_orig)) {
+                /* OK, the data is already there.
+                ** Just copy the header portion
+                */
+                im->gdes[i].start = im->gdes[ii].start;
+                im->gdes[i].end = im->gdes[ii].end;
+                im->gdes[i].step = im->gdes[ii].step;
+                im->gdes[i].ds_cnt = im->gdes[ii].ds_cnt;
+                im->gdes[i].ds_namv = im->gdes[ii].ds_namv;                
+                im->gdes[i].data = im->gdes[ii].data;
+                im->gdes[i].data_first = 0;
+                skip=1;
+            }
+            if (skip) 
+                break;
+        }
+        if (! skip) {
+            unsigned long  ft_step = im->gdes[i].step ; /* ft_step will record what we got from fetch */
+            
+            if((rrd_fetch_fn(im->gdes[i].rrd,
+                             im->gdes[i].cf,
+                             &im->gdes[i].start,
+                             &im->gdes[i].end,
+                             &ft_step,
+                             &im->gdes[i].ds_cnt,
+                             &im->gdes[i].ds_namv,
+                             &im->gdes[i].data)) == -1){                
+                return -1;
+            }
+            im->gdes[i].data_first = 1;            
+        
+            if (ft_step < im->gdes[i].step) {
+                reduce_data(im->gdes[i].cf_reduce,
+                            ft_step,
+                            &im->gdes[i].start,
+                            &im->gdes[i].end,
+                            &im->gdes[i].step,
+                            &im->gdes[i].ds_cnt,
+                            &im->gdes[i].data);
+            } else {
+                im->gdes[i].step = ft_step;
+            }
+        }
+        
+        /* lets see if the required data source is really there */
+        for(ii=0;ii<(int)im->gdes[i].ds_cnt;ii++){
+            if(strcmp(im->gdes[i].ds_namv[ii],im->gdes[i].ds_nam) == 0){
+                im->gdes[i].ds=ii; }
+        }
+        if (im->gdes[i].ds== -1){
+            rrd_set_error("No DS called '%s' in '%s'",
+                          im->gdes[i].ds_nam,im->gdes[i].rrd);
+            return -1; 
+        }
+        
+    }
+    return 0;
+}
+
+/* evaluate the expressions in the CDEF functions */
+
+/*************************************************************
+ * CDEF stuff 
+ *************************************************************/
+
+long
+find_var_wrapper(void *arg1, char *key)
+{
+   return find_var((image_desc_t *) arg1, key);
+}
+
+/* find gdes containing var*/
+long
+find_var(image_desc_t *im, char *key){
+    long ii;
+    for(ii=0;ii<im->gdes_c-1;ii++){
+        if((im->gdes[ii].gf == GF_DEF 
+            || im->gdes[ii].gf == GF_VDEF
+            || im->gdes[ii].gf == GF_CDEF) 
+           && (strcmp(im->gdes[ii].vname,key) == 0)){
+            return ii; 
+        }           
+    }                        
+    return -1;
+}
+
+/* find the largest common denominator for all the numbers
+   in the 0 terminated num array */
+long
+lcd(long *num){
+    long rest;
+    int i;
+    for (i=0;num[i+1]!=0;i++){
+        do { 
+            rest=num[i] % num[i+1];
+            num[i]=num[i+1]; num[i+1]=rest;
+        } while (rest!=0);
+        num[i+1] = num[i];
+    }
+/*    return i==0?num[i]:num[i-1]; */
+      return num[i];
+}
+
+/* run the rpn calculator on all the VDEF and CDEF arguments */
+int
+data_calc( image_desc_t *im){
+
+    int       gdi;
+    int       dataidx;
+    long      *steparray, rpi;
+    int       stepcnt;
+    time_t    now;
+    rpnstack_t rpnstack;
+
+    rpnstack_init(&rpnstack);
+
+    for (gdi=0;gdi<im->gdes_c;gdi++){
+        /* Look for GF_VDEF and GF_CDEF in the same loop,
+         * so CDEFs can use VDEFs and vice versa
+         */
+        switch (im->gdes[gdi].gf) {
+            case GF_XPORT:
+              break;
+            case GF_SHIFT: {
+                graph_desc_t        *vdp = &im->gdes[im->gdes[gdi].vidx];
+                
+                /* remove current shift */
+                vdp->start -= vdp->shift;
+                vdp->end -= vdp->shift;
+                
+                /* vdef */
+                if (im->gdes[gdi].shidx >= 0) 
+                        vdp->shift = im->gdes[im->gdes[gdi].shidx].vf.val;
+                /* constant */
+                else
+                        vdp->shift = im->gdes[gdi].shval;
+
+                /* normalize shift to multiple of consolidated step */
+                vdp->shift = (vdp->shift / (long)vdp->step) * (long)vdp->step;
+
+                /* apply shift */
+                vdp->start += vdp->shift;
+                vdp->end += vdp->shift;
+                break;
+            }
+            case GF_VDEF:
+                /* A VDEF has no DS.  This also signals other parts
+                 * of rrdtool that this is a VDEF value, not a CDEF.
+                 */
+                im->gdes[gdi].ds_cnt = 0;
+                if (vdef_calc(im,gdi)) {
+                    rrd_set_error("Error processing VDEF '%s'"
+                        ,im->gdes[gdi].vname
+                        );
+                    rpnstack_free(&rpnstack);
+                    return -1;
+                }
+                break;
+            case GF_CDEF:
+                im->gdes[gdi].ds_cnt = 1;
+                im->gdes[gdi].ds = 0;
+                im->gdes[gdi].data_first = 1;
+                im->gdes[gdi].start = 0;
+                im->gdes[gdi].end = 0;
+                steparray=NULL;
+                stepcnt = 0;
+                dataidx=-1;
+
+                /* Find the variables in the expression.
+                 * - VDEF variables are substituted by their values
+                 *   and the opcode is changed into OP_NUMBER.
+                 * - CDEF variables are analized for their step size,
+                 *   the lowest common denominator of all the step
+                 *   sizes of the data sources involved is calculated
+                 *   and the resulting number is the step size for the
+                 *   resulting data source.
+                 */
+                for(rpi=0;im->gdes[gdi].rpnp[rpi].op != OP_END;rpi++){
+                    if(im->gdes[gdi].rpnp[rpi].op == OP_VARIABLE  ||
+                        im->gdes[gdi].rpnp[rpi].op == OP_PREV_OTHER){
+                        long ptr = im->gdes[gdi].rpnp[rpi].ptr;
+                        if (im->gdes[ptr].ds_cnt == 0) { /* this is a VDEF data source */
+#if 0
+                            printf("DEBUG: inside CDEF '%s' processing VDEF '%s'\n",
+                               im->gdes[gdi].vname,
+                               im->gdes[ptr].vname);
+                            printf("DEBUG: value from vdef is %f\n",im->gdes[ptr].vf.val);
+#endif
+                            im->gdes[gdi].rpnp[rpi].val = im->gdes[ptr].vf.val;
+                            im->gdes[gdi].rpnp[rpi].op  = OP_NUMBER;
+                        } else { /* normal variables and PREF(variables) */
+
+                            /* add one entry to the array that keeps track of the step sizes of the
+                             * data sources going into the CDEF. */
+                            if ((steparray =
+                                 rrd_realloc(steparray,
+                                                         (++stepcnt+1)*sizeof(*steparray)))==NULL){
+                                  rrd_set_error("realloc steparray");
+                                  rpnstack_free(&rpnstack);
+                                 return -1;
+                            };
+
+                            steparray[stepcnt-1] = im->gdes[ptr].step;
+
+                            /* adjust start and end of cdef (gdi) so
+                             * that it runs from the latest start point
+                             * to the earliest endpoint of any of the
+                             * rras involved (ptr)
+                             */
+
+                            if(im->gdes[gdi].start < im->gdes[ptr].start)
+                                im->gdes[gdi].start = im->gdes[ptr].start;
+
+                            if(im->gdes[gdi].end == 0 ||
+                                        im->gdes[gdi].end > im->gdes[ptr].end)
+                                im->gdes[gdi].end = im->gdes[ptr].end;
+                
+                            /* store pointer to the first element of
+                             * the rra providing data for variable,
+                             * further save step size and data source
+                             * count of this rra
+                             */ 
+                            im->gdes[gdi].rpnp[rpi].data   = im->gdes[ptr].data + im->gdes[ptr].ds;
+                            im->gdes[gdi].rpnp[rpi].step   = im->gdes[ptr].step;
+                            im->gdes[gdi].rpnp[rpi].ds_cnt = im->gdes[ptr].ds_cnt;
+
+                            /* backoff the *.data ptr; this is done so
+                             * rpncalc() function doesn't have to treat
+                             * the first case differently
+                             */
+                        } /* if ds_cnt != 0 */
+                    } /* if OP_VARIABLE */
+                } /* loop through all rpi */
+
+                /* move the data pointers to the correct period */
+                for(rpi=0;im->gdes[gdi].rpnp[rpi].op != OP_END;rpi++){
+                    if(im->gdes[gdi].rpnp[rpi].op == OP_VARIABLE ||
+                        im->gdes[gdi].rpnp[rpi].op == OP_PREV_OTHER){
+                        long ptr  = im->gdes[gdi].rpnp[rpi].ptr;
+                        long diff = im->gdes[gdi].start - im->gdes[ptr].start;
+
+                        if(diff > 0)
+                            im->gdes[gdi].rpnp[rpi].data += (diff / im->gdes[ptr].step) * im->gdes[ptr].ds_cnt;
+                     }
+                }
+
+                if(steparray == NULL){
+                    rrd_set_error("rpn expressions without DEF"
+                                " or CDEF variables are not supported");
+                    rpnstack_free(&rpnstack);
+                    return -1;    
+                }
+                steparray[stepcnt]=0;
+                /* Now find the resulting step.  All steps in all
+                 * used RRAs have to be visited
+                 */
+                im->gdes[gdi].step = lcd(steparray);
+                free(steparray);
+                if((im->gdes[gdi].data = malloc((
+                                (im->gdes[gdi].end-im->gdes[gdi].start) 
+                                    / im->gdes[gdi].step)
+                                    * sizeof(double)))==NULL){
+                    rrd_set_error("malloc im->gdes[gdi].data");
+                    rpnstack_free(&rpnstack);
+                    return -1;
+                }
+        
+                /* Step through the new cdef results array and
+                 * calculate the values
+                 */
+                for (now = im->gdes[gdi].start + im->gdes[gdi].step;
+                                now<=im->gdes[gdi].end;
+                                now += im->gdes[gdi].step)
+                {
+                    rpnp_t  *rpnp = im -> gdes[gdi].rpnp;
+
+                    /* 3rd arg of rpn_calc is for OP_VARIABLE lookups;
+                     * in this case we are advancing by timesteps;
+                     * we use the fact that time_t is a synonym for long
+                     */
+                    if (rpn_calc(rpnp,&rpnstack,(long) now, 
+                                im->gdes[gdi].data,++dataidx) == -1) {
+                        /* rpn_calc sets the error string */
+                        rpnstack_free(&rpnstack); 
+                        return -1;
+                    } 
+                } /* enumerate over time steps within a CDEF */
+                break;
+            default:
+                continue;
+        }
+    } /* enumerate over CDEFs */
+    rpnstack_free(&rpnstack);
+    return 0;
+}
+
+static int AlmostEqual2sComplement (float A, float B, int maxUlps)
+{
+
+    int aInt = *(int*)&A;
+    int bInt = *(int*)&B;
+    int intDiff;
+    /* Make sure maxUlps is non-negative and small enough that the
+       default NAN won't compare as equal to anything.  */
+
+    /* assert(maxUlps > 0 && maxUlps < 4 * 1024 * 1024); */
+
+    /* Make aInt lexicographically ordered as a twos-complement int */
+
+    if (aInt < 0)
+        aInt = 0x80000000l - aInt;
+
+    /* Make bInt lexicographically ordered as a twos-complement int */
+
+    if (bInt < 0)
+        bInt = 0x80000000l - bInt;
+
+    intDiff = abs(aInt - bInt);
+
+    if (intDiff <= maxUlps)
+        return 1;
+
+    return 0;
+}
+
+/* massage data so, that we get one value for each x coordinate in the graph */
+int
+data_proc( image_desc_t *im ){
+    long i,ii;
+    double pixstep = (double)(im->end-im->start)
+        /(double)im->xsize; /* how much time 
+                               passes in one pixel */
+    double paintval;
+    double minval=DNAN,maxval=DNAN;
+    
+    unsigned long gr_time;    
+
+    /* memory for the processed data */
+    for(i=0;i<im->gdes_c;i++) {
+        if((im->gdes[i].gf==GF_LINE) ||
+                (im->gdes[i].gf==GF_AREA) ||
+                (im->gdes[i].gf==GF_TICK)) {
+            if((im->gdes[i].p_data = malloc((im->xsize +1)
+                                        * sizeof(rrd_value_t)))==NULL){
+                rrd_set_error("malloc data_proc");
+                return -1;
+            }
+        }
+    }
+
+    for (i=0;i<im->xsize;i++) {        /* for each pixel */
+        long vidx;
+        gr_time = im->start+pixstep*i; /* time of the current step */
+        paintval=0.0;
+        
+        for (ii=0;ii<im->gdes_c;ii++) {
+            double value;
+            switch (im->gdes[ii].gf) {
+                case GF_LINE:
+                case GF_AREA:
+                case GF_TICK:
+                    if (!im->gdes[ii].stack)
+                        paintval = 0.0;
+                    value = im->gdes[ii].yrule;
+                    if (isnan(value) || (im->gdes[ii].gf == GF_TICK)) {
+                        /* The time of the data doesn't necessarily match
+                        ** the time of the graph. Beware.
+                        */
+                        vidx = im->gdes[ii].vidx;
+                        if (im->gdes[vidx].gf == GF_VDEF) {
+                            value = im->gdes[vidx].vf.val;
+                        } else if (((long int)gr_time >= (long int)im->gdes[vidx].start) &&
+                                   ((long int)gr_time <= (long int)im->gdes[vidx].end) ) {
+                            value = im->gdes[vidx].data[
+                                (unsigned long) floor(
+                                    (double)(gr_time - im->gdes[vidx].start)
+                                                / im->gdes[vidx].step)
+                                * im->gdes[vidx].ds_cnt
+                                + im->gdes[vidx].ds
+                            ];
+                        } else {
+                            value = DNAN;
+                        }
+                    };
+
+                    if (! isnan(value)) {
+                        paintval += value;
+                        im->gdes[ii].p_data[i] = paintval;
+                        /* GF_TICK: the data values are not
+                        ** relevant for min and max
+                        */
+                        if (finite(paintval) && im->gdes[ii].gf != GF_TICK ) {
+                            if ((isnan(minval) || paintval <  minval ) &&
+                              ! (im->logarithmic && paintval <= 0.0)) 
+                                        minval = paintval;
+                            if (isnan(maxval) || paintval >  maxval)
+                                maxval = paintval;
+                        }
+                    } else {
+                        im->gdes[ii].p_data[i] = DNAN;
+                    }
+                    break;
+                case GF_STACK:
+                    rrd_set_error("STACK should already be turned into LINE or AREA here");
+                    return -1;
+                    break;
+                default:
+                    break;
+            }
+        }
+    }
+
+    /* if min or max have not been asigned a value this is because
+       there was no data in the graph ... this is not good ...
+       lets set these to dummy values then ... */
+
+    if (im->logarithmic) {
+        if (isnan(minval)) minval = 0.2;
+        if (isnan(maxval)) maxval = 5.1;
+    }
+    else {
+        if (isnan(minval)) minval = 0.0;
+        if (isnan(maxval)) maxval = 1.0;
+    }
+    
+    /* adjust min and max values */
+    if (isnan(im->minval) 
+        /* don't adjust low-end with log scale */ /* why not? */
+        || ((!im->rigid) && im->minval > minval)
+        ) {
+        if (im->logarithmic)
+            im->minval = minval * 0.5;
+        else
+            im->minval = minval;
+    }
+    if (isnan(im->maxval) 
+        || (!im->rigid && im->maxval < maxval)
+        ) {
+        if (im->logarithmic)
+            im->maxval = maxval * 2.0;
+        else
+            im->maxval = maxval;
+    }
+    /* make sure min is smaller than max */
+    if (im->minval > im->maxval ) {             
+        if (im->maxval > 0)
+            im->minval = 0.99 * im->maxval;
+        else 
+            im->minval = 1.01 * im->maxval;
+    }
+                      
+    /* make sure min and max are not equal */
+   if (  AlmostEqual2sComplement(im->minval,im->maxval,4)) {
+        if (im->maxval > 0)
+           im->maxval *= 1.01; 
+        else 
+           im->maxval *= 0.99;
+
+        if (! im->logarithmic) {
+            if (im->minval > 0)
+               im->minval *= 0.99;
+            else 
+               im->minval *= 1.01;
+        }
+        /* make sure min and max are not both zero */
+        if (AlmostEqual2sComplement(im->maxval,0,4)) {
+            im->maxval = 1.0;
+        }
+    }
+    return 0;
+}
+
+
+
+/* identify the point where the first gridline, label ... gets placed */
+
+time_t
+find_first_time(
+    time_t   start, /* what is the initial time */
+    enum tmt_en baseint,  /* what is the basic interval */
+    long     basestep /* how many if these do we jump a time */
+    )
+{
+    struct tm tm;
+    localtime_r(&start, &tm);
+    switch(baseint){
+    case TMT_SECOND:
+        tm.tm_sec -= tm.tm_sec % basestep; break;
+    case TMT_MINUTE: 
+        tm.tm_sec=0;
+        tm.tm_min -= tm.tm_min % basestep; 
+        break;
+    case TMT_HOUR:
+        tm.tm_sec=0;
+        tm.tm_min = 0;
+        tm.tm_hour -= tm.tm_hour % basestep; break;
+    case TMT_DAY:
+        /* we do NOT look at the basestep for this ... */
+        tm.tm_sec=0;
+        tm.tm_min = 0;
+        tm.tm_hour = 0; break;
+    case TMT_WEEK:
+        /* we do NOT look at the basestep for this ... */
+        tm.tm_sec=0;
+        tm.tm_min = 0;
+        tm.tm_hour = 0;
+        tm.tm_mday -= tm.tm_wday -1;        /* -1 because we want the monday */
+        if (tm.tm_wday==0) tm.tm_mday -= 7; /* we want the *previous* monday */
+        break;
+    case TMT_MONTH:
+        tm.tm_sec=0;
+        tm.tm_min = 0;
+        tm.tm_hour = 0;
+        tm.tm_mday = 1;
+        tm.tm_mon -= tm.tm_mon % basestep; break;
+
+    case TMT_YEAR:
+        tm.tm_sec=0;
+        tm.tm_min = 0;
+        tm.tm_hour = 0;
+        tm.tm_mday = 1;
+        tm.tm_mon = 0;
+        tm.tm_year -= (tm.tm_year+1900) % basestep;
+        
+    }
+    return mktime(&tm);
+}
+/* identify the point where the next gridline, label ... gets placed */
+time_t 
+find_next_time(
+    time_t   current, /* what is the initial time */
+    enum tmt_en baseint,  /* what is the basic interval */
+    long     basestep /* how many if these do we jump a time */
+    )
+{
+    struct tm tm;
+    time_t madetime;
+    localtime_r(&current, &tm);
+    do {
+        switch(baseint){
+        case TMT_SECOND:
+            tm.tm_sec += basestep; break;
+        case TMT_MINUTE: 
+            tm.tm_min += basestep; break;
+        case TMT_HOUR:
+            tm.tm_hour += basestep; break;
+        case TMT_DAY:
+            tm.tm_mday += basestep; break;
+        case TMT_WEEK:
+            tm.tm_mday += 7*basestep; break;
+        case TMT_MONTH:
+            tm.tm_mon += basestep; break;
+        case TMT_YEAR:
+            tm.tm_year += basestep;        
+        }
+        madetime = mktime(&tm);
+    } while (madetime == -1); /* this is necessary to skip impssible times
+                                 like the daylight saving time skips */
+    return madetime;
+          
+}
+
+
+/* calculate values required for PRINT and GPRINT functions */
+
+int
+print_calc(image_desc_t *im, char ***prdata) 
+{
+    long i,ii,validsteps;
+    double printval;
+    struct tm tmvdef;
+    int graphelement = 0;
+    long vidx;
+    int max_ii;        
+    double magfact = -1;
+    char *si_symb = "";
+    char *percent_s;
+    int prlines = 1;
+    /* wow initializing tmvdef is quite a task :-) */
+    time_t now = time(NULL);
+    localtime_r(&now,&tmvdef);
+    if (im->imginfo) prlines++;
+    for(i=0;i<im->gdes_c;i++){
+            vidx = im->gdes[i].vidx;
+        switch(im->gdes[i].gf){
+        case GF_PRINT:
+            prlines++;
+            if(((*prdata) = rrd_realloc((*prdata),prlines*sizeof(char *)))==NULL){
+                rrd_set_error("realloc prdata");
+                return 0;
+            }
+        case GF_GPRINT:
+            /* PRINT and GPRINT can now print VDEF generated values.
+             * There's no need to do any calculations on them as these
+             * calculations were already made.
+             */
+            if (im->gdes[vidx].gf==GF_VDEF) { /* simply use vals */
+                printval = im->gdes[vidx].vf.val;
+                localtime_r(&im->gdes[vidx].vf.when,&tmvdef);
+            } else { /* need to calculate max,min,avg etcetera */
+                max_ii =((im->gdes[vidx].end 
+                        - im->gdes[vidx].start)
+                        / im->gdes[vidx].step
+                        * im->gdes[vidx].ds_cnt);
+                printval = DNAN;
+                validsteps = 0;
+                for(        ii=im->gdes[vidx].ds;
+                        ii < max_ii;
+                        ii+=im->gdes[vidx].ds_cnt){
+                    if (! finite(im->gdes[vidx].data[ii]))
+                        continue;
+                    if (isnan(printval)){
+                        printval = im->gdes[vidx].data[ii];
+                        validsteps++;
+                        continue;
+                    }
+
+                    switch (im->gdes[i].cf){
+                        case CF_HWPREDICT:
+                        case CF_DEVPREDICT:
+                        case CF_DEVSEASONAL:
+                        case CF_SEASONAL:
+                        case CF_AVERAGE:
+                            validsteps++;
+                            printval += im->gdes[vidx].data[ii];
+                            break;
+                        case CF_MINIMUM:
+                            printval = min( printval, im->gdes[vidx].data[ii]);
+                            break;
+                        case CF_FAILURES:
+                        case CF_MAXIMUM:
+                            printval = max( printval, im->gdes[vidx].data[ii]);
+                            break;
+                        case CF_LAST:
+                            printval = im->gdes[vidx].data[ii];
+                    }
+                }
+                if (im->gdes[i].cf==CF_AVERAGE || im->gdes[i].cf > CF_LAST) {
+                    if (validsteps > 1) {
+                        printval = (printval / validsteps);
+                    }
+                }
+            } /* prepare printval */
+
+            if ((percent_s = strstr(im->gdes[i].format,"%S")) != NULL) {
+                /* Magfact is set to -1 upon entry to print_calc.  If it
+                 * is still less than 0, then we need to run auto_scale.
+                 * Otherwise, put the value into the correct units.  If
+                 * the value is 0, then do not set the symbol or magnification
+                 * so next the calculation will be performed again. */
+                if (magfact < 0.0) {
+                    auto_scale(im,&printval,&si_symb,&magfact);
+                    if (printval == 0.0)
+                        magfact = -1.0;
+                } else {
+                    printval /= magfact;
+                }
+                *(++percent_s) = 's';
+            } else if (strstr(im->gdes[i].format,"%s") != NULL) {
+                auto_scale(im,&printval,&si_symb,&magfact);
+            }
+
+            if (im->gdes[i].gf == GF_PRINT){
+                (*prdata)[prlines-2] = malloc((FMT_LEG_LEN+2)*sizeof(char));
+                (*prdata)[prlines-1] = NULL;
+                if (im->gdes[i].strftm){
+                        strftime((*prdata)[prlines-2],FMT_LEG_LEN,im->gdes[i].format,&tmvdef);
+                } else {
+                     if (bad_format(im->gdes[i].format)) {
+                          rrd_set_error("bad format for PRINT in '%s'", im->gdes[i].format);
+                        return -1;
+                  }
+
+#ifdef HAVE_SNPRINTF
+                  snprintf((*prdata)[prlines-2],FMT_LEG_LEN,im->gdes[i].format,printval,si_symb);
+#else
+                  sprintf((*prdata)[prlines-2],im->gdes[i].format,printval,si_symb);
+#endif
+               }
+             } else {
+                /* GF_GPRINT */
+
+                if (im->gdes[i].strftm){
+                        strftime(im->gdes[i].legend,FMT_LEG_LEN,im->gdes[i].format,&tmvdef);
+                } else {
+                    if (bad_format(im->gdes[i].format)) {
+                        rrd_set_error("bad format for GPRINT in '%s'", im->gdes[i].format);
+                        return -1;
+                  }
+#ifdef HAVE_SNPRINTF
+                  snprintf(im->gdes[i].legend,FMT_LEG_LEN-2,im->gdes[i].format,printval,si_symb);
+#else
+                  sprintf(im->gdes[i].legend,im->gdes[i].format,printval,si_symb);
+#endif
+                }
+                graphelement = 1;               
+            }            
+            break;
+        case GF_LINE:
+        case GF_AREA:
+        case GF_TICK:
+            graphelement = 1;
+            break;
+        case GF_HRULE:
+            if(isnan(im->gdes[i].yrule)) { /* we must set this here or the legend printer can not decide to print the legend */
+               im->gdes[i].yrule=im->gdes[vidx].vf.val;
+            };
+            graphelement = 1;
+            break;
+        case GF_VRULE:
+            if(im->gdes[i].xrule == 0) { /* again ... the legend printer needs it*/
+              im->gdes[i].xrule = im->gdes[vidx].vf.when;
+            };
+            graphelement = 1;
+            break;
+        case GF_COMMENT:
+        case GF_DEF:
+        case GF_CDEF:            
+        case GF_VDEF:            
+#ifdef WITH_PIECHART
+        case GF_PART:
+#endif
+        case GF_SHIFT:
+        case GF_XPORT:
+            break;
+        case GF_STACK:
+            rrd_set_error("STACK should already be turned into LINE or AREA here");
+            return -1;
+            break;
+        }
+    }
+    return graphelement;
+}
+
+
+/* place legends with color spots */
+int
+leg_place(image_desc_t *im)
+{
+    /* graph labels */
+    int   interleg = im->text_prop[TEXT_PROP_LEGEND].size*2.0;
+    int   border = im->text_prop[TEXT_PROP_LEGEND].size*2.0;
+    int   fill=0, fill_last;
+    int   leg_c = 0;
+    int   leg_x = border, leg_y = im->yimg;
+    int   leg_y_prev = im->yimg;
+    int   leg_cc;
+    int   glue = 0;
+    int   i,ii, mark = 0;
+    char  prt_fctn; /*special printfunctions */
+    int  *legspace;
+
+  if( !(im->extra_flags & NOLEGEND) & !(im->extra_flags & ONLY_GRAPH) ) {
+    if ((legspace = malloc(im->gdes_c*sizeof(int)))==NULL){
+       rrd_set_error("malloc for legspace");
+       return -1;
+    }
+
+    for(i=0;i<im->gdes_c;i++){
+        fill_last = fill;
+        
+        /* hid legends for rules which are not displayed */
+        
+        if(!(im->extra_flags & FORCE_RULES_LEGEND)) {
+                if (im->gdes[i].gf == GF_HRULE &&
+                    (im->gdes[i].yrule < im->minval || im->gdes[i].yrule > im->maxval))
+                    im->gdes[i].legend[0] = '\0';
+
+                if (im->gdes[i].gf == GF_VRULE &&
+                    (im->gdes[i].xrule < im->start || im->gdes[i].xrule > im->end))
+                    im->gdes[i].legend[0] = '\0';
+        }
+
+        leg_cc = strlen(im->gdes[i].legend);
+        
+        /* is there a controle code ant the end of the legend string ? */ 
+        /* and it is not a tab \\t */
+        if (leg_cc >= 2 && im->gdes[i].legend[leg_cc-2] == '\\' && im->gdes[i].legend[leg_cc-1] != 't') {
+            prt_fctn = im->gdes[i].legend[leg_cc-1];
+            leg_cc -= 2;
+            im->gdes[i].legend[leg_cc] = '\0';
+        } else {
+            prt_fctn = '\0';
+        }
+        /* only valid control codes */
+        if (prt_fctn != 'l' && 
+            prt_fctn != 'n' && /* a synonym for l */
+            prt_fctn != 'r' &&
+            prt_fctn != 'j' &&
+            prt_fctn != 'c' &&
+            prt_fctn != 's' &&
+            prt_fctn != 't' &&
+            prt_fctn != '\0' &&
+            prt_fctn != 'g' ) {
+               free(legspace);
+               rrd_set_error("Unknown control code at the end of '%s\\%c'",im->gdes[i].legend,prt_fctn);
+                      return -1;
+
+        }
+
+        /* remove exess space */
+        if ( prt_fctn == 'n' ){
+            prt_fctn='l';
+        }
+
+        while (prt_fctn=='g' && 
+               leg_cc > 0 && 
+               im->gdes[i].legend[leg_cc-1]==' '){
+           leg_cc--;
+           im->gdes[i].legend[leg_cc]='\0';
+        }
+        if (leg_cc != 0 ){
+           legspace[i]=(prt_fctn=='g' ? 0 : interleg);
+           
+           if (fill > 0){ 
+                /* no interleg space if string ends in \g */
+               fill += legspace[i];
+            }
+           fill += gfx_get_text_width(im->canvas, fill+border,
+                                      im->text_prop[TEXT_PROP_LEGEND].font,
+                                      im->text_prop[TEXT_PROP_LEGEND].size,
+                                      im->tabwidth,
+                                      im->gdes[i].legend, 0);
+            leg_c++;
+        } else {
+           legspace[i]=0;
+        }
+        /* who said there was a special tag ... ?*/
+        if (prt_fctn=='g') {    
+           prt_fctn = '\0';
+        }
+        if (prt_fctn == '\0') {
+            if (i == im->gdes_c -1 ) prt_fctn ='l';
+            
+            /* is it time to place the legends ? */
+            if (fill > im->ximg - 2*border){
+                if (leg_c > 1) {
+                    /* go back one */
+                    i--; 
+                    fill = fill_last;
+                    leg_c--;
+                    prt_fctn = 'j';
+                } else {
+                    prt_fctn = 'l';
+                }
+                
+            }
+        }
+
+
+        if (prt_fctn != '\0'){        
+            leg_x = border;
+            if (leg_c >= 2 && prt_fctn == 'j') {
+                glue = (im->ximg - fill - 2* border) / (leg_c-1);
+            } else {
+                glue = 0;
+            }
+            if (prt_fctn =='c') leg_x =  (im->ximg - fill) / 2.0;
+            if (prt_fctn =='r') leg_x =  im->ximg - fill - border;
+
+            for(ii=mark;ii<=i;ii++){
+                if(im->gdes[ii].legend[0]=='\0')
+                    continue; /* skip empty legends */
+                im->gdes[ii].leg_x = leg_x;
+                im->gdes[ii].leg_y = leg_y;
+                leg_x += 
+                 gfx_get_text_width(im->canvas, leg_x,
+                                      im->text_prop[TEXT_PROP_LEGEND].font,
+                                      im->text_prop[TEXT_PROP_LEGEND].size,
+                                      im->tabwidth,
+                                      im->gdes[ii].legend, 0) 
+                   + legspace[ii]
+                   + glue;
+            }                        
+            leg_y_prev = leg_y;
+            /* only add y space if there was text on the line */
+            if (leg_x > border || prt_fctn == 's')            
+               leg_y += im->text_prop[TEXT_PROP_LEGEND].size*1.8;
+            if (prt_fctn == 's')
+               leg_y -=  im->text_prop[TEXT_PROP_LEGEND].size;           
+            fill = 0;
+            leg_c = 0;
+            mark = ii;
+        }           
+    }
+    im->yimg = leg_y_prev;
+    /* if we did place some legends we have to add vertical space */
+    if (leg_y != im->yimg){
+        im->yimg += im->text_prop[TEXT_PROP_LEGEND].size*1.8;
+    }
+    free(legspace);
+  }
+  return 0;
+}
+
+/* create a grid on the graph. it determines what to do
+   from the values of xsize, start and end */
+
+/* the xaxis labels are determined from the number of seconds per pixel
+   in the requested graph */
+
+
+
+int
+calc_horizontal_grid(image_desc_t   *im)
+{
+    double   range;
+    double   scaledrange;
+    int      pixel,i;
+    int      gridind=0;
+    int      decimals, fractionals;
+
+    im->ygrid_scale.labfact=2;
+    range =  im->maxval - im->minval;
+    scaledrange = range / im->magfact;
+
+        /* does the scale of this graph make it impossible to put lines
+           on it? If so, give up. */
+        if (isnan(scaledrange)) {
+                return 0;
+        }
+
+    /* find grid spaceing */
+    pixel=1;
+    if(isnan(im->ygridstep)){
+        if(im->extra_flags & ALTYGRID) {
+            /* find the value with max number of digits. Get number of digits */
+            decimals = ceil(log10(max(fabs(im->maxval), fabs(im->minval))*im->viewfactor/im->magfact));
+            if(decimals <= 0) /* everything is small. make place for zero */
+                decimals = 1;
+            
+            im->ygrid_scale.gridstep = pow((double)10, floor(log10(range*im->viewfactor/im->magfact)))/im->viewfactor*im->magfact;
+            
+            if(im->ygrid_scale.gridstep == 0) /* range is one -> 0.1 is reasonable scale */
+                im->ygrid_scale.gridstep = 0.1;
+            /* should have at least 5 lines but no more then 15 */
+            if(range/im->ygrid_scale.gridstep < 5)
+                im->ygrid_scale.gridstep /= 10;
+            if(range/im->ygrid_scale.gridstep > 15)
+                im->ygrid_scale.gridstep *= 10;
+            if(range/im->ygrid_scale.gridstep > 5) {
+                im->ygrid_scale.labfact = 1;
+                if(range/im->ygrid_scale.gridstep > 8)
+                    im->ygrid_scale.labfact = 2;
+            }
+            else {
+                im->ygrid_scale.gridstep /= 5;
+                im->ygrid_scale.labfact = 5;
+            }
+            fractionals = floor(log10(im->ygrid_scale.gridstep*(double)im->ygrid_scale.labfact*im->viewfactor/im->magfact));
+            if(fractionals < 0) { /* small amplitude. */
+                int len = decimals - fractionals + 1;
+                if (im->unitslength < len+2) im->unitslength = len+2;
+                sprintf(im->ygrid_scale.labfmt, "%%%d.%df%s", len, -fractionals,(im->symbol != ' ' ? " %c" : ""));
+            } else {
+                int len = decimals + 1;
+                if (im->unitslength < len+2) im->unitslength = len+2;
+                sprintf(im->ygrid_scale.labfmt, "%%%d.0f%s", len, ( im->symbol != ' ' ? " %c" : "" ));
+            }
+        }
+        else {
+            for(i=0;ylab[i].grid > 0;i++){
+                pixel = im->ysize / (scaledrange / ylab[i].grid);
+                   gridind = i;
+                if (pixel > 7)
+                    break;
+            }
+            
+            for(i=0; i<4;i++) {
+               if (pixel * ylab[gridind].lfac[i] >=  2.5 * im->text_prop[TEXT_PROP_AXIS].size) {
+                  im->ygrid_scale.labfact =  ylab[gridind].lfac[i];
+                  break;
+               }
+            } 
+            
+            im->ygrid_scale.gridstep = ylab[gridind].grid * im->magfact;
+        }
+    } else {
+        im->ygrid_scale.gridstep = im->ygridstep;
+        im->ygrid_scale.labfact = im->ylabfact;
+    }
+    return 1;
+}
+
+int draw_horizontal_grid(image_desc_t *im)
+{
+    int      i;
+    double   scaledstep;
+    char     graph_label[100];
+    int      nlabels=0;
+    double X0=im->xorigin;
+    double X1=im->xorigin+im->xsize;
+   
+    int sgrid = (int)( im->minval / im->ygrid_scale.gridstep - 1);
+    int egrid = (int)( im->maxval / im->ygrid_scale.gridstep + 1);
+    double MaxY;
+    scaledstep = im->ygrid_scale.gridstep/(double)im->magfact*(double)im->viewfactor;
+    MaxY = scaledstep*(double)egrid;
+    for (i = sgrid; i <= egrid; i++){
+       double Y0=ytr(im,im->ygrid_scale.gridstep*i);
+       double YN=ytr(im,im->ygrid_scale.gridstep*(i+1));
+       if ( floor(Y0+0.5) >= im->yorigin-im->ysize 
+            && floor(Y0+0.5) <= im->yorigin){       
+            /* Make sure at least 2 grid labels are shown, even if it doesn't agree
+               with the chosen settings. Add a label if required by settings, or if
+               there is only one label so far and the next grid line is out of bounds. */
+            if(i % im->ygrid_scale.labfact == 0 || ( nlabels==1 && (YN < im->yorigin-im->ysize || YN > im->yorigin) )){                
+                if (im->symbol == ' ') {
+                     if(im->extra_flags & ALTYGRID) {
+                        sprintf(graph_label,im->ygrid_scale.labfmt,scaledstep*(double)i);
+                    } else {
+                        if(MaxY < 10) {
+                           sprintf(graph_label,"%4.1f",scaledstep*(double)i);
+                          } else {
+                           sprintf(graph_label,"%4.0f",scaledstep*(double)i);
+                        }
+                    }
+                }else {
+                    char sisym = ( i == 0  ? ' ' : im->symbol);
+                     if(im->extra_flags & ALTYGRID) {
+                        sprintf(graph_label,im->ygrid_scale.labfmt,scaledstep*(double)i,sisym);
+                    } else {
+                          if(MaxY < 10){
+                             sprintf(graph_label,"%4.1f %c",scaledstep*(double)i, sisym);
+                        } else {
+                             sprintf(graph_label,"%4.0f %c",scaledstep*(double)i, sisym);
+                        }
+                    }
+                }
+                nlabels++;
+
+               gfx_new_text ( im->canvas,
+                              X0-im->text_prop[TEXT_PROP_AXIS].size, Y0,
+                              im->graph_col[GRC_FONT],
+                              im->text_prop[TEXT_PROP_AXIS].font,
+                              im->text_prop[TEXT_PROP_AXIS].size,
+                              im->tabwidth, 0.0, GFX_H_RIGHT, GFX_V_CENTER,
+                              graph_label );
+               gfx_new_dashed_line ( im->canvas,
+                              X0-2,Y0,
+                              X1+2,Y0,
+                              MGRIDWIDTH, im->graph_col[GRC_MGRID],
+                              im->grid_dash_on, im->grid_dash_off);               
+               
+            } else if (!(im->extra_flags & NOMINOR)) {                
+               gfx_new_dashed_line ( im->canvas,
+                              X0-1,Y0,
+                              X1+1,Y0,
+                              GRIDWIDTH, im->graph_col[GRC_GRID],
+                              im->grid_dash_on, im->grid_dash_off);               
+               
+            }            
+        }        
+    } 
+    return 1;
+}
+
+/* this is frexp for base 10 */
+double frexp10(double, double *);
+double frexp10(double x, double *e) {
+    double mnt;
+    int iexp;
+
+    iexp = floor(log(fabs(x)) / log(10));
+    mnt = x / pow(10.0, iexp);
+    if(mnt >= 10.0) {
+        iexp++;
+        mnt = x / pow(10.0, iexp);
+    }
+    *e = iexp;
+    return mnt;
+}
+
+
+/* logaritmic horizontal grid */
+int
+horizontal_log_grid(image_desc_t   *im)   
+{
+    double yloglab[][10] = {
+        {1.0, 10., 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+        {1.0, 5.0, 10., 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
+        {1.0, 2.0, 5.0, 7.0, 10., 0.0, 0.0, 0.0, 0.0, 0.0},
+        {1.0, 2.0, 4.0, 6.0, 8.0, 10., 0.0, 0.0, 0.0, 0.0},
+        {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.},
+        {0,0,0,0,0, 0,0,0,0,0} /* last line */ };
+
+    int i, j, val_exp, min_exp;
+    double nex;                /* number of decades in data */
+    double logscale;        /* scale in logarithmic space */
+    int exfrac = 1;        /* decade spacing */
+    int mid = -1;        /* row in yloglab for major grid */
+    double mspac;        /* smallest major grid spacing (pixels) */
+    int flab;                /* first value in yloglab to use */
+    double value, tmp, pre_value;
+    double X0,X1,Y0;   
+    char graph_label[100];
+
+    nex = log10(im->maxval / im->minval);
+    logscale = im->ysize / nex;
+
+    /* major spacing for data with high dynamic range */
+    while(logscale * exfrac < 3 * im->text_prop[TEXT_PROP_LEGEND].size) {
+        if(exfrac == 1) exfrac = 3;
+        else exfrac += 3;
+    }
+
+    /* major spacing for less dynamic data */
+    do {
+        /* search best row in yloglab */
+        mid++;
+        for(i = 0; yloglab[mid][i + 1] < 10.0; i++);
+        mspac = logscale * log10(10.0 / yloglab[mid][i]);
+    } while(mspac > 2 * im->text_prop[TEXT_PROP_LEGEND].size && yloglab[mid][0] > 0);
+    if(mid) mid--;
+
+    /* find first value in yloglab */
+    for(flab = 0; yloglab[mid][flab] < 10 && frexp10(im->minval, &tmp) > yloglab[mid][flab] ; flab++);
+    if(yloglab[mid][flab] == 10.0) {
+        tmp += 1.0;
+        flab = 0;
+    }
+    val_exp = tmp;
+    if(val_exp % exfrac) val_exp += abs(-val_exp % exfrac);
+
+    X0=im->xorigin;
+    X1=im->xorigin+im->xsize;
+
+    /* draw grid */
+    pre_value = DNAN;
+    while(1) {       
+
+        value = yloglab[mid][flab] * pow(10.0, val_exp);
+        if (  AlmostEqual2sComplement(value,pre_value,4) ) break; /* it seems we are not converging */
+
+        pre_value = value;
+
+        Y0 = ytr(im, value);
+        if(floor(Y0+0.5) <= im->yorigin - im->ysize) break;
+
+        /* major grid line */
+        gfx_new_dashed_line ( im->canvas,
+            X0-2,Y0,
+            X1+2,Y0,
+            MGRIDWIDTH, im->graph_col[GRC_MGRID],
+            im->grid_dash_on, im->grid_dash_off);
+
+        /* label */
+        if (im->extra_flags & FORCE_UNITS_SI) {
+            int scale;
+            double pvalue;
+            char symbol;
+
+            scale = floor(val_exp / 3.0);
+            if( value >= 1.0 ) pvalue = pow(10.0, val_exp % 3);
+            else pvalue = pow(10.0, ((val_exp + 1) % 3) + 2);
+            pvalue *= yloglab[mid][flab];
+
+            if ( ((scale+si_symbcenter) < (int)sizeof(si_symbol)) &&
+                ((scale+si_symbcenter) >= 0) )
+                symbol = si_symbol[scale+si_symbcenter];
+            else
+                symbol = '?';
+
+                sprintf(graph_label,"%3.0f %c", pvalue, symbol);
+        } else
+            sprintf(graph_label,"%3.0e", value);
+        gfx_new_text ( im->canvas,
+            X0-im->text_prop[TEXT_PROP_AXIS].size, Y0,
+            im->graph_col[GRC_FONT],
+            im->text_prop[TEXT_PROP_AXIS].font,
+            im->text_prop[TEXT_PROP_AXIS].size,
+            im->tabwidth,0.0, GFX_H_RIGHT, GFX_V_CENTER,
+            graph_label );
+
+        /* minor grid */
+        if(mid < 4 && exfrac == 1) {
+            /* find first and last minor line behind current major line
+             * i is the first line and j tha last */
+            if(flab == 0) {
+                min_exp = val_exp - 1;
+                for(i = 1; yloglab[mid][i] < 10.0; i++);
+                i = yloglab[mid][i - 1] + 1;
+                j = 10;
+            }
+            else {
+                min_exp = val_exp;
+                i = yloglab[mid][flab - 1] + 1;
+                j = yloglab[mid][flab];
+            }
+
+            /* draw minor lines below current major line */
+            for(; i < j; i++) {
+
+                value = i * pow(10.0, min_exp);
+                if(value < im->minval) continue;
+
+                Y0 = ytr(im, value);
+                if(floor(Y0+0.5) <= im->yorigin - im->ysize) break;
+
+                /* draw lines */
+                gfx_new_dashed_line ( im->canvas,
+                    X0-1,Y0,
+                    X1+1,Y0,
+                    GRIDWIDTH, im->graph_col[GRC_GRID],
+                    im->grid_dash_on, im->grid_dash_off);
+            }
+        }
+        else if(exfrac > 1) {
+            for(i = val_exp - exfrac / 3 * 2; i < val_exp; i += exfrac / 3) {
+                value = pow(10.0, i);
+                if(value < im->minval) continue;
+
+                Y0 = ytr(im, value);
+                if(floor(Y0+0.5) <= im->yorigin - im->ysize) break;
+
+                /* draw lines */
+                gfx_new_dashed_line ( im->canvas,
+                    X0-1,Y0,
+                    X1+1,Y0,
+                    GRIDWIDTH, im->graph_col[GRC_GRID],
+                    im->grid_dash_on, im->grid_dash_off);
+            }
+        }
+
+        /* next decade */
+        if(yloglab[mid][++flab] == 10.0) {
+            flab = 0;
+            val_exp += exfrac;
+        }
+    }
+
+    /* draw minor lines after highest major line */
+    if(mid < 4 && exfrac == 1) {
+        /* find first and last minor line below current major line
+         * i is the first line and j tha last */
+        if(flab == 0) {
+            min_exp = val_exp - 1;
+            for(i = 1; yloglab[mid][i] < 10.0; i++);
+            i = yloglab[mid][i - 1] + 1;
+            j = 10;
+        }
+        else {
+            min_exp = val_exp;
+            i = yloglab[mid][flab - 1] + 1;
+            j = yloglab[mid][flab];
+        }
+
+        /* draw minor lines below current major line */
+        for(; i < j; i++) {
+
+            value = i * pow(10.0, min_exp);
+            if(value < im->minval) continue;
+
+            Y0 = ytr(im, value);
+            if(floor(Y0+0.5) <= im->yorigin - im->ysize) break;
+
+            /* draw lines */
+            gfx_new_dashed_line ( im->canvas,
+                X0-1,Y0,
+                X1+1,Y0,
+                GRIDWIDTH, im->graph_col[GRC_GRID],
+                im->grid_dash_on, im->grid_dash_off);
+        }
+    }
+    /* fancy minor gridlines */
+    else if(exfrac > 1) {
+        for(i = val_exp - exfrac / 3 * 2; i < val_exp; i += exfrac / 3) {
+            value = pow(10.0, i);
+            if(value < im->minval) continue;
+
+            Y0 = ytr(im, value);
+            if(floor(Y0+0.5) <= im->yorigin - im->ysize) break;
+
+            /* draw lines */
+            gfx_new_dashed_line ( im->canvas,
+                X0-1,Y0,
+                X1+1,Y0,
+                GRIDWIDTH, im->graph_col[GRC_GRID],
+                im->grid_dash_on, im->grid_dash_off);
+        }
+    }
+
+    return 1;
+}
+
+
+void
+vertical_grid(
+    image_desc_t   *im )
+{   
+    int xlab_sel;                /* which sort of label and grid ? */
+    time_t ti, tilab, timajor;
+    long factor;
+    char graph_label[100];
+    double X0,Y0,Y1; /* points for filled graph and more*/
+    struct tm tm;
+
+    /* the type of time grid is determined by finding
+       the number of seconds per pixel in the graph */
+    
+    
+    if(im->xlab_user.minsec == -1){
+        factor=(im->end - im->start)/im->xsize;
+        xlab_sel=0;
+        while ( xlab[xlab_sel+1].minsec != -1 
+                && xlab[xlab_sel+1].minsec <= factor) { xlab_sel++; }        /* pick the last one */
+        while ( xlab[xlab_sel-1].minsec == xlab[xlab_sel].minsec
+                && xlab[xlab_sel].length > (im->end - im->start)) { xlab_sel--; }        /* go back to the smallest size */
+        im->xlab_user.gridtm = xlab[xlab_sel].gridtm;
+        im->xlab_user.gridst = xlab[xlab_sel].gridst;
+        im->xlab_user.mgridtm = xlab[xlab_sel].mgridtm;
+        im->xlab_user.mgridst = xlab[xlab_sel].mgridst;
+        im->xlab_user.labtm = xlab[xlab_sel].labtm;
+        im->xlab_user.labst = xlab[xlab_sel].labst;
+        im->xlab_user.precis = xlab[xlab_sel].precis;
+        im->xlab_user.stst = xlab[xlab_sel].stst;
+    }
+    
+    /* y coords are the same for every line ... */
+    Y0 = im->yorigin;
+    Y1 = im->yorigin-im->ysize;
+   
+
+    /* paint the minor grid */
+    if (!(im->extra_flags & NOMINOR))
+    {
+        for(ti = find_first_time(im->start,
+                                im->xlab_user.gridtm,
+                                im->xlab_user.gridst),
+            timajor = find_first_time(im->start,
+                                im->xlab_user.mgridtm,
+                                im->xlab_user.mgridst);
+            ti < im->end; 
+            ti = find_next_time(ti,im->xlab_user.gridtm,im->xlab_user.gridst)
+            ){
+            /* are we inside the graph ? */
+            if (ti < im->start || ti > im->end) continue;
+            while (timajor < ti) {
+                timajor = find_next_time(timajor,
+                        im->xlab_user.mgridtm, im->xlab_user.mgridst);
+            }
+            if (ti == timajor) continue; /* skip as falls on major grid line */
+           X0 = xtr(im,ti);       
+           gfx_new_dashed_line(im->canvas,X0,Y0+1, X0,Y1-1,GRIDWIDTH,
+               im->graph_col[GRC_GRID],
+               im->grid_dash_on, im->grid_dash_off);
+           
+        }
+    }
+
+    /* paint the major grid */
+    for(ti = find_first_time(im->start,
+                            im->xlab_user.mgridtm,
+                            im->xlab_user.mgridst);
+        ti < im->end; 
+        ti = find_next_time(ti,im->xlab_user.mgridtm,im->xlab_user.mgridst)
+        ){
+        /* are we inside the graph ? */
+        if (ti < im->start || ti > im->end) continue;
+       X0 = xtr(im,ti);
+       gfx_new_dashed_line(im->canvas,X0,Y0+3, X0,Y1-2,MGRIDWIDTH,
+           im->graph_col[GRC_MGRID],
+           im->grid_dash_on, im->grid_dash_off);
+       
+    }
+    /* paint the labels below the graph */
+    for(ti = find_first_time(im->start - im->xlab_user.precis/2,
+                            im->xlab_user.labtm,
+                            im->xlab_user.labst);
+        ti <= im->end - im->xlab_user.precis/2; 
+        ti = find_next_time(ti,im->xlab_user.labtm,im->xlab_user.labst)
+        ){
+        tilab= ti + im->xlab_user.precis/2; /* correct time for the label */
+        /* are we inside the graph ? */
+        if (tilab < im->start || tilab > im->end) continue;
+
+#if HAVE_STRFTIME
+        localtime_r(&tilab, &tm);
+        strftime(graph_label,99,im->xlab_user.stst, &tm);
+#else
+# error "your libc has no strftime I guess we'll abort the exercise here."
+#endif
+       gfx_new_text ( im->canvas,
+                      xtr(im,tilab), Y0+im->text_prop[TEXT_PROP_AXIS].size*1.4+5,
+                      im->graph_col[GRC_FONT],
+                      im->text_prop[TEXT_PROP_AXIS].font,
+                      im->text_prop[TEXT_PROP_AXIS].size,
+                      im->tabwidth, 0.0, GFX_H_CENTER, GFX_V_BOTTOM,
+                      graph_label );
+       
+    }
+
+}
+
+
+void 
+axis_paint(
+   image_desc_t   *im
+           )
+{   
+    /* draw x and y axis */
+    /* gfx_new_line ( im->canvas, im->xorigin+im->xsize,im->yorigin,
+                      im->xorigin+im->xsize,im->yorigin-im->ysize,
+                      GRIDWIDTH, im->graph_col[GRC_AXIS]);
+       
+       gfx_new_line ( im->canvas, im->xorigin,im->yorigin-im->ysize,
+                         im->xorigin+im->xsize,im->yorigin-im->ysize,
+                         GRIDWIDTH, im->graph_col[GRC_AXIS]); */
+   
+       gfx_new_line ( im->canvas, im->xorigin-4,im->yorigin,
+                         im->xorigin+im->xsize+4,im->yorigin,
+                         MGRIDWIDTH, im->graph_col[GRC_AXIS]);
+   
+       gfx_new_line ( im->canvas, im->xorigin,im->yorigin+4,
+                         im->xorigin,im->yorigin-im->ysize-4,
+                         MGRIDWIDTH, im->graph_col[GRC_AXIS]);
+   
+    
+    /* arrow for X and Y axis direction */
+    gfx_new_area ( im->canvas, 
+                   im->xorigin+im->xsize+2,  im->yorigin-2,
+                   im->xorigin+im->xsize+2,  im->yorigin+3,
+                   im->xorigin+im->xsize+7,  im->yorigin+0.5, /* LINEOFFSET */
+                   im->graph_col[GRC_ARROW]);
+
+    gfx_new_area ( im->canvas, 
+                   im->xorigin-2,  im->yorigin-im->ysize-2,
+                   im->xorigin+3,  im->yorigin-im->ysize-2,
+                   im->xorigin+0.5,    im->yorigin-im->ysize-7, /* LINEOFFSET */
+                   im->graph_col[GRC_ARROW]);
+
+}
+
+void
+grid_paint(image_desc_t   *im)
+{   
+    long i;
+    int res=0;
+    double X0,Y0; /* points for filled graph and more*/
+    gfx_node_t *node;
+
+    /* draw 3d border */
+    node = gfx_new_area (im->canvas, 0,im->yimg,
+                                 2,im->yimg-2,
+                                 2,2,im->graph_col[GRC_SHADEA]);
+    gfx_add_point( node , im->ximg - 2, 2 );
+    gfx_add_point( node , im->ximg, 0 );
+    gfx_add_point( node , 0,0 );
+/*    gfx_add_point( node , 0,im->yimg ); */
+   
+    node =  gfx_new_area (im->canvas, 2,im->yimg-2,
+                                  im->ximg-2,im->yimg-2,
+                                  im->ximg - 2, 2,
+                                 im->graph_col[GRC_SHADEB]);
+    gfx_add_point( node ,   im->ximg,0);
+    gfx_add_point( node ,   im->ximg,im->yimg);
+    gfx_add_point( node ,   0,im->yimg);
+/*    gfx_add_point( node , 0,im->yimg ); */
+   
+   
+    if (im->draw_x_grid == 1 )
+      vertical_grid(im);
+    
+    if (im->draw_y_grid == 1){
+        if(im->logarithmic){
+                res = horizontal_log_grid(im);
+        } else {
+                res = draw_horizontal_grid(im);
+        }
+        
+        /* dont draw horizontal grid if there is no min and max val */
+        if (! res ) {
+          char *nodata = "No Data found";
+           gfx_new_text(im->canvas,im->ximg/2, (2*im->yorigin-im->ysize) / 2,
+                        im->graph_col[GRC_FONT],
+                        im->text_prop[TEXT_PROP_AXIS].font,
+                        im->text_prop[TEXT_PROP_AXIS].size,
+                        im->tabwidth, 0.0, GFX_H_CENTER, GFX_V_CENTER,
+                        nodata );           
+        }
+    }
+
+    /* yaxis unit description */
+    gfx_new_text( im->canvas,
+                  10, (im->yorigin - im->ysize/2),
+                  im->graph_col[GRC_FONT],
+                  im->text_prop[TEXT_PROP_UNIT].font,
+                  im->text_prop[TEXT_PROP_UNIT].size, im->tabwidth, 
+                  RRDGRAPH_YLEGEND_ANGLE,
+                  GFX_H_LEFT, GFX_V_CENTER,
+                  im->ylegend);
+
+    /* graph title */
+    gfx_new_text( im->canvas,
+                  im->ximg/2, im->text_prop[TEXT_PROP_TITLE].size*1.3+4,
+                  im->graph_col[GRC_FONT],
+                  im->text_prop[TEXT_PROP_TITLE].font,
+                  im->text_prop[TEXT_PROP_TITLE].size, im->tabwidth, 0.0,
+                  GFX_H_CENTER, GFX_V_CENTER,
+                  im->title);
+    /* rrdtool 'logo' */
+    gfx_new_text( im->canvas,
+                  im->ximg-7, 7,
+                  ( im->graph_col[GRC_FONT] & 0xffffff00 ) | 0x00000044,
+                  im->text_prop[TEXT_PROP_AXIS].font,
+                  5.5, im->tabwidth, 270,
+                  GFX_H_RIGHT, GFX_V_TOP,
+                  "RRDTOOL / TOBI OETIKER");
+
+    /* graph watermark */
+    if(im->watermark[0] != '\0') {
+        gfx_new_text( im->canvas,
+                  im->ximg/2, im->yimg-6,
+                  ( im->graph_col[GRC_FONT] & 0xffffff00 ) | 0x00000044,
+                  im->text_prop[TEXT_PROP_AXIS].font,
+                  5.5, im->tabwidth, 0,
+                  GFX_H_CENTER, GFX_V_BOTTOM,
+                  im->watermark);
+    }
+    
+    /* graph labels */
+    if( !(im->extra_flags & NOLEGEND) & !(im->extra_flags & ONLY_GRAPH) ) {
+            for(i=0;i<im->gdes_c;i++){
+                    if(im->gdes[i].legend[0] =='\0')
+                            continue;
+                    
+                    /* im->gdes[i].leg_y is the bottom of the legend */
+                    X0 = im->gdes[i].leg_x;
+                    Y0 = im->gdes[i].leg_y;
+                    gfx_new_text ( im->canvas, X0, Y0,
+                                   im->graph_col[GRC_FONT],
+                                   im->text_prop[TEXT_PROP_LEGEND].font,
+                                   im->text_prop[TEXT_PROP_LEGEND].size,
+                                   im->tabwidth,0.0, GFX_H_LEFT, GFX_V_BOTTOM,
+                                   im->gdes[i].legend );
+                    /* The legend for GRAPH items starts with "M " to have
+                       enough space for the box */
+                    if (           im->gdes[i].gf != GF_PRINT &&
+                                   im->gdes[i].gf != GF_GPRINT &&
+                                   im->gdes[i].gf != GF_COMMENT) {
+                            int boxH, boxV;
+                            
+                            boxH = gfx_get_text_width(im->canvas, 0,
+                                                      im->text_prop[TEXT_PROP_LEGEND].font,
+                                                      im->text_prop[TEXT_PROP_LEGEND].size,
+                                                      im->tabwidth,"o", 0) * 1.2;
+                            boxV = boxH*1.1;
+                            
+                            /* make sure transparent colors show up the same way as in the graph */
+                             node = gfx_new_area(im->canvas,
+                                                X0,Y0-boxV,
+                                                X0,Y0,
+                                                X0+boxH,Y0,
+                                                im->graph_col[GRC_BACK]);
+                            gfx_add_point ( node, X0+boxH, Y0-boxV );
+
+                            node = gfx_new_area(im->canvas,
+                                                X0,Y0-boxV,
+                                                X0,Y0,
+                                                X0+boxH,Y0,
+                                                im->gdes[i].col);
+                            gfx_add_point ( node, X0+boxH, Y0-boxV );
+                            node = gfx_new_line(im->canvas,
+                                                X0,Y0-boxV,
+                                                X0,Y0,
+                                                1.0,im->graph_col[GRC_FRAME]);
+                            gfx_add_point(node,X0+boxH,Y0);
+                            gfx_add_point(node,X0+boxH,Y0-boxV);
+                            gfx_close_path(node);
+                    }
+            }
+    }
+}
+
+
+/*****************************************************
+ * lazy check make sure we rely need to create this graph
+ *****************************************************/
+
+int lazy_check(image_desc_t *im){
+    FILE *fd = NULL;
+        int size = 1;
+    struct stat  imgstat;
+    
+    if (im->lazy == 0) return 0; /* no lazy option */
+    if (stat(im->graphfile,&imgstat) != 0) 
+      return 0; /* can't stat */
+    /* one pixel in the existing graph is more then what we would
+       change here ... */
+    if (time(NULL) - imgstat.st_mtime > 
+        (im->end - im->start) / im->xsize) 
+      return 0;
+    if ((fd = fopen(im->graphfile,"rb")) == NULL) 
+      return 0; /* the file does not exist */
+    switch (im->canvas->imgformat) {
+    case IF_PNG:
+           size = PngSize(fd,&(im->ximg),&(im->yimg));
+           break;
+    default:
+           size = 1;
+    }
+    fclose(fd);
+    return size;
+}
+
+#ifdef WITH_PIECHART
+void
+pie_part(image_desc_t *im, gfx_color_t color,
+            double PieCenterX, double PieCenterY, double Radius,
+            double startangle, double endangle)
+{
+    gfx_node_t *node;
+    double angle;
+    double step=M_PI/50; /* Number of iterations for the circle;
+                         ** 10 is definitely too low, more than
+                         ** 50 seems to be overkill
+                         */
+
+    /* Strange but true: we have to work clockwise or else
+    ** anti aliasing nor transparency don't work.
+    **
+    ** This test is here to make sure we do it right, also
+    ** this makes the for...next loop more easy to implement.
+    ** The return will occur if the user enters a negative number
+    ** (which shouldn't be done according to the specs) or if the
+    ** programmers do something wrong (which, as we all know, never
+    ** happens anyway :)
+    */
+    if (endangle<startangle) return;
+
+    /* Hidden feature: Radius decreases each full circle */
+    angle=startangle;
+    while (angle>=2*M_PI) {
+        angle  -= 2*M_PI;
+        Radius *= 0.8;
+    }
+
+    node=gfx_new_area(im->canvas,
+                PieCenterX+sin(startangle)*Radius,
+                PieCenterY-cos(startangle)*Radius,
+                PieCenterX,
+                PieCenterY,
+                PieCenterX+sin(endangle)*Radius,
+                PieCenterY-cos(endangle)*Radius,
+                color);
+    for (angle=endangle;angle-startangle>=step;angle-=step) {
+        gfx_add_point(node,
+                PieCenterX+sin(angle)*Radius,
+                PieCenterY-cos(angle)*Radius );
+    }
+}
+
+#endif
+
+int
+graph_size_location(image_desc_t *im, int elements
+
+#ifdef WITH_PIECHART
+, int piechart
+#endif
+
+ )
+{
+    /* The actual size of the image to draw is determined from
+    ** several sources.  The size given on the command line is
+    ** the graph area but we need more as we have to draw labels
+    ** and other things outside the graph area
+    */
+
+    /* +-+-------------------------------------------+
+    ** |l|.................title.....................|
+    ** |e+--+-------------------------------+--------+
+    ** |b| b|                               |        |
+    ** |a| a|                               |  pie   |
+    ** |l| l|          main graph area      | chart  |
+    ** |.| .|                               |  area  |
+    ** |t| y|                               |        |
+    ** |r+--+-------------------------------+--------+
+    ** |e|  | x-axis labels                 |        |
+    ** |v+--+-------------------------------+--------+
+    ** | |..............legends......................|
+    ** +-+-------------------------------------------+
+    ** |                 watermark                   |
+    ** +---------------------------------------------+
+    */
+    int Xvertical=0,        
+                        Ytitle   =0,
+        Xylabel  =0,        
+        Xmain    =0,        Ymain    =0,
+#ifdef WITH_PIECHART
+        Xpie     =0,        Ypie     =0,
+#endif
+                        Yxlabel  =0,
+#if 0
+        Xlegend  =0,        Ylegend  =0,
+#endif
+        Xspacing =15,  Yspacing =15,
+       
+                      Ywatermark =4;
+
+    if (im->extra_flags & ONLY_GRAPH) {
+        im->xorigin =0;
+        im->ximg = im->xsize;
+        im->yimg = im->ysize;
+        im->yorigin = im->ysize;
+        ytr(im,DNAN); 
+        return 0;
+    }
+
+    if (im->ylegend[0] != '\0' ) {
+           Xvertical = im->text_prop[TEXT_PROP_UNIT].size *2;
+    }
+
+
+    if (im->title[0] != '\0') {
+        /* The title is placed "inbetween" two text lines so it
+        ** automatically has some vertical spacing.  The horizontal
+        ** spacing is added here, on each side.
+        */
+        /* don't care for the with of the title
+                Xtitle = gfx_get_text_width(im->canvas, 0,
+                im->text_prop[TEXT_PROP_TITLE].font,
+                im->text_prop[TEXT_PROP_TITLE].size,
+                im->tabwidth,
+                im->title, 0) + 2*Xspacing; */
+        Ytitle = im->text_prop[TEXT_PROP_TITLE].size*2.6+10;
+    }
+
+    if (elements) {
+        Xmain=im->xsize;
+        Ymain=im->ysize;
+        if (im->draw_x_grid) {
+            Yxlabel=im->text_prop[TEXT_PROP_AXIS].size *2.5;
+        }
+        if (im->draw_y_grid || im->forceleftspace ) {
+            Xylabel=gfx_get_text_width(im->canvas, 0,
+                        im->text_prop[TEXT_PROP_AXIS].font,
+                        im->text_prop[TEXT_PROP_AXIS].size,
+                        im->tabwidth,
+                        "0", 0) * im->unitslength;
+        }
+    }
+
+#ifdef WITH_PIECHART
+    if (piechart) {
+        im->piesize=im->xsize<im->ysize?im->xsize:im->ysize;
+        Xpie=im->piesize;
+        Ypie=im->piesize;
+    }
+#endif
+
+    /* Now calculate the total size.  Insert some spacing where
+       desired.  im->xorigin and im->yorigin need to correspond
+       with the lower left corner of the main graph area or, if
+       this one is not set, the imaginary box surrounding the
+       pie chart area. */
+
+    /* The legend width cannot yet be determined, as a result we
+    ** have problems adjusting the image to it.  For now, we just
+    ** forget about it at all; the legend will have to fit in the
+    ** size already allocated.
+    */
+    im->ximg = Xylabel + Xmain + 2 * Xspacing;
+
+#ifdef WITH_PIECHART
+    im->ximg  += Xpie;
+#endif
+
+    if (Xmain) im->ximg += Xspacing;
+#ifdef WITH_PIECHART
+    if (Xpie) im->ximg += Xspacing;
+#endif
+
+    im->xorigin = Xspacing + Xylabel;
+
+    /* the length of the title should not influence with width of the graph
+       if (Xtitle > im->ximg) im->ximg = Xtitle; */
+
+    if (Xvertical) { /* unit description */
+        im->ximg += Xvertical;
+        im->xorigin += Xvertical;
+    }
+    xtr(im,0);
+
+    /* The vertical size is interesting... we need to compare
+    ** the sum of {Ytitle, Ymain, Yxlabel, Ylegend, Ywatermark} with 
+    ** Yvertical however we need to know {Ytitle+Ymain+Yxlabel}
+    ** in order to start even thinking about Ylegend or Ywatermark.
+    **
+    ** Do it in three portions: First calculate the inner part,
+    ** then do the legend, then adjust the total height of the img,
+    ** adding space for a watermark if one exists;
+    */
+
+    /* reserve space for main and/or pie */
+
+    im->yimg = Ymain + Yxlabel;
+    
+#ifdef WITH_PIECHART
+    if (im->yimg < Ypie) im->yimg = Ypie;
+#endif
+
+    im->yorigin = im->yimg - Yxlabel;
+
+    /* reserve space for the title *or* some padding above the graph */
+    if (Ytitle) {
+        im->yimg += Ytitle;
+        im->yorigin += Ytitle;
+    } else {
+        im->yimg += 1.5*Yspacing;
+        im->yorigin += 1.5*Yspacing;
+    }
+    /* reserve space for padding below the graph */
+    im->yimg += Yspacing;
+     
+    /* Determine where to place the legends onto the image.
+    ** Adjust im->yimg to match the space requirements.
+    */
+    if(leg_place(im)==-1)
+        return -1;
+        
+    if (im->watermark[0] != '\0') {
+        im->yimg += Ywatermark;
+    }
+
+#if 0
+    if (Xlegend > im->ximg) {
+        im->ximg = Xlegend;
+        /* reposition Pie */
+    }
+#endif
+
+#ifdef WITH_PIECHART
+    /* The pie is placed in the upper right hand corner,
+    ** just below the title (if any) and with sufficient
+    ** padding.
+    */
+    if (elements) {
+        im->pie_x = im->ximg - Xspacing - Xpie/2;
+        im->pie_y = im->yorigin-Ymain+Ypie/2;
+    } else {
+        im->pie_x = im->ximg/2;
+        im->pie_y = im->yorigin-Ypie/2;
+    }
+#endif
+
+    ytr(im,DNAN);
+    return 0;
+}
+
+/* from http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm */
+/* yes we are loosing precision by doing tos with floats instead of doubles
+   but it seems more stable this way. */
+   
+
+/* draw that picture thing ... */
+int
+graph_paint(image_desc_t *im, char ***calcpr)
+{
+  int i,ii;
+  int lazy =     lazy_check(im);
+#ifdef WITH_PIECHART
+  int piechart = 0;
+  double PieStart=0.0;
+#endif
+  FILE  *fo;
+  gfx_node_t *node;
+  
+  double areazero = 0.0;
+  graph_desc_t *lastgdes = NULL;    
+
+  /* if we are lazy and there is nothing to PRINT ... quit now */
+  if (lazy && im->prt_c==0) return 0;
+
+  /* pull the data from the rrd files ... */
+  
+  if(data_fetch(im)==-1)
+    return -1;
+
+  /* evaluate VDEF and CDEF operations ... */
+  if(data_calc(im)==-1)
+    return -1;
+
+#ifdef WITH_PIECHART  
+  /* check if we need to draw a piechart */
+  for(i=0;i<im->gdes_c;i++){
+    if (im->gdes[i].gf == GF_PART) {
+      piechart=1;
+      break;
+    }
+  }
+#endif
+
+  /* calculate and PRINT and GPRINT definitions. We have to do it at
+   * this point because it will affect the length of the legends
+   * if there are no graph elements we stop here ... 
+   * if we are lazy, try to quit ... 
+   */
+  i=print_calc(im,calcpr);
+  if(i<0) return -1;
+  if(((i==0)
+#ifdef WITH_PIECHART
+&&(piechart==0)
+#endif
+) || lazy) return 0;
+
+#ifdef WITH_PIECHART
+  /* If there's only the pie chart to draw, signal this */
+  if (i==0) piechart=2;
+#endif
+  
+  /* get actual drawing data and find min and max values*/
+  if(data_proc(im)==-1)
+    return -1;
+  
+  if(!im->logarithmic){si_unit(im);}        /* identify si magnitude Kilo, Mega Giga ? */
+  
+  if(!im->rigid && ! im->logarithmic)
+    expand_range(im);   /* make sure the upper and lower limit are
+                           sensible values */
+
+  if (!calc_horizontal_grid(im))
+    return -1;
+
+  if (im->gridfit)
+    apply_gridfit(im);
+
+
+/**************************************************************
+ *** Calculating sizes and locations became a bit confusing ***
+ *** so I moved this into a separate function.              ***
+ **************************************************************/
+  if(graph_size_location(im,i
+#ifdef WITH_PIECHART
+,piechart
+#endif
+)==-1)
+    return -1;
+
+  /* the actual graph is created by going through the individual
+     graph elements and then drawing them */
+  
+  node=gfx_new_area ( im->canvas,
+                      0, 0,
+                      0, im->yimg,
+                      im->ximg, im->yimg,                      
+                      im->graph_col[GRC_BACK]);
+
+  gfx_add_point(node,im->ximg, 0);
+
+#ifdef WITH_PIECHART
+  if (piechart != 2) {
+#endif
+    node=gfx_new_area ( im->canvas,
+                      im->xorigin,             im->yorigin, 
+                      im->xorigin + im->xsize, im->yorigin,
+                      im->xorigin + im->xsize, im->yorigin-im->ysize,
+                      im->graph_col[GRC_CANVAS]);
+  
+    gfx_add_point(node,im->xorigin, im->yorigin - im->ysize);
+
+    if (im->minval > 0.0)
+      areazero = im->minval;
+    if (im->maxval < 0.0)
+      areazero = im->maxval;
+#ifdef WITH_PIECHART
+   }
+#endif
+
+#ifdef WITH_PIECHART
+  if (piechart) {
+    pie_part(im,im->graph_col[GRC_CANVAS],im->pie_x,im->pie_y,im->piesize*0.5,0,2*M_PI);
+  }
+#endif
+
+  for(i=0;i<im->gdes_c;i++){
+    switch(im->gdes[i].gf){
+    case GF_CDEF:
+    case GF_VDEF:
+    case GF_DEF:
+    case GF_PRINT:
+    case GF_GPRINT:
+    case GF_COMMENT:
+    case GF_HRULE:
+    case GF_VRULE:
+    case GF_XPORT:
+    case GF_SHIFT:
+      break;
+    case GF_TICK:
+      for (ii = 0; ii < im->xsize; ii++)
+        {
+          if (!isnan(im->gdes[i].p_data[ii]) && 
+              im->gdes[i].p_data[ii] != 0.0)
+           { 
+              if (im -> gdes[i].yrule > 0 ) {
+                      gfx_new_line(im->canvas,
+                                   im -> xorigin + ii, im->yorigin,
+                                   im -> xorigin + ii, im->yorigin - im -> gdes[i].yrule * im -> ysize,
+                                   1.0,
+                                   im -> gdes[i].col );
+              } else if ( im -> gdes[i].yrule < 0 ) {
+                      gfx_new_line(im->canvas,
+                                   im -> xorigin + ii, im->yorigin - im -> ysize,
+                                   im -> xorigin + ii, im->yorigin - ( 1 - im -> gdes[i].yrule ) * im -> ysize,
+                                   1.0,
+                                   im -> gdes[i].col );
+              
+              }
+           }
+        }
+      break;
+    case GF_LINE:
+    case GF_AREA:
+      /* fix data points at oo and -oo */
+      for(ii=0;ii<im->xsize;ii++){
+        if (isinf(im->gdes[i].p_data[ii])){
+          if (im->gdes[i].p_data[ii] > 0) {
+            im->gdes[i].p_data[ii] = im->maxval ;
+          } else {
+            im->gdes[i].p_data[ii] = im->minval ;
+          }                 
+          
+        }
+      } /* for */
+
+      /* *******************************************************
+       a           ___. (a,t) 
+                    |   |    ___
+              ____|   |   |   |
+              |       |___|
+       -------|--t-1--t--------------------------------      
+                      
+      if we know the value at time t was a then 
+      we draw a square from t-1 to t with the value a.
+
+      ********************************************************* */
+      if (im->gdes[i].col != 0x0){   
+        /* GF_LINE and friend */
+        if(im->gdes[i].gf == GF_LINE ){
+          double last_y=0.0;
+          node = NULL;
+          for(ii=1;ii<im->xsize;ii++){
+            if (isnan(im->gdes[i].p_data[ii]) || (im->slopemode==1 && isnan(im->gdes[i].p_data[ii-1]))){
+                node = NULL;
+                continue;
+            }
+            if ( node == NULL ) {
+                     last_y = ytr(im,im->gdes[i].p_data[ii]);
+                if ( im->slopemode == 0 ){
+                  node = gfx_new_line(im->canvas,
+                                    ii-1+im->xorigin,last_y,
+                                    ii+im->xorigin,last_y,
+                                    im->gdes[i].linewidth,
+                                    im->gdes[i].col);
+                } else {
+                  node = gfx_new_line(im->canvas,
+                                    ii-1+im->xorigin,ytr(im,im->gdes[i].p_data[ii-1]),
+                                    ii+im->xorigin,last_y,
+                                    im->gdes[i].linewidth,
+                                    im->gdes[i].col);
+                }
+             } else {
+               double new_y = ytr(im,im->gdes[i].p_data[ii]);
+               if ( im->slopemode==0 && ! AlmostEqual2sComplement(new_y,last_y,4)){
+                   gfx_add_point(node,ii-1+im->xorigin,new_y);
+               };
+               last_y = new_y;
+               gfx_add_point(node,ii+im->xorigin,new_y);
+             };
+
+          }
+        } else {
+          int idxI=-1;
+          double *foreY=malloc(sizeof(double)*im->xsize*2);
+          double *foreX=malloc(sizeof(double)*im->xsize*2);
+          double *backY=malloc(sizeof(double)*im->xsize*2);
+          double *backX=malloc(sizeof(double)*im->xsize*2);
+          int drawem = 0;
+          for(ii=0;ii<=im->xsize;ii++){
+            double ybase,ytop;
+            if ( idxI > 0 && ( drawem != 0 || ii==im->xsize)){
+               int cntI=1;
+               int lastI=0;
+               while (cntI < idxI && AlmostEqual2sComplement(foreY[lastI],foreY[cntI],4) && AlmostEqual2sComplement(foreY[lastI],foreY[cntI+1],4)){cntI++;}
+               node = gfx_new_area(im->canvas,
+                                backX[0],backY[0],
+                                foreX[0],foreY[0],
+                                foreX[cntI],foreY[cntI], im->gdes[i].col);
+               while (cntI < idxI) {
+                 lastI = cntI;
+                 cntI++;
+                 while ( cntI < idxI && AlmostEqual2sComplement(foreY[lastI],foreY[cntI],4) && AlmostEqual2sComplement(foreY[lastI],foreY[cntI+1],4)){cntI++;} 
+                 gfx_add_point(node,foreX[cntI],foreY[cntI]);
+               }
+               gfx_add_point(node,backX[idxI],backY[idxI]);
+               while (idxI > 1){
+                 lastI = idxI;
+                 idxI--;
+                 while ( idxI > 1 && AlmostEqual2sComplement(backY[lastI], backY[idxI],4) && AlmostEqual2sComplement(backY[lastI],backY[idxI-1],4)){idxI--;} 
+                 gfx_add_point(node,backX[idxI],backY[idxI]);
+               }
+               idxI=-1;
+               drawem = 0;
+            }
+            if (drawem != 0){
+              drawem = 0;
+              idxI=-1;
+            }
+            if (ii == im->xsize) break;
+            
+            /* keep things simple for now, just draw these bars
+               do not try to build a big and complex area */
+
+                                                               
+            if ( im->slopemode == 0 && ii==0){
+                continue;
+            }
+            if ( isnan(im->gdes[i].p_data[ii]) ) {
+                drawem = 1;
+                continue;
+            }
+            ytop = ytr(im,im->gdes[i].p_data[ii]);
+             if ( lastgdes && im->gdes[i].stack ) {
+                  ybase = ytr(im,lastgdes->p_data[ii]);
+            } else {
+                  ybase = ytr(im,areazero);
+            }
+            if ( ybase == ytop ){
+                drawem = 1;
+                continue;        
+            }
+            /* every area has to be wound clock-wise,
+               so we have to make sur base remains base  */                
+            if (ybase > ytop){
+                double extra = ytop;
+                ytop = ybase;
+                ybase = extra;
+            }
+            if ( im->slopemode == 0 ){
+                    backY[++idxI] = ybase-0.2;
+                    backX[idxI] = ii+im->xorigin-1;
+                    foreY[idxI] = ytop+0.2;
+                    foreX[idxI] = ii+im->xorigin-1;
+            }
+            backY[++idxI] = ybase-0.2;
+            backX[idxI] = ii+im->xorigin;
+            foreY[idxI] = ytop+0.2;
+            foreX[idxI] = ii+im->xorigin;
+          }
+          /* close up any remaining area */             
+          free(foreY);
+          free(foreX);
+          free(backY);
+          free(backX);
+        } /* else GF_LINE */
+      } /* if color != 0x0 */
+      /* make sure we do not run into trouble when stacking on NaN */
+      for(ii=0;ii<im->xsize;ii++){
+        if (isnan(im->gdes[i].p_data[ii])) {
+          if (lastgdes && (im->gdes[i].stack)) {
+            im->gdes[i].p_data[ii] = lastgdes->p_data[ii];
+          } else {
+            im->gdes[i].p_data[ii] = areazero;
+          }
+        }
+      } 
+      lastgdes = &(im->gdes[i]);                         
+      break;
+#ifdef WITH_PIECHART
+    case GF_PART:
+      if(isnan(im->gdes[i].yrule)) /* fetch variable */
+        im->gdes[i].yrule = im->gdes[im->gdes[i].vidx].vf.val;
+     
+      if (finite(im->gdes[i].yrule)) {        /* even the fetched var can be NaN */
+        pie_part(im,im->gdes[i].col,
+                im->pie_x,im->pie_y,im->piesize*0.4,
+                M_PI*2.0*PieStart/100.0,
+                M_PI*2.0*(PieStart+im->gdes[i].yrule)/100.0);
+        PieStart += im->gdes[i].yrule;
+      }
+      break;
+#endif
+    case GF_STACK:
+      rrd_set_error("STACK should already be turned into LINE or AREA here");
+      return -1;
+      break;
+        
+    } /* switch */
+  }
+#ifdef WITH_PIECHART
+  if (piechart==2) {
+    im->draw_x_grid=0;
+    im->draw_y_grid=0;
+  }
+#endif
+
+
+  /* grid_paint also does the text */
+  if( !(im->extra_flags & ONLY_GRAPH) )  
+    grid_paint(im);
+
+  
+  if( !(im->extra_flags & ONLY_GRAPH) )  
+      axis_paint(im);
+  
+  /* the RULES are the last thing to paint ... */
+  for(i=0;i<im->gdes_c;i++){    
+    
+    switch(im->gdes[i].gf){
+    case GF_HRULE:
+      if(im->gdes[i].yrule >= im->minval
+         && im->gdes[i].yrule <= im->maxval)
+        gfx_new_line(im->canvas,
+                     im->xorigin,ytr(im,im->gdes[i].yrule),
+                     im->xorigin+im->xsize,ytr(im,im->gdes[i].yrule),
+                     1.0,im->gdes[i].col); 
+      break;
+    case GF_VRULE:
+      if(im->gdes[i].xrule >= im->start
+         && im->gdes[i].xrule <= im->end)
+        gfx_new_line(im->canvas,
+                     xtr(im,im->gdes[i].xrule),im->yorigin,
+                     xtr(im,im->gdes[i].xrule),im->yorigin-im->ysize,
+                     1.0,im->gdes[i].col); 
+      break;
+    default:
+      break;
+    }
+  }
+
+  
+  if (strcmp(im->graphfile,"-")==0) {
+    fo = im->graphhandle ? im->graphhandle : stdout;
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+    /* Change translation mode for stdout to BINARY */
+    _setmode( _fileno( fo ), O_BINARY );
+#endif
+  } else {
+    if ((fo = fopen(im->graphfile,"wb")) == NULL) {
+      rrd_set_error("Opening '%s' for write: %s",im->graphfile,
+                    rrd_strerror(errno));
+      return (-1);
+    }
+  }
+  gfx_render (im->canvas,im->ximg,im->yimg,0x00000000,fo);
+  if (strcmp(im->graphfile,"-") != 0)
+    fclose(fo);
+  return 0;
+}
+
+
+/*****************************************************
+ * graph stuff 
+ *****************************************************/
+
+int
+gdes_alloc(image_desc_t *im){
+
+    im->gdes_c++;
+    if ((im->gdes = (graph_desc_t *) rrd_realloc(im->gdes, (im->gdes_c)
+                                           * sizeof(graph_desc_t)))==NULL){
+        rrd_set_error("realloc graph_descs");
+        return -1;
+    }
+
+
+    im->gdes[im->gdes_c-1].step=im->step;
+    im->gdes[im->gdes_c-1].step_orig=im->step;
+    im->gdes[im->gdes_c-1].stack=0;
+    im->gdes[im->gdes_c-1].linewidth=0;
+    im->gdes[im->gdes_c-1].debug=0;
+    im->gdes[im->gdes_c-1].start=im->start; 
+    im->gdes[im->gdes_c-1].start_orig=im->start; 
+    im->gdes[im->gdes_c-1].end=im->end; 
+    im->gdes[im->gdes_c-1].end_orig=im->end; 
+    im->gdes[im->gdes_c-1].vname[0]='\0'; 
+    im->gdes[im->gdes_c-1].data=NULL;
+    im->gdes[im->gdes_c-1].ds_namv=NULL;
+    im->gdes[im->gdes_c-1].data_first=0;
+    im->gdes[im->gdes_c-1].p_data=NULL;
+    im->gdes[im->gdes_c-1].rpnp=NULL;
+    im->gdes[im->gdes_c-1].shift=0;
+    im->gdes[im->gdes_c-1].col = 0x0;
+    im->gdes[im->gdes_c-1].legend[0]='\0';
+    im->gdes[im->gdes_c-1].format[0]='\0';
+    im->gdes[im->gdes_c-1].strftm=0;   
+    im->gdes[im->gdes_c-1].rrd[0]='\0';
+    im->gdes[im->gdes_c-1].ds=-1;    
+    im->gdes[im->gdes_c-1].cf_reduce=CF_AVERAGE;    
+    im->gdes[im->gdes_c-1].cf=CF_AVERAGE;    
+    im->gdes[im->gdes_c-1].p_data=NULL;    
+    im->gdes[im->gdes_c-1].yrule=DNAN;
+    im->gdes[im->gdes_c-1].xrule=0;
+    return 0;
+}
+
+/* copies input untill the first unescaped colon is found
+   or until input ends. backslashes have to be escaped as well */
+int
+scan_for_col(const char *const input, int len, char *const output)
+{
+    int inp,outp=0;
+    for (inp=0; 
+         inp < len &&
+           input[inp] != ':' &&
+           input[inp] != '\0';
+         inp++){
+      if (input[inp] == '\\' &&
+          input[inp+1] != '\0' && 
+          (input[inp+1] == '\\' ||
+           input[inp+1] == ':')){
+        output[outp++] = input[++inp];
+      }
+      else {
+        output[outp++] = input[inp];
+      }
+    }
+    output[outp] = '\0';
+    return inp;
+}
+/* Some surgery done on this function, it became ridiculously big.
+** Things moved:
+** - initializing     now in rrd_graph_init()
+** - options parsing  now in rrd_graph_options()
+** - script parsing   now in rrd_graph_script()
+*/
+int 
+rrd_graph(int argc, char **argv, char ***prdata, int *xsize, int *ysize, FILE *stream, double *ymin, double *ymax)
+{
+    image_desc_t   im;
+    rrd_graph_init(&im);
+    im.graphhandle = stream;
+    
+    rrd_graph_options(argc,argv,&im);
+    if (rrd_test_error()) {
+        im_free(&im);
+        return -1;
+    }
+    
+    if (strlen(argv[optind])>=MAXPATH) {
+        rrd_set_error("filename (including path) too long");
+        im_free(&im);
+        return -1;
+    }
+    strncpy(im.graphfile,argv[optind],MAXPATH-1);
+    im.graphfile[MAXPATH-1]='\0';
+
+    rrd_graph_script(argc,argv,&im,1);
+    if (rrd_test_error()) {
+        im_free(&im);
+        return -1;
+    }
+
+    /* Everything is now read and the actual work can start */
+
+    (*prdata)=NULL;
+    if (graph_paint(&im,prdata)==-1){
+        im_free(&im);
+        return -1;
+    }
+
+    /* The image is generated and needs to be output.
+    ** Also, if needed, print a line with information about the image.
+    */
+
+    *xsize=im.ximg;
+    *ysize=im.yimg;
+    *ymin=im.minval;
+    *ymax=im.maxval;
+    if (im.imginfo) {
+        char *filename;
+        if (!(*prdata)) {
+            /* maybe prdata is not allocated yet ... lets do it now */
+            if ((*prdata = calloc(2,sizeof(char *)))==NULL) {
+                rrd_set_error("malloc imginfo");
+                return -1; 
+            };
+        }
+        if(((*prdata)[0] = malloc((strlen(im.imginfo)+200+strlen(im.graphfile))*sizeof(char)))
+         ==NULL){
+            rrd_set_error("malloc imginfo");
+            return -1;
+        }
+        filename=im.graphfile+strlen(im.graphfile);
+        while(filename > im.graphfile) {
+            if (*(filename-1)=='/' || *(filename-1)=='\\' ) break;
+            filename--;
+        }
+
+        sprintf((*prdata)[0],im.imginfo,filename,(long)(im.canvas->zoom*im.ximg),(long)(im.canvas->zoom*im.yimg));
+    }
+    im_free(&im);
+    return 0;
+}
+
+void
+rrd_graph_init(image_desc_t *im)
+{
+    unsigned int i;
+
+#ifdef HAVE_TZSET
+    tzset();
+#endif
+#ifdef HAVE_SETLOCALE
+    setlocale(LC_TIME,"");
+#ifdef HAVE_MBSTOWCS
+    setlocale(LC_CTYPE,"");
+#endif
+#endif
+    im->yorigin=0;
+    im->xorigin=0;
+    im->minval=0;
+    im->xlab_user.minsec = -1;
+    im->ximg=0;
+    im->yimg=0;
+    im->xsize = 400;
+    im->ysize = 100;
+    im->step = 0;
+    im->ylegend[0] = '\0';
+    im->title[0] = '\0';
+    im->watermark[0] = '\0';
+    im->minval = DNAN;
+    im->maxval = DNAN;    
+    im->unitsexponent= 9999;
+    im->unitslength= 6; 
+    im->forceleftspace = 0;
+    im->symbol = ' ';
+    im->viewfactor = 1.0;
+    im->extra_flags= 0;
+    im->rigid = 0;
+    im->gridfit = 1;
+    im->imginfo = NULL;
+    im->lazy = 0;
+    im->slopemode = 0;
+    im->logarithmic = 0;
+    im->ygridstep = DNAN;
+    im->draw_x_grid = 1;
+    im->draw_y_grid = 1;
+    im->base = 1000;
+    im->prt_c = 0;
+    im->gdes_c = 0;
+    im->gdes = NULL;
+    im->canvas = gfx_new_canvas();
+    im->grid_dash_on = 1;
+    im->grid_dash_off = 1;
+    im->tabwidth = 40.0;
+    
+    for(i=0;i<DIM(graph_col);i++)
+        im->graph_col[i]=graph_col[i];
+
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+    {
+            char *windir; 
+            char rrd_win_default_font[1000];
+            windir = getenv("windir");
+            /* %windir% is something like D:\windows or C:\winnt */
+            if (windir != NULL) {
+                    strncpy(rrd_win_default_font,windir,500);
+                    rrd_win_default_font[500] = '\0';
+                    strcat(rrd_win_default_font,"\\fonts\\");
+                    strcat(rrd_win_default_font,RRD_DEFAULT_FONT);         
+                    for(i=0;i<DIM(text_prop);i++){
+                            strncpy(text_prop[i].font,rrd_win_default_font,sizeof(text_prop[i].font)-1);
+                            text_prop[i].font[sizeof(text_prop[i].font)-1] = '\0';
+                     }
+             }
+    }
+#endif
+    {
+            char *deffont; 
+            deffont = getenv("RRD_DEFAULT_FONT");
+            if (deffont != NULL) {
+                 for(i=0;i<DIM(text_prop);i++){
+                        strncpy(text_prop[i].font,deffont,sizeof(text_prop[i].font)-1);
+                        text_prop[i].font[sizeof(text_prop[i].font)-1] = '\0';
+                 }
+            }
+    }
+    for(i=0;i<DIM(text_prop);i++){        
+      im->text_prop[i].size = text_prop[i].size;
+      strcpy(im->text_prop[i].font,text_prop[i].font);
+    }
+}
+
+void
+rrd_graph_options(int argc, char *argv[],image_desc_t *im)
+{
+    int                        stroff;    
+    char                *parsetime_error = NULL;
+    char                scan_gtm[12],scan_mtm[12],scan_ltm[12],col_nam[12];
+    time_t                start_tmp=0,end_tmp=0;
+    long                long_tmp;
+    struct rrd_time_value        start_tv, end_tv;
+    gfx_color_t         color;
+    optind = 0; opterr = 0;  /* initialize getopt */
+
+    parsetime("end-24h", &start_tv);
+    parsetime("now", &end_tv);
+
+    /* defines for long options without a short equivalent. should be bytes,
+       and may not collide with (the ASCII value of) short options */
+    #define LONGOPT_UNITS_SI 255
+
+    while (1){
+        static struct option long_options[] =
+        {
+            {"start",      required_argument, 0,  's'},
+            {"end",        required_argument, 0,  'e'},
+            {"x-grid",     required_argument, 0,  'x'},
+            {"y-grid",     required_argument, 0,  'y'},
+            {"vertical-label",required_argument,0,'v'},
+            {"width",      required_argument, 0,  'w'},
+            {"height",     required_argument, 0,  'h'},
+            {"interlaced", no_argument,       0,  'i'},
+            {"upper-limit",required_argument, 0,  'u'},
+            {"lower-limit",required_argument, 0,  'l'},
+            {"rigid",      no_argument,       0,  'r'},
+            {"base",       required_argument, 0,  'b'},
+            {"logarithmic",no_argument,       0,  'o'},
+            {"color",      required_argument, 0,  'c'},
+            {"font",       required_argument, 0,  'n'},
+            {"title",      required_argument, 0,  't'},
+            {"imginfo",    required_argument, 0,  'f'},
+            {"imgformat",  required_argument, 0,  'a'},
+            {"lazy",       no_argument,       0,  'z'},
+            {"zoom",       required_argument, 0,  'm'},
+            {"no-legend",  no_argument,       0,  'g'},
+            {"force-rules-legend",no_argument,0,  'F'},
+            {"only-graph", no_argument,       0,  'j'},
+            {"alt-y-grid", no_argument,       0,  'Y'},
+            {"no-minor",   no_argument,       0,  'I'},
+            {"slope-mode", no_argument,              0,  'E'},
+            {"alt-autoscale", no_argument,    0,  'A'},
+           {"alt-autoscale-min", no_argument, 0, 'J'},
+            {"alt-autoscale-max", no_argument, 0, 'M'},
+            {"no-gridfit", no_argument,       0,   'N'},
+            {"units-exponent",required_argument, 0, 'X'},
+            {"units-length",required_argument, 0, 'L'},
+            {"units",      required_argument, 0,  LONGOPT_UNITS_SI },
+            {"step",       required_argument, 0,    'S'},
+            {"tabwidth",   required_argument, 0,    'T'},            
+            {"font-render-mode", required_argument, 0, 'R'},
+            {"font-smoothing-threshold", required_argument, 0, 'B'},
+            {"watermark",  required_argument, 0,  'W'},
+            {"alt-y-mrtg", no_argument,       0,  1000}, /* this has no effect it is just here to save old apps from crashing when they use it */
+            {0,0,0,0}};
+        int option_index = 0;
+        int opt;
+        int col_start,col_end;
+
+        opt = getopt_long(argc, argv, 
+                         "s:e:x:y:v:w:h:iu:l:rb:oc:n:m:t:f:a:I:zgjFYAMEX:L:S:T:NR:B:W:",
+                          long_options, &option_index);
+
+        if (opt == EOF)
+            break;
+        
+        switch(opt) {
+        case 'I':
+            im->extra_flags |= NOMINOR;
+            break;
+        case 'Y':
+            im->extra_flags |= ALTYGRID;
+            break;
+        case 'A':
+            im->extra_flags |= ALTAUTOSCALE;
+           break;
+       case 'J':
+           im->extra_flags |= ALTAUTOSCALE_MIN;
+            break;
+        case 'M':
+            im->extra_flags |= ALTAUTOSCALE_MAX;
+            break;
+        case 'j':
+           im->extra_flags |= ONLY_GRAPH;
+           break;
+        case 'g':
+            im->extra_flags |= NOLEGEND;
+            break;
+        case 'F':
+            im->extra_flags |= FORCE_RULES_LEGEND;
+            break;
+        case LONGOPT_UNITS_SI:
+            if(im->extra_flags & FORCE_UNITS) {
+                rrd_set_error("--units can only be used once!");
+                return;
+            }
+            if(strcmp(optarg,"si")==0)
+                im->extra_flags |= FORCE_UNITS_SI;
+            else {
+                rrd_set_error("invalid argument for --units: %s", optarg );
+                return;
+            }
+            break;
+        case 'X':
+            im->unitsexponent = atoi(optarg);
+            break;
+        case 'L':
+            im->unitslength = atoi(optarg);
+            im->forceleftspace = 1;
+            break;
+        case 'T':
+            im->tabwidth = atof(optarg);
+            break;
+        case 'S':
+            im->step =  atoi(optarg);
+            break;
+        case 'N':
+            im->gridfit = 0;
+            break;
+        case 's':
+            if ((parsetime_error = parsetime(optarg, &start_tv))) {
+                rrd_set_error( "start time: %s", parsetime_error );
+                return;
+            }
+            break;
+        case 'e':
+            if ((parsetime_error = parsetime(optarg, &end_tv))) {
+                rrd_set_error( "end time: %s", parsetime_error );
+                return;
+            }
+            break;
+        case 'x':
+            if(strcmp(optarg,"none") == 0){
+              im->draw_x_grid=0;
+              break;
+            };
+                
+            if(sscanf(optarg,
+                      "%10[A-Z]:%ld:%10[A-Z]:%ld:%10[A-Z]:%ld:%ld:%n",
+                      scan_gtm,
+                      &im->xlab_user.gridst,
+                      scan_mtm,
+                      &im->xlab_user.mgridst,
+                      scan_ltm,
+                      &im->xlab_user.labst,
+                      &im->xlab_user.precis,
+                      &stroff) == 7 && stroff != 0){
+                strncpy(im->xlab_form, optarg+stroff, sizeof(im->xlab_form) - 1);
+                im->xlab_form[sizeof(im->xlab_form)-1] = '\0'; 
+                if((int)(im->xlab_user.gridtm = tmt_conv(scan_gtm)) == -1){
+                    rrd_set_error("unknown keyword %s",scan_gtm);
+                    return;
+                } else if ((int)(im->xlab_user.mgridtm = tmt_conv(scan_mtm)) == -1){
+                    rrd_set_error("unknown keyword %s",scan_mtm);
+                    return;
+                } else if ((int)(im->xlab_user.labtm = tmt_conv(scan_ltm)) == -1){
+                    rrd_set_error("unknown keyword %s",scan_ltm);
+                    return;
+                } 
+                im->xlab_user.minsec = 1;
+                im->xlab_user.stst = im->xlab_form;
+            } else {
+                rrd_set_error("invalid x-grid format");
+                return;
+            }
+            break;
+        case 'y':
+
+            if(strcmp(optarg,"none") == 0){
+              im->draw_y_grid=0;
+              break;
+            };
+
+            if(sscanf(optarg,
+                      "%lf:%d",
+                      &im->ygridstep,
+                      &im->ylabfact) == 2) {
+                if(im->ygridstep<=0){
+                    rrd_set_error("grid step must be > 0");
+                    return;
+                } else if (im->ylabfact < 1){
+                    rrd_set_error("label factor must be > 0");
+                    return;
+                } 
+            } else {
+                rrd_set_error("invalid y-grid format");
+                return;
+            }
+            break;
+        case 'v':
+            strncpy(im->ylegend,optarg,150);
+            im->ylegend[150]='\0';
+            break;
+        case 'u':
+            im->maxval = atof(optarg);
+            break;
+        case 'l':
+            im->minval = atof(optarg);
+            break;
+        case 'b':
+            im->base = atol(optarg);
+            if(im->base != 1024 && im->base != 1000 ){
+                rrd_set_error("the only sensible value for base apart from 1000 is 1024");
+                return;
+            }
+            break;
+        case 'w':
+            long_tmp = atol(optarg);
+            if (long_tmp < 10) {
+                rrd_set_error("width below 10 pixels");
+                return;
+            }
+            im->xsize = long_tmp;
+            break;
+        case 'h':
+            long_tmp = atol(optarg);
+            if (long_tmp < 10) {
+                rrd_set_error("height below 10 pixels");
+                return;
+            }
+            im->ysize = long_tmp;
+            break;
+        case 'i':
+            im->canvas->interlaced = 1;
+            break;
+        case 'r':
+            im->rigid = 1;
+            break;
+        case 'f':
+            im->imginfo = optarg;
+            break;
+            case 'a':
+            if((int)(im->canvas->imgformat = if_conv(optarg)) == -1) {
+                rrd_set_error("unsupported graphics format '%s'",optarg);
+                return;
+            }
+            break;
+        case 'z':
+            im->lazy = 1;
+            break;
+        case 'E':
+            im->slopemode = 1;
+            break;
+
+        case 'o':
+            im->logarithmic = 1;
+            break;
+        case 'c':
+            if(sscanf(optarg,
+                      "%10[A-Z]#%n%8lx%n",
+                      col_nam,&col_start,&color,&col_end) == 2){
+                int ci;
+                int col_len = col_end - col_start;
+                switch (col_len){
+                        case 3:
+                                color = (
+                                        ((color & 0xF00) * 0x110000) |
+                                        ((color & 0x0F0) * 0x011000) |
+                                        ((color & 0x00F) * 0x001100) |
+                                        0x000000FF
+                                        );
+                                break;
+                        case 4:
+                                color = (
+                                        ((color & 0xF000) * 0x11000) |
+                                        ((color & 0x0F00) * 0x01100) |
+                                        ((color & 0x00F0) * 0x00110) |
+                                        ((color & 0x000F) * 0x00011)
+                                        );
+                                break;
+                        case 6:
+                                color = (color << 8) + 0xff /* shift left by 8 */;
+                                break;
+                        case 8:
+                                break;
+                        default:
+                                rrd_set_error("the color format is #RRGGBB[AA]");
+                                return;
+                }
+                if((ci=grc_conv(col_nam)) != -1){
+                    im->graph_col[ci]=color;
+                }  else {
+                  rrd_set_error("invalid color name '%s'",col_nam);
+                  return;
+                }
+            } else {
+                rrd_set_error("invalid color def format");
+                return;
+            }
+            break;        
+        case 'n':{
+            char prop[15];
+            double size = 1;
+            char font[1024] = "";
+
+            if(sscanf(optarg,
+                                "%10[A-Z]:%lf:%1000s",
+                                prop,&size,font) >= 2){
+                int sindex,propidx;
+                if((sindex=text_prop_conv(prop)) != -1){
+                  for (propidx=sindex;propidx<TEXT_PROP_LAST;propidx++){                        
+                        if (size > 0){
+                              im->text_prop[propidx].size=size;              
+                      }
+                       if (strlen(font) > 0){
+                          strcpy(im->text_prop[propidx].font,font);
+                      }
+                      if (propidx==sindex && sindex != 0) break;
+                  }
+                } else {
+                    rrd_set_error("invalid fonttag '%s'",prop);
+                    return;
+                }
+            } else {
+                rrd_set_error("invalid text property format");
+                return;
+            }
+            break;          
+        }
+        case 'm':
+            im->canvas->zoom = atof(optarg);
+            if (im->canvas->zoom <= 0.0) {
+                rrd_set_error("zoom factor must be > 0");
+                return;
+            }
+          break;
+        case 't':
+            strncpy(im->title,optarg,150);
+            im->title[150]='\0';
+            break;
+
+        case 'R':
+                if ( strcmp( optarg, "normal" ) == 0 )
+                        im->canvas->aa_type = AA_NORMAL;
+                else if ( strcmp( optarg, "light" ) == 0 )
+                        im->canvas->aa_type = AA_LIGHT;
+                else if ( strcmp( optarg, "mono" ) == 0 )
+                        im->canvas->aa_type = AA_NONE;
+                else
+                {
+                        rrd_set_error("unknown font-render-mode '%s'", optarg );
+                        return;
+                }
+                break;
+
+        case 'B':
+            im->canvas->font_aa_threshold = atof(optarg);
+                break;
+
+        case 'W':
+            strncpy(im->watermark,optarg,100);
+            im->watermark[99]='\0';
+            break;
+
+        case '?':
+            if (optopt != 0)
+                rrd_set_error("unknown option '%c'", optopt);
+            else
+                rrd_set_error("unknown option '%s'",argv[optind-1]);
+            return;
+        }
+    }
+    
+    if (optind >= argc) {
+       rrd_set_error("missing filename");
+       return;
+    }
+
+    if (im->logarithmic == 1 && im->minval <= 0){
+        rrd_set_error("for a logarithmic yaxis you must specify a lower-limit > 0");        
+        return;
+    }
+
+    if (proc_start_end(&start_tv,&end_tv,&start_tmp,&end_tmp) == -1){
+        /* error string is set in parsetime.c */
+        return;
+    }  
+    
+    if (start_tmp < 3600*24*365*10){
+        rrd_set_error("the first entry to fetch should be after 1980 (%ld)",start_tmp);
+        return;
+    }
+    
+    if (end_tmp < start_tmp) {
+        rrd_set_error("start (%ld) should be less than end (%ld)", 
+               start_tmp, end_tmp);
+        return;
+    }
+    
+    im->start = start_tmp;
+    im->end = end_tmp;
+    im->step = max((long)im->step, (im->end-im->start)/im->xsize);
+}
+
+int
+rrd_graph_color(image_desc_t *im, char *var, char *err, int optional)
+{
+    char *color;
+    graph_desc_t *gdp=&im->gdes[im->gdes_c-1];
+
+    color=strstr(var,"#");
+    if (color==NULL) {
+        if (optional==0) {
+            rrd_set_error("Found no color in %s",err);
+            return 0;
+        }
+        return 0;
+    } else {
+        int n=0;
+        char *rest;
+        gfx_color_t    col;
+
+        rest=strstr(color,":");
+        if (rest!=NULL)
+            n=rest-color;
+        else
+            n=strlen(color);
+
+        switch (n) {
+            case 7:
+                sscanf(color,"#%6lx%n",&col,&n);
+                col = (col << 8) + 0xff /* shift left by 8 */;
+                if (n!=7) rrd_set_error("Color problem in %s",err);
+                break;
+            case 9:
+                sscanf(color,"#%8lx%n",&col,&n);
+                if (n==9) break;
+            default:
+                rrd_set_error("Color problem in %s",err);
+        }
+        if (rrd_test_error()) return 0;
+        gdp->col = col;
+        return n;
+    }
+}
+
+
+int bad_format(char *fmt) {
+    char *ptr;
+    int n=0;
+    ptr = fmt;
+    while (*ptr != '\0')
+        if (*ptr++ == '%') {
+             /* line cannot end with percent char */
+             if (*ptr == '\0') return 1;
+             /* '%s', '%S' and '%%' are allowed */
+             if (*ptr == 's' || *ptr == 'S' || *ptr == '%') ptr++;
+
+             /* %c is allowed (but use only with vdef!) */
+             else if (*ptr == 'c') {
+                ptr++;
+                n=1;
+             }
+
+             /* or else '% 6.2lf' and such are allowed */
+             else {
+                 /* optional padding character */
+                 if (*ptr == ' ' || *ptr == '+' || *ptr == '-') ptr++;
+
+                 /* This should take care of 'm.n' with all three optional */
+                 while (*ptr >= '0' && *ptr <= '9') ptr++;
+                 if (*ptr == '.') ptr++;
+                 while (*ptr >= '0' && *ptr <= '9') ptr++;
+  
+                 /* Either 'le', 'lf' or 'lg' must follow here */
+                 if (*ptr++ != 'l') return 1;
+                 if (*ptr == 'e' || *ptr == 'f' || *ptr == 'g') ptr++;
+                 else return 1;
+                 n++;
+            }
+         }
+      
+      return (n!=1); 
+}
+
+
+int
+vdef_parse(gdes,str)
+struct graph_desc_t *gdes;
+const char *const str;
+{
+    /* A VDEF currently is either "func" or "param,func"
+     * so the parsing is rather simple.  Change if needed.
+     */
+    double        param;
+    char        func[30];
+    int                n;
+    
+    n=0;
+    sscanf(str,"%le,%29[A-Z]%n",&param,func,&n);
+    if (n== (int)strlen(str)) { /* matched */
+        ;
+    } else {
+        n=0;
+        sscanf(str,"%29[A-Z]%n",func,&n);
+        if (n== (int)strlen(str)) { /* matched */
+            param=DNAN;
+        } else {
+            rrd_set_error("Unknown function string '%s' in VDEF '%s'"
+                ,str
+                ,gdes->vname
+                );
+            return -1;
+        }
+    }
+    if                (!strcmp("PERCENT",func)) gdes->vf.op = VDEF_PERCENT;
+    else if        (!strcmp("MAXIMUM",func)) gdes->vf.op = VDEF_MAXIMUM;
+    else if        (!strcmp("AVERAGE",func)) gdes->vf.op = VDEF_AVERAGE;
+    else if        (!strcmp("MINIMUM",func)) gdes->vf.op = VDEF_MINIMUM;
+    else if        (!strcmp("TOTAL",  func)) gdes->vf.op = VDEF_TOTAL;
+    else if        (!strcmp("FIRST",  func)) gdes->vf.op = VDEF_FIRST;
+    else if        (!strcmp("LAST",   func)) gdes->vf.op = VDEF_LAST;
+    else if     (!strcmp("LSLSLOPE", func)) gdes->vf.op = VDEF_LSLSLOPE;
+    else if     (!strcmp("LSLINT",   func)) gdes->vf.op = VDEF_LSLINT;
+    else if     (!strcmp("LSLCORREL",func)) gdes->vf.op = VDEF_LSLCORREL;
+    else {
+        rrd_set_error("Unknown function '%s' in VDEF '%s'\n"
+            ,func
+            ,gdes->vname
+            );
+        return -1;
+    };
+
+    switch (gdes->vf.op) {
+        case VDEF_PERCENT:
+            if (isnan(param)) { /* no parameter given */
+                rrd_set_error("Function '%s' needs parameter in VDEF '%s'\n"
+                    ,func
+                    ,gdes->vname
+                    );
+                return -1;
+            };
+            if (param>=0.0 && param<=100.0) {
+                gdes->vf.param = param;
+                gdes->vf.val   = DNAN;        /* undefined */
+                gdes->vf.when  = 0;        /* undefined */
+            } else {
+                rrd_set_error("Parameter '%f' out of range in VDEF '%s'\n"
+                    ,param
+                    ,gdes->vname
+                    );
+                return -1;
+            };
+            break;
+        case VDEF_MAXIMUM:
+        case VDEF_AVERAGE:
+        case VDEF_MINIMUM:
+        case VDEF_TOTAL:
+        case VDEF_FIRST:
+        case VDEF_LAST:
+        case VDEF_LSLSLOPE:
+        case VDEF_LSLINT:
+        case VDEF_LSLCORREL:
+            if (isnan(param)) {
+                gdes->vf.param = DNAN;
+                gdes->vf.val   = DNAN;
+                gdes->vf.when  = 0;
+            } else {
+                rrd_set_error("Function '%s' needs no parameter in VDEF '%s'\n"
+                    ,func
+                    ,gdes->vname
+                    );
+                return -1;
+            };
+            break;
+    };
+    return 0;
+}
+
+
+int
+vdef_calc(im,gdi)
+image_desc_t *im;
+int gdi;
+{
+    graph_desc_t        *src,*dst;
+    rrd_value_t                *data;
+    long                step,steps;
+
+    dst = &im->gdes[gdi];
+    src = &im->gdes[dst->vidx];
+    data = src->data + src->ds;
+    steps = (src->end - src->start) / src->step;
+
+#if 0
+printf("DEBUG: start == %lu, end == %lu, %lu steps\n"
+    ,src->start
+    ,src->end
+    ,steps
+    );
+#endif
+
+    switch (dst->vf.op) {
+        case VDEF_PERCENT: {
+                rrd_value_t *        array;
+                int                field;
+
+
+                if ((array = malloc(steps*sizeof(double)))==NULL) {
+                    rrd_set_error("malloc VDEV_PERCENT");
+                    return -1;
+                }
+                for (step=0;step < steps; step++) {
+                    array[step]=data[step*src->ds_cnt];
+                }
+                qsort(array,step,sizeof(double),vdef_percent_compar);
+
+                field = (steps-1)*dst->vf.param/100;
+                dst->vf.val  = array[field];
+                dst->vf.when = 0;        /* no time component */
+                free(array);
+#if 0
+for(step=0;step<steps;step++)
+printf("DEBUG: %3li:%10.2f %c\n",step,array[step],step==field?'*':' ');
+#endif
+            }
+            break;
+        case VDEF_MAXIMUM:
+            step=0;
+            while (step != steps && isnan(data[step*src->ds_cnt])) step++;
+            if (step == steps) {
+                dst->vf.val  = DNAN;
+                dst->vf.when = 0;
+            } else {
+                dst->vf.val  = data[step*src->ds_cnt];
+                dst->vf.when = src->start + (step+1)*src->step;
+            }
+            while (step != steps) {
+                if (finite(data[step*src->ds_cnt])) {
+                    if (data[step*src->ds_cnt] > dst->vf.val) {
+                        dst->vf.val  = data[step*src->ds_cnt];
+                        dst->vf.when = src->start + (step+1)*src->step;
+                    }
+                }
+                step++;
+            }
+            break;
+        case VDEF_TOTAL:
+        case VDEF_AVERAGE: {
+            int cnt=0;
+            double sum=0.0;
+            for (step=0;step<steps;step++) {
+                if (finite(data[step*src->ds_cnt])) {
+                    sum += data[step*src->ds_cnt];
+                    cnt ++;
+                };
+            }
+            if (cnt) {
+                if (dst->vf.op == VDEF_TOTAL) {
+                    dst->vf.val  = sum*src->step;
+                    dst->vf.when = 0;        /* no time component */
+                } else {
+                    dst->vf.val = sum/cnt;
+                    dst->vf.when = 0;        /* no time component */
+                };
+            } else {
+                dst->vf.val  = DNAN;
+                dst->vf.when = 0;
+            }
+            }
+            break;
+        case VDEF_MINIMUM:
+            step=0;
+            while (step != steps && isnan(data[step*src->ds_cnt])) step++;
+            if (step == steps) {
+                dst->vf.val  = DNAN;
+                dst->vf.when = 0;
+            } else {
+                dst->vf.val  = data[step*src->ds_cnt];
+                dst->vf.when = src->start + (step+1)*src->step;
+            }
+            while (step != steps) {
+                if (finite(data[step*src->ds_cnt])) {
+                    if (data[step*src->ds_cnt] < dst->vf.val) {
+                        dst->vf.val  = data[step*src->ds_cnt];
+                        dst->vf.when = src->start + (step+1)*src->step;
+                    }
+                }
+                step++;
+            }
+            break;
+        case VDEF_FIRST:
+            /* The time value returned here is one step before the
+             * actual time value.  This is the start of the first
+             * non-NaN interval.
+             */
+            step=0;
+            while (step != steps && isnan(data[step*src->ds_cnt])) step++;
+            if (step == steps) { /* all entries were NaN */
+                dst->vf.val  = DNAN;
+                dst->vf.when = 0;
+            } else {
+                dst->vf.val  = data[step*src->ds_cnt];
+                dst->vf.when = src->start + step*src->step;
+            }
+            break;
+        case VDEF_LAST:
+            /* The time value returned here is the
+             * actual time value.  This is the end of the last
+             * non-NaN interval.
+             */
+            step=steps-1;
+            while (step >= 0 && isnan(data[step*src->ds_cnt])) step--;
+            if (step < 0) { /* all entries were NaN */
+                dst->vf.val  = DNAN;
+                dst->vf.when = 0;
+            } else {
+                dst->vf.val  = data[step*src->ds_cnt];
+                dst->vf.when = src->start + (step+1)*src->step;
+            }
+            break;
+        case VDEF_LSLSLOPE:
+        case VDEF_LSLINT:
+        case VDEF_LSLCORREL:{
+            /* Bestfit line by linear least squares method */ 
+
+            int cnt=0;
+            double SUMx, SUMy, SUMxy, SUMxx, SUMyy, slope, y_intercept, correl ;
+            SUMx = 0; SUMy = 0; SUMxy = 0; SUMxx = 0; SUMyy = 0;
+
+            for (step=0;step<steps;step++) {
+                if (finite(data[step*src->ds_cnt])) {
+                    cnt++;
+                    SUMx  += step;
+                    SUMxx += step * step;
+                    SUMxy += step * data[step*src->ds_cnt];
+                    SUMy  += data[step*src->ds_cnt];
+                    SUMyy  += data[step*src->ds_cnt]*data[step*src->ds_cnt];
+                };
+            }
+
+            slope = ( SUMx*SUMy - cnt*SUMxy ) / ( SUMx*SUMx - cnt*SUMxx );
+            y_intercept = ( SUMy - slope*SUMx ) / cnt;
+            correl = (SUMxy - (SUMx*SUMy)/cnt) / sqrt((SUMxx - (SUMx*SUMx)/cnt)*(SUMyy - (SUMy*SUMy)/cnt));
+
+            if (cnt) {
+                    if (dst->vf.op == VDEF_LSLSLOPE) {
+                        dst->vf.val  = slope;
+                        dst->vf.when = 0;
+                    } else if (dst->vf.op == VDEF_LSLINT)  {
+                        dst->vf.val = y_intercept;
+                        dst->vf.when = 0;
+                    } else if (dst->vf.op == VDEF_LSLCORREL)  {
+                        dst->vf.val = correl;
+                        dst->vf.when = 0;
+                    };
+                
+            } else {
+                dst->vf.val  = DNAN;
+                dst->vf.when = 0;
+            }
+        }
+        break;
+    }
+    return 0;
+}
+
+/* NaN < -INF < finite_values < INF */
+int
+vdef_percent_compar(a,b)
+const void *a,*b;
+{
+    /* Equality is not returned; this doesn't hurt except
+     * (maybe) for a little performance.
+     */
+
+    /* First catch NaN values. They are smallest */
+    if (isnan( *(double *)a )) return -1;
+    if (isnan( *(double *)b )) return  1;
+
+    /* NaN doesn't reach this part so INF and -INF are extremes.
+     * The sign from isinf() is compatible with the sign we return
+     */
+    if (isinf( *(double *)a )) return isinf( *(double *)a );
+    if (isinf( *(double *)b )) return isinf( *(double *)b );
+
+    /* If we reach this, both values must be finite */
+    if ( *(double *)a < *(double *)b ) return -1; else return 1;
+}
diff --git a/src/rrd_graph.h b/src/rrd_graph.h
new file mode 100644 (file)
index 0000000..e83b442
--- /dev/null
@@ -0,0 +1,263 @@
+#ifndef _RRD_GRAPH_H
+#define _RRD_GRAPH_H
+
+#include "rrd_tool.h"
+#include "rrd_rpncalc.h"
+#include "rrd_gfx.h"
+
+#define MAX_VNAME_LEN 255
+#define DEF_NAM_FMT "%255[-_A-Za-z0-9]"
+
+#define ALTYGRID        0x01   /* use alternative y grid algorithm */
+#define ALTAUTOSCALE    0x02   /* use alternative algorithm to find lower and upper bounds */
+#define ALTAUTOSCALE_MIN 0x04  /* use alternative algorithm to find lower bounds */
+#define ALTAUTOSCALE_MAX 0x08  /* use alternative algorithm to find upper bounds */
+#define NOLEGEND        0x10   /* use no legend */
+#define NOMINOR          0x20    /* Turn off minor gridlines */
+#define ONLY_GRAPH       0x40   /* use only graph */
+#define FORCE_RULES_LEGEND 0x80        /* force printing of HRULE and VRULE legend */
+
+#define FORCE_UNITS 0x100        /* mask for all FORCE_UNITS_* flags */
+#define FORCE_UNITS_SI 0x100     /* force use of SI units in Y axis (no effect in linear graph, SI instead of E in log graph) */
+
+enum tmt_en {TMT_SECOND=0,TMT_MINUTE,TMT_HOUR,TMT_DAY,
+            TMT_WEEK,TMT_MONTH,TMT_YEAR};
+
+enum grc_en {GRC_CANVAS=0,GRC_BACK,GRC_SHADEA,GRC_SHADEB,
+            GRC_GRID,GRC_MGRID,GRC_FONT,GRC_ARROW,GRC_AXIS,GRC_FRAME,__GRC_END__};
+
+#define MGRIDWIDTH 0.6
+#define GRIDWIDTH  0.4
+
+enum gf_en {GF_PRINT=0,GF_GPRINT,GF_COMMENT,GF_HRULE,GF_VRULE,GF_LINE,
+           GF_AREA,GF_STACK,GF_TICK,
+           GF_DEF, GF_CDEF, GF_VDEF, GF_SHIFT,
+#ifdef WITH_PIECHART
+           GF_PART,
+#endif
+            GF_XPORT};
+
+enum vdef_op_en {
+                VDEF_MAXIMUM=0 /* like the MAX in (G)PRINT */
+               ,VDEF_MINIMUM   /* like the MIN in (G)PRINT */
+               ,VDEF_AVERAGE   /* like the AVERAGE in (G)PRINT */
+               ,VDEF_PERCENT   /* Nth percentile */
+               ,VDEF_TOTAL     /* average multiplied by time */
+               ,VDEF_FIRST     /* first non-unknown value and time */
+               ,VDEF_LAST      /* last  non-unknown value and time */
+               ,VDEF_LSLSLOPE  /* least squares line slope */
+               ,VDEF_LSLINT    /* least squares line y_intercept */
+               ,VDEF_LSLCORREL /* least squares line correlation coefficient */
+               };
+enum text_prop_en { TEXT_PROP_DEFAULT=0,   /* default settings */
+                   TEXT_PROP_TITLE,       /* properties for the title */
+                   TEXT_PROP_AXIS,        /* for the numbers next to the axis */
+                   TEXT_PROP_UNIT,        /* for the vertical unit description */
+                   TEXT_PROP_LEGEND,      /* fot the legend below the graph */
+                   TEXT_PROP_LAST };
+
+typedef struct text_prop_t {
+  double       size;
+  char         font[1024];
+} text_prop_t;
+
+
+typedef struct vdef_t {
+    enum vdef_op_en    op;
+    double             param;  /* parameter for function, if applicable */
+    double             val;    /* resulting value */
+    time_t             when;   /* timestamp, if applicable */
+} vdef_t;
+
+typedef struct xlab_t {
+    long         minsec;       /* minimum sec per pix */
+    long         length;       /* number of secs on the image */
+    enum tmt_en  gridtm;       /* grid interval in what ?*/
+    long         gridst;       /* how many whats per grid*/
+    enum tmt_en  mgridtm;      /* label interval in what ?*/
+    long         mgridst;      /* how many whats per label*/
+    enum tmt_en  labtm;        /* label interval in what ?*/
+    long         labst;        /* how many whats per label*/
+    long         precis;       /* label precision -> label placement*/
+    char         *stst;        /* strftime string*/
+} xlab_t;
+
+typedef struct ygrid_scale_t {  /* y axis grid scaling info */
+    double       gridstep;
+    int          labfact;
+    char         labfmt[64];
+} ygrid_scale_t;
+
+/* sensible y label intervals ...*/
+
+typedef struct ylab_t {
+    double   grid;    /* grid spacing */
+    int      lfac[4]; /* associated label spacing*/
+} ylab_t;
+
+
+/* this structure describes the elements which can make up a graph.
+   because they are quite diverse, not all elements will use all the
+   possible parts of the structure. */
+#ifdef HAVE_SNPRINTF
+#define FMT_LEG_LEN 200
+#else
+#define FMT_LEG_LEN 2000
+#endif
+
+typedef  struct graph_desc_t {
+    enum gf_en     gf;         /* graphing function */
+    int            stack;      /* boolean */
+    int            debug;      /* boolean */
+    char           vname[MAX_VNAME_LEN+1];  /* name of the variable */
+    long           vidx;       /* gdes reference */
+    char           rrd[1024];   /* name of the rrd_file containing data */
+    char           ds_nam[DS_NAM_SIZE]; /* data source name */
+    long           ds;         /* data source number */
+    enum cf_en     cf;         /* consolidation function */
+    enum cf_en     cf_reduce;  /* consolidation function for reduce_data() */
+    gfx_color_t    col;        /* graph color */
+    char  format[FMT_LEG_LEN+5]; /* format for PRINT AND GPRINT */
+    char  legend[FMT_LEG_LEN+5]; /* legend*/
+    int            strftm;     /* should the VDEF legend be formated with strftime */
+    double         leg_x,leg_y;  /* location of legend */   
+    double         yrule;      /* value for y rule line and for VDEF */
+    time_t         xrule;      /* time for x rule line and for VDEF */
+    vdef_t         vf;         /* instruction for VDEF function */
+    rpnp_t         *rpnp;     /* instructions for CDEF function */
+
+    /* SHIFT implementation */
+    int            shidx; /* gdes reference for offset (-1 --> constant) */
+    time_t         shval; /* offset if shidx is -1 */
+    time_t         shift; /* current shift applied */
+
+    /* description of data fetched for the graph element */
+    time_t         start,end; /* timestaps for first and last data element */
+    time_t         start_orig,end_orig; /* timestaps for first and last data element */
+    unsigned long  step;      /* time between samples */
+    unsigned long  step_orig;      /* time between samples */
+    unsigned long  ds_cnt; /* how many data sources are there in the fetch */
+    long           data_first; /* first pointer to this data */
+    char           **ds_namv; /* name of datasources  in the fetch. */
+    rrd_value_t    *data; /* the raw data drawn from the rrd */
+    rrd_value_t    *p_data; /* processed data, xsize elments */
+    double         linewidth;  /* linewideth */
+} graph_desc_t;
+
+typedef struct image_desc_t {
+
+    /* configuration of graph */
+
+    char           graphfile[MAXPATH]; /* filename for graphic */
+    FILE         *graphhandle;        /* FILE to use if filename is "-" */
+    long           xsize,ysize;        /* graph area size in pixels */
+#ifdef WITH_PIECHART
+    long          piesize;            /* size of the piechart */
+#endif
+    gfx_color_t    graph_col[__GRC_END__]; /* real colors for the graph */   
+    text_prop_t    text_prop[TEXT_PROP_LAST]; /* text properties */
+    char           ylegend[210];   /* legend along the yaxis */
+    char           title[210];     /* title for graph */
+    char           watermark[110];   /* watermark for graph */
+    int            draw_x_grid;      /* no x-grid at all */
+    int            draw_y_grid;      /* no x-grid at all */
+    double         grid_dash_on, grid_dash_off;
+    xlab_t         xlab_user;      /* user defined labeling for xaxis */
+    char           xlab_form[210]; /* format for the label on the xaxis */
+
+    double         ygridstep;      /* user defined step for y grid */
+    int            ylabfact;       /* every how many y grid shall a label be written ? */
+    double         tabwidth;       /* tabwdith */
+    time_t         start,end;      /* what time does the graph cover */
+    unsigned long  step;           /* any preference for the default step ? */
+    rrd_value_t    minval,maxval;  /* extreme values in the data */
+    int            rigid;          /* do not expand range even with 
+                                     values outside */
+    ygrid_scale_t  ygrid_scale;    /* calculated y axis grid info */
+    int            gridfit;        /* adjust y-axis range etc so all
+                                     grindlines falls in integer pixel values */
+    char*          imginfo;        /* construct an <IMG ... tag and return 
+                                     as first retval */
+    int            lazy;           /* only update the image if there is
+                                     reasonable probablility that the
+                                     existing one is out of date */
+    int                   slopemode;      /* connect the dots of the curve directly, not using a stair */
+    int            logarithmic;    /* scale the yaxis logarithmic */
+    
+    /* status information */
+           
+    long           xorigin,yorigin;/* where is (0,0) of the graph */
+#ifdef WITH_PIECHART
+    long           pie_x,pie_y;    /* where is the centerpoint */
+#endif
+    long           ximg,yimg;      /* total size of the image */
+    double         magfact;        /* numerical magnitude*/
+    long         base;             /* 1000 or 1024 depending on what we graph */
+    char           symbol;         /* magnitude symbol for y-axis */
+    float          viewfactor;     /* how should the numbers on the y-axis be scaled for viewing ? */
+    int            unitsexponent;  /* 10*exponent for units on y-asis */
+    int            unitslength;    /* width of the yaxis labels */
+    int            forceleftspace; /* do not kill the space to the left of the y-axis if there is no grid */
+
+    int            extra_flags;    /* flags for boolean options */
+    /* data elements */
+
+    long  prt_c;                  /* number of print elements */
+    long  gdes_c;                  /* number of graphics elements */
+    graph_desc_t   *gdes;          /* points to an array of graph elements */
+    gfx_canvas_t   *canvas;        /* graphics library */
+} image_desc_t;
+
+/* Prototypes */
+int xtr(image_desc_t *,time_t);
+double ytr(image_desc_t *, double);
+enum gf_en gf_conv(char *);
+enum gfx_if_en if_conv(char *);
+enum tmt_en tmt_conv(char *);
+enum grc_en grc_conv(char *);
+enum text_prop_en text_prop_conv(char *);
+int im_free(image_desc_t *);
+void auto_scale( image_desc_t *,  double *, char **, double *);
+void si_unit( image_desc_t *);
+void expand_range(image_desc_t *);
+void apply_gridfit(image_desc_t *);
+void reduce_data( enum cf_en,  unsigned long,  time_t *, time_t *,  unsigned long *,  unsigned long *,  rrd_value_t **);
+int data_fetch( image_desc_t *);
+long find_var(image_desc_t *, char *);
+long find_var_wrapper(void *arg1, char *key);
+long lcd(long *);
+int data_calc( image_desc_t *);
+int data_proc( image_desc_t *);
+time_t find_first_time( time_t,  enum tmt_en,  long);
+time_t find_next_time( time_t,  enum tmt_en,  long);
+int print_calc(image_desc_t *, char ***);
+int leg_place(image_desc_t *);
+int calc_horizontal_grid(image_desc_t *);
+int draw_horizontal_grid(image_desc_t *);
+int horizontal_log_grid(image_desc_t *);
+void vertical_grid(image_desc_t *);
+void axis_paint(image_desc_t *);
+void grid_paint(image_desc_t *);
+int lazy_check(image_desc_t *);
+int graph_paint(image_desc_t *, char ***);
+#ifdef WITH_PIECHART
+void pie_part(image_desc_t *, gfx_color_t, double, double, double, double, double);
+#endif
+int gdes_alloc(image_desc_t *);
+int scan_for_col(const char *const , int, char *const);
+int rrd_graph(int, char **, char ***, int *, int *, FILE *, double *, double *);
+void rrd_graph_init(image_desc_t *);
+void rrd_graph_options(int, char **, image_desc_t *);
+void rrd_graph_script(int, char **, image_desc_t *, int);
+int rrd_graph_color(image_desc_t *, char *, char *, int);
+int bad_format(char *);
+int vdef_parse(struct graph_desc_t *,const char *const);
+int vdef_calc(image_desc_t *, int);
+int vdef_percent_compar(const void *,const void *);
+int graph_size_location(image_desc_t *, int
+#ifdef WITH_PIECHART
+ ,int
+#endif
+);
+
+#endif
diff --git a/src/rrd_graph_helper.c b/src/rrd_graph_helper.c
new file mode 100644 (file)
index 0000000..53da695
--- /dev/null
@@ -0,0 +1,869 @@
+/****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ ****************************************************************************
+ * rrd_graph_helper.c  commandline parser functions 
+ *                     this code initially written by Alex van den Bogaerdt
+ ****************************************************************************/
+
+#include "rrd_graph.h"
+
+#define dprintf if (gdp->debug) printf
+
+/* NOTE ON PARSING:
+ *
+ * we use the following:
+ * 
+ * i=0;  sscanf(&line[*eaten], "what to find%n", variables, &i)
+ *
+ * Usually you want to find a separator as well.  Example:
+ * i=0; sscanf(&line[*eaten], "%li:%n", &someint, &i)
+ *
+ * When the separator is not found, i is not set and thus remains zero.
+ * Another way would be to compare strlen() to i
+ *
+ * Why is this important?  Because 12345abc should not be matched as
+ * integer 12345 ...
+ */
+
+/* NOTE ON VNAMES:
+ *
+ * "if ((gdp->vidx=find_var(im, l))!=-1)" is not good enough, at least
+ * not by itself.
+ *
+ * A vname as a result of a VDEF is quite different from a vname
+ * resulting of a DEF or CDEF.
+ */
+
+/* NOTE ON VNAMES:
+ *
+ * A vname called "123" is not to be parsed as the number 123
+ */
+
+
+/* Define prototypes for the parsing methods.
+  Inputs:
+   const char *const line    - a fixed pointer to a fixed string
+   unsigned int *const eaten - a fixed pointer to a changing index in that line
+   graph_desc_t *const gdp   - a fixed pointer to a changing graph description
+   image_desc_t *const im    - a fixed pointer to a changing image description
+*/
+
+int rrd_parse_find_gf (const char * const, unsigned int *const, graph_desc_t *const);
+int rrd_parse_legend  (const char * const, unsigned int *const, graph_desc_t *const);
+int rrd_parse_color   (const char * const, graph_desc_t *const);
+int rrd_parse_CF      (const char * const, unsigned int *const, graph_desc_t *const, enum cf_en *const);
+int rrd_parse_print   (const char * const, unsigned int *const, graph_desc_t *const, image_desc_t *const);
+int rrd_parse_shift   (const char * const, unsigned int *const, graph_desc_t *const, image_desc_t *const);
+int rrd_parse_xport   (const char * const, unsigned int *const, graph_desc_t *const, image_desc_t *const);
+int rrd_parse_PVHLAST (const char * const, unsigned int *const, graph_desc_t *const, image_desc_t *const);
+int rrd_parse_make_vname   (const char * const, unsigned int *const, graph_desc_t *const, image_desc_t *const);
+int rrd_parse_find_vname   (const char * const, unsigned int *const, graph_desc_t *const, image_desc_t *const);
+int rrd_parse_def     (const char * const, unsigned int *const, graph_desc_t *const, image_desc_t *const);
+int rrd_parse_vdef    (const char * const, unsigned int *const, graph_desc_t *const, image_desc_t *const);
+int rrd_parse_cdef    (const char * const, unsigned int *const, graph_desc_t *const, image_desc_t *const);
+
+
+
+int
+rrd_parse_find_gf(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp) {
+    char funcname[11],c1=0;
+    int i=0;
+
+    /* start an argument with DEBUG to be able to see how it is parsed */
+    sscanf(&line[*eaten], "DEBUG%n", &i);
+    if (i) {
+       gdp->debug=1;
+       (*eaten)+=i;
+       i=0;
+       dprintf("Scanning line '%s'\n",&line[*eaten]);
+    }
+    i=0;c1='\0';
+    sscanf(&line[*eaten], "%10[A-Z]%n%c", funcname, &i, &c1);
+    if (!i) {
+       rrd_set_error("Could not make sense out of '%s'",line);
+       return 1;
+    }
+    (*eaten)+=i;
+    if ((int)(gdp->gf=gf_conv(funcname)) == -1) {
+       rrd_set_error("'%s' is not a valid function name", funcname);
+       return 1;
+    } else {
+       dprintf("- found function name '%s'\n",funcname);
+    }
+
+    if (c1 == '\0') {
+       rrd_set_error("Function %s needs parameters.  Line: %s\n",funcname,line);
+       return 1;
+    }
+    if (c1 == ':') (*eaten)++;
+
+    /* Some commands have a parameter before the colon
+     * (currently only LINE)
+     */
+    switch (gdp->gf) {
+       case GF_LINE:
+           if (c1 == ':') {
+               gdp->linewidth=1;
+               dprintf("- - using default width of 1\n");
+           } else {
+               i=0;sscanf(&line[*eaten],"%lf:%n",&gdp->linewidth,&i);
+               if (!i) {
+                   rrd_set_error("Cannot parse line width '%s' in line '%s'\n",&line[*eaten],line);
+                   return 1;
+               } else {
+                   dprintf("- - scanned width %f\n",gdp->linewidth);
+                   if (isnan(gdp->linewidth)) {
+                       rrd_set_error("LINE width '%s' is not a number in line '%s'\n",&line[*eaten],line);
+                       return 1;
+                   }
+                   if (isinf(gdp->linewidth)) {
+                       rrd_set_error("LINE width '%s' is out of range in line '%s'\n",&line[*eaten],line);
+                       return 1;
+                   }
+                   if (gdp->linewidth<0) {
+                       rrd_set_error("LINE width '%s' is less than 0 in line '%s'\n",&line[*eaten],line);
+                       return 1;
+                   }
+               }
+               (*eaten)+=i;
+           }
+           break;
+       default:
+           if (c1 == ':') break;
+           rrd_set_error("Malformed '%s' command in line '%s'\n",&line[*eaten],line);
+           return 1;
+    }
+    if (line[*eaten] == '\0') {
+       rrd_set_error("Expected some arguments after '%s'\n",line);
+       return 1;
+    }
+    return 0;
+}
+
+int
+rrd_parse_legend(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp) {
+    int i;
+
+    if (line[*eaten]=='\0' || line[*eaten]==':') {
+       dprintf("- no (or: empty) legend found\n");
+       return 0;
+    }
+
+    i=scan_for_col(&line[*eaten],FMT_LEG_LEN,gdp->legend);
+
+    (*eaten)+=i;
+
+    if (line[*eaten]!='\0' && line[*eaten]!=':') {
+       rrd_set_error("Legend too long");
+       return 1;
+    } else {
+       return 0;
+    }
+}
+
+int
+rrd_parse_color(const char *const string, graph_desc_t *const gdp) {
+    unsigned int r=0,g=0,b=0,a=0,i;
+
+    /* matches the following formats:
+    ** RGB
+    ** RGBA
+    ** RRGGBB
+    ** RRGGBBAA
+    */
+
+    i=0;
+    while (string[i] && isxdigit((unsigned int)string[i])) i++;
+    if (string[i] != '\0') return 1; /* garbage follows hexdigits */
+    switch (i) {
+       case 3:
+       case 4:
+           sscanf(string, "%1x%1x%1x%1x",&r,&g,&b,&a);
+           r *= 0x11;
+           g *= 0x11;
+           b *= 0x11;
+           a *= 0x11;
+           if (i==3) a=0xFF;
+           break;
+       case 6:
+       case 8:
+           sscanf(string, "%02x%02x%02x%02x",&r,&g,&b,&a);
+           if (i==6) a=0xFF;
+           break;
+       default:
+           return 1;   /* wrong number of digits */
+    }
+    gdp->col = r<<24|g<<16|b<<8|a;
+    return 0;
+}
+
+int
+rrd_parse_CF(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, enum cf_en *cf) {
+    char               symname[CF_NAM_SIZE];
+    int                        i=0;
+
+    sscanf(&line[*eaten], CF_NAM_FMT "%n", symname,&i);
+    if ((!i)||((line[(*eaten)+i]!='\0')&&(line[(*eaten)+i]!=':'))) {
+       rrd_set_error("Cannot parse CF in '%s'",line);
+       return 1;
+    }
+    (*eaten)+=i;
+    dprintf("- using CF '%s'\n",symname);
+
+    if ((int)(*cf = cf_conv(symname))==-1) {
+       rrd_set_error("Unknown CF '%s' in '%s'",symname,line);
+       return 1;
+    }
+
+    if (line[*eaten]!='\0') (*eaten)++;
+    return 0;
+}
+
+/* Try to match next token as a vname.
+ *
+ * Returns:
+ * -1     an error occured and the error string is set
+ * other  the vname index number
+ *
+ * *eaten is incremented only when a vname is found.
+ */
+int
+rrd_parse_find_vname(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, image_desc_t *const im) {
+    char tmpstr[MAX_VNAME_LEN+1];
+    int i;
+    long vidx;
+
+    i=0;sscanf(&line[*eaten], DEF_NAM_FMT "%n", tmpstr,&i);
+    if (!i) {
+       rrd_set_error("Could not parse line '%s'",line);
+       return -1;
+    }
+    if (line[*eaten+i]!=':' && line[*eaten+i]!='\0') {
+       rrd_set_error("Could not parse line '%s'",line);
+       return -1;
+    }
+    dprintf("- Considering '%s'\n",tmpstr);
+
+    if ((vidx=find_var(im,tmpstr))<0) {
+       dprintf("- Not a vname\n");
+       rrd_set_error("Not a valid vname: %s in line %s",tmpstr,line);
+       return -1;
+    }
+    dprintf("- Found vname '%s' vidx '%li'\n",tmpstr,gdp->vidx);
+    if (line[*eaten+i]==':') i++;
+    (*eaten)+=i;
+    return vidx;
+}
+
+/* Parsing old-style xPRINT and new-style xPRINT */
+int
+rrd_parse_print(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, image_desc_t *const im) {
+    /* vname:CF:format in case of DEF-based vname
+    ** vname:CF:format in case of CDEF-based vname
+    ** vname:format[:strftime] in case of VDEF-based vname
+    */
+    if ((gdp->vidx=rrd_parse_find_vname(line,eaten,gdp,im))<0) return 1;
+    switch (im->gdes[gdp->vidx].gf) {
+       case GF_DEF:
+       case GF_CDEF:
+           dprintf("- vname is of type DEF or CDEF, looking for CF\n");
+           if (rrd_parse_CF(line,eaten,gdp,&gdp->cf)) return 1;
+           break;
+       case GF_VDEF:
+           dprintf("- vname is of type VDEF\n");
+           break;
+       default:
+           rrd_set_error("Encountered unknown type variable '%s'",im->gdes[gdp->vidx].vname);
+           return 1;
+    }
+
+    if (rrd_parse_legend(line,eaten,gdp)) return 1;
+    /* for *PRINT the legend itself gets rendered later. We only
+       get the format at this juncture */
+    strcpy(gdp->format,gdp->legend);
+    gdp->legend[0]='\0';       
+    /* this is a very crud test, parsing :style flags should be in a function */
+    if (im->gdes[gdp->vidx].gf == GF_VDEF && strcmp(line+(*eaten),":strftime")==0){
+       gdp->strftm = 1;
+        (*eaten)+=strlen(":strftime");
+    }
+    return 0;
+}
+
+/* SHIFT:_def_or_cdef:_vdef_or_number_
+ */
+int
+rrd_parse_shift(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, image_desc_t *const im) {
+    int i;
+    long time_tmp = 0;
+    if ((gdp->vidx=rrd_parse_find_vname(line,eaten,gdp,im))<0) return 1;
+
+    switch (im->gdes[gdp->vidx].gf) {
+       case GF_DEF:
+       case GF_CDEF:
+           dprintf("- vname is of type DEF or CDEF, OK\n");
+           break;
+       case GF_VDEF:
+           rrd_set_error("Cannot shift a VDEF: '%s' in line '%s'\n",im->gdes[gdp->vidx].vname,line);
+           return 1;
+       default:
+           rrd_set_error("Encountered unknown type variable '%s' in line '%s'",im->gdes[gdp->vidx].vname,line);
+           return 1;
+    }
+
+    if ((gdp->shidx=rrd_parse_find_vname(line,eaten,gdp,im))>=0) {
+       switch (im->gdes[gdp->shidx].gf) {
+           case GF_DEF:
+           case GF_CDEF:
+               rrd_set_error("Offset cannot be a (C)DEF: '%s' in line '%s'\n",im->gdes[gdp->shidx].vname,line);
+               return 1;
+           case GF_VDEF:
+               dprintf("- vname is of type VDEF, OK\n");
+               break;
+           default:
+               rrd_set_error("Encountered unknown type variable '%s' in line '%s'",im->gdes[gdp->vidx].vname,line);
+               return 1;
+       }
+    } else {
+       rrd_clear_error();
+       i=0; sscanf(&line[*eaten],"%li%n",&time_tmp,&i);
+    gdp->shval = time_tmp;
+       if (i!=(int)strlen(&line[*eaten])) {
+           rrd_set_error("Not a valid offset: %s in line %s",&line[*eaten],line);
+           return 1;
+       }
+       (*eaten)+=i;
+       dprintf("- offset is number %li\n",gdp->shval);
+       gdp->shidx = -1;
+    }
+    return 0;
+}
+
+/* XPORT:_def_or_cdef[:legend]
+ */
+int
+rrd_parse_xport(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, image_desc_t *const im) {
+    if ((gdp->vidx=rrd_parse_find_vname(line,eaten,gdp,im))<0) return 1;
+
+    switch (im->gdes[gdp->vidx].gf) {
+       case GF_DEF:
+       case GF_CDEF:
+           dprintf("- vname is of type DEF or CDEF, OK\n");
+           break;
+       case GF_VDEF:
+           rrd_set_error("Cannot xport a VDEF: '%s' in line '%s'\n",im->gdes[gdp->vidx].vname,line);
+           return 1;
+       default:
+           rrd_set_error("Encountered unknown type variable '%s' in line '%s'",im->gdes[gdp->vidx].vname,line);
+           return 1;
+    }
+    dprintf("- looking for legend in '%s'\n",&line[*eaten]);
+    if (rrd_parse_legend(line,eaten,gdp)) return 1;
+    return 0;
+}
+
+/* Parsing of PART, VRULE, HRULE, LINE, AREA, STACK and TICK
+** is done in one function.
+**
+** Stacking PART, VRULE, HRULE or TICK is not allowed.
+**
+** If a number (which is valid to enter) is more than a
+** certain amount of characters, it is caught as an error.
+** While this is arguable, so is entering fixed numbers
+** with more than MAX_VNAME_LEN significant digits.
+*/
+int
+rrd_parse_PVHLAST(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, image_desc_t *const im) {
+    int i,j,k;
+    int colorfound=0;
+    char tmpstr[MAX_VNAME_LEN + 10];   /* vname#RRGGBBAA\0 */
+    long time_tmp = 0;
+    static int spacecnt = 0;
+
+    if (spacecnt == 0) {        
+       float one_space = gfx_get_text_width(im->canvas, 0,
+                               im->text_prop[TEXT_PROP_LEGEND].font,
+                               im->text_prop[TEXT_PROP_LEGEND].size,
+                               im->tabwidth,"    ", 0) / 4.0;
+       float target_space = gfx_get_text_width(im->canvas, 0,
+                               im->text_prop[TEXT_PROP_LEGEND].font,
+                               im->text_prop[TEXT_PROP_LEGEND].size,
+                               im->tabwidth,"oo", 0);
+       spacecnt =  target_space / one_space;   
+        dprintf("- spacecnt: %i onespace: %f targspace: %f\n",spacecnt,one_space,target_space);
+    }
+
+
+    dprintf("- parsing '%s'\n",&line[*eaten]);
+
+    /* have simpler code in the drawing section */
+    if ( gdp->gf == GF_STACK ){
+           gdp->stack=1;
+    }
+
+    i=scan_for_col(&line[*eaten],MAX_VNAME_LEN+9,tmpstr);
+    if (line[*eaten+i]!='\0' && line[*eaten+i]!=':') {
+       rrd_set_error("Cannot parse line '%s'",line);
+       return 1;
+    }
+
+    j=i; while (j>0 && tmpstr[j]!='#') j--;
+
+    if (j) {
+       tmpstr[j]='\0';
+    }
+    /* We now have:
+     * tmpstr[0]    containing vname
+     * tmpstr[j]    if j!=0 then containing color
+     * i            size of vname + color
+     * j            if j!=0 then size of vname
+     */
+
+    /* Number or vname ?
+     * If it is an existing vname, that's OK, provided that it is a
+     * valid type (need time for VRULE, not a float)
+     * Else see if it parses as a number.
+     */
+    dprintf("- examining string '%s'\n",tmpstr);
+    if ((gdp->vidx=find_var(im,tmpstr))>=0) {
+       dprintf("- found vname: '%s' vidx %li\n",tmpstr,gdp->vidx);
+       switch (gdp->gf) {
+#ifdef WITH_PIECHART
+           case GF_PART:
+#endif
+           case GF_VRULE:
+           case GF_HRULE:
+               if (im->gdes[gdp->vidx].gf != GF_VDEF) {
+                   rrd_set_error("Using vname %s of wrong type in line %s\n",im->gdes[gdp->gf].vname,line);
+                   return 1;
+               }
+               break;
+           default:;
+       }
+    } else {
+       dprintf("- it is not an existing vname\n");
+       switch (gdp->gf) {
+           case GF_VRULE:
+               k=0;sscanf(tmpstr,"%li%n",&time_tmp,&k);
+        gdp->xrule = time_tmp;
+               if (((j!=0)&&(k==j))||((j==0)&&(k==i))) {
+                   dprintf("- found time: %li\n",gdp->xrule);
+               } else {
+                   dprintf("- is is not a valid number: %li\n",gdp->xrule);
+                   rrd_set_error("parameter '%s' does not represent time in line %s\n",tmpstr,line);
+                   return 1;
+               }
+           default:
+               k=0;sscanf(tmpstr,"%lf%n",&gdp->yrule,&k);
+               if (((j!=0)&&(k==j))||((j==0)&&(k==i))) {
+                   dprintf("- found number: %lf\n",gdp->yrule);
+               } else {
+                   dprintf("- is is not a valid number: %lf\n",gdp->yrule);
+                   rrd_set_error("parameter '%s' does not represent a number in line %s\n",tmpstr,line);
+                   return 1;
+               }
+       }
+    }
+
+    if (j) {
+       j++;
+       dprintf("- examining color '%s'\n",&tmpstr[j]);
+       if (rrd_parse_color(&tmpstr[j],gdp)) {
+           rrd_set_error("Could not parse color in '%s'",&tmpstr[j]);
+           return 1;
+       }
+       dprintf("- parsed color 0x%08x\n",(unsigned int)gdp->col);
+       colorfound=1;
+    } else {
+       dprintf("- no color present in '%s'\n",tmpstr);
+    }
+
+    (*eaten) += i; /* after vname#color */
+    if (line[*eaten]!='\0') {
+       (*eaten)++;     /* after colon */
+    }
+
+    if (gdp->gf == GF_TICK) {
+       dprintf("- parsing '%s'\n",&line[*eaten]);
+       dprintf("- looking for optional TICK number\n");
+       j=0;
+       sscanf(&line[*eaten],"%lf%n",&gdp->yrule,&j);
+       if (j) {
+           if (line[*eaten+j]!='\0' && line[*eaten+j]!=':') {
+               rrd_set_error("Cannot parse TICK fraction '%s'",line);
+               return 1;
+           }
+           dprintf("- found number %f\n",gdp->yrule);
+           if (gdp->yrule > 1.0 || gdp->yrule < -1.0) {
+               rrd_set_error("Tick factor should be <= 1.0");
+               return 1;
+           }
+           (*eaten)+=j;
+       } else {
+            dprintf("- not found, defaulting to 0.1\n");
+            gdp->yrule=0.1;
+       }
+       if (line[*eaten] == '\0') {
+           dprintf("- done parsing line\n");
+           return 0;
+       } else { if (line[*eaten] == ':') {
+                   (*eaten)++;    
+                } else {
+                    rrd_set_error("Can't make sense of that TICK line");
+                  return 1;
+                 }
+        }
+    }
+
+    dprintf("- parsing '%s'\n",&line[*eaten]);
+
+    /* Legend is next.  A legend without a color is an error.
+    ** Stacking an item without having a legend is OK however
+    ** then an empty legend should be specified.
+    **   LINE:val#color:STACK  means legend is string "STACK"
+    **   LINE:val#color::STACK means no legend, and do STACK
+    **   LINE:val:STACK                is an error (legend but no color)
+    **   LINE:val::STACK       means no legend, and do STACK
+    */
+    if (colorfound) {
+       int err=0;
+        char *linecp = strdup(line);
+       dprintf("- looking for optional legend\n");
+       
+       dprintf("- examining '%s'\n",&line[*eaten]);
+       if (linecp[*eaten] != '\0' && linecp[*eaten] != ':') {
+           int spi;            
+           /* If the legend is not empty, it has to be prefixed with spacecnt ' ' characters. This then gets
+            * replaced by the color box later on. */
+           for (spi=0;spi<spacecnt && (*eaten) > 1;spi++){
+              linecp[--(*eaten)]=' ';
+           }
+       }
+
+       if (rrd_parse_legend(linecp, eaten, gdp)) err=1;
+       free(linecp);
+       if (err) return 1;
+
+       dprintf("- found legend '%s'\n", &gdp->legend[2]);
+    } else {
+       dprintf("- skipping empty legend\n");
+       if (line[*eaten] != '\0' && line[*eaten] != ':') {
+           rrd_set_error("Legend set but no color: %s",&line[*eaten]);
+           return 1;
+       }
+    }
+    if (line[*eaten]=='\0') {
+       dprintf("- done parsing line\n");
+       return 0;
+    }
+    (*eaten)++;        /* after colon */
+
+    /* PART, HRULE, VRULE and TICK cannot be stacked. */
+    if (   (gdp->gf == GF_HRULE)
+       || (gdp->gf == GF_VRULE)
+#ifdef WITH_PIECHART
+       || (gdp->gf == GF_PART)
+#endif
+       || (gdp->gf == GF_TICK)
+       ) return 0;
+
+    dprintf("- parsing '%s'\n",&line[*eaten]);
+    if (line[*eaten]!='\0') {
+       dprintf("- still more, should be STACK\n");
+       j=scan_for_col(&line[*eaten],5,tmpstr);
+       if (line[*eaten+j]!='\0' && line[*eaten+j]!=':') {
+           /* not 5 chars */
+           rrd_set_error("Garbage found where STACK expected");
+           return 1;
+       }
+       if (!strcmp("STACK",tmpstr)) {
+           dprintf("- found STACK\n");
+           gdp->stack=1;
+           (*eaten)+=j;
+       } else {
+           rrd_set_error("Garbage found where STACK expected");
+           return 1;
+       }
+    }
+    if (line[*eaten]=='\0') {
+       dprintf("- done parsing line\n");
+       return 0;
+    }
+    (*eaten)++;
+    dprintf("- parsing '%s'\n",&line[*eaten]);
+
+    return 0;
+}
+
+int
+rrd_parse_make_vname(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, image_desc_t *const im) {
+    char tmpstr[MAX_VNAME_LEN + 10];
+    int i=0;
+
+    sscanf(&line[*eaten], DEF_NAM_FMT "=%n", tmpstr,&i);
+    if (!i) {
+       rrd_set_error("Cannot parse vname from '%s'",line);
+       return 1;
+    }
+    dprintf("- found candidate '%s'\n",tmpstr);
+
+    if ((gdp->vidx=find_var(im,tmpstr))>=0) {
+       rrd_set_error("Attempting to reuse '%s'",im->gdes[gdp->vidx].vname);
+       return 1;
+    }
+    strcpy(gdp->vname,tmpstr);
+    dprintf("- created vname '%s' vidx %lu\n", gdp->vname,im->gdes_c-1);
+    (*eaten)+=i;
+    return 0;
+}
+
+int
+rrd_parse_def(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, image_desc_t *const im) {
+    int                        i=0;
+    char               command[7]; /* step, start, end, reduce */
+    char               tmpstr[256];
+    struct rrd_time_value      start_tv,end_tv;
+    time_t             start_tmp=0,end_tmp=0;
+    char               *parsetime_error=NULL;
+
+    start_tv.type   = end_tv.type=ABSOLUTE_TIME;
+    start_tv.offset = end_tv.offset=0;
+    localtime_r(&gdp->start, &start_tv.tm);
+    localtime_r(&gdp->end, &end_tv.tm);
+    
+    dprintf("- parsing '%s'\n",&line[*eaten]);
+    dprintf("- from line '%s'\n",line);
+
+    if (rrd_parse_make_vname(line,eaten,gdp,im)) return 1;
+    i=scan_for_col(&line[*eaten],sizeof(gdp->rrd)-1,gdp->rrd);
+    if (line[*eaten+i]!=':') {
+       rrd_set_error("Problems reading database name");
+       return 1;
+    }
+    (*eaten)+=++i;
+    dprintf("- using file '%s'\n",gdp->rrd);
+
+    i=0;
+    sscanf(&line[*eaten], DS_NAM_FMT ":%n", gdp->ds_nam,&i);
+    if (!i) {
+       rrd_set_error("Cannot parse DS in '%s'",line);
+       return 1;
+    }
+    (*eaten)+=i;
+    dprintf("- using DS '%s'\n",gdp->ds_nam);
+
+    if (rrd_parse_CF(line,eaten,gdp,&gdp->cf)) return 1;
+    gdp->cf_reduce = gdp->cf;
+    
+    if (line[*eaten]=='\0') return 0;
+
+    while (1) {
+       dprintf("- optional parameter follows: %s\n", &line[*eaten]);
+       i=0;
+       sscanf(&line[*eaten], "%6[a-z]=%n", command, &i);
+       if (!i) {
+           rrd_set_error("Parse error in '%s'",line);
+           return 1;
+       }
+       (*eaten)+=i;
+       dprintf("- processing '%s'\n",command);
+       if (!strcmp("reduce",command)) {
+         if (rrd_parse_CF(line,eaten,gdp,&gdp->cf_reduce)) return 1;
+         if (line[*eaten] != '\0')
+             (*eaten)--;
+       } else if (!strcmp("step",command)) {
+           i=0;
+           sscanf(&line[*eaten],"%lu%n",&gdp->step,&i);
+           gdp->step_orig = gdp->step;
+           (*eaten)+=i;
+           dprintf("- using step %lu\n",gdp->step);
+       } else if (!strcmp("start",command)) {
+           i=scan_for_col(&line[*eaten],255,tmpstr);
+           (*eaten)+=i;
+           if ((parsetime_error = parsetime(tmpstr, &start_tv))) {
+               rrd_set_error( "start time: %s", parsetime_error );
+               return 1;
+           }
+           dprintf("- done parsing:  '%s'\n",&line[*eaten]);
+       } else if (!strcmp("end",command)) {
+           i=scan_for_col(&line[*eaten],255,tmpstr);
+           (*eaten)+=i;
+           if ((parsetime_error = parsetime(tmpstr, &end_tv))) {
+               rrd_set_error( "end time: %s", parsetime_error );
+               return 1;
+           }
+           dprintf("- done parsing:  '%s'\n",&line[*eaten]);
+       } else {
+           rrd_set_error("Parse error in '%s'",line);
+           return 1;
+       }
+       if (line[*eaten]=='\0') break;
+       if (line[*eaten]!=':') {
+           dprintf("- Expected to see end of string but got '%s'\n",\
+                                                        &line[*eaten]);
+           rrd_set_error("Parse error in '%s'",line);
+           return 1;
+       }
+       (*eaten)++;
+    }
+    if (proc_start_end(&start_tv,&end_tv,&start_tmp,&end_tmp) == -1){
+       /* error string is set in parsetime.c */
+       return 1;
+    }
+    if (start_tmp < 3600*24*365*10) {
+       rrd_set_error("the first entry to fetch should be "
+                       "after 1980 (%ld)",start_tmp);
+       return 1;
+    }
+
+    if (end_tmp < start_tmp) {
+       rrd_set_error("start (%ld) should be less than end (%ld)",
+                       start_tmp, end_tmp);
+       return 1;
+    }
+
+    gdp->start = start_tmp;
+    gdp->end = end_tmp;
+    gdp->start_orig = start_tmp;
+    gdp->end_orig = end_tmp;
+
+    dprintf("- start time %lu\n",gdp->start);
+    dprintf("- end   time %lu\n",gdp->end);
+
+    return 0;
+}
+
+int
+rrd_parse_vdef(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, image_desc_t *const im) {
+    char tmpstr[MAX_VNAME_LEN+1];      /* vname\0 */
+    int i=0;
+
+    dprintf("- parsing '%s'\n",&line[*eaten]);
+    if (rrd_parse_make_vname(line,eaten,gdp,im)) return 1;
+
+    sscanf(&line[*eaten], DEF_NAM_FMT ",%n", tmpstr,&i);
+    if (!i) {
+       rrd_set_error("Cannot parse line '%s'",line);
+       return 1;
+    }
+    if ((gdp->vidx=find_var(im,tmpstr))<0) {
+       rrd_set_error("Not a valid vname: %s in line %s",tmpstr,line);
+       return 1;
+    }
+    if (   im->gdes[gdp->vidx].gf != GF_DEF
+       && im->gdes[gdp->vidx].gf != GF_CDEF) {
+       rrd_set_error("variable '%s' not DEF nor "
+                       "CDEF in VDEF '%s'", tmpstr,gdp->vname);
+       return 1;
+    }
+    dprintf("- found vname: '%s' vidx %li\n",tmpstr,gdp->vidx);
+    (*eaten)+=i;
+
+    dprintf("- calling vdef_parse with param '%s'\n",&line[*eaten]);
+    vdef_parse(gdp,&line[*eaten]);
+    while (line[*eaten]!='\0'&&line[*eaten]!=':')
+       (*eaten)++;
+
+    return 0;
+}
+
+int
+rrd_parse_cdef(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, image_desc_t *const im) {
+    dprintf("- parsing '%s'\n",&line[*eaten]);
+    if (rrd_parse_make_vname(line,eaten,gdp,im)) return 1;
+    if ((gdp->rpnp = rpn_parse(
+       (void *)im,
+       &line[*eaten],
+       &find_var_wrapper)
+    )==NULL) {
+       rrd_set_error("invalid rpn expression in: %s",&line[*eaten]);
+       return 1;
+    };
+    while (line[*eaten]!='\0'&&line[*eaten]!=':')
+       (*eaten)++;
+    return 0;
+}
+
+void
+rrd_graph_script(int argc, char *argv[], image_desc_t *const im, int optno) {
+    int i;
+    /* save state for STACK backward compat function */
+    enum gf_en     last_gf=GF_PRINT;
+    float          last_linewidth=0.0;
+
+    for (i=optind+optno;i<argc;i++) {
+       graph_desc_t *gdp;
+       unsigned int eaten=0;
+
+       if (gdes_alloc(im)) return; /* the error string is already set */
+       gdp = &im->gdes[im->gdes_c-1];
+#ifdef DEBUG
+       gdp->debug = 1;
+#endif
+
+       if (rrd_parse_find_gf(argv[i],&eaten,gdp)) return;
+        
+       switch (gdp->gf) {
+           case GF_SHIFT:      /* vname:value */
+               if (rrd_parse_shift(argv[i],&eaten,gdp,im)) return;
+               break;
+           case GF_XPORT:
+               if (rrd_parse_xport(argv[i],&eaten,gdp,im)) return;
+               break;
+           case GF_PRINT:      /* vname:CF:format -or- vname:format */
+               im->prt_c++;            
+           case GF_GPRINT:     /* vname:CF:format -or- vname:format */
+               if (rrd_parse_print(argv[i],&eaten,gdp,im)) return;
+               break;
+            case GF_COMMENT:   /* text */
+               if (rrd_parse_legend(argv[i],&eaten,gdp)) return;
+               break;
+#ifdef WITH_PIECHART
+           case GF_PART:       /* value[#color[:legend]] */
+#endif
+           case GF_VRULE:      /* value#color[:legend] */
+           case GF_HRULE:      /* value#color[:legend] */
+           case GF_LINE:       /* vname-or-value[#color[:legend]][:STACK] */
+           case GF_AREA:       /* vname-or-value[#color[:legend]][:STACK] */
+           case GF_TICK:       /* vname#color[:num[:legend]] */
+               if (rrd_parse_PVHLAST(argv[i],&eaten,gdp,im))return;
+                last_gf = gdp->gf;
+                last_linewidth = gdp->linewidth;
+               break;
+           case GF_STACK:      /* vname-or-value[#color[:legend]] */           
+               if (rrd_parse_PVHLAST(argv[i],&eaten,gdp,im))return;
+                if (last_gf == GF_LINE || last_gf == GF_AREA){
+                   gdp->gf = last_gf;
+                   gdp->linewidth = last_linewidth;
+                } else {
+                   rrd_set_error("STACK must follow LINE or AREA! command:\n%s",
+                        &argv[i][eaten],argv[i]);
+                   return;
+                }
+               break;
+       /* data acquisition */
+           case GF_DEF:        /* vname=x:DS:CF:[:step=#][:start=#][:end=#] */
+               if (rrd_parse_def(argv[i],&eaten,gdp,im)) return;
+               break;
+           case GF_CDEF:       /* vname=rpn-expression */
+               if (rrd_parse_cdef(argv[i],&eaten,gdp,im)) return;
+               break;
+           case GF_VDEF:       /* vname=rpn-expression */
+               if (rrd_parse_vdef(argv[i],&eaten,gdp,im)) return;
+               break;
+       }
+       if (gdp->debug) {
+           dprintf("used %i out of %i chars\n",eaten,strlen(argv[i]));
+           dprintf("parsed line: '%s'\n",argv[i]);
+           dprintf("remaining: '%s'\n",&argv[i][eaten]);
+           if (eaten >= strlen(argv[i]))
+               dprintf("Command finished successfully\n");
+       }
+       if (eaten < strlen(argv[i])) {
+           rrd_set_error("Garbage '%s' after command:\n%s",
+                       &argv[i][eaten],argv[i]);
+           return;
+       }
+    }
+}
diff --git a/src/rrd_hw.c b/src/rrd_hw.c
new file mode 100644 (file)
index 0000000..2641cdb
--- /dev/null
@@ -0,0 +1,843 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_hw.c : Support for Holt-Winters Smoothing/ Aberrant Behavior Detection
+ *****************************************************************************
+ * Initial version by Jake Brutlag, WebTV Networks, 5/1/00
+ *****************************************************************************/
+
+#include "rrd_tool.h"
+#include "rrd_hw.h"
+
+/* #define DEBUG */
+
+/* private functions */
+unsigned long MyMod(signed long val, unsigned long mod);
+int update_hwpredict(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx, 
+                 unsigned long ds_idx, unsigned short CDP_scratch_idx);
+int update_seasonal(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx, 
+                                unsigned long ds_idx, unsigned short CDP_scratch_idx, 
+                                rrd_value_t *seasonal_coef);
+int update_devpredict(rrd_t *rrd, unsigned long cdp_idx, 
+                                 unsigned long rra_idx, unsigned long ds_idx, unsigned short CDP_scratch_idx);
+int update_devseasonal(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx, 
+                      unsigned long ds_idx, unsigned short CDP_scratch_idx, 
+                                  rrd_value_t *seasonal_dev);
+int update_failures(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx, 
+                               unsigned long ds_idx, unsigned short CDP_scratch_idx);
+
+int
+update_hwpredict(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx, 
+                 unsigned long ds_idx, unsigned short CDP_scratch_idx)
+{
+   rrd_value_t prediction, seasonal_coef;
+   unsigned long dependent_rra_idx, seasonal_cdp_idx;
+   unival *coefs = rrd -> cdp_prep[cdp_idx].scratch;
+   rra_def_t *current_rra = &(rrd -> rra_def[rra_idx]);
+
+   /* save coefficients from current prediction */
+   coefs[CDP_hw_last_intercept].u_val = coefs[CDP_hw_intercept].u_val;
+   coefs[CDP_hw_last_slope].u_val = coefs[CDP_hw_slope].u_val;
+   coefs[CDP_last_null_count].u_cnt = coefs[CDP_null_count].u_cnt;
+
+   /* retrieve the current seasonal coef */
+   dependent_rra_idx = current_rra -> par[RRA_dependent_rra_idx].u_cnt;
+   seasonal_cdp_idx = dependent_rra_idx*(rrd -> stat_head -> ds_cnt) + ds_idx;
+   if (dependent_rra_idx < rra_idx)
+         seasonal_coef = rrd -> cdp_prep[seasonal_cdp_idx].scratch[CDP_hw_last_seasonal].u_val;
+   else
+         seasonal_coef = rrd -> cdp_prep[seasonal_cdp_idx].scratch[CDP_hw_seasonal].u_val;
+   
+   /* compute the prediction */
+   if (isnan(coefs[CDP_hw_intercept].u_val) || isnan(coefs[CDP_hw_slope].u_val)
+      || isnan(seasonal_coef))
+   {
+     prediction = DNAN;
+      
+     /* bootstrap initialization of slope and intercept */
+     if (isnan(coefs[CDP_hw_intercept].u_val) &&
+        !isnan(coefs[CDP_scratch_idx].u_val)) 
+     {
+#ifdef DEBUG
+       fprintf(stderr,"Initialization of slope/intercept\n");
+#endif
+       coefs[CDP_hw_intercept].u_val = coefs[CDP_scratch_idx].u_val;
+       coefs[CDP_hw_last_intercept].u_val = coefs[CDP_scratch_idx].u_val;
+       /* initialize the slope to 0 */
+       coefs[CDP_hw_slope].u_val = 0.0;
+       coefs[CDP_hw_last_slope].u_val = 0.0;
+       /* initialize null count to 1 */
+       coefs[CDP_null_count].u_cnt = 1;
+       coefs[CDP_last_null_count].u_cnt = 1;
+     }
+     /* if seasonal coefficient is NA, then don't update intercept, slope */
+   } else {
+     prediction = coefs[CDP_hw_intercept].u_val + 
+       (coefs[CDP_hw_slope].u_val)*(coefs[CDP_null_count].u_cnt)
+       + seasonal_coef;
+#ifdef DEBUG
+     fprintf(stderr,"computed prediction: %f\n",prediction);
+#endif
+     if (isnan(coefs[CDP_scratch_idx].u_val))
+     {
+       /* NA value, no updates of intercept, slope;
+           * increment the null count */
+       (coefs[CDP_null_count].u_cnt)++;
+     } else {
+#ifdef DEBUG
+       fprintf(stderr,"Updating intercept, slope\n");
+#endif
+       /* update the intercept */
+       coefs[CDP_hw_intercept].u_val = (current_rra -> par[RRA_hw_alpha].u_val)*
+               (coefs[CDP_scratch_idx].u_val - seasonal_coef) +
+               (1 - current_rra -> par[RRA_hw_alpha].u_val)*(coefs[CDP_hw_intercept].u_val
+               + (coefs[CDP_hw_slope].u_val)*(coefs[CDP_null_count].u_cnt));
+       /* update the slope */
+       coefs[CDP_hw_slope].u_val = (current_rra -> par[RRA_hw_beta].u_val)*
+               (coefs[CDP_hw_intercept].u_val - coefs[CDP_hw_last_intercept].u_val) +
+               (1 - current_rra -> par[RRA_hw_beta].u_val)*(coefs[CDP_hw_slope].u_val);
+       /* reset the null count */
+       coefs[CDP_null_count].u_cnt = 1;
+     }
+   }
+
+   /* store the prediction for writing */
+   coefs[CDP_scratch_idx].u_val = prediction;
+   return 0;
+}
+
+int
+lookup_seasonal(rrd_t *rrd, unsigned long rra_idx, unsigned long rra_start,
+                               FILE *rrd_file, unsigned long offset, rrd_value_t **seasonal_coef)
+{
+   unsigned long pos_tmp;
+   /* rra_ptr[].cur_row points to the rra row to be written; this function
+       * reads cur_row + offset */
+   unsigned long row_idx = rrd -> rra_ptr[rra_idx].cur_row + offset;
+   /* handle wrap around */
+   if (row_idx >= rrd -> rra_def[rra_idx].row_cnt)
+     row_idx = row_idx % (rrd -> rra_def[rra_idx].row_cnt);
+
+   /* rra_start points to the appropriate rra block in the file */
+   /* compute the pointer to the appropriate location in the file */
+   pos_tmp = rra_start + (row_idx)*(rrd -> stat_head -> ds_cnt)*sizeof(rrd_value_t);
+
+   /* allocate memory if need be */
+   if (*seasonal_coef == NULL)
+         *seasonal_coef = 
+            (rrd_value_t *) malloc((rrd -> stat_head -> ds_cnt)*sizeof(rrd_value_t));
+   if (*seasonal_coef == NULL) {
+         rrd_set_error("memory allocation failure: seasonal coef");
+         return -1;
+   }
+
+   if (!fseek(rrd_file,pos_tmp,SEEK_SET))
+   {
+      if (fread(*seasonal_coef,sizeof(rrd_value_t),rrd->stat_head->ds_cnt,rrd_file)
+                 == rrd -> stat_head -> ds_cnt)
+         {
+                /* success! */
+         /* we can safely ignore the rule requiring a seek operation between read
+          * and write, because this read moves the file pointer to somewhere
+          * in the file other than the next write location.
+          * */
+                return 0;
+         } else {
+            rrd_set_error("read operation failed in lookup_seasonal(): %lu\n",pos_tmp);
+         }
+   } else {
+         rrd_set_error("seek operation failed in lookup_seasonal(): %lu\n",pos_tmp);
+   }
+   
+   return -1;
+}
+
+int
+update_seasonal(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx, 
+                                unsigned long ds_idx, unsigned short CDP_scratch_idx, rrd_value_t *seasonal_coef)
+{
+/* TODO: extract common if subblocks in the wake of I/O optimization */
+   rrd_value_t intercept, seasonal;
+   rra_def_t *current_rra = &(rrd -> rra_def[rra_idx]);
+   rra_def_t *hw_rra = &(rrd -> rra_def[current_rra -> par[RRA_dependent_rra_idx].u_cnt]);
+   /* obtain cdp_prep index for HWPREDICT */
+   unsigned long hw_cdp_idx = (current_rra -> par[RRA_dependent_rra_idx].u_cnt)
+      * (rrd -> stat_head -> ds_cnt) + ds_idx;
+   unival *coefs = rrd -> cdp_prep[hw_cdp_idx].scratch;
+
+   /* update seasonal coefficient in cdp prep areas */
+   seasonal = rrd -> cdp_prep[cdp_idx].scratch[CDP_hw_seasonal].u_val;
+   rrd -> cdp_prep[cdp_idx].scratch[CDP_hw_last_seasonal].u_val = seasonal;
+   rrd -> cdp_prep[cdp_idx].scratch[CDP_hw_seasonal].u_val =
+         seasonal_coef[ds_idx];
+
+   /* update seasonal value for disk */
+   if (current_rra -> par[RRA_dependent_rra_idx].u_cnt < rra_idx)
+         /* associated HWPREDICT has already been updated */
+         /* check for possible NA values */
+      if (isnan(rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val))
+         {
+                /* no update, store the old value unchanged,
+                 * doesn't matter if it is NA */
+            rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = seasonal;
+         } else if (isnan(coefs[CDP_hw_last_intercept].u_val) 
+                    || isnan(coefs[CDP_hw_last_slope].u_val))
+         {
+                /* this should never happen, as HWPREDICT was already updated */
+                rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val= DNAN;
+         } else if (isnan(seasonal))
+         {
+                /* initialization: intercept is not currently being updated */
+#ifdef DEBUG
+                fprintf(stderr,"Initialization of seasonal coef %lu\n",
+                       rrd -> rra_ptr[rra_idx].cur_row);
+#endif
+                rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val 
+                       -= coefs[CDP_hw_last_intercept].u_val; 
+         } else {
+                intercept = coefs[CDP_hw_intercept].u_val;
+#ifdef DEBUG
+                fprintf(stderr,
+                       "Updating seasonal, params: gamma %f, new intercept %f, old seasonal %f\n",
+                       current_rra -> par[RRA_seasonal_gamma].u_val,
+                       intercept, seasonal);
+#endif
+                rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val =
+                       (current_rra -> par[RRA_seasonal_gamma].u_val)*
+                       (rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val - intercept) +
+                       (1 - current_rra -> par[RRA_seasonal_gamma].u_val)*seasonal;
+         }
+   else {
+         /* SEASONAL array is updated first, which means the new intercept
+          * hasn't be computed; so we compute it here. */
+
+         /* check for possible NA values */
+      if (isnan(rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val))
+         {
+                /* no update, simple store the old value unchanged,
+                 * doesn't matter if it is NA */
+                rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val =  seasonal;
+         } else if (isnan(coefs[CDP_hw_intercept].u_val) 
+                    || isnan(coefs[CDP_hw_slope].u_val))
+         {
+                /* Initialization of slope and intercept will occur.
+                 * force seasonal coefficient to 0. */
+                rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val= 0.0;
+         } else if (isnan(seasonal))
+         {
+                /* initialization: intercept will not be updated
+                 * CDP_hw_intercept = CDP_hw_last_intercept; just need to 
+                 * subtract this baseline value. */
+#ifdef DEBUG
+                fprintf(stderr,"Initialization of seasonal coef %lu\n",
+                       rrd -> rra_ptr[rra_idx].cur_row);
+#endif
+                rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val -= coefs[CDP_hw_intercept].u_val; 
+         } else {
+                /* Note that we must get CDP_scratch_idx from SEASONAL array, as CDP_scratch_idx
+                 * for HWPREDICT array will be DNAN. */
+            intercept = (hw_rra -> par[RRA_hw_alpha].u_val)*
+                   (rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val - seasonal)
+                   + (1 - hw_rra -> par[RRA_hw_alpha].u_val)*(coefs[CDP_hw_intercept].u_val
+                   + (coefs[CDP_hw_slope].u_val)*(coefs[CDP_null_count].u_cnt));
+                rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val =
+                  (current_rra -> par[RRA_seasonal_gamma].u_val)*
+                  (rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val - intercept) +
+                  (1 - current_rra -> par[RRA_seasonal_gamma].u_val)*seasonal;
+         }
+   }
+#ifdef DEBUG
+   fprintf(stderr,"seasonal coefficient set= %f\n",
+         rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val);
+#endif
+   return 0;
+}
+
+int
+update_devpredict(rrd_t *rrd, unsigned long cdp_idx, 
+                                 unsigned long rra_idx, unsigned long ds_idx, unsigned short CDP_scratch_idx)
+{
+   /* there really isn't any "update" here; the only reason this information
+    * is stored separately from DEVSEASONAL is to preserve deviation predictions
+    * for a longer duration than one seasonal cycle. */
+   unsigned long seasonal_cdp_idx = (rrd -> rra_def[rra_idx].par[RRA_dependent_rra_idx].u_cnt)
+      * (rrd -> stat_head -> ds_cnt) + ds_idx;
+
+   if (rrd -> rra_def[rra_idx].par[RRA_dependent_rra_idx].u_cnt < rra_idx)
+   {
+         /* associated DEVSEASONAL array already updated */
+         rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val
+                = rrd -> cdp_prep[seasonal_cdp_idx].scratch[CDP_last_seasonal_deviation].u_val;
+   } else {
+         /* associated DEVSEASONAL not yet updated */
+         rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val
+                = rrd -> cdp_prep[seasonal_cdp_idx].scratch[CDP_seasonal_deviation].u_val;
+   }
+   return 0;
+}
+
+int
+update_devseasonal(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx, 
+                      unsigned long ds_idx, unsigned short CDP_scratch_idx, 
+                                  rrd_value_t *seasonal_dev)
+{
+   rrd_value_t prediction = 0, seasonal_coef = DNAN;
+   rra_def_t *current_rra = &(rrd -> rra_def[rra_idx]);
+   /* obtain cdp_prep index for HWPREDICT */
+   unsigned long hw_rra_idx = current_rra -> par[RRA_dependent_rra_idx].u_cnt;
+   unsigned long hw_cdp_idx = hw_rra_idx * (rrd -> stat_head -> ds_cnt) + ds_idx;
+   unsigned long seasonal_cdp_idx;
+   unival *coefs = rrd -> cdp_prep[hw_cdp_idx].scratch;
+   rrd -> cdp_prep[cdp_idx].scratch[CDP_last_seasonal_deviation].u_val =
+         rrd -> cdp_prep[cdp_idx].scratch[CDP_seasonal_deviation].u_val;
+   /* retrieve the next seasonal deviation value, could be NA */
+   rrd -> cdp_prep[cdp_idx].scratch[CDP_seasonal_deviation].u_val =
+         seasonal_dev[ds_idx];
+
+   /* retrieve the current seasonal_coef (not to be confused with the
+       * current seasonal deviation). Could make this more readable by introducing
+       * some wrapper functions. */
+   seasonal_cdp_idx = (rrd -> rra_def[hw_rra_idx].par[RRA_dependent_rra_idx].u_cnt)
+         *(rrd -> stat_head -> ds_cnt) + ds_idx;
+   if (rrd -> rra_def[hw_rra_idx].par[RRA_dependent_rra_idx].u_cnt < rra_idx)
+         /* SEASONAL array already updated */
+         seasonal_coef = rrd -> cdp_prep[seasonal_cdp_idx].scratch[CDP_hw_last_seasonal].u_val;
+   else
+         /* SEASONAL array not yet updated */
+         seasonal_coef = rrd -> cdp_prep[seasonal_cdp_idx].scratch[CDP_hw_seasonal].u_val;
+   
+   /* compute the abs value of the difference between the prediction and
+       * observed value */
+   if (hw_rra_idx < rra_idx)
+   {
+         /* associated HWPREDICT has already been updated */
+         if (isnan(coefs[CDP_hw_last_intercept].u_val) ||
+             isnan(coefs[CDP_hw_last_slope].u_val) ||
+             isnan(seasonal_coef))
+         {
+                /* one of the prediction values is uinitialized */
+                rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = DNAN;
+                return 0;
+         } else {
+            prediction = coefs[CDP_hw_last_intercept].u_val + 
+                  (coefs[CDP_hw_last_slope].u_val)*(coefs[CDP_last_null_count].u_cnt)
+                  + seasonal_coef;
+         }
+   } else {
+         /* associated HWPREDICT has NOT been updated */
+         if (isnan(coefs[CDP_hw_intercept].u_val) ||
+             isnan(coefs[CDP_hw_slope].u_val) ||
+             isnan(seasonal_coef))
+         {
+                /* one of the prediction values is uinitialized */
+                rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = DNAN;
+                return 0;
+         } else {
+            prediction = coefs[CDP_hw_intercept].u_val + 
+                  (coefs[CDP_hw_slope].u_val)*(coefs[CDP_null_count].u_cnt) 
+                  + seasonal_coef;
+         }
+   }
+
+   if (isnan(rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val))
+   {
+      /* no update, store existing value unchanged, doesn't
+          * matter if it is NA */
+         rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val =
+                rrd -> cdp_prep[cdp_idx].scratch[CDP_last_seasonal_deviation].u_val;
+   } else if (isnan(rrd -> cdp_prep[cdp_idx].scratch[CDP_last_seasonal_deviation].u_val))
+   {
+         /* initialization */
+#ifdef DEBUG
+         fprintf(stderr,"Initialization of seasonal deviation\n");
+#endif
+         rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val =
+            fabs(prediction - rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val);
+   } else {
+         /* exponential smoothing update */
+         rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val =
+           (rrd -> rra_def[rra_idx].par[RRA_seasonal_gamma].u_val)*
+           fabs(prediction - rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val)
+           + (1 -  rrd -> rra_def[rra_idx].par[RRA_seasonal_gamma].u_val)*
+           (rrd -> cdp_prep[cdp_idx].scratch[CDP_last_seasonal_deviation].u_val);
+   }
+   return 0;
+}
+
+/* Check for a failure based on a threshold # of violations within the specified
+ * window. */
+int 
+update_failures(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx, 
+                               unsigned long ds_idx, unsigned short CDP_scratch_idx)
+{
+   /* detection of a violation depends on 3 RRAs:
+       * HWPREDICT, SEASONAL, and DEVSEASONAL */
+   rra_def_t *current_rra = &(rrd -> rra_def[rra_idx]);
+   unsigned long dev_rra_idx = current_rra -> par[RRA_dependent_rra_idx].u_cnt;
+   rra_def_t *dev_rra = &(rrd -> rra_def[dev_rra_idx]);
+   unsigned long hw_rra_idx = dev_rra -> par[RRA_dependent_rra_idx].u_cnt;
+   rra_def_t *hw_rra =  &(rrd -> rra_def[hw_rra_idx]);
+   unsigned long seasonal_rra_idx = hw_rra -> par[RRA_dependent_rra_idx].u_cnt;
+   unsigned long temp_cdp_idx;
+   rrd_value_t deviation = DNAN;
+   rrd_value_t seasonal_coef = DNAN;
+   rrd_value_t prediction = DNAN;
+   char violation = 0; 
+   unsigned short violation_cnt = 0, i;
+   char *violations_array;
+
+   /* usual checks to determine the order of the RRAs */
+   temp_cdp_idx = dev_rra_idx * (rrd -> stat_head -> ds_cnt) + ds_idx;
+   if (rra_idx < seasonal_rra_idx)
+   {
+         /* DEVSEASONAL not yet updated */
+         deviation = rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_seasonal_deviation].u_val;
+   } else {
+         /* DEVSEASONAL already updated */
+         deviation = rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_last_seasonal_deviation].u_val;
+   }
+   if (!isnan(deviation)) {
+
+   temp_cdp_idx = seasonal_rra_idx * (rrd -> stat_head -> ds_cnt) + ds_idx;
+   if (rra_idx < seasonal_rra_idx)
+   {
+         /* SEASONAL not yet updated */
+         seasonal_coef = rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_hw_seasonal].u_val;
+   } else {
+         /* SEASONAL already updated */
+         seasonal_coef = rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_hw_last_seasonal].u_val;
+   }
+   /* in this code block, we know seasonal coef is not DNAN, because deviation is not
+       * null */
+
+   temp_cdp_idx = hw_rra_idx * (rrd -> stat_head -> ds_cnt) + ds_idx;
+   if (rra_idx < hw_rra_idx)
+   {
+         /* HWPREDICT not yet updated */
+         prediction = rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_hw_intercept].u_val + 
+            (rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_hw_slope].u_val)
+                *(rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_null_count].u_cnt)
+                + seasonal_coef;
+   } else {
+         /* HWPREDICT already updated */
+         prediction = rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_hw_last_intercept].u_val + 
+            (rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_hw_last_slope].u_val)
+                *(rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_last_null_count].u_cnt)
+                + seasonal_coef;
+   }
+
+   /* determine if the observed value is a violation */
+   if (!isnan(rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val))
+   {
+         if (rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val > prediction + 
+                (current_rra -> par[RRA_delta_pos].u_val)*deviation
+            || rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val < prediction - 
+                (current_rra -> par[RRA_delta_neg].u_val)*deviation)
+                violation = 1;
+   } else {
+         violation = 1; /* count DNAN values as violations */
+   }
+
+   }
+
+   /* determine if a failure has occurred and update the failure array */
+   violation_cnt = violation;
+   violations_array = (char *) ((void *) rrd -> cdp_prep[cdp_idx].scratch);
+   for (i = current_rra -> par[RRA_window_len].u_cnt; i > 1; i--)
+   {
+         /* shift */
+         violations_array[i-1] = violations_array[i-2]; 
+         violation_cnt += violations_array[i-1];
+   }
+   violations_array[0] = violation;
+
+   if (violation_cnt < current_rra -> par[RRA_failure_threshold].u_cnt)
+         /* not a failure */
+         rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = 0.0;
+   else
+         rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = 1.0;
+
+   return (rrd-> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val);
+}
+
+/* For the specified CDP prep area and the FAILURES RRA,
+ * erase all history of past violations.
+ */
+void
+erase_violations(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx)
+{
+   unsigned short i;
+   char *violations_array;
+   /* check that rra_idx is a CF_FAILURES array */
+   if (cf_conv(rrd -> rra_def[rra_idx].cf_nam) != CF_FAILURES)
+   {
+#ifdef DEBUG
+         fprintf(stderr,"erase_violations called for non-FAILURES RRA: %s\n",
+            rrd -> rra_def[rra_idx].cf_nam);
+#endif
+         return;
+   }
+
+#ifdef DEBUG
+   fprintf(stderr,"scratch buffer before erase:\n");
+   for (i = 0; i < MAX_CDP_PAR_EN; i++)
+   {
+         fprintf(stderr,"%lu ", rrd -> cdp_prep[cdp_idx].scratch[i].u_cnt);
+   }
+   fprintf(stderr,"\n");
+#endif
+
+   /* WARNING: an array of longs on disk is treated as an array of chars
+    * in memory. */
+   violations_array = (char *) ((void *) rrd -> cdp_prep[cdp_idx].scratch);
+   /* erase everything in the part of the CDP scratch array that will be
+    * used to store violations for the current window */
+   for (i = rrd -> rra_def[rra_idx].par[RRA_window_len].u_cnt; i > 0; i--)
+   {
+         violations_array[i-1] = 0;
+   }
+#ifdef DEBUG
+   fprintf(stderr,"scratch buffer after erase:\n");
+   for (i = 0; i < MAX_CDP_PAR_EN; i++)
+   {
+         fprintf(stderr,"%lu ", rrd -> cdp_prep[cdp_idx].scratch[i].u_cnt);
+   }
+   fprintf(stderr,"\n");
+#endif
+}
+
+/* Smooth a periodic array with a moving average: equal weights and
+ * length = 5% of the period. */
+int
+apply_smoother(rrd_t *rrd, unsigned long rra_idx, unsigned long rra_start,
+               FILE *rrd_file)
+{
+   unsigned long i, j, k;
+   unsigned long totalbytes;
+   rrd_value_t *rrd_values;
+   unsigned long row_length = rrd -> stat_head -> ds_cnt;
+   unsigned long row_count = rrd -> rra_def[rra_idx].row_cnt;
+   unsigned long offset;
+   FIFOqueue **buffers;
+   rrd_value_t *working_average;
+   rrd_value_t *baseline;
+
+   offset = floor(0.025*row_count);
+   if (offset == 0) return 0; /* no smoothing */
+
+   /* allocate memory */
+   totalbytes = sizeof(rrd_value_t)*row_length*row_count;
+   rrd_values = (rrd_value_t *) malloc(totalbytes);
+   if (rrd_values == NULL)
+   {
+         rrd_set_error("apply smoother: memory allocation failure");
+         return -1;
+   }
+
+   /* rra_start is at the beginning of this rra */
+   if (fseek(rrd_file,rra_start,SEEK_SET))
+   {
+         rrd_set_error("seek to rra %d failed", rra_start);
+         free(rrd_values);
+         return -1;
+   }
+   fflush(rrd_file);
+   /* could read all data in a single block, but we need to
+    * check for NA values */
+   for (i = 0; i < row_count; ++i)
+   {
+         for (j = 0; j < row_length; ++j)
+         {
+                fread(&(rrd_values[i*row_length + j]),sizeof(rrd_value_t),1,rrd_file);
+                /* should check fread for errors... */
+                if (isnan(rrd_values[i*row_length + j])) {
+                       /* can't apply smoothing, still uninitialized values */
+#ifdef DEBUG
+                       fprintf(stderr,"apply_smoother: NA detected in seasonal array: %ld %ld\n",i,j);
+#endif
+                       free(rrd_values);
+                       return 0;
+                }
+         }
+   }
+
+   /* allocate queues, one for each data source */
+   buffers = (FIFOqueue **) malloc(sizeof(FIFOqueue *)*row_length);
+   for (i = 0; i < row_length; ++i)
+   {
+      queue_alloc(&(buffers[i]),2*offset + 1);
+   }
+   /* need working average initialized to 0 */
+   working_average = (rrd_value_t *) calloc(row_length,sizeof(rrd_value_t));
+   baseline = (rrd_value_t *) calloc(row_length,sizeof(rrd_value_t));
+
+   /* compute sums of the first 2*offset terms */ 
+   for (i = 0; i < 2*offset; ++i)
+   {
+         k = MyMod(i - offset,row_count);
+         for (j = 0; j < row_length; ++j)
+         {
+                queue_push(buffers[j],rrd_values[k*row_length + j]);
+                working_average[j] += rrd_values[k*row_length + j];
+         }
+   }
+
+   /* compute moving averages */
+   for (i = offset; i < row_count + offset; ++i)
+   {
+         for (j = 0; j < row_length; ++j)
+         {
+            k = MyMod(i,row_count);
+            /* add a term to the sum */
+            working_average[j] += rrd_values[k*row_length + j];
+            queue_push(buffers[j],rrd_values[k*row_length + j]);
+
+            /* reset k to be the center of the window */
+            k = MyMod(i - offset,row_count);
+            /* overwrite rdd_values entry, the old value is already
+             * saved in buffers */
+            rrd_values[k*row_length + j] = working_average[j]/(2*offset + 1);
+            baseline[j] += rrd_values[k*row_length + j];
+
+            /* remove a term from the sum */
+            working_average[j] -= queue_pop(buffers[j]);
+         }     
+   } 
+   for (i = 0; i < row_length; ++i)
+   {
+         queue_dealloc(buffers[i]);
+         baseline[i] /= row_count; 
+   }
+   free(buffers);
+   free(working_average);
+
+   if (cf_conv(rrd->rra_def[rra_idx].cf_nam) == CF_SEASONAL) {
+   for (j = 0; j < row_length; ++j)
+   {
+   for (i = 0; i < row_count; ++i)
+   {
+        rrd_values[i*row_length + j] -= baseline[j];
+   }
+        /* update the baseline coefficient,
+         * first, compute the cdp_index. */
+        offset = (rrd->rra_def[rra_idx].par[RRA_dependent_rra_idx].u_cnt)
+         * row_length + j;
+        (rrd->cdp_prep[offset]).scratch[CDP_hw_intercept].u_val += baseline[j];
+   }
+   /* flush cdp to disk */
+   fflush(rrd_file);
+   if (fseek(rrd_file,sizeof(stat_head_t) + 
+         rrd->stat_head->ds_cnt * sizeof(ds_def_t) +
+         rrd->stat_head->rra_cnt * sizeof(rra_def_t) + 
+         sizeof(live_head_t) +
+         rrd->stat_head->ds_cnt * sizeof(pdp_prep_t),SEEK_SET))
+   {
+         rrd_set_error("apply_smoother: seek to cdp_prep failed");
+         free(rrd_values);
+         return -1;
+   }
+   if (fwrite( rrd -> cdp_prep,
+         sizeof(cdp_prep_t),
+         (rrd->stat_head->rra_cnt) * rrd->stat_head->ds_cnt, rrd_file) 
+         != (rrd->stat_head->rra_cnt) * (rrd->stat_head->ds_cnt) )
+   { 
+         rrd_set_error("apply_smoother: cdp_prep write failed");
+         free(rrd_values);
+         return -1;
+   }
+   } /* endif CF_SEASONAL */ 
+
+   /* flush updated values to disk */
+   fflush(rrd_file);
+   if (fseek(rrd_file,rra_start,SEEK_SET))
+   {
+         rrd_set_error("apply_smoother: seek to pos %d failed", rra_start);
+         free(rrd_values);
+         return -1;
+   }
+   /* write as a single block */
+   if (fwrite(rrd_values,sizeof(rrd_value_t),row_length*row_count,rrd_file)
+         != row_length*row_count)
+   {
+         rrd_set_error("apply_smoother: write failed to %lu",rra_start);
+         free(rrd_values);
+         return -1;
+   }
+
+   fflush(rrd_file);
+   free(rrd_values);
+   free(baseline);
+   return 0;
+}
+
+/* Reset aberrant behavior model coefficients, including intercept, slope,
+ * seasonal, and seasonal deviation for the specified data source. */
+void
+reset_aberrant_coefficients(rrd_t *rrd, FILE *rrd_file, unsigned long ds_idx)
+{
+   unsigned long cdp_idx, rra_idx, i;
+   unsigned long cdp_start, rra_start;
+   rrd_value_t nan_buffer = DNAN;
+
+   /* compute the offset for the cdp area */
+   cdp_start = sizeof(stat_head_t) + 
+         rrd->stat_head->ds_cnt * sizeof(ds_def_t) +
+         rrd->stat_head->rra_cnt * sizeof(rra_def_t) + 
+         sizeof(live_head_t) +
+         rrd->stat_head->ds_cnt * sizeof(pdp_prep_t);
+   /* compute the offset for the first rra */
+   rra_start = cdp_start + 
+         (rrd->stat_head->ds_cnt) * (rrd->stat_head->rra_cnt) * sizeof(cdp_prep_t) +
+         rrd->stat_head->rra_cnt * sizeof(rra_ptr_t);
+
+   /* loop over the RRAs */
+   for (rra_idx = 0; rra_idx < rrd -> stat_head -> rra_cnt; rra_idx++)
+   {
+         cdp_idx = rra_idx * (rrd-> stat_head-> ds_cnt) + ds_idx;
+         switch (cf_conv(rrd -> rra_def[rra_idx].cf_nam))
+         {
+                case CF_HWPREDICT:
+               init_hwpredict_cdp(&(rrd -> cdp_prep[cdp_idx]));
+                       break;
+                case CF_SEASONAL:
+                case CF_DEVSEASONAL:
+                       /* don't use init_seasonal because it will reset burn-in, which
+                        * means different data sources will be calling for the smoother
+                        * at different times. */
+               rrd->cdp_prep[cdp_idx].scratch[CDP_hw_seasonal].u_val = DNAN;
+               rrd->cdp_prep[cdp_idx].scratch[CDP_hw_last_seasonal].u_val = DNAN;
+                       /* move to first entry of data source for this rra */
+                       fseek(rrd_file,rra_start + ds_idx * sizeof(rrd_value_t),SEEK_SET);
+                       /* entries for the same data source are not contiguous, 
+                        * temporal entries are contiguous */
+               for (i = 0; i < rrd->rra_def[rra_idx].row_cnt; ++i)
+                       {
+                          if (fwrite(&nan_buffer,sizeof(rrd_value_t),1,rrd_file) != 1)
+                          {
+                  rrd_set_error(
+                                 "reset_aberrant_coefficients: write failed data source %lu rra %s",
+                                 ds_idx,rrd->rra_def[rra_idx].cf_nam);
+                                 return;
+                          } 
+                          fseek(rrd_file,(rrd->stat_head->ds_cnt - 1) * 
+                                 sizeof(rrd_value_t),SEEK_CUR);
+                       }
+                       break;
+                case CF_FAILURES:
+                       erase_violations(rrd,cdp_idx,rra_idx);
+                       break;
+                default:
+                       break;
+         }
+         /* move offset to the next rra */
+         rra_start += rrd->rra_def[rra_idx].row_cnt * rrd->stat_head->ds_cnt * 
+                sizeof(rrd_value_t);
+   }
+   fseek(rrd_file,cdp_start,SEEK_SET);
+   if (fwrite( rrd -> cdp_prep,
+         sizeof(cdp_prep_t),
+         (rrd->stat_head->rra_cnt) * rrd->stat_head->ds_cnt, rrd_file) 
+         != (rrd->stat_head->rra_cnt) * (rrd->stat_head->ds_cnt) )
+   {
+         rrd_set_error("reset_aberrant_coefficients: cdp_prep write failed");
+         return;
+   }
+}
+
+void init_hwpredict_cdp(cdp_prep_t *cdp)
+{
+   cdp->scratch[CDP_hw_intercept].u_val = DNAN;
+   cdp->scratch[CDP_hw_last_intercept].u_val = DNAN;
+   cdp->scratch[CDP_hw_slope].u_val = DNAN;
+   cdp->scratch[CDP_hw_last_slope].u_val = DNAN;
+   cdp->scratch[CDP_null_count].u_cnt = 1;
+   cdp->scratch[CDP_last_null_count].u_cnt = 1;
+}
+
+void init_seasonal_cdp(cdp_prep_t *cdp)
+{
+   cdp->scratch[CDP_hw_seasonal].u_val = DNAN;
+   cdp->scratch[CDP_hw_last_seasonal].u_val = DNAN;
+   cdp->scratch[CDP_init_seasonal].u_cnt = 1;
+}
+
+int
+update_aberrant_CF(rrd_t *rrd, rrd_value_t pdp_val, enum cf_en current_cf, 
+                 unsigned long cdp_idx, unsigned long rra_idx, unsigned long ds_idx, 
+                 unsigned short CDP_scratch_idx, rrd_value_t *seasonal_coef)
+{
+   rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = pdp_val;
+   switch (current_cf) {
+   case CF_AVERAGE:
+   default:
+        return 0;
+   case CF_HWPREDICT:
+     return update_hwpredict(rrd,cdp_idx,rra_idx,ds_idx,CDP_scratch_idx);
+   case CF_DEVPREDICT:
+        return update_devpredict(rrd,cdp_idx,rra_idx,ds_idx,CDP_scratch_idx);
+   case CF_SEASONAL:
+     return update_seasonal(rrd,cdp_idx,rra_idx,ds_idx,CDP_scratch_idx,seasonal_coef);
+   case CF_DEVSEASONAL:
+     return update_devseasonal(rrd,cdp_idx,rra_idx,ds_idx,CDP_scratch_idx,seasonal_coef);
+   case CF_FAILURES:
+     return update_failures(rrd,cdp_idx,rra_idx,ds_idx,CDP_scratch_idx);
+   }
+   return -1;
+}
+
+unsigned long MyMod(signed long val, unsigned long mod)
+{
+   unsigned long new_val;
+   if (val < 0)
+     new_val = ((unsigned long) abs(val)) % mod;
+   else
+     new_val = (val % mod);
+   
+   if (val < 0) 
+     return (mod - new_val);
+   else
+     return (new_val);
+}
+
+/* a standard fixed-capacity FIF0 queue implementation
+ * No overflow checking is performed. */
+int queue_alloc(FIFOqueue **q,int capacity)
+{
+   *q = (FIFOqueue *) malloc(sizeof(FIFOqueue));
+   if (*q == NULL) return -1;
+   (*q) -> queue = (rrd_value_t *) malloc(sizeof(rrd_value_t)*capacity);
+   if ((*q) -> queue == NULL)
+   {
+         free(*q);
+         return -1;
+   }
+   (*q) -> capacity = capacity;
+   (*q) -> head = capacity;
+   (*q) -> tail = 0;
+   return 0;
+}
+
+int queue_isempty(FIFOqueue *q)
+{
+   return (q -> head % q -> capacity == q -> tail);
+}
+
+void queue_push(FIFOqueue *q, rrd_value_t value)
+{
+   q -> queue[(q -> tail)++] = value;
+   q -> tail = q -> tail % q -> capacity;
+}
+
+rrd_value_t queue_pop(FIFOqueue *q)
+{
+   q -> head = q -> head % q -> capacity;
+   return q -> queue[(q -> head)++];
+}
+
+void queue_dealloc(FIFOqueue *q)
+{
+   free(q -> queue);
+   free(q);
+}
diff --git a/src/rrd_hw.h b/src/rrd_hw.h
new file mode 100644 (file)
index 0000000..df2ca5e
--- /dev/null
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_hw.h : Support for Holt-Winters Smoothing/ Aberrant Behavior Detection
+ *****************************************************************************/
+
+/* functions implemented in rrd_hw.c */
+int update_aberrant_CF(rrd_t *rrd, rrd_value_t pdp_val, enum cf_en current_cf,
+   unsigned long cdp_idx, unsigned long rra_idx, unsigned long ds_idx,
+   unsigned short CDP_scratch_idx, rrd_value_t *seasonal_coef);
+int create_hw_contingent_rras(rrd_t *rrd, unsigned short period, 
+   unsigned long hashed_name);
+int lookup_seasonal(rrd_t *rrd, unsigned long rra_idx, unsigned long rra_start,
+   FILE *rrd_file, unsigned long offset, rrd_value_t **seasonal_coef);
+void erase_violations(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx);
+int apply_smoother(rrd_t *rrd, unsigned long rra_idx, unsigned long rra_start,
+   FILE *rrd_file);
+void reset_aberrant_coefficients(rrd_t *rrd, FILE *rrd_file, unsigned long ds_idx);
+void init_hwpredict_cdp(cdp_prep_t *);
+void init_seasonal_cdp(cdp_prep_t *);
+#define BURNIN_CYCLES 3
+
+/* a standard fixed-capacity FIFO queue implementation */
+typedef struct FIFOqueue {
+   rrd_value_t *queue;
+   int capacity, head, tail;
+} FIFOqueue;
+
+int queue_alloc(FIFOqueue **q,int capacity);
+void queue_dealloc(FIFOqueue *q);
+void queue_push(FIFOqueue *q, rrd_value_t value);
+int queue_isempty(FIFOqueue *q);
+rrd_value_t queue_pop(FIFOqueue *q);
diff --git a/src/rrd_info.c b/src/rrd_info.c
new file mode 100644 (file)
index 0000000..02e7bff
--- /dev/null
@@ -0,0 +1,238 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_info  Get Information about the configuration of an RRD
+ *****************************************************************************/
+
+#include "rrd_tool.h"
+#include "rrd_rpncalc.h"
+#include <stdarg.h>
+
+/* proto */
+info_t *rrd_info(int, char **);
+info_t *rrd_info_r(char *filename);
+
+/* allocate memory for string */
+char *
+sprintf_alloc(char *fmt, ...) {
+#ifdef HAVE_VSNPRINTF    
+    int maxlen = 50;
+#else
+    int maxlen = 1000;
+#endif
+    char *str = NULL;
+    va_list argp;
+    str = malloc(sizeof(char)*(strlen(fmt)+maxlen));
+    if (str != NULL) {
+       va_start(argp, fmt);
+#ifdef HAVE_VSNPRINTF
+       vsnprintf(str, maxlen-1, fmt, argp);
+#else
+       vsprintf(str, fmt, argp);
+#endif
+    }
+    va_end(argp);
+    return str;
+}
+/* the function formerly known as push was renamed info_push because
+ * it is now used outside the scope of this file */
+info_t 
+*info_push(info_t *info, char *key, enum info_type type, infoval value){
+    info_t *next;
+    next = malloc(sizeof(*next));
+    next->next = (info_t *) 0;
+    if( info )
+       info->next = next;
+    next->type = type;
+    next->key  = key;
+    switch (type) {
+    case RD_I_VAL:
+       next->value.u_val = value.u_val;
+       break;
+    case RD_I_CNT:
+       next->value.u_cnt = value.u_cnt;
+       break;
+    case RD_I_INT:
+       next->value.u_int = value.u_int;
+       break;
+    case RD_I_STR:
+       next->value.u_str = malloc(sizeof(char)*(strlen(value.u_str)+1));
+       strcpy(next->value.u_str,value.u_str);
+       break;
+    }
+    return(next);
+}
+
+
+info_t *
+rrd_info(int argc, char **argv) {   
+    info_t             *info;
+
+    if(argc < 2){
+        rrd_set_error("please specify an rrd");
+        return NULL;
+    }
+
+    info = rrd_info_r(argv[1]);
+
+    return(info);
+}
+
+
+  
+info_t *
+rrd_info_r(char *filename) {   
+    unsigned int i,ii=0;
+    FILE         *in_file;
+    rrd_t        rrd;
+    info_t       *data,*cd;
+    infoval      info;
+       enum cf_en   current_cf;
+       enum dst_en  current_ds;
+
+    if(rrd_open(filename,&in_file,&rrd, RRD_READONLY)==-1){
+       return(NULL);
+    }
+    fclose(in_file);
+
+    info.u_str=filename;
+    cd=info_push(NULL,sprintf_alloc("filename"),    RD_I_STR, info);
+    data=cd;
+
+    info.u_str=rrd.stat_head->version;
+    cd=info_push(cd,sprintf_alloc("rrd_version"),    RD_I_STR, info);
+
+    info.u_cnt=rrd.stat_head->pdp_step;
+    cd=info_push(cd,sprintf_alloc("step"),       RD_I_CNT, info);
+
+    info.u_cnt=rrd.live_head->last_up;
+    cd=info_push(cd,sprintf_alloc("last_update"), RD_I_CNT, info);
+
+    for(i=0;i<rrd.stat_head->ds_cnt;i++){
+
+       info.u_str=rrd.ds_def[i].dst;
+       cd=info_push(cd,sprintf_alloc("ds[%s].type",             rrd.ds_def[i].ds_nam), RD_I_STR, info);
+  
+       current_ds = dst_conv(rrd.ds_def[i].dst);
+    switch (current_ds) {
+          case DST_CDEF:
+                 {
+                 char *buffer = NULL;
+                 rpn_compact2str((rpn_cdefds_t *) &(rrd.ds_def[i].par[DS_cdef]),
+                        rrd.ds_def, &buffer);
+                 info.u_str = buffer;
+                 cd=info_push(cd,sprintf_alloc("ds[%s].cdef",rrd.ds_def[i].ds_nam),RD_I_STR,info);
+                 free(buffer);
+                 }
+                 break;
+          default:
+          info.u_cnt=rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt;
+          cd=info_push(cd,sprintf_alloc("ds[%s].minimal_heartbeat",rrd.ds_def[i].ds_nam), RD_I_CNT, info);
+
+          info.u_val=rrd.ds_def[i].par[DS_min_val].u_val;
+          cd=info_push(cd,sprintf_alloc("ds[%s].min",rrd.ds_def[i].ds_nam), RD_I_VAL, info);
+       
+          info.u_val=rrd.ds_def[i].par[DS_max_val].u_val;
+          cd=info_push(cd,sprintf_alloc("ds[%s].max",rrd.ds_def[i].ds_nam), RD_I_VAL, info);
+          break;
+       }
+       
+       info.u_str=rrd.pdp_prep[i].last_ds;
+       cd=info_push(cd,sprintf_alloc("ds[%s].last_ds",          rrd.ds_def[i].ds_nam), RD_I_STR, info);
+
+       info.u_val=rrd.pdp_prep[i].scratch[PDP_val].u_val;
+        cd=info_push(cd,sprintf_alloc("ds[%s].value",            rrd.ds_def[i].ds_nam), RD_I_VAL, info);
+
+       info.u_cnt=rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt;
+       cd=info_push(cd,sprintf_alloc("ds[%s].unknown_sec",      rrd.ds_def[i].ds_nam), RD_I_CNT, info);
+    }
+
+    for(i=0;i<rrd.stat_head->rra_cnt;i++){
+       info.u_str=rrd.rra_def[i].cf_nam;
+       cd=info_push(cd,sprintf_alloc("rra[%d].cf",         i),  RD_I_STR,   info);
+       current_cf = cf_conv(rrd.rra_def[i].cf_nam);
+
+       info.u_cnt=rrd.rra_def[i].row_cnt;
+       cd=info_push(cd,sprintf_alloc("rra[%d].rows",i),  RD_I_CNT,   info);
+
+       info.u_cnt=rrd.rra_def[i].pdp_cnt;
+       cd=info_push(cd,sprintf_alloc("rra[%d].pdp_per_row",i),  RD_I_CNT,   info);
+
+       switch(current_cf)
+       {
+          case CF_HWPREDICT:
+                 info.u_val=rrd.rra_def[i].par[RRA_hw_alpha].u_val;
+                 cd=info_push(cd,sprintf_alloc("rra[%d].alpha",i),RD_I_VAL,info);
+                 info.u_val=rrd.rra_def[i].par[RRA_hw_beta].u_val;
+                 cd=info_push(cd,sprintf_alloc("rra[%d].beta",i),RD_I_VAL,info);
+                 break;
+          case CF_SEASONAL:
+          case CF_DEVSEASONAL:
+                 info.u_val=rrd.rra_def[i].par[RRA_seasonal_gamma].u_val;
+                 cd=info_push(cd,sprintf_alloc("rra[%d].gamma",i),RD_I_VAL,info);
+                 break;
+          case CF_FAILURES:
+                 info.u_val=rrd.rra_def[i].par[RRA_delta_pos].u_val;
+                 cd=info_push(cd,sprintf_alloc("rra[%d].delta_pos",i),RD_I_VAL,info);
+                 info.u_val=rrd.rra_def[i].par[RRA_delta_neg].u_val;
+                 cd=info_push(cd,sprintf_alloc("rra[%d].delta_neg",i),RD_I_VAL,info);
+                 info.u_cnt=rrd.rra_def[i].par[RRA_failure_threshold].u_cnt;
+                 cd=info_push(cd,sprintf_alloc("rra[%d].failure_threshold",i),RD_I_CNT,info);
+                 info.u_cnt=rrd.rra_def[i].par[RRA_window_len].u_cnt;
+                 cd=info_push(cd,sprintf_alloc("rra[%d].window_length",i),RD_I_CNT,info);
+                 break;
+          case CF_DEVPREDICT:
+                 break;
+          default:
+                 info.u_val=rrd.rra_def[i].par[RRA_cdp_xff_val].u_val;
+                 cd=info_push(cd,sprintf_alloc("rra[%d].xff",i),RD_I_VAL,info);
+                 break;
+       }
+
+       for(ii=0;ii<rrd.stat_head->ds_cnt;ii++){
+        switch(current_cf)
+               {
+               case CF_HWPREDICT:
+           info.u_val=rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_hw_intercept].u_val;
+           cd=info_push(cd,sprintf_alloc("rra[%d].cdp_prep[%d].intercept",i,ii), RD_I_VAL, info);
+           info.u_val=rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_hw_slope].u_val;
+           cd=info_push(cd,sprintf_alloc("rra[%d].cdp_prep[%d].slope",i,ii), RD_I_VAL, info);
+           info.u_cnt=rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_null_count].u_cnt;
+           cd=info_push(cd,sprintf_alloc("rra[%d].cdp_prep[%d].NaN_count",i,ii), RD_I_CNT, info);
+                  break;
+               case CF_SEASONAL:
+           info.u_val=rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_hw_seasonal].u_val;
+           cd=info_push(cd,sprintf_alloc("rra[%d].cdp_prep[%d].seasonal",i,ii), RD_I_VAL, info);
+                  break;
+               case CF_DEVSEASONAL:
+           info.u_val=rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_seasonal_deviation].u_val;
+           cd=info_push(cd,sprintf_alloc("rra[%d].cdp_prep[%d].deviation",i,ii), RD_I_VAL, info);
+                  break;
+               case CF_DEVPREDICT:
+                  break;
+               case CF_FAILURES:
+                  {
+                         unsigned short j;
+                         char *violations_array;
+                         char history[MAX_FAILURES_WINDOW_LEN+1];
+                         violations_array = (char*) rrd.cdp_prep[i*rrd.stat_head->ds_cnt +ii].scratch;
+                         for (j = 0; j < rrd.rra_def[i].par[RRA_window_len].u_cnt; ++j)
+                                history[j] = (violations_array[j] == 1) ? '1' : '0';
+                     history[j] = '\0';
+                     info.u_str = history;
+                         cd=info_push(cd,sprintf_alloc("rra[%d].cdp_prep[%d].history",i,ii), RD_I_STR, info);
+                  }
+                  break;
+               default:
+           info.u_val=rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_val].u_val;
+           cd=info_push(cd,sprintf_alloc("rra[%d].cdp_prep[%d].value",i,ii), RD_I_VAL, info);
+           info.u_cnt=rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_unkn_pdp_cnt].u_cnt;
+           cd=info_push(cd,sprintf_alloc("rra[%d].cdp_prep[%d].unknown_datapoints",i,ii), RD_I_CNT, info);
+                  break;
+        }
+    }
+       }
+       rrd_free(&rrd);
+    return(data);
+
+}
diff --git a/src/rrd_is_thread_safe.h b/src/rrd_is_thread_safe.h
new file mode 100644 (file)
index 0000000..5fff45d
--- /dev/null
@@ -0,0 +1,29 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ * This file:     Copyright 2003 Peter Stamfest <peter@stamfest.at> 
+ *                             & Tobias Oetiker
+ * Distributed under the GPL
+ *****************************************************************************
+ * rrd_is_thread_safe.c   Poisons some nasty function calls using GNU cpp
+ *****************************************************************************
+ * $Id: rrd_is_thread_safe.h 1235 2007-11-20 00:15:07Z oetiker $
+ *************************************************************************** */
+
+#ifndef _RRD_IS_THREAD_SAFE_H
+#define _RRD_IS_THREAD_SAFE_H
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+#undef strerror
+
+#if( 2 < __GNUC__ )
+#pragma GCC poison strtok asctime ctime gmtime localtime tmpnam strerror
+#endif
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif /*_RRD_IS_THREAD_SAFE_H */
diff --git a/src/rrd_last.c b/src/rrd_last.c
new file mode 100644 (file)
index 0000000..3697aca
--- /dev/null
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_last.c
+ *****************************************************************************
+ * Initial version by Russ Wright, @Home Network, 9/28/98
+ *****************************************************************************/
+
+#include "rrd_tool.h"
+
+time_t
+rrd_last(int argc, char **argv)
+{
+    if(argc < 2){
+        rrd_set_error("please specify an rrd");
+        return(-1);
+    }
+
+    return( rrd_last_r(argv[1]) );
+}
+
+time_t
+rrd_last_r(const char *filename)
+{
+    FILE       *in_file;
+    time_t       lastup;
+
+    rrd_t       rrd;
+
+    if(rrd_open(filename, &in_file, &rrd, RRD_READONLY)==-1){
+        return(-1);
+    }
+    lastup = rrd.live_head->last_up;
+    rrd_free(&rrd);
+    fclose(in_file);
+    return(lastup);
+}
+
+
diff --git a/src/rrd_lastupdate.c b/src/rrd_lastupdate.c
new file mode 100644 (file)
index 0000000..dad2c7a
--- /dev/null
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_lastupdate  Get the last datum entered for each DS
+ *****************************************************************************/
+
+#include "rrd_tool.h"
+#include "rrd_rpncalc.h"
+#include <stdarg.h>
+
+int
+rrd_lastupdate(int argc, char **argv, time_t *last_update,
+                 unsigned long *ds_cnt, char ***ds_namv, char ***last_ds) {
+    unsigned long i=0;
+    char        *filename;
+    FILE         *in_file;
+    rrd_t        rrd;
+
+    if(argc < 2){
+        rrd_set_error("please specify an rrd");
+        return -1;
+    }
+    filename = argv[1];
+
+    if(rrd_open(filename,&in_file,&rrd, RRD_READONLY)==-1){
+       return(-1);
+    }
+    fclose(in_file);
+
+    *last_update=rrd.live_head->last_up;
+    *ds_cnt = rrd.stat_head->ds_cnt;
+    if (((*ds_namv) =
+               (char **) malloc(rrd.stat_head->ds_cnt * sizeof(char*)))==NULL){
+        rrd_set_error("malloc fetch ds_namv array");
+       rrd_free(&rrd);
+       return(-1);
+    } 
+
+    if (((*last_ds) =
+               (char **) malloc(rrd.stat_head->ds_cnt * sizeof(char*)))==NULL){
+        rrd_set_error("malloc fetch last_ds array");
+       rrd_free(&rrd);
+       free(*ds_namv);
+       return(-1);
+    } 
+
+    for(i=0;i<rrd.stat_head->ds_cnt;i++){
+       (*ds_namv)[i] = sprintf_alloc("%s", rrd.ds_def[i].ds_nam);
+       (*last_ds)[i] = sprintf_alloc("%s", rrd.pdp_prep[i].last_ds);
+    }
+
+    rrd_free(&rrd);
+    return(0); 
+}
diff --git a/src/rrd_nan_inf.c b/src/rrd_nan_inf.c
new file mode 100644 (file)
index 0000000..2a5ac14
--- /dev/null
@@ -0,0 +1,32 @@
+#include "rrd_nan_inf.h"
+
+int done_nan = 0;
+int done_inf = 0;
+
+double dnan;
+double dinf;
+
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+#include <math.h>
+
+#define NAN_FUNC (double)fmod(0.0,0.0)
+#define INF_FUNC (double)fabs((double)log(0.0))
+
+#else
+
+#define NAN_FUNC (double)(0.0/0.0)
+#define INF_FUNC (double)(1.0/0.0)
+
+#endif
+
+double set_to_DNAN(void)
+{
+  if ( !done_nan ) { dnan = NAN_FUNC; done_nan = 1; }
+  return dnan;
+}
+
+double set_to_DINF(void)
+{
+  if ( !done_inf ) { dinf = INF_FUNC; done_inf = 1; }
+  return dinf;
+}
diff --git a/src/rrd_nan_inf.h b/src/rrd_nan_inf.h
new file mode 100644 (file)
index 0000000..7934fdb
--- /dev/null
@@ -0,0 +1,5 @@
+#define DNAN          set_to_DNAN()
+#define DINF          set_to_DINF()
+
+double set_to_DNAN(void);
+double set_to_DINF(void);
diff --git a/src/rrd_not_thread_safe.c b/src/rrd_not_thread_safe.c
new file mode 100644 (file)
index 0000000..7504d6e
--- /dev/null
@@ -0,0 +1,47 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ * This file:     Copyright 2003 Peter Stamfest <peter@stamfest.at> 
+ *                             & Tobias Oetiker
+ * Distributed under the GPL
+ *****************************************************************************
+ * rrd_not_thread_safe.c   Contains routines used when thread safety is not
+ *                         an issue
+ *****************************************************************************
+ * $Id: rrd_not_thread_safe.c 1235 2007-11-20 00:15:07Z oetiker $
+ *************************************************************************** */
+#include "rrd.h"
+#include "rrd_tool.h"
+#define MAXLEN 4096
+#define ERRBUFLEN 256
+
+static char rrd_error[MAXLEN+10];
+static char rrd_liberror[ERRBUFLEN+10];
+static int  rrd_context_init = 0;
+/* The global context is very useful in the transition period to even
+   more thread-safe stuff, it can be used whereever we need a context
+   and do not need to worry about concurrency. */
+static struct rrd_context global_ctx = {
+    MAXLEN,
+    ERRBUFLEN,
+    rrd_error, 
+    rrd_liberror
+};
+/* #include <stdarg.h> */
+
+struct rrd_context *rrd_get_context(void) {
+    if (! rrd_context_init ){
+       rrd_context_init = 1;
+        global_ctx.rrd_error[0]='\0';
+        global_ctx.lib_errstr[0]='\0';
+    }
+    return &global_ctx;
+}
+
+/* how ugly that is!!! - make sure strerror is what it should be. It
+   might be redefined to help in keeping other modules thread safe by
+   silently turning misplaced strerror into rrd_strerror, but here
+   this turns recursive! */
+#undef strerror
+const char *rrd_strerror(int err) {
+    return strerror(err);
+}
diff --git a/src/rrd_open.c b/src/rrd_open.c
new file mode 100644 (file)
index 0000000..418e5fe
--- /dev/null
@@ -0,0 +1,258 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_open.c  Open an RRD File
+ *****************************************************************************
+ * $Id: rrd_open.c 1235 2007-11-20 00:15:07Z oetiker $
+ * $Log$
+ * Revision 1.10  2004/05/26 22:11:12  oetiker
+ * reduce compiler warnings. Many small fixes. -- Mike Slifcak <slif@bellsouth.net>
+ *
+ * Revision 1.9  2003/04/29 21:56:49  oetiker
+ * readline in rrd_open.c reads the file in 8 KB blocks, and calls realloc for
+ * each block. realloc is very slow in Mac OS X for huge blocks, e.g. when
+ * restoring databases from huge xml files. This patch finds the size of the
+ * file, and starts out with malloc'ing the full size.
+ * -- Peter Speck <speck@ruc.dk>
+ *
+ * Revision 1.8  2003/04/11 19:43:44  oetiker
+ * New special value COUNT which allows calculations based on the position of a
+ * value within a data set. Bug fix in rrd_rpncalc.c. PREV returned erroneus
+ * value for the second value. Bug fix in rrd_restore.c. Bug causing seek error
+ * when accesing an RRD restored from an xml that holds an RRD version <3.
+ * --  Ruben Justo <ruben@ainek.com>
+ *
+ * Revision 1.7  2003/03/31 21:22:12  oetiker
+ * enables RRDtool updates with microsecond or in case of windows millisecond
+ * precision. This is needed to reduce time measurement error when archive step
+ * is small. (<30s) --  Sasha Mikheev <sasha@avalon-net.co.il>
+ *
+ * Revision 1.6  2003/02/13 07:05:27  oetiker
+ * Find attached the patch I promised to send to you. Please note that there
+ * are three new source files (src/rrd_is_thread_safe.h, src/rrd_thread_safe.c
+ * and src/rrd_not_thread_safe.c) and the introduction of librrd_th. This
+ * library is identical to librrd, but it contains support code for per-thread
+ * global variables currently used for error information only. This is similar
+ * to how errno per-thread variables are implemented.  librrd_th must be linked
+ * alongside of libpthred
+ *
+ * There is also a new file "THREADS", holding some documentation.
+ *
+ * -- Peter Stamfest <peter@stamfest.at>
+ *
+ * Revision 1.5  2002/06/20 00:21:03  jake
+ * More Win32 build changes; thanks to Kerry Calvert.
+ *
+ * Revision 1.4  2002/02/01 20:34:49  oetiker
+ * fixed version number and date/time
+ *
+ * Revision 1.3  2001/03/04 13:01:55  oetiker
+ * Aberrant Behavior Detection support. A brief overview added to rrdtool.pod.
+ * Major updates to rrd_update.c, rrd_create.c. Minor update to other core files.
+ * This is backwards compatible! But new files using the Aberrant stuff are not readable
+ * by old rrdtool versions. See http://cricket.sourceforge.net/aberrant/rrd_hw.htm
+ * -- Jake Brutlag <jakeb@corp.webtv.net>
+ *
+ * Revision 1.2  2001/03/04 10:29:20  oetiker
+ * fixed filedescriptor leak
+ * -- Mike Franusich <mike@franusich.com>
+ *
+ * Revision 1.1.1.1  2001/02/25 22:25:05  oetiker
+ * checkin
+ *
+ *****************************************************************************/
+
+#include "rrd_tool.h"
+#define MEMBLK 8192
+
+/* open a database file, return its header and a open filehandle */
+/* positioned to the first cdp in the first rra */
+
+int
+rrd_open(const char *file_name, FILE **in_file, rrd_t *rrd, int rdwr)    
+{
+
+    
+    char *mode = NULL;
+    int version;
+    
+    rrd_init(rrd);
+    if (rdwr == RRD_READONLY) {
+        mode = "rb";
+    } else {
+        mode = "rb+";
+    }
+    
+    if (((*in_file) = fopen(file_name,mode)) == NULL ){
+        rrd_set_error("opening '%s': %s",file_name, rrd_strerror(errno));
+        return (-1);
+    }
+
+#ifdef HAVE_POSIX_FADVISE
+    /* In general we need no read-ahead when dealing with rrd_files.
+       When we stop reading, it is highly unlikely that we start up again.
+       In this manner we actually save time and diskaccess (and buffer cache).
+       Thanks to Dave Plonka for the Idea of using POSIX_FADV_RANDOM here. */       
+    /* if (0 != posix_fadvise(fileno(*in_file), 0, 0, POSIX_FADV_RANDOM)) {
+        rrd_set_error("setting POSIX_FADV_RANDOM on '%s': %s",file_name, rrd_strerror(errno));
+        fclose(*in_file);
+        return(-1); */
+
+        /* if it does not work, then this is sad, but we should not quit */
+     posix_fadvise(fileno(*in_file), 0, 0, POSIX_FADV_RANDOM);
+        
+     /*     }     */
+#endif
+
+/*
+        if (rdwr == RRD_READWRITE)
+        {
+           if (setvbuf((*in_file),NULL,_IONBF,2)) {
+                  rrd_set_error("failed to disable the stream buffer\n");
+                  return (-1);
+           }
+        }
+*/
+    
+#define MYFREAD(MYVAR,MYVART,MYCNT) \
+    if ((MYVAR = malloc(sizeof(MYVART) * MYCNT)) == NULL) {\
+        rrd_set_error("" #MYVAR " malloc"); \
+        fclose(*in_file); \
+        return (-1); } \
+    fread(MYVAR,sizeof(MYVART),MYCNT, *in_file); 
+
+
+    MYFREAD(rrd->stat_head, stat_head_t,  1)
+    /* lets see if the first read worked */
+    if (ferror( *in_file ) || feof(*in_file)) {
+        rrd_set_error("reading the cookie off %s faild",file_name);
+        fclose(*in_file);
+        return(-1);
+    }        
+
+        /* lets do some test if we are on track ... */
+        if (strncmp(rrd->stat_head->cookie,RRD_COOKIE,4) != 0){
+            rrd_set_error("'%s' is not an RRD file",file_name);
+            free(rrd->stat_head);
+            rrd->stat_head = NULL; 
+            fclose(*in_file);
+            return(-1);}
+
+        if (rrd->stat_head->float_cookie != FLOAT_COOKIE){
+            rrd_set_error("This RRD was created on other architecture");
+            free(rrd->stat_head);
+            rrd->stat_head = NULL; 
+            fclose(*in_file);
+            return(-1);}
+
+    version = atoi(rrd->stat_head->version);
+
+        if (version > atoi(RRD_VERSION)){
+            rrd_set_error("can't handle RRD file version %s",
+                        rrd->stat_head->version);
+            free(rrd->stat_head);
+            rrd->stat_head = NULL; 
+            fclose(*in_file);
+            return(-1);}
+
+
+    MYFREAD(rrd->ds_def,    ds_def_t,     rrd->stat_head->ds_cnt)
+    MYFREAD(rrd->rra_def,   rra_def_t,    rrd->stat_head->rra_cnt)
+    /* handle different format for the live_head */
+    if(version < 3) {
+            rrd->live_head = (live_head_t *)malloc(sizeof(live_head_t));
+            if(rrd->live_head == NULL) {
+                rrd_set_error("live_head_t malloc");
+                fclose(*in_file); 
+                return (-1);
+            }
+                fread(&rrd->live_head->last_up, sizeof(long), 1, *in_file); 
+                rrd->live_head->last_up_usec = 0;
+    }
+    else {
+            MYFREAD(rrd->live_head, live_head_t, 1)
+    }
+    MYFREAD(rrd->pdp_prep,  pdp_prep_t,   rrd->stat_head->ds_cnt)
+    MYFREAD(rrd->cdp_prep,  cdp_prep_t,   (rrd->stat_head->rra_cnt
+                                             * rrd->stat_head->ds_cnt))
+    MYFREAD(rrd->rra_ptr,   rra_ptr_t,    rrd->stat_head->rra_cnt)
+#undef MYFREAD
+
+    return(0);
+}
+
+void rrd_init(rrd_t *rrd)
+{
+    rrd->stat_head = NULL;
+    rrd->ds_def = NULL;
+    rrd->rra_def = NULL;
+    rrd->live_head = NULL;
+    rrd->rra_ptr = NULL;
+    rrd->pdp_prep = NULL;
+    rrd->cdp_prep = NULL;
+    rrd->rrd_value = NULL;
+}
+
+void rrd_free(rrd_t *rrd)
+{
+    if (rrd->stat_head) free(rrd->stat_head);
+    if (rrd->ds_def) free(rrd->ds_def);
+    if (rrd->rra_def) free(rrd->rra_def);
+    if (rrd->live_head) free(rrd->live_head);
+    if (rrd->rra_ptr) free(rrd->rra_ptr);
+    if (rrd->pdp_prep) free(rrd->pdp_prep);
+    if (rrd->cdp_prep) free(rrd->cdp_prep);
+    if (rrd->rrd_value) free(rrd->rrd_value);
+}
+
+/* routine used by external libraries to free memory allocated by
+ * rrd library */
+void rrd_freemem(void *mem)
+{
+
+    if (mem) free(mem);
+}
+
+int readfile(const char *file_name, char **buffer, int skipfirst){
+    long writecnt=0,totalcnt = MEMBLK;
+     long offset = 0;
+    FILE *input=NULL;
+    char c ;
+    if ((strcmp("-",file_name) == 0)) { input = stdin; }
+    else {
+      if ((input = fopen(file_name,"rb")) == NULL ){
+        rrd_set_error("opening '%s': %s",file_name,rrd_strerror(errno));
+        return (-1);
+      }
+    }
+    if (skipfirst){
+      do { c = getc(input); offset++; } while (c != '\n' && ! feof(input));
+    }
+    if (strcmp("-",file_name)) {
+      fseek(input, 0, SEEK_END);
+      /* have extra space for detecting EOF without realloc */
+      totalcnt = (ftell(input) + 1) / sizeof(char) - offset;
+      if (totalcnt < MEMBLK)
+        totalcnt = MEMBLK; /* sanitize */
+      fseek(input, offset * sizeof(char), SEEK_SET);
+    }
+    if (((*buffer) = (char *) malloc((totalcnt+4) * sizeof(char))) == NULL) {
+        perror("Allocate Buffer:");
+        exit(1);
+    };
+    do{
+      writecnt += fread((*buffer)+writecnt, 1, (totalcnt - writecnt) * sizeof(char),input);
+      if (writecnt >= totalcnt){
+        totalcnt += MEMBLK;
+        if (((*buffer)=rrd_realloc((*buffer), (totalcnt+4) * sizeof(char)))==NULL){
+            perror("Realloc Buffer:");
+            exit(1);
+        };
+      }
+    } while (! feof(input));
+    (*buffer)[writecnt] = '\0';
+    if (strcmp("-",file_name) != 0) {fclose(input);};
+    return writecnt;
+}
+
+
diff --git a/src/rrd_resize.c b/src/rrd_resize.c
new file mode 100644 (file)
index 0000000..7219953
--- /dev/null
@@ -0,0 +1,205 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_resize.c Alters size of an RRA
+ *****************************************************************************
+ * Initial version by Alex van den Bogaerdt
+ *****************************************************************************/
+
+#include "rrd_tool.h"
+
+int
+rrd_resize(int argc, char **argv)
+{
+    char               *infilename,outfilename[11]="resize.rrd";
+    FILE               *infile,*outfile;
+    rrd_t              rrdold,rrdnew;
+    rrd_value_t                buffer;
+    int                        version;
+    unsigned long      l,rra;
+    long               modify;
+    unsigned long      target_rra;
+    int                        grow=0,shrink=0;
+    char               *endptr;
+
+    infilename=argv[1];
+    if (!strcmp(infilename,"resize.rrd")) {
+        rrd_set_error("resize.rrd is a reserved name");
+        return(-1);
+    }
+    if (argc!=5) {
+        rrd_set_error("wrong number of parameters");
+        return(-1);
+    }
+
+    target_rra=strtol(argv[2],&endptr,0);
+
+    if (!strcmp(argv[3],"GROW")) grow=1;
+    else if (!strcmp(argv[3],"SHRINK")) shrink=1;
+    else {
+        rrd_set_error("I can only GROW or SHRINK");
+        return(-1);
+    }
+
+    modify=strtol(argv[4],&endptr,0);
+
+    if ((modify<1)) {
+        rrd_set_error("Please grow or shrink with at least 1 row");
+        return(-1);
+    }
+
+    if (shrink) modify = -modify;
+
+
+    if (rrd_open(infilename, &infile, &rrdold, RRD_READWRITE)==-1) {
+        rrd_set_error("could not open RRD");
+        return(-1);
+    }
+    if (LockRRD(infile) != 0) {
+        rrd_set_error("could not lock original RRD");
+        rrd_free(&rrdold);
+        fclose(infile);
+        return(-1);
+    }
+
+    if (target_rra >= rrdold.stat_head->rra_cnt) {
+        rrd_set_error("no such RRA in this RRD");
+        rrd_free(&rrdold);
+        fclose(infile);
+        return(-1);
+    }
+
+    if (modify < 0)
+       if ((long)rrdold.rra_def[target_rra].row_cnt <= -modify) {
+           rrd_set_error("This RRA is not that big");
+           rrd_free(&rrdold);
+           fclose(infile);
+           return(-1);
+       }
+
+    rrdnew.stat_head = rrdold.stat_head;
+    rrdnew.ds_def    = rrdold.ds_def;
+    rrdnew.rra_def   = rrdold.rra_def;
+    rrdnew.live_head = rrdold.live_head;
+    rrdnew.pdp_prep  = rrdold.pdp_prep;
+    rrdnew.cdp_prep  = rrdold.cdp_prep;
+    rrdnew.rra_ptr   = rrdold.rra_ptr;
+
+    version = atoi(rrdold.stat_head->version);
+    switch (version) {
+       case 3: break;
+       case 1: rrdold.stat_head->version[3]='3';
+               break;
+       default: {
+               rrd_set_error("Do not know how to handle RRD version %s",rrdold.stat_head->version);
+               rrd_free(&rrdold);      
+               fclose(infile);
+               return(-1);
+               }
+    }
+
+    if ((outfile=fopen(outfilename,"wb"))==NULL) {
+        rrd_set_error("Can't create '%s'",outfilename);
+        return(-1);
+    }
+    if (LockRRD(outfile) != 0) {
+        rrd_set_error("could not lock new RRD");
+        rrd_free(&rrdold);
+        fclose(infile);
+        fclose(outfile);
+        return(-1);
+    }
+    fwrite(rrdnew.stat_head, sizeof(stat_head_t),1,outfile);
+    fwrite(rrdnew.ds_def,sizeof(ds_def_t),rrdnew.stat_head->ds_cnt,outfile);
+    fwrite(rrdnew.rra_def,sizeof(rra_def_t),rrdnew.stat_head->rra_cnt,outfile);
+    fwrite(rrdnew.live_head,sizeof(live_head_t),1,outfile);
+    fwrite(rrdnew.pdp_prep,sizeof(pdp_prep_t),rrdnew.stat_head->ds_cnt,outfile);
+    fwrite(rrdnew.cdp_prep,sizeof(cdp_prep_t),rrdnew.stat_head->ds_cnt*rrdnew.stat_head->rra_cnt,outfile);
+    fwrite(rrdnew.rra_ptr,sizeof(rra_ptr_t),rrdnew.stat_head->rra_cnt,outfile);
+
+    /* Move the CDPs from the old to the new database.
+    ** This can be made (much) faster but isn't worth the effort. Clarity
+    ** is much more important.
+    */
+
+    /* Move data in unmodified RRAs
+    */
+    l=0;
+    for (rra=0;rra<target_rra;rra++) {
+        l+=rrdnew.stat_head->ds_cnt * rrdnew.rra_def[rra].row_cnt;
+    }
+    while (l>0) {
+        fread(&buffer,sizeof(rrd_value_t),1,infile);
+        fwrite(&buffer,sizeof(rrd_value_t),1,outfile);
+        l--;
+    }
+    /* Move data in this RRA, either removing or adding some rows
+    */
+    if (modify>0) {
+        /* Adding extra rows; insert unknown values just after the
+        ** current row number.
+        */
+        l = rrdnew.stat_head->ds_cnt * (rrdnew.rra_ptr[target_rra].cur_row+1);
+        while (l>0) {
+            fread(&buffer,sizeof(rrd_value_t),1,infile);
+            fwrite(&buffer,sizeof(rrd_value_t),1,outfile);
+            l--;
+        }
+        buffer=DNAN;
+        l=rrdnew.stat_head->ds_cnt * modify;
+        while (l>0) {
+            fwrite(&buffer,sizeof(rrd_value_t),1,outfile);
+            l--;
+        }
+    } else {
+        /* Removing rows. Normally this would be just after the cursor
+        ** however this may also mean that we wrap to the beginning of
+        ** the array.
+        */
+        signed long int remove_end=0;
+
+        remove_end=(rrdnew.rra_ptr[target_rra].cur_row-modify)%rrdnew.rra_def[target_rra].row_cnt;
+        if (remove_end <= (signed long int)rrdnew.rra_ptr[target_rra].cur_row) {
+            while (remove_end >= 0) {
+                fseek(infile,sizeof(rrd_value_t)*rrdnew.stat_head->ds_cnt,SEEK_CUR);
+                rrdnew.rra_ptr[target_rra].cur_row--;
+                rrdnew.rra_def[target_rra].row_cnt--;
+                remove_end--;
+                modify++;
+            }
+            remove_end=rrdnew.rra_def[target_rra].row_cnt-1;
+        }
+        for (l=0;l<=rrdnew.rra_ptr[target_rra].cur_row;l++) {
+            unsigned int tmp;
+            for (tmp=0;tmp<rrdnew.stat_head->ds_cnt;tmp++) {
+                fread(&buffer,sizeof(rrd_value_t),1,infile);
+                fwrite(&buffer,sizeof(rrd_value_t),1,outfile);
+            }
+        }
+        while (modify<0) {
+            fseek(infile,sizeof(rrd_value_t)*rrdnew.stat_head->ds_cnt,SEEK_CUR);
+            rrdnew.rra_def[target_rra].row_cnt--;
+            modify++;
+        }
+    }
+    /* Move the rest of the CDPs
+    */
+    while (1) {
+       fread(&buffer,sizeof(rrd_value_t),1,infile);
+       if (feof(infile))
+           break;
+        fwrite(&buffer,sizeof(rrd_value_t),1,outfile);
+    }
+    rrdnew.rra_def[target_rra].row_cnt += modify;
+    fseek(outfile,sizeof(stat_head_t)+sizeof(ds_def_t)*rrdnew.stat_head->ds_cnt,SEEK_SET);
+    fwrite(rrdnew.rra_def,sizeof(rra_def_t),rrdnew.stat_head->rra_cnt, outfile);
+    fseek(outfile,sizeof(live_head_t),SEEK_CUR);
+    fseek(outfile,sizeof(pdp_prep_t)*rrdnew.stat_head->ds_cnt,SEEK_CUR);
+    fseek(outfile,sizeof(cdp_prep_t)*rrdnew.stat_head->ds_cnt*rrdnew.stat_head->rra_cnt,SEEK_CUR);
+    fwrite(rrdnew.rra_ptr,sizeof(rra_ptr_t),rrdnew.stat_head->rra_cnt, outfile);
+    
+    fclose(outfile);
+    rrd_free(&rrdold);
+    fclose(infile);
+    return(0);
+}
diff --git a/src/rrd_restore.c b/src/rrd_restore.c
new file mode 100644 (file)
index 0000000..9c5c1c6
--- /dev/null
@@ -0,0 +1,652 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_restore.c  creates new rrd from data dumped by rrd_dump.c
+ *****************************************************************************/
+
+#include "rrd_tool.h"
+#include "rrd_rpncalc.h"
+#include <fcntl.h>
+
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+#include <io.h>
+#define open _open
+#define close _close
+#endif
+
+/* Prototypes */
+
+void xml_lc(char*);
+int skip(char **);
+int skipxml(char **);
+int eat_tag(char **, char *);
+int read_tag(char **, char *, char *, void *);
+int xml2rrd(char*, rrd_t*, char);
+int rrd_write(char *, rrd_t *, char);
+void parse_patch1028_RRA_params(char **buf, rrd_t *rrd, int rra_index);
+void parse_patch1028_CDP_params(char **buf, rrd_t *rrd, int rra_index, int ds_index);
+void parse_FAILURES_history(char **buf, rrd_t *rrd, int rra_index, int ds_index);
+
+/* convert all occurrences of <BlaBlaBla> to <blablabla> */
+
+void xml_lc(char* buf){
+  int intag=0;
+  while((*buf)){
+    if (intag ==0 && (*buf) == '<') {
+      intag = 1;
+    }
+    else if (intag ==1 && (*buf) == '>') {
+      intag = 0;
+      continue;
+    } else  if (intag ==1) {
+      *buf = tolower(*buf);
+    }
+    buf++;    
+  }
+}
+
+int skipxml(char **buf){
+  char *ptr;  
+  ptr=(*buf);
+  do {
+    (*buf)=ptr;
+    while((*(ptr+1)) && ((*ptr)==' ' ||  (*ptr)=='\r' || (*ptr)=='\n' || (*ptr)=='\t')) ptr++;
+    if (strncmp(ptr,"<?xml",4) == 0) {
+      ptr= strstr(ptr,"?>");
+      if (ptr) ptr+=2; else {
+       rrd_set_error("Dangling XML header");
+       (*buf) = NULL;
+       return -1;
+      }
+    }
+  } while ((*buf)!=ptr);  
+  return 1;
+}
+
+int skip(char **buf){
+  char *ptr;
+  if ((buf == NULL) || (*buf == NULL))
+    return -1;  
+  ptr=(*buf);
+  do {
+    (*buf)=ptr;
+    while((*(ptr+1)) && ((*ptr)==' ' ||  (*ptr)=='\r' || (*ptr)=='\n' || (*ptr)=='\t')) ptr++;
+    if (strncmp(ptr,"<!--",4) == 0) {
+      ptr= strstr(ptr,"-->");
+      if (ptr) ptr+=3; else {
+       rrd_set_error("Dangling Comment");
+       (*buf) = NULL;
+       return -1;
+      }
+    }
+  } while ((*buf)!=ptr);  
+  return 1;
+}
+
+int eat_tag(char **buf, char *tag){ 
+  if ((*buf)==NULL) return -1;   /* fall though clause */
+
+  rrd_clear_error();
+  skip(buf);
+  if ((**buf)=='<' 
+      && strncmp((*buf)+1,tag,strlen(tag)) == 0 
+      && *((*buf)+strlen(tag)+1)=='>') {
+    (*buf) += strlen(tag)+2;
+  }
+  else {
+    rrd_set_error("No <%s> tag found",tag);
+    (*buf) = NULL;
+    return -1;
+  }
+  skip(buf);
+  return 1;
+}
+
+int read_tag(char **buf, char *tag, char *format, void *value){
+    char *end_tag;
+    int matches;
+    if ((*buf)==NULL) return -1;   /* fall though clause */
+    rrd_clear_error();
+    if (eat_tag(buf,tag)==1){
+       char *temp;
+       temp = (*buf);
+       while(*((*buf)+1) && (*(*buf) != '<')) (*buf)++; /*find start of endtag*/
+       *(*buf) = '\0';
+       matches =sscanf(temp,format,value);
+       *(*buf) = '<';
+       end_tag = malloc((strlen(tag)+2)*sizeof(char));
+       sprintf(end_tag,"/%s",tag);
+       eat_tag(buf,end_tag);
+       free(end_tag);
+       if (matches == 0 && strcmp(format,"%lf") == 0)
+           (*((double* )(value))) = DNAN;
+       if (matches != 1)       return 0;       
+       return 1;
+    }
+    return -1;
+}
+
+
+/* parse the data stored in buf and return a filled rrd structure */
+int xml2rrd(char* buf, rrd_t* rrd, char rc){
+  /* pass 1 identify number of RRAs  */
+  char *ptr,*ptr2,*ptr3; /* walks thought the buffer */
+  long rows=0,mempool=0,i=0;
+  int rra_index;
+  int input_version;
+  xml_lc(buf); /* lets lowercase all active parts of the xml */
+  ptr=buf;
+  ptr2=buf;
+  ptr3=buf;
+  /* start with an RRD tag */
+  
+  skipxml(&ptr);
+
+  eat_tag(&ptr,"rrd");
+  /* allocate static header */
+  if((rrd->stat_head = calloc(1,sizeof(stat_head_t)))==NULL){
+    rrd_set_error("allocating rrd.stat_head");
+    return -1;    
+  };
+
+  strcpy(rrd->stat_head->cookie,RRD_COOKIE);
+  read_tag(&ptr,"version","%4[0-9]",rrd->stat_head->version);
+  input_version = atoi(rrd->stat_head->version);
+  /* added primitive version checking */
+  if (input_version > atoi(RRD_VERSION) || input_version < 1)
+  {
+    rrd_set_error("Incompatible file version, detected version %s. This is not supported by the version %s restore tool.\n",
+                 rrd -> stat_head -> version, RRD_VERSION );
+    free(rrd -> stat_head); 
+    rrd->stat_head = NULL; 
+    return -1;
+  }
+  /* make sure we output the right version */
+  strcpy(rrd->stat_head->version,RRD_VERSION);
+
+  /*  if (atoi(rrd -> stat_head -> version) < 2) 
+  {
+    rrd_set_error("Can only restore version >= 2 (Not %s). Dump your old rrd using a current rrdtool dump.",  rrd -> stat_head -> version );
+    return -1;
+  } */
+
+  rrd->stat_head->float_cookie = FLOAT_COOKIE;
+  rrd->stat_head->ds_cnt = 0;
+  rrd->stat_head->rra_cnt = 0;
+  read_tag(&ptr,"step","%lu",&(rrd->stat_head->pdp_step));
+
+  /* allocate live head */
+  if((rrd->live_head = calloc(1,sizeof(live_head_t)))==NULL){
+    rrd_set_error("allocating rrd.live_head");
+    return -1;    
+  }
+  read_tag(&ptr,"lastupdate","%lu",&(rrd->live_head->last_up));
+
+  /* Data Source Definition Part */
+  ptr2 = ptr;
+  while (eat_tag(&ptr2,"ds") == 1){
+      rrd->stat_head->ds_cnt++;
+      if((rrd->ds_def = rrd_realloc(rrd->ds_def,rrd->stat_head->ds_cnt*sizeof(ds_def_t)))==NULL){
+         rrd_set_error("allocating rrd.ds_def");
+         return -1;
+      };
+      /* clean out memory to make sure no data gets stored from previous tasks */
+      memset(&(rrd->ds_def[rrd->stat_head->ds_cnt-1]), 0, sizeof(ds_def_t));
+      if((rrd->pdp_prep = rrd_realloc(rrd->pdp_prep,rrd->stat_head->ds_cnt
+                                 *sizeof(pdp_prep_t)))==NULL){
+       rrd_set_error("allocating pdp_prep");
+       return(-1);
+      }
+      /* clean out memory to make sure no data gets stored from previous tasks */
+      memset(&(rrd->pdp_prep[rrd->stat_head->ds_cnt-1]), 0, sizeof(pdp_prep_t));
+
+      read_tag(&ptr2,"name",DS_NAM_FMT,rrd->ds_def[rrd->stat_head->ds_cnt-1].ds_nam);
+
+      read_tag(&ptr2,"type",DST_FMT,rrd->ds_def[rrd->stat_head->ds_cnt-1].dst);
+      /* test for valid type */
+      if( (int)dst_conv(rrd->ds_def[rrd->stat_head->ds_cnt-1].dst) == -1) return -1;      
+
+         if (dst_conv(rrd->ds_def[rrd->stat_head->ds_cnt-1].dst) != DST_CDEF)
+         {
+      read_tag(&ptr2,"minimal_heartbeat","%lu",
+              &(rrd->ds_def[rrd->stat_head->ds_cnt-1].par[DS_mrhb_cnt].u_cnt));
+      read_tag(&ptr2,"min","%lf",&(rrd->ds_def[rrd->stat_head->ds_cnt-1].par[DS_min_val].u_val));
+      read_tag(&ptr2,"max","%lf",&(rrd->ds_def[rrd->stat_head->ds_cnt-1].par[DS_max_val].u_val));
+         } else { /* DST_CDEF */
+                char buffer[1024];
+                read_tag(&ptr2,"cdef","%1000s",buffer);
+                parseCDEF_DS(buffer,rrd,rrd -> stat_head -> ds_cnt - 1);
+                if (rrd_test_error()) return -1;
+         }
+
+      read_tag(&ptr2,"last_ds","%30s",rrd->pdp_prep[rrd->stat_head->ds_cnt-1].last_ds);
+      read_tag(&ptr2,"value","%lf",&(rrd->pdp_prep[rrd->stat_head->ds_cnt-1].scratch[PDP_val].u_val));
+      read_tag(&ptr2,"unknown_sec","%lu",&(rrd->pdp_prep[rrd->stat_head->ds_cnt-1].scratch[PDP_unkn_sec_cnt].u_cnt));      
+      eat_tag(&ptr2,"/ds");
+      ptr=ptr2;
+  }
+  
+  ptr2 = ptr;
+  while (eat_tag(&ptr2,"rra") == 1){
+      rrd->stat_head->rra_cnt++;
+
+      /* allocate and reset rra definition areas */
+      if((rrd->rra_def = rrd_realloc(rrd->rra_def,rrd->stat_head->rra_cnt*sizeof(rra_def_t)))==NULL){
+         rrd_set_error("allocating rra_def"); return -1; }      
+      memset(&(rrd->rra_def[rrd->stat_head->rra_cnt-1]), 0, sizeof(rra_def_t));
+
+      /* allocate and reset consolidation point areas */
+      if((rrd->cdp_prep = rrd_realloc(rrd->cdp_prep,
+                                 rrd->stat_head->rra_cnt
+                                 *rrd->stat_head->ds_cnt*sizeof(cdp_prep_t)))==NULL){
+         rrd_set_error("allocating cdp_prep"); return -1; }
+
+      memset(&(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rrd->stat_head->rra_cnt-1)]), 
+            0, rrd->stat_head->ds_cnt*sizeof(cdp_prep_t));
+
+      
+      read_tag(&ptr2,"cf",CF_NAM_FMT,rrd->rra_def[rrd->stat_head->rra_cnt-1].cf_nam);
+      /* test for valid type */
+      if( (int)cf_conv(rrd->rra_def[rrd->stat_head->rra_cnt-1].cf_nam) == -1) return -1;
+
+      read_tag(&ptr2,"pdp_per_row","%lu",&(rrd->rra_def[rrd->stat_head->rra_cnt-1].pdp_cnt));
+      /* support to read RRA parameters */
+      rra_index = rrd->stat_head->rra_cnt - 1;
+      if ( input_version < 2 ){
+         read_tag(&ptr2, "xff","%lf",
+            &(rrd->rra_def[rra_index].par[RRA_cdp_xff_val].u_val));
+      } else {
+        if (eat_tag(&ptr2, "params") != 1) {
+         rrd_set_error("could not find params tag to eat and skip");
+          return -1;
+        }
+        skip(&ptr2);
+        /* backwards compatibility w/ old patch */
+      if (strncmp(ptr2, "<value>",7) == 0) {
+          parse_patch1028_RRA_params(&ptr2,rrd,rra_index); 
+      } else {
+      switch(cf_conv(rrd -> rra_def[rra_index].cf_nam)) {
+      case CF_HWPREDICT:
+         read_tag(&ptr2, "hw_alpha", "%lf", 
+            &(rrd->rra_def[rra_index].par[RRA_hw_alpha].u_val));
+         read_tag(&ptr2, "hw_beta", "%lf", 
+            &(rrd->rra_def[rra_index].par[RRA_hw_beta].u_val));
+         read_tag(&ptr2, "dependent_rra_idx", "%lu", 
+            &(rrd->rra_def[rra_index].par[RRA_dependent_rra_idx].u_cnt));
+         break;
+      case CF_SEASONAL:
+      case CF_DEVSEASONAL:
+         read_tag(&ptr2, "seasonal_gamma", "%lf", 
+            &(rrd->rra_def[rra_index].par[RRA_seasonal_gamma].u_val));
+         read_tag(&ptr2, "seasonal_smooth_idx", "%lu", 
+            &(rrd->rra_def[rra_index].par[RRA_seasonal_smooth_idx].u_cnt));
+         read_tag(&ptr2, "dependent_rra_idx", "%lu", 
+            &(rrd->rra_def[rra_index].par[RRA_dependent_rra_idx].u_cnt));
+         break;
+      case CF_FAILURES:
+         read_tag(&ptr2, "delta_pos", "%lf", 
+            &(rrd->rra_def[rra_index].par[RRA_delta_pos].u_val));
+         read_tag(&ptr2, "delta_neg", "%lf", 
+            &(rrd->rra_def[rra_index].par[RRA_delta_neg].u_val));
+         read_tag(&ptr2, "window_len", "%lu", 
+            &(rrd->rra_def[rra_index].par[RRA_window_len].u_cnt));
+         read_tag(&ptr2, "failure_threshold", "%lu", 
+            &(rrd->rra_def[rra_index].par[RRA_failure_threshold].u_cnt));
+         /* fall thru */
+      case CF_DEVPREDICT:
+         read_tag(&ptr2, "dependent_rra_idx", "%lu", 
+            &(rrd->rra_def[rra_index].par[RRA_dependent_rra_idx].u_cnt));
+         break;
+      case CF_AVERAGE:
+      case CF_MAXIMUM:
+      case CF_MINIMUM:
+      case CF_LAST:
+      default:
+         read_tag(&ptr2, "xff","%lf",
+            &(rrd->rra_def[rra_index].par[RRA_cdp_xff_val].u_val));
+      }
+      }
+      eat_tag(&ptr2, "/params");
+   }
+
+
+      eat_tag(&ptr2,"cdp_prep");
+      for(i=0;i< (int)rrd->stat_head->ds_cnt;i++)
+      {
+      eat_tag(&ptr2,"ds");
+      /* support to read CDP parameters */
+      rra_index = rrd->stat_head->rra_cnt-1; 
+      skip(&ptr2);
+      if ( input_version < 2 ){
+          rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)+i].scratch[CDP_primary_val].u_val = 0.0;
+          rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)+i].scratch[CDP_secondary_val].u_val = 0.0;
+          read_tag(&ptr2,"value","%lf",&(rrd->cdp_prep[rrd->stat_head->ds_cnt
+               *(rra_index) +i].scratch[CDP_val].u_val));
+          read_tag(&ptr2,"unknown_datapoints","%lu",&(rrd->cdp_prep[rrd->stat_head->ds_cnt
+              *(rra_index) +i].scratch[CDP_unkn_pdp_cnt].u_cnt));
+      } else {
+
+      if (strncmp(ptr2, "<value>",7) == 0) {
+         parse_patch1028_CDP_params(&ptr2,rrd,rra_index,i);
+      } else {
+         read_tag(&ptr2, "primary_value","%lf",
+               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
+               +i].scratch[CDP_primary_val].u_val));
+         read_tag(&ptr2, "secondary_value","%lf",
+               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
+               +i].scratch[CDP_secondary_val].u_val));
+         switch(cf_conv(rrd->rra_def[rra_index].cf_nam)) {
+         case CF_HWPREDICT:
+            read_tag(&ptr2,"intercept","%lf", 
+               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
+               +i].scratch[CDP_hw_intercept].u_val));
+            read_tag(&ptr2,"last_intercept","%lf", 
+               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
+               +i].scratch[CDP_hw_last_intercept].u_val));
+            read_tag(&ptr2,"slope","%lf", 
+               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
+               +i].scratch[CDP_hw_slope].u_val));
+            read_tag(&ptr2,"last_slope","%lf", 
+               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
+               +i].scratch[CDP_hw_last_slope].u_val));
+            read_tag(&ptr2,"nan_count","%lu", 
+               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
+               +i].scratch[CDP_null_count].u_cnt));
+            read_tag(&ptr2,"last_nan_count","%lu", 
+               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
+               +i].scratch[CDP_last_null_count].u_cnt));
+            break;
+         case CF_SEASONAL:
+         case CF_DEVSEASONAL:
+            read_tag(&ptr2,"seasonal","%lf", 
+               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
+               +i].scratch[CDP_hw_seasonal].u_val));
+            read_tag(&ptr2,"last_seasonal","%lf", 
+               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
+               +i].scratch[CDP_hw_last_seasonal].u_val));
+            read_tag(&ptr2,"init_flag","%lu", 
+               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
+               +i].scratch[CDP_init_seasonal].u_cnt));
+            break;
+         case CF_DEVPREDICT:
+            break;
+         case CF_FAILURES:
+            parse_FAILURES_history(&ptr2,rrd,rra_index,i); 
+            break;
+         case CF_AVERAGE:
+         case CF_MAXIMUM:
+         case CF_MINIMUM:
+         case CF_LAST:
+         default:
+            read_tag(&ptr2,"value","%lf",&(rrd->cdp_prep[rrd->stat_head->ds_cnt
+               *(rra_index) +i].scratch[CDP_val].u_val));
+            read_tag(&ptr2,"unknown_datapoints","%lu",&(rrd->cdp_prep[rrd->stat_head->ds_cnt
+               *(rra_index) +i].scratch[CDP_unkn_pdp_cnt].u_cnt));
+            break;
+        }
+      }
+      }
+      eat_tag(&ptr2,"/ds");
+      }
+      eat_tag(&ptr2,"/cdp_prep");
+      rrd->rra_def[rrd->stat_head->rra_cnt-1].row_cnt=0;
+      eat_tag(&ptr2,"database");
+      ptr3 = ptr2;      
+      while (eat_tag(&ptr3,"row") == 1){
+       
+         if(mempool==0){
+           mempool = 1000;
+           if((rrd->rrd_value = rrd_realloc(rrd->rrd_value,
+                                        (rows+mempool)*(rrd->stat_head->ds_cnt)
+                                        *sizeof(rrd_value_t)))==NULL) {
+             rrd_set_error("allocating rrd_values"); return -1; }
+         }
+         rows++;
+         mempool--;
+         rrd->rra_def[rrd->stat_head->rra_cnt-1].row_cnt++;
+         for(i=0;i< (int)rrd->stat_head->ds_cnt;i++){
+
+                 rrd_value_t  * value = &(rrd->rrd_value[(rows-1)*rrd->stat_head->ds_cnt+i]);
+
+                 read_tag(&ptr3,"v","%lf", value);
+                 
+                 if (
+                         (rc == 1)                     /* do we have to check for the ranges */
+                         &&
+                     (!isnan(*value))  /* not a NAN value */
+                     &&
+                         (dst_conv(rrd->ds_def[i].dst) != DST_CDEF)
+                         &&
+                     (                                 /* min defined and in the range ? */
+                         (!isnan(rrd->ds_def[i].par[DS_min_val].u_val) 
+                               && (*value < rrd->ds_def[i].par[DS_min_val].u_val)) 
+                         ||                            /* max defined and in the range ? */
+                         (!isnan(rrd->ds_def[i].par[DS_max_val].u_val) 
+                               && (*value > rrd->ds_def[i].par[DS_max_val].u_val))
+                     )
+                 ) {
+                     fprintf (stderr, "out of range found [ds: %lu], [value : %0.10e]\n", i, *value);
+                     *value = DNAN;
+                 }
+         }
+         eat_tag(&ptr3,"/row");                  
+         ptr2=ptr3;
+      }
+      eat_tag(&ptr2,"/database");
+      eat_tag(&ptr2,"/rra");                  
+      ptr=ptr2;
+  }  
+  eat_tag(&ptr,"/rrd");
+
+  if((rrd->rra_ptr = calloc(1,sizeof(rra_ptr_t)*rrd->stat_head->rra_cnt)) == NULL) {
+      rrd_set_error("allocating rra_ptr");
+      return(-1);
+  }
+
+  for(i=0; i < (int)rrd->stat_head->rra_cnt; i++) {
+         /* last row in the xml file is the most recent; as
+          * rrd_update increments the current row pointer, set cur_row
+          * here to the last row. */
+      rrd->rra_ptr[i].cur_row = rrd->rra_def[i].row_cnt-1;
+  }
+  if (ptr==NULL)
+      return -1;
+  return 1;
+}
+  
+    
+
+
+
+/* create and empty rrd file according to the specs given */
+
+int
+rrd_write(char *file_name, rrd_t *rrd, char force_overwrite)
+{
+    unsigned long    i,ii,val_cnt;
+    FILE             *rrd_file=NULL;
+    int                        fdflags;
+    int                        fd;
+
+    if (strcmp("-",file_name)==0){
+      rrd_file= stdout;
+    } else {
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+      fdflags = O_RDWR|O_BINARY|O_CREAT;
+#else
+      fdflags = O_WRONLY|O_CREAT;
+#endif            
+      if (force_overwrite == 0) {
+       fdflags |= O_EXCL;
+      }
+      fd = open(file_name,fdflags,0666);
+      if (fd == -1 || (rrd_file = fdopen(fd,"wb")) == NULL) {
+       rrd_set_error("creating '%s': %s",file_name,rrd_strerror(errno));
+        if (fd != -1)
+          close(fd);
+       return(-1);
+      }
+    }
+    fwrite(rrd->stat_head,
+          sizeof(stat_head_t), 1, rrd_file);
+
+    fwrite(rrd->ds_def,
+          sizeof(ds_def_t), rrd->stat_head->ds_cnt, rrd_file);
+
+    fwrite(rrd->rra_def,
+          sizeof(rra_def_t), rrd->stat_head->rra_cnt, rrd_file);
+
+    fwrite(rrd->live_head, sizeof(live_head_t),1, rrd_file);
+
+    fwrite( rrd->pdp_prep, sizeof(pdp_prep_t),rrd->stat_head->ds_cnt,rrd_file);
+    
+    fwrite( rrd->cdp_prep, sizeof(cdp_prep_t),rrd->stat_head->rra_cnt*
+           rrd->stat_head->ds_cnt,rrd_file);
+    fwrite( rrd->rra_ptr, sizeof(rra_ptr_t), rrd->stat_head->rra_cnt,rrd_file);
+
+
+
+    /* calculate the number of rrd_values to dump */
+    val_cnt=0;
+    for(i=0; i <  rrd->stat_head->rra_cnt; i++)
+       for(ii=0; ii <  rrd->rra_def[i].row_cnt * rrd->stat_head->ds_cnt;ii++)
+           val_cnt++;
+    fwrite( rrd->rrd_value, sizeof(rrd_value_t),val_cnt,rrd_file);
+
+    /* lets see if we had an error */
+    if(ferror(rrd_file)){
+       rrd_set_error("a file error occurred while creating '%s'",file_name);
+       fclose(rrd_file);       
+       return(-1);
+    }
+    
+    fclose(rrd_file);    
+    return 0;
+}
+
+
+int
+rrd_restore(int argc, char **argv) 
+{
+    rrd_t          rrd;
+    char          *buf;
+       char                    rc = 0;
+       char                    force_overwrite = 0;    
+
+    /* init rrd clean */
+    optind = 0; opterr = 0;  /* initialize getopt */
+       while (1) {
+               static struct option long_options[] =
+               {
+                       {"range-check",      no_argument, 0,  'r'},
+                       {"force-overwrite",  no_argument, 0,  'f'},
+                       {0,0,0,0}
+               };
+               int option_index = 0;
+               int opt;
+               
+               
+               opt = getopt_long(argc, argv, "rf", long_options, &option_index);
+               
+               if (opt == EOF)
+                       break;
+               
+               switch(opt) {
+               case 'r':
+                       rc=1;
+                       break;
+               case 'f':
+                       force_overwrite=1;
+                       break;
+               default:
+                       rrd_set_error("usage rrdtool %s [--range-check|-r] [--force-overwrite/-f]  file.xml file.rrd",argv[0]);
+                       return -1;
+                       break;
+               }
+    }
+
+    if (argc-optind != 2) {
+               rrd_set_error("usage rrdtool %s [--range-check/-r] [--force-overwrite/-f] file.xml file.rrd",argv[0]);
+               return -1;
+    }
+       
+    if (readfile(argv[optind],&buf,0)==-1){
+      return -1;
+    }
+
+    rrd_init(&rrd);
+
+    if (xml2rrd(buf,&rrd,rc)==-1) {
+       rrd_free(&rrd);
+       free(buf);
+       return -1;
+    }
+
+    free(buf);
+
+    if(rrd_write(argv[optind+1],&rrd,force_overwrite)==-1){
+       rrd_free(&rrd); 
+       return -1;      
+    };
+    rrd_free(&rrd);    
+    return 0;
+}
+
+/* a backwards compatibility routine that will parse the RRA params section
+ * generated by the aberrant patch to 1.0.28. */
+
+void
+parse_patch1028_RRA_params(char **buf, rrd_t *rrd, int rra_index)
+{
+   int i;
+   for (i = 0; i < MAX_RRA_PAR_EN; i++)
+   {
+   if (i == RRA_dependent_rra_idx ||
+       i == RRA_seasonal_smooth_idx ||
+       i == RRA_failure_threshold)
+      read_tag(buf, "value","%lu",
+         &(rrd->rra_def[rra_index].par[i].u_cnt));
+   else
+      read_tag(buf, "value","%lf",
+         &(rrd->rra_def[rra_index].par[i].u_val));
+   }
+}
+
+/* a backwards compatibility routine that will parse the CDP params section
+ * generated by the aberrant patch to 1.0.28. */
+void
+parse_patch1028_CDP_params(char **buf, rrd_t *rrd, int rra_index, int ds_index)
+{
+   int ii;
+   for (ii = 0; ii < MAX_CDP_PAR_EN; ii++)
+   {
+   if (cf_conv(rrd->rra_def[rra_index].cf_nam) == CF_FAILURES ||
+       ii == CDP_unkn_pdp_cnt ||
+       ii == CDP_null_count ||
+       ii == CDP_last_null_count)
+   {
+      read_tag(buf,"value","%lu",
+       &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index) + ds_index].scratch[ii].u_cnt));
+   } else {
+      read_tag(buf,"value","%lf",&(rrd->cdp_prep[rrd->stat_head->ds_cnt*
+       (rra_index) + ds_index].scratch[ii].u_val));
+   }
+   }
+}
+
+void
+parse_FAILURES_history(char **buf, rrd_t *rrd, int rra_index, int ds_index)
+{
+   char history[MAX_FAILURES_WINDOW_LEN + 1];
+   char *violations_array;
+   unsigned short i;
+
+   /* 28 = MAX_FAILURES_WINDOW_LEN */ 
+   read_tag(buf, "history", "%28[0-1]", history);
+   violations_array = (char*) rrd -> cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
+      + ds_index].scratch;
+   
+   for (i = 0; i < rrd -> rra_def[rra_index].par[RRA_window_len].u_cnt; ++i)
+      violations_array[i] = (history[i] == '1') ? 1 : 0;
+
+}
diff --git a/src/rrd_rpncalc.c b/src/rrd_rpncalc.c
new file mode 100644 (file)
index 0000000..75b10e9
--- /dev/null
@@ -0,0 +1,830 @@
+/****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ ****************************************************************************
+ * rrd_rpncalc.c  RPN calculator functions
+ ****************************************************************************/
+
+#include "rrd_tool.h"
+#include "rrd_rpncalc.h"
+#include "rrd_graph.h"
+#include <limits.h>
+
+short addop2str(enum op_en op, enum op_en op_type, char *op_str, 
+           char **result_str, unsigned short *offset);
+int tzoffset(time_t); /* used to implement LTIME */
+
+short rpn_compact(rpnp_t *rpnp, rpn_cdefds_t **rpnc, short *count)
+{
+    short i;
+    *count = 0;
+    /* count the number of rpn nodes */
+    while(rpnp[*count].op != OP_END) (*count)++;
+    if (++(*count) > DS_CDEF_MAX_RPN_NODES) {
+        rrd_set_error("Maximum %d RPN nodes permitted",
+                      DS_CDEF_MAX_RPN_NODES);
+        return -1;
+    }
+    
+    /* allocate memory */
+    *rpnc = (rpn_cdefds_t *) calloc(*count,sizeof(rpn_cdefds_t));
+    for (i = 0; rpnp[i].op != OP_END; i++)
+    {
+        (*rpnc)[i].op = (char) rpnp[i].op;
+        if (rpnp[i].op == OP_NUMBER) {
+            /* rpnp.val is a double, rpnc.val is a short */
+            double temp = floor(rpnp[i].val);
+            if (temp < SHRT_MIN || temp > SHRT_MAX) {
+                rrd_set_error(
+                   "constants must be integers in the interval (%d, %d)",
+                    SHRT_MIN, SHRT_MAX);
+                free(*rpnc);   
+                return -1;
+            }
+            (*rpnc)[i].val = (short) temp;
+         } else if (rpnp[i].op == OP_VARIABLE ||
+                                rpnp[i].op == OP_PREV_OTHER) {
+            (*rpnc)[i].val = (short) rpnp[i].ptr;
+        }
+    }
+    /* terminate the sequence */
+    (*rpnc)[(*count) - 1].op = OP_END;
+    return 0;
+}
+
+rpnp_t * rpn_expand(rpn_cdefds_t *rpnc)
+{
+    short i;
+    rpnp_t *rpnp;
+    
+    /* DS_CDEF_MAX_RPN_NODES is small, so at the expense of some wasted
+     * memory we avoid any reallocs */
+    rpnp = (rpnp_t *) calloc(DS_CDEF_MAX_RPN_NODES,sizeof(rpnp_t));
+    if (rpnp == NULL) return NULL;
+    for (i = 0; rpnc[i].op != OP_END; ++i)
+    {
+        rpnp[i].op = (long) rpnc[i].op;
+        if (rpnp[i].op == OP_NUMBER) {
+            rpnp[i].val = (double) rpnc[i].val;
+         } else if (rpnp[i].op == OP_VARIABLE ||
+                                rpnp[i].op == OP_PREV_OTHER) {
+            rpnp[i].ptr = (long) rpnc[i].val;
+        }
+    }
+    /* terminate the sequence */
+    rpnp[i].op = OP_END;
+    return rpnp;
+}
+
+/* rpn_compact2str: convert a compact sequence of RPN operator nodes back
+ * into a CDEF string. This function is used by rrd_dump.
+ * arguments:
+ *  rpnc: an array of compact RPN operator nodes
+ *  ds_def: a pointer to the data source definition section of an RRD header
+ *   for lookup of data source names by index
+ *  str: out string, memory is allocated by the function, must be freed by the
+ *   the caller */
+void rpn_compact2str(rpn_cdefds_t *rpnc,ds_def_t *ds_def,char **str)
+{
+    unsigned short i,offset = 0;
+    char buffer[7]; /* short as a string */
+    
+    for (i = 0; rpnc[i].op != OP_END; i++)
+    {
+        if (i > 0) (*str)[offset++] = ',';
+        
+#define add_op(VV,VVV) \
+         if (addop2str(rpnc[i].op, VV, VVV, str, &offset) == 1) continue;
+        
+        if (rpnc[i].op == OP_NUMBER) {
+            /* convert a short into a string */
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+            _itoa(rpnc[i].val,buffer,10);
+#else
+            sprintf(buffer,"%d",rpnc[i].val);
+#endif
+            add_op(OP_NUMBER,buffer)
+                }
+        
+        if (rpnc[i].op == OP_VARIABLE) {
+            char *ds_name = ds_def[rpnc[i].val].ds_nam;
+            add_op(OP_VARIABLE, ds_name)
+                }
+
+         if (rpnc[i].op == OP_PREV_OTHER) {
+               char *ds_name = ds_def[rpnc[i].val].ds_nam;
+               add_op(OP_VARIABLE, ds_name)
+         }
+
+#undef add_op
+        
+#define add_op(VV,VVV) \
+         if (addop2str(rpnc[i].op, VV, #VVV, str, &offset) == 1) continue;
+        
+          add_op(OP_ADD,+)
+          add_op(OP_SUB,-)
+          add_op(OP_MUL,*)
+          add_op(OP_DIV,/)
+          add_op(OP_MOD,%)
+          add_op(OP_SIN,SIN)
+          add_op(OP_COS,COS)
+          add_op(OP_LOG,LOG)
+          add_op(OP_FLOOR,FLOOR)
+         add_op(OP_CEIL,CEIL)
+         add_op(OP_EXP,EXP)
+         add_op(OP_DUP,DUP)
+         add_op(OP_EXC,EXC)
+         add_op(OP_POP,POP)
+         add_op(OP_LT,LT)
+          add_op(OP_LE,LE)
+         add_op(OP_GT,GT)
+         add_op(OP_GE,GE)
+         add_op(OP_EQ,EQ)
+         add_op(OP_IF,IF)
+         add_op(OP_MIN,MIN)
+         add_op(OP_MAX,MAX)
+         add_op(OP_LIMIT,LIMIT)
+         add_op(OP_UNKN,UNKN)
+         add_op(OP_UN,UN)
+         add_op(OP_NEGINF,NEGINF)
+         add_op(OP_NE,NE)
+         add_op(OP_PREV,PREV)
+         add_op(OP_INF,INF)
+         add_op(OP_ISINF,ISINF)
+         add_op(OP_NOW,NOW)
+         add_op(OP_LTIME,LTIME)
+         add_op(OP_TIME,TIME)
+         add_op(OP_ATAN2,ATAN2)
+         add_op(OP_ATAN,ATAN)
+         add_op(OP_SQRT,SQRT)
+         add_op(OP_SORT,SORT)
+         add_op(OP_REV,REV)
+         add_op(OP_TREND,TREND)
+         add_op(OP_RAD2DEG,RAD2DEG)
+         add_op(OP_DEG2RAD,DEG2RAD)
+         add_op(OP_AVG,AVG)
+         add_op(OP_ABS,ABS)
+#undef add_op
+              }
+    (*str)[offset] = '\0';
+
+}
+
+short addop2str(enum op_en op, enum op_en op_type, char *op_str, 
+                char **result_str, unsigned short *offset)
+{
+    if (op == op_type) {
+        short op_len;
+        op_len = strlen(op_str);
+        *result_str =  (char *) rrd_realloc(*result_str,
+                                            (op_len + 1 + *offset)*sizeof(char));
+        if (*result_str == NULL) {
+            rrd_set_error("failed to alloc memory in addop2str");
+            return -1;
+        }
+        strncpy(&((*result_str)[*offset]),op_str,op_len);
+        *offset += op_len;
+        return 1;
+    }
+    return 0;
+}
+
+void parseCDEF_DS(const char *def,rrd_t *rrd, int ds_idx)
+{
+    rpnp_t *rpnp = NULL;
+    rpn_cdefds_t *rpnc = NULL;
+    short count, i;
+    
+    rpnp = rpn_parse((void*) rrd, def, &lookup_DS);
+    if (rpnp == NULL) {
+        rrd_set_error("failed to parse computed data source");
+        return;
+    }
+    /* Check for OP nodes not permitted in COMPUTE DS.
+     * Moved this check from within rpn_compact() because it really is
+     * COMPUTE DS specific. This is less efficient, but creation doesn't
+     * occur too often. */
+    for (i = 0; rpnp[i].op != OP_END; i++) {
+        if (rpnp[i].op == OP_TIME || rpnp[i].op == OP_LTIME || 
+            rpnp[i].op == OP_PREV || rpnp[i].op == OP_COUNT)
+        {
+            rrd_set_error(
+                "operators time, ltime, prev and count not supported with DS COMPUTE");
+            free(rpnp);
+            return;
+        }
+    }
+    if (rpn_compact(rpnp,&rpnc,&count) == -1) {
+        free(rpnp);
+        return;
+    }
+    /* copy the compact rpn representation over the ds_def par array */
+    memcpy((void*) &(rrd -> ds_def[ds_idx].par[DS_cdef]),
+           (void*) rpnc, count*sizeof(rpn_cdefds_t));
+    free(rpnp);
+    free(rpnc);
+}
+
+/* lookup a data source name in the rrd struct and return the index,
+ * should use ds_match() here except:
+ * (1) need a void * pointer to the rrd
+ * (2) error handling is left to the caller
+ */
+long lookup_DS(void *rrd_vptr,char *ds_name)
+{
+    unsigned int i;
+    rrd_t *rrd; 
+    
+    rrd = (rrd_t *) rrd_vptr;
+    
+    for (i = 0; i < rrd -> stat_head -> ds_cnt; ++i)
+    {
+        if(strcmp(ds_name,rrd -> ds_def[i].ds_nam) == 0)
+            return i;
+    }
+    /* the caller handles a bad data source name in the rpn string */
+    return -1;
+}
+
+/* rpn_parse : parse a string and generate a rpnp array; modified
+ * str2rpn() originally included in rrd_graph.c
+ * arguments:
+ * key_hash: a transparent argument passed to lookup(); conceptually this
+ *    is a hash object for lookup of a numeric key given a variable name
+ * expr: the string RPN expression, including variable names
+ * lookup(): a function that retrieves a numeric key given a variable name
+ */
+rpnp_t * 
+rpn_parse(void *key_hash,const char *const expr_const,long (*lookup)(void *,char*)){
+    int pos=0;
+    char *expr;
+    long steps=-1;    
+    rpnp_t  *rpnp;
+    char vname[MAX_VNAME_LEN+10];
+    
+    rpnp=NULL;
+    expr=(char *)expr_const;
+    
+    while(*expr){
+       if ((rpnp = (rpnp_t *) rrd_realloc(rpnp, (++steps + 2)* 
+                                      sizeof(rpnp_t)))==NULL){
+           return NULL;
+       }
+        
+       else if((sscanf(expr,"%lf%n",&rpnp[steps].val,&pos) == 1) && (expr[pos] == ',')){
+           rpnp[steps].op = OP_NUMBER;
+           expr+=pos;
+       } 
+       
+#define match_op(VV,VVV) \
+        else if (strncmp(expr, #VVV, strlen(#VVV))==0 && ( expr[strlen(#VVV)] == ',' || expr[strlen(#VVV)] == '\0' )){ \
+            rpnp[steps].op = VV; \
+            expr+=strlen(#VVV); \
+       }
+
+
+#define match_op_param(VV,VVV) \
+        else if (sscanf(expr, #VVV "(" DEF_NAM_FMT ")",vname) == 1) { \
+          int length = 0; \
+          if ((length = strlen(#VVV)+strlen(vname)+2, \
+              expr[length] == ',' || expr[length] == '\0') ) { \
+             rpnp[steps].op = VV; \
+             rpnp[steps].ptr = (*lookup)(key_hash,vname); \
+             if (rpnp[steps].ptr < 0) { \
+                          free(rpnp); \
+                          return NULL; \
+                        } else expr+=length; \
+          } \
+        }
+
+       match_op(OP_ADD,+)
+       match_op(OP_SUB,-)
+       match_op(OP_MUL,*)
+       match_op(OP_DIV,/)
+       match_op(OP_MOD,%)
+       match_op(OP_SIN,SIN)
+       match_op(OP_COS,COS)
+       match_op(OP_LOG,LOG)
+       match_op(OP_FLOOR,FLOOR)
+       match_op(OP_CEIL,CEIL)
+       match_op(OP_EXP,EXP)
+       match_op(OP_DUP,DUP)
+       match_op(OP_EXC,EXC)
+       match_op(OP_POP,POP)
+       match_op(OP_LTIME,LTIME)
+       match_op(OP_LT,LT)
+       match_op(OP_LE,LE)
+       match_op(OP_GT,GT)
+       match_op(OP_GE,GE)
+       match_op(OP_EQ,EQ)
+       match_op(OP_IF,IF)
+       match_op(OP_MIN,MIN)
+       match_op(OP_MAX,MAX)
+       match_op(OP_LIMIT,LIMIT)
+         /* order is important here ! .. match longest first */
+       match_op(OP_UNKN,UNKN)
+       match_op(OP_UN,UN)
+       match_op(OP_NEGINF,NEGINF)
+       match_op(OP_NE,NE)
+       match_op(OP_COUNT,COUNT)
+       match_op_param(OP_PREV_OTHER,PREV)
+       match_op(OP_PREV,PREV)
+       match_op(OP_INF,INF)
+       match_op(OP_ISINF,ISINF)
+       match_op(OP_NOW,NOW)
+       match_op(OP_TIME,TIME)
+       match_op(OP_ATAN2,ATAN2)
+       match_op(OP_ATAN,ATAN)
+       match_op(OP_SQRT,SQRT)
+       match_op(OP_SORT,SORT)
+       match_op(OP_REV,REV)
+       match_op(OP_TREND,TREND)
+       match_op(OP_RAD2DEG,RAD2DEG)
+       match_op(OP_DEG2RAD,DEG2RAD)
+       match_op(OP_AVG,AVG)
+       match_op(OP_ABS,ABS)
+#undef match_op
+
+
+            else if ((sscanf(expr, DEF_NAM_FMT "%n",
+                             vname,&pos) == 1) 
+                     && ((rpnp[steps].ptr = (*lookup)(key_hash,vname)) != -1)){
+                rpnp[steps].op = OP_VARIABLE;
+                expr+=pos;
+            }     
+        
+       else {
+           free(rpnp);
+           return NULL;
+       }
+       if (*expr == 0)
+            break;
+       if (*expr == ',')
+           expr++;
+       else {
+           free(rpnp);
+           return NULL;
+       }  
+    }
+    rpnp[steps+1].op = OP_END;
+    return rpnp;
+}
+
+void
+rpnstack_init(rpnstack_t *rpnstack)
+{
+    rpnstack -> s = NULL;
+    rpnstack -> dc_stacksize = 0;
+    rpnstack -> dc_stackblock = 100;
+}
+
+void
+rpnstack_free(rpnstack_t *rpnstack)
+{
+   if (rpnstack -> s != NULL)
+         free(rpnstack -> s);
+   rpnstack -> dc_stacksize = 0;
+}
+
+static int
+rpn_compare_double(const void *x, const void *y)
+{
+       double  diff = *((const double *)x) - *((const double *)y);
+       
+       return (diff < 0) ? -1 : (diff > 0) ? 1 : 0;
+}
+
+/* rpn_calc: run the RPN calculator; also performs variable substitution;
+ * moved and modified from data_calc() originally included in rrd_graph.c 
+ * arguments:
+ * rpnp : an array of RPN operators (including variable references)
+ * rpnstack : the initialized stack
+ * data_idx : when data_idx is a multiple of rpnp.step, the rpnp.data pointer
+ *   is advanced by rpnp.ds_cnt; used only for variable substitution
+ * output : an array of output values; OP_PREV assumes this array contains
+ *   the "previous" value at index position output_idx-1; the definition of
+ *   "previous" depends on the calling environment
+ * output_idx : an index into the output array in which to store the output
+ *   of the RPN calculator
+ * returns: -1 if the computation failed (also calls rrd_set_error)
+ *           0 on success
+ */
+short
+rpn_calc(rpnp_t *rpnp, rpnstack_t *rpnstack, long data_idx, 
+               rrd_value_t *output, int output_idx)
+{
+    int rpi;
+    long stptr = -1;
+   
+    /* process each op from the rpn in turn */
+    for (rpi=0; rpnp[rpi].op != OP_END; rpi++){
+       /* allocate or grow the stack */
+       if (stptr + 5 > rpnstack -> dc_stacksize){
+           /* could move this to a separate function */
+           rpnstack -> dc_stacksize += rpnstack -> dc_stackblock;              
+           rpnstack -> s = rrd_realloc(rpnstack -> s,
+                       (rpnstack -> dc_stacksize)*sizeof(*(rpnstack -> s)));
+           if (rpnstack -> s == NULL){
+               rrd_set_error("RPN stack overflow");
+               return -1;
+           }
+       }
+
+#define stackunderflow(MINSIZE)                                \
+       if(stptr<MINSIZE){                              \
+           rrd_set_error("RPN stack underflow");       \
+           return -1;                                  \
+       }
+
+       switch (rpnp[rpi].op){
+           case OP_NUMBER:
+               rpnstack -> s[++stptr] = rpnp[rpi].val;
+               break;
+           case OP_VARIABLE:
+            case OP_PREV_OTHER:
+           /* Sanity check: VDEFs shouldn't make it here */
+               if (rpnp[rpi].ds_cnt == 0) {
+                   rrd_set_error("VDEF made it into rpn_calc... aborting");
+                   return -1;
+               } else {
+                   /* make sure we pull the correct value from
+                    * the *.data array. Adjust the pointer into
+                    * the array acordingly. Advance the ptr one
+                    * row in the rra (skip over non-relevant
+                    * data sources)
+                    */
+                   if (rpnp[rpi].op == OP_VARIABLE) {
+                       rpnstack -> s[++stptr] =  *(rpnp[rpi].data);
+                   } else {
+                       if ((output_idx) <= 0) {
+                           rpnstack -> s[++stptr] = DNAN;
+                       } else {                            
+                           rpnstack -> s[++stptr] =  *(rpnp[rpi].data-rpnp[rpi].ds_cnt);
+                       }
+                      
+                   }              
+                   if (data_idx % rpnp[rpi].step == 0){
+                       rpnp[rpi].data += rpnp[rpi].ds_cnt;
+                   }
+               }
+               break;
+           case OP_COUNT:
+               rpnstack -> s[++stptr] = (output_idx+1); /* Note: Counter starts at 1 */
+               break;
+           case OP_PREV:
+               if ((output_idx) <= 0) {
+                   rpnstack -> s[++stptr] = DNAN;
+               } else {
+                   rpnstack -> s[++stptr] = output[output_idx-1];
+               }
+               break;
+        case OP_UNKN:
+               rpnstack -> s[++stptr] = DNAN; 
+               break;
+           case OP_INF:
+               rpnstack -> s[++stptr] = DINF; 
+               break;
+           case OP_NEGINF:
+               rpnstack -> s[++stptr] = -DINF; 
+               break;
+           case OP_NOW:
+               rpnstack -> s[++stptr] = (double)time(NULL);
+               break;
+           case OP_TIME:
+               /* HACK: this relies on the data_idx being the time,
+               ** which the within-function scope is unaware of */
+               rpnstack -> s[++stptr] = (double) data_idx;
+               break;
+           case OP_LTIME:
+               rpnstack -> s[++stptr] =
+                       (double) tzoffset(data_idx) + (double)data_idx;
+               break;
+           case OP_ADD:
+               stackunderflow(1);
+               rpnstack -> s[stptr-1]  = rpnstack -> s[stptr-1] 
+                                       + rpnstack -> s[stptr];
+               stptr--;
+               break;
+           case OP_SUB:
+               stackunderflow(1);
+               rpnstack -> s[stptr-1]  = rpnstack -> s[stptr-1]
+                                       - rpnstack -> s[stptr];
+               stptr--;
+               break;
+           case OP_MUL:
+               stackunderflow(1);
+               rpnstack -> s[stptr-1]  = (rpnstack -> s[stptr-1])
+                                       * (rpnstack -> s[stptr]);
+               stptr--;
+               break;
+           case OP_DIV:
+               stackunderflow(1);
+               rpnstack -> s[stptr-1]  = rpnstack -> s[stptr-1]
+                                       / rpnstack -> s[stptr];
+               stptr--;
+               break;
+           case OP_MOD:
+               stackunderflow(1);
+               rpnstack -> s[stptr-1]= fmod(   rpnstack -> s[stptr-1]
+                                               ,rpnstack -> s[stptr]);
+               stptr--;
+               break;
+           case OP_SIN:
+               stackunderflow(0);
+               rpnstack -> s[stptr] = sin(rpnstack -> s[stptr]);
+               break;
+           case OP_ATAN:
+               stackunderflow(0);
+               rpnstack -> s[stptr] = atan(rpnstack -> s[stptr]);
+               break;
+           case OP_RAD2DEG:
+               stackunderflow(0);
+               rpnstack -> s[stptr] = 57.29577951 * rpnstack -> s[stptr];
+               break;
+           case OP_DEG2RAD:
+               stackunderflow(0);
+               rpnstack -> s[stptr] = 0.0174532952 * rpnstack -> s[stptr];
+               break;
+           case OP_ATAN2:
+               stackunderflow(1);
+               rpnstack -> s[stptr-1]= atan2(
+                               rpnstack -> s[stptr-1],
+                               rpnstack -> s[stptr]);
+               stptr--;
+               break;
+           case OP_COS:
+               stackunderflow(0);
+               rpnstack -> s[stptr] = cos(rpnstack -> s[stptr]);
+               break;
+           case OP_CEIL:
+               stackunderflow(0);
+               rpnstack -> s[stptr] = ceil(rpnstack -> s[stptr]);
+               break;
+           case OP_FLOOR:
+               stackunderflow(0);
+               rpnstack -> s[stptr] = floor(rpnstack -> s[stptr]);
+               break;
+           case OP_LOG:
+               stackunderflow(0);
+               rpnstack -> s[stptr] = log(rpnstack -> s[stptr]);
+               break;
+           case OP_DUP:
+               stackunderflow(0);
+               rpnstack -> s[stptr+1] = rpnstack -> s[stptr];
+               stptr++;
+               break;
+           case OP_POP:
+               stackunderflow(0);
+               stptr--;
+               break;
+           case OP_EXC:
+               stackunderflow(1);
+               {
+                   double dummy;
+                   dummy = rpnstack -> s[stptr] ;
+                   rpnstack -> s[stptr] = rpnstack -> s[stptr-1];
+                   rpnstack -> s[stptr-1] = dummy;
+               }
+               break;
+           case OP_EXP:
+               stackunderflow(0);
+               rpnstack -> s[stptr] = exp(rpnstack -> s[stptr]);
+               break;
+           case OP_LT:
+               stackunderflow(1);
+               if (isnan(rpnstack -> s[stptr-1])) 
+                   ;
+               else if (isnan(rpnstack -> s[stptr]))
+                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr];
+               else
+                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr-1] <
+                                       rpnstack -> s[stptr] ? 1.0 : 0.0;
+               stptr--;
+               break;
+           case OP_LE:
+               stackunderflow(1);
+               if (isnan(rpnstack -> s[stptr-1])) 
+                   ;
+               else if (isnan(rpnstack -> s[stptr]))
+                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr];
+               else
+                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr-1] <=
+                                       rpnstack -> s[stptr] ? 1.0 : 0.0;
+               stptr--;
+               break;
+           case OP_GT:
+               stackunderflow(1);
+               if (isnan(rpnstack -> s[stptr-1])) 
+                   ;
+               else if (isnan(rpnstack -> s[stptr]))
+                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr];
+               else
+                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr-1] >
+                                       rpnstack -> s[stptr] ? 1.0 : 0.0;
+               stptr--;
+               break;
+           case OP_GE:
+               stackunderflow(1);
+               if (isnan(rpnstack -> s[stptr-1])) 
+                   ;
+               else if (isnan(rpnstack -> s[stptr]))
+                           rpnstack -> s[stptr-1] = rpnstack -> s[stptr];
+               else
+                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr-1] >=
+                                       rpnstack -> s[stptr] ? 1.0 : 0.0;
+               stptr--;
+               break;
+           case OP_NE:
+               stackunderflow(1);
+               if (isnan(rpnstack -> s[stptr-1]))
+                   ;
+               else if (isnan(rpnstack -> s[stptr]))
+                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr];
+               else
+                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr-1] ==
+                                       rpnstack -> s[stptr] ? 0.0 : 1.0;
+               stptr--;
+               break;
+           case OP_EQ:
+               stackunderflow(1);
+               if (isnan(rpnstack -> s[stptr-1])) 
+                   ;
+               else if (isnan(rpnstack -> s[stptr]))
+                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr];
+               else
+                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr-1] ==
+                                       rpnstack -> s[stptr] ? 1.0 : 0.0;
+               stptr--;
+               break;
+           case OP_IF:
+               stackunderflow(2);
+               rpnstack->s[stptr-2] = rpnstack->s[stptr-2] != 0.0 ?
+                               rpnstack->s[stptr-1] : rpnstack->s[stptr];
+               stptr--;
+               stptr--;
+               break;
+           case OP_MIN:
+               stackunderflow(1);
+               if (isnan(rpnstack->s[stptr-1])) 
+                   ;
+               else if (isnan(rpnstack->s[stptr]))
+                   rpnstack->s[stptr-1] = rpnstack->s[stptr];
+               else if (rpnstack->s[stptr-1] > rpnstack->s[stptr])
+                   rpnstack->s[stptr-1] = rpnstack->s[stptr];
+               stptr--;
+               break;
+           case OP_MAX:
+               stackunderflow(1);
+               if (isnan(rpnstack->s[stptr-1])) 
+               ;
+               else if (isnan(rpnstack->s[stptr]))
+                   rpnstack->s[stptr-1] = rpnstack->s[stptr];
+               else if (rpnstack->s[stptr-1] < rpnstack->s[stptr])
+                   rpnstack->s[stptr-1] = rpnstack->s[stptr];
+               stptr--;
+               break;
+           case OP_LIMIT:
+               stackunderflow(2);
+               if (isnan(rpnstack->s[stptr-2])) 
+                   ;
+               else if (isnan(rpnstack->s[stptr-1]))
+                   rpnstack->s[stptr-2] = rpnstack->s[stptr-1];
+               else if (isnan(rpnstack->s[stptr]))
+                   rpnstack->s[stptr-2] = rpnstack->s[stptr];
+               else if (rpnstack->s[stptr-2] < rpnstack->s[stptr-1])
+                   rpnstack->s[stptr-2] = DNAN;
+               else if (rpnstack->s[stptr-2] > rpnstack->s[stptr])
+                   rpnstack->s[stptr-2] = DNAN;
+               stptr-=2;
+                       break;
+           case OP_UN:
+               stackunderflow(0);
+               rpnstack->s[stptr] = isnan(rpnstack->s[stptr]) ? 1.0 : 0.0;
+               break;
+           case OP_ISINF:
+               stackunderflow(0);
+               rpnstack->s[stptr] = isinf(rpnstack->s[stptr]) ? 1.0 : 0.0;
+               break;
+           case OP_SQRT:
+               stackunderflow(0);
+               rpnstack -> s[stptr] = sqrt(rpnstack -> s[stptr]);
+               break;
+           case OP_SORT:
+               stackunderflow(0);
+               {
+                   int spn = (int)rpnstack -> s[stptr--];
+
+                   stackunderflow(spn-1);
+                   qsort(rpnstack -> s + stptr-spn+1, spn, sizeof(double),
+                         rpn_compare_double);
+               }
+               break;
+           case OP_REV:
+               stackunderflow(0);
+               {
+                   int spn = (int)rpnstack -> s[stptr--];
+                   double *p, *q;
+
+                   stackunderflow(spn-1);
+
+                   p = rpnstack -> s + stptr-spn+1;
+                   q = rpnstack -> s + stptr;
+                   while (p < q) {
+                           double      x = *q;
+                           
+                           *q-- = *p;
+                           *p++ = x;
+                   }
+               }
+               break;
+           case OP_TREND:
+               stackunderflow(1);
+               if ((rpi < 2) || (rpnp[rpi-2].op != OP_VARIABLE)) {
+                   rrd_set_error("malformed trend arguments");
+                   return -1;
+               } else {
+                   time_t dur = (time_t)rpnstack -> s[stptr];
+                   time_t step = (time_t)rpnp[rpi-2].step;
+
+                   if (output_idx > (int)ceil((float)dur / (float)step)) {
+                       double accum = 0.0;
+                       int i = 0;
+               
+                       do {
+                           accum += rpnp[rpi-2].data[rpnp[rpi-2].ds_cnt * i--];
+                           dur -= step;
+                       } while (dur > 0);
+
+                       rpnstack -> s[--stptr] = (accum / -i);
+                   } else
+                       rpnstack -> s[--stptr] = DNAN;
+               }
+               break;
+           case OP_AVG:
+               stackunderflow(0);
+                {
+                   int i=(int)rpnstack -> s[stptr--];
+                   double sum=0;
+                   int count=0;
+                   stackunderflow(i-1);
+                   while(i>0) {
+                     double val=rpnstack -> s[stptr--];
+                     i--;
+                    if (isnan(val)) { continue; }
+                     count++;
+                     sum+=val;
+                   }
+                   /* now push the result back on stack */
+                   if (count>0) {
+                     rpnstack -> s[++stptr]=sum/count;
+                   } else {
+                     rpnstack -> s[++stptr]=DNAN;
+                   }
+                }
+                break;
+            case OP_ABS:
+                stackunderflow(0);
+                rpnstack -> s[stptr] = fabs(rpnstack -> s[stptr]);
+                break;
+           case OP_END:
+               break;
+       }
+#undef stackunderflow
+   }
+   if(stptr!=0){
+       rrd_set_error("RPN final stack size != 1");
+       return -1;
+   }
+   
+   output[output_idx] = rpnstack->s[0];
+   return 0;
+}
+
+/* figure out what the local timezone offset for any point in
+   time was. Return it in seconds */
+int
+tzoffset( time_t now ){
+    int gm_sec, gm_min, gm_hour, gm_yday, gm_year,
+        l_sec, l_min, l_hour, l_yday, l_year;
+    struct tm t;
+    int off;
+    gmtime_r(&now, &t);
+    gm_sec = t.tm_sec;
+    gm_min = t.tm_min;
+    gm_hour = t.tm_hour;
+    gm_yday = t.tm_yday;
+    gm_year = t.tm_year;
+    localtime_r(&now, &t);
+    l_sec = t.tm_sec;
+    l_min = t.tm_min;
+    l_hour = t.tm_hour;
+    l_yday = t.tm_yday;
+    l_year = t.tm_year;
+    off = (l_sec-gm_sec)+(l_min-gm_min)*60+(l_hour-gm_hour)*3600; 
+    if ( l_yday > gm_yday || l_year > gm_year){
+        off += 24*3600;
+    } else if ( l_yday < gm_yday || l_year < gm_year){
+        off -= 24*3600;
+    }
+   return off;
+}
+
diff --git a/src/rrd_rpncalc.h b/src/rrd_rpncalc.h
new file mode 100644 (file)
index 0000000..d0f7be8
--- /dev/null
@@ -0,0 +1,59 @@
+/****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ ****************************************************************************
+ * rrd_rpncalc.h  RPN calculator functions
+ ****************************************************************************/
+#ifndef _RRD_RPNCALC_H
+#define _RRD_RPNCALC_H
+
+/* WARNING: if new operators are added, they MUST be added at the very end of the list.
+ * This is because COMPUTE (CDEF) DS store OP nodes by number (name is not
+ * an option due to limited par array size). OP nodes must have the same
+ * numeric values, otherwise the stored numbers will mean something different. */
+enum op_en {OP_NUMBER=0,OP_VARIABLE,OP_INF,OP_PREV,OP_NEGINF,
+           OP_UNKN,OP_NOW,OP_TIME,OP_ADD,OP_MOD,OP_SUB,OP_MUL,
+           OP_DIV,OP_SIN, OP_DUP, OP_EXC, OP_POP,
+           OP_COS,OP_LOG,OP_EXP,OP_LT,OP_LE,OP_GT,OP_GE,OP_EQ,OP_IF,
+           OP_MIN,OP_MAX,OP_LIMIT, OP_FLOOR, OP_CEIL,
+           OP_UN,OP_END,OP_LTIME,OP_NE,OP_ISINF,OP_PREV_OTHER,OP_COUNT,
+           OP_ATAN,OP_SQRT,OP_SORT,OP_REV,OP_TREND,
+           OP_ATAN2,OP_RAD2DEG,OP_DEG2RAD,
+           OP_AVG,OP_ABS};
+
+typedef struct rpnp_t {
+    enum op_en   op;
+    double val; /* value for a OP_NUMBER */
+    long ptr; /* pointer into the gdes array for OP_VAR */
+    double *data; /* pointer to the current value from OP_VAR DAS*/
+    long ds_cnt;   /* data source count for data pointer */
+    long step; /* time step for OP_VAR das */
+} rpnp_t;
+
+/* a compact representation of rpnp_t for computed data sources */
+typedef struct rpn_cdefds_t {
+    char op;  /* rpn operator type */
+    short val; /* used by OP_NUMBER and OP_VARIABLE */
+} rpn_cdefds_t;
+
+/* limit imposed by sizeof(rpn_cdefs_t) and rrd.ds_def.par */
+#define DS_CDEF_MAX_RPN_NODES 26 
+
+typedef struct rpnstack_t {
+    double *s;
+    long dc_stacksize;
+    long dc_stackblock;
+} rpnstack_t;
+
+void rpnstack_init(rpnstack_t *rpnstack);
+void rpnstack_free(rpnstack_t *rpnstack);
+
+void parseCDEF_DS(const char *def, rrd_t *rrd, int ds_idx);
+long lookup_DS(void *rrd_vptr, char *ds_name);
+
+short rpn_compact(rpnp_t *rpnp,rpn_cdefds_t **rpnc,short *count);
+rpnp_t * rpn_expand(rpn_cdefds_t *rpnc);
+void rpn_compact2str(rpn_cdefds_t *rpnc,ds_def_t *ds_def,char **str);
+rpnp_t * rpn_parse(void *key_hash,const char *const expr, long (*lookup)(void *,char *));
+short rpn_calc(rpnp_t *rpnp, rpnstack_t *rpnstack, long data_idx, rrd_value_t *output, int output_idx);
+
+#endif
diff --git a/src/rrd_thread_safe.c b/src/rrd_thread_safe.c
new file mode 100644 (file)
index 0000000..fb63f4d
--- /dev/null
@@ -0,0 +1,72 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ * This file:     Copyright 2003 Peter Stamfest <peter@stamfest.at> 
+ *                             & Tobias Oetiker
+ * Distributed under the GPL
+ *****************************************************************************
+ * rrd_thread_safe.c   Contains routines used when thread safety is required
+ *****************************************************************************
+ * $Id: rrd_thread_safe.c 1235 2007-11-20 00:15:07Z oetiker $
+ *************************************************************************** */
+
+#include <pthread.h>
+#include <string.h>
+/* #include <error.h> */
+#include "rrd.h"
+#include "rrd_tool.h"
+
+/* Key for the thread-specific rrd_context */
+static pthread_key_t context_key;
+
+/* Once-only initialisation of the key */
+static pthread_once_t context_key_once = PTHREAD_ONCE_INIT;
+
+/* Free the thread-specific rrd_context - we might actually use
+   rrd_free_context instead...
+ */
+static void context_destroy_context(void *ctx_)
+{
+    struct rrd_context *ctx = ctx_;
+    if (ctx) rrd_free_context(ctx);
+}
+
+/* Allocate the key */
+static void context_get_key()
+{
+    pthread_key_create(&context_key, context_destroy_context);
+}
+
+struct rrd_context *rrd_get_context(void) {
+    struct rrd_context *ctx;
+
+    pthread_once(&context_key_once, context_get_key);
+    ctx = pthread_getspecific(context_key);
+    if (!ctx) {
+       ctx = rrd_new_context();
+       pthread_setspecific(context_key, ctx);
+    } 
+    return ctx;
+}
+
+#ifdef HAVE_STRERROR_R
+const char *rrd_strerror(int err) {
+    struct rrd_context *ctx = rrd_get_context();
+    if (strerror_r(err, ctx->lib_errstr, ctx->errlen)) 
+         return "strerror_r faild. sorry!"; 
+    else 
+         return ctx->lib_errstr; 
+}
+#else
+#undef strerror
+const char *rrd_strerror(int err) {
+    static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
+    struct rrd_context *ctx;
+    ctx = rrd_get_context();
+    pthread_mutex_lock(&mtx);
+    strncpy(ctx->lib_errstr, strerror(err), ctx->errlen);
+    ctx->lib_errstr[ctx->errlen]='\0';
+    pthread_mutex_unlock(&mtx);
+    return ctx->lib_errstr;
+}
+#endif
+
diff --git a/src/rrd_thread_safe_nt.c b/src/rrd_thread_safe_nt.c
new file mode 100644 (file)
index 0000000..6e4c305
--- /dev/null
@@ -0,0 +1,142 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ * This file:     Copyright 2003 Peter Stamfest <peter@stamfest.at> 
+ *                             & Tobias Oetiker
+ * Distributed under the GPL
+ *****************************************************************************
+ * rrd_thread_safe.c   Contains routines used when thread safety is required
+ *                     for win32
+ *****************************************************************************
+ * $Id: rrd_thread_safe_nt.c 1235 2007-11-20 00:15:07Z oetiker $
+ *************************************************************************** */
+
+#include <windows.h>
+#include <string.h>
+/* #include <error.h> */
+#include "rrd.h"
+#include "rrd_tool.h"
+
+/* Key for the thread-specific rrd_context */
+static DWORD context_key;
+static CRITICAL_SECTION CriticalSection; 
+
+
+/* Once-only initialisation of the key */
+static DWORD context_key_once = 0;
+
+
+/* Free the thread-specific rrd_context - we might actually use
+   rrd_free_context instead...
+ */
+static void context_destroy_context(void)
+{
+       DeleteCriticalSection(&CriticalSection);
+    TlsFree(context_key);
+       context_key_once=0;
+}
+static void context_init_context(void)
+{
+       if (!InterlockedExchange(&context_key_once, 1)) {
+               context_key = TlsAlloc();
+               InitializeCriticalSection(&CriticalSection);
+               atexit(context_destroy_context);
+       }
+}
+struct rrd_context *rrd_get_context(void) {
+    struct rrd_context *ctx;
+               
+       context_init_context();
+    ctx = TlsGetValue(context_key);
+    if (!ctx) {
+               ctx = rrd_new_context();
+               TlsSetValue(context_key, ctx);
+    } 
+    return ctx;
+}
+#undef strerror
+const char *rrd_strerror(int err) {
+    struct rrd_context *ctx;
+       context_init_context();
+
+       ctx = rrd_get_context();
+
+    EnterCriticalSection(&CriticalSection); 
+    strncpy(ctx->lib_errstr, strerror(err), ctx->errlen);
+    ctx->lib_errstr[ctx->errlen] = '\0';
+    LeaveCriticalSection(&CriticalSection); 
+
+    return ctx->lib_errstr;
+}
+/*
+ * there much be a re-entrant version of these somewhere in win32 land
+ */
+struct tm* localtime_r(const time_t *timep, struct tm* result)
+{
+       struct tm *local;
+       context_init_context();
+
+       EnterCriticalSection(&CriticalSection);
+       local = localtime(timep);
+       memcpy(result,local,sizeof(struct tm));
+       LeaveCriticalSection(&CriticalSection);
+       return result;
+}
+char* ctime_r(const time_t *timep, char* result)
+{
+       char *local;
+       context_init_context();
+
+       EnterCriticalSection(&CriticalSection);
+       local = ctime(timep);
+       strcpy(result,local);
+       LeaveCriticalSection(&CriticalSection);
+       return result;
+}
+
+struct tm* gmtime_r(const time_t *timep, struct tm* result)
+{
+       struct tm *local;
+       context_init_context();
+
+       EnterCriticalSection(&CriticalSection);
+       local = gmtime(timep);
+       memcpy(result,local,sizeof(struct tm));
+       LeaveCriticalSection(&CriticalSection);
+       return result;
+}
+
+/* implementation from Apache's APR library */
+char *strtok_r(char *str, const char *sep, char **last)
+{
+    char *token;
+       context_init_context();
+
+
+    if (!str)           /* subsequent call */
+        str = *last;    /* start where we left off */
+
+    /* skip characters in sep (will terminate at '\0') */
+    while (*str && strchr(sep, *str))
+        ++str;
+
+    if (!*str)          /* no more tokens */
+        return NULL;
+
+    token = str;
+
+    /* skip valid token characters to terminate token and
+     * prepare for the next call (will terminate at '\0) 
+     */
+    *last = token + 1;
+    while (**last && !strchr(sep, **last))
+        ++*last;
+
+    if (**last) {
+        **last = '\0';
+        ++*last;
+    }
+
+    return token;
+}
+
diff --git a/src/rrd_tool.c b/src/rrd_tool.c
new file mode 100644 (file)
index 0000000..5dbef0e
--- /dev/null
@@ -0,0 +1,874 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_tool.c  Startup wrapper
+ *****************************************************************************/
+
+#include "rrd_tool.h"
+#include "rrd_xport.h"
+
+void PrintUsage(char *cmd);
+int CountArgs(char *aLine);
+int CreateArgs(char *, char *, int, char **);
+int HandleInputLine(int, char **, FILE*);
+int RemoteMode=0;
+int ChangeRoot=0;
+#define TRUE           1
+#define FALSE          0
+#define MAX_LENGTH     10000
+
+
+void PrintUsage(char *cmd)
+{
+
+    char help_main[] =
+          "RRDtool " PACKAGE_VERSION "  Copyright 1997-2007 by Tobias Oetiker <tobi@oetiker.ch>\n"
+           "               Compiled " __DATE__ " " __TIME__ "\n\n"
+          "Usage: rrdtool [options] command command_options\n\n";
+
+    char help_list[] =
+          "Valid commands: create, update, updatev, graph, dump, restore,\n"
+          "\t\tlast, lastupdate, first, info, fetch, tune,\n"
+          "\t\tresize, xport\n\n";
+
+    char help_listremote[] =
+           "Valid remote commands: quit, ls, cd, mkdir, pwd\n\n";
+
+
+    char help_create[] =
+          "* create - create a new RRD\n\n"
+          "\trrdtool create filename [--start|-b start time]\n"
+          "\t\t[--step|-s step]\n"
+          "\t\t[DS:ds-name:DST:dst arguments]\n" 
+          "\t\t[RRA:CF:cf arguments]\n\n";
+
+    char help_dump[] =
+          "* dump - dump an RRD to XML\n\n"
+          "\trrdtool dump filename.rrd >filename.xml\n\n";
+
+    char help_info[] =
+          "* info - returns the configuration and status of the RRD\n\n"
+          "\trrdtool info filename.rrd\n\n";
+
+    char help_restore[] =
+          "* restore - restore an RRD file from its XML form\n\n"
+          "\trrdtool restore [--range-check|-r] [--force-overwrite|-f] filename.xml filename.rrd\n\n";
+
+    char help_last[] =
+           "* last - show last update time for RRD\n\n"
+           "\trrdtool last filename.rrd\n\n";
+
+    char help_lastupdate[] =
+          "* lastupdate - returns the most recent datum stored for\n"
+          "  each DS in an RRD\n\n"
+          "\trrdtool lastupdate filename.rrd\n\n"; 
+
+    char help_first[] =
+           "* first - show first update time for RRA within an RRD\n\n"
+           "\trrdtool first filename.rrd [--rraindex number]\n\n";
+
+    char help_update[] =
+          "* update - update an RRD\n\n"
+          "\trrdtool update filename\n"
+          "\t\t--template|-t ds-name:ds-name:...\n"
+          "\t\ttime|N:value[:value...]\n\n"
+           "\t\tat-time@value[:value...]\n\n"
+          "\t\t[ time:value[:value...] ..]\n\n";
+    
+       char help_updatev[] =
+          "* updatev - a verbose version of update\n"
+          "\treturns information about values, RRAs, and datasources updated\n\n"
+          "\trrdtool updatev filename\n"
+          "\t\t--template|-t ds-name:ds-name:...\n"
+          "\t\ttime|N:value[:value...]\n\n"
+           "\t\tat-time@value[:value...]\n\n"
+          "\t\t[ time:value[:value...] ..]\n\n";
+    char help_fetch[] =
+          "* fetch - fetch data out of an RRD\n\n"
+          "\trrdtool fetch filename.rrd CF\n"
+          "\t\t[-r|--resolution resolution]\n"
+          "\t\t[-s|--start start] [-e|--end end]\n\n";
+
+/* break up very large strings (help_graph, help_tune) for ISO C89 compliance*/
+
+    char help_graph1[] =
+          "* graph - generate a graph from one or several RRD\n\n"
+          "\trrdtool graph filename [-s|--start seconds] [-e|--end seconds]\n"
+          "\t\t[-x|--x-grid x-axis grid and label]\n"
+          "\t\t[-Y|--alt-y-grid]\n"
+          "\t\t[-y|--y-grid y-axis grid and label]\n"
+          "\t\t[-v|--vertical-label string] [-w|--width pixels]\n"
+          "\t\t[-h|--height pixels] [-o|--logarithmic]\n"
+          "\t\t[-u|--upper-limit value] [-z|--lazy]\n"
+          "\t\t[-l|--lower-limit value] [-r|--rigid]\n"
+           "\t\t[-g|--no-legend]\n"
+          "\t\t[-F|--force-rules-legend]\n"
+           "\t\t[-j|--only-graph]\n";
+    char help_graph2[] =
+          "\t\t[-n|--font FONTTAG:size:font]\n"
+           "\t\t[-m|--zoom factor]\n"       
+          "\t\t[-A|--alt-autoscale]\n"
+          "\t\t[-M|--alt-autoscale-max]\n"
+          "\t\t[-R|--font-render-mode {normal,light,mono}]\n"
+          "\t\t[-B|--font-smoothing-threshold size]\n"
+          "\t\t[-E|--slope-mode]\n"
+          "\t\t[-N|--no-gridfit]\n"
+          "\t\t[-X|--units-exponent value]\n"
+          "\t\t[-L|--units-length value]\n"
+          "\t\t[-S|--step seconds]\n"     
+          "\t\t[-f|--imginfo printfstr]\n"
+          "\t\t[-a|--imgformat PNG]\n"
+          "\t\t[-c|--color COLORTAG#rrggbb[aa]] [-t|--title string]\n"
+          "\t\t[-W|--watermark string]\n"
+          "\t\t[DEF:vname=rrd:ds-name:CF]\n";
+    char help_graph3[] =
+          "\t\t[CDEF:vname=rpn-expression]\n"
+          "\t\t[VDEF:vdefname=rpn-expression]\n"
+          "\t\t[PRINT:vdefname:format]\n"
+          "\t\t[GPRINT:vdefname:format]\n"
+          "\t\t[COMMENT:text]\n"
+          "\t\t[SHIFT:vname:offset]\n"
+          "\t\t[TICK:vname#rrggbb[aa][:[fraction][:legend]]]\n"
+          "\t\t[HRULE:value#rrggbb[aa][:legend]]\n"
+          "\t\t[VRULE:value#rrggbb[aa][:legend]]\n"
+          "\t\t[LINE[width]:vname[#rrggbb[aa][:[legend][:STACK]]]]\n"
+          "\t\t[AREA:vname[#rrggbb[aa][:[legend][:STACK]]]]\n"
+          "\t\t[PRINT:vname:CF:format] (deprecated)\n"
+          "\t\t[GPRINT:vname:CF:format] (deprecated)\n"
+          "\t\t[STACK:vname[#rrggbb[aa][:legend]]] (deprecated)\n\n";
+
+    char help_tune1[] =
+          " * tune -  Modify some basic properties of an RRD\n\n"
+          "\trrdtool tune filename\n"
+          "\t\t[--heartbeat|-h ds-name:heartbeat]\n"
+          "\t\t[--data-source-type|-d ds-name:DST]\n"
+          "\t\t[--data-source-rename|-r old-name:new-name]\n"
+          "\t\t[--minimum|-i ds-name:min] [--maximum|-a ds-name:max]\n"
+          "\t\t[--deltapos scale-value] [--deltaneg scale-value]\n"
+          "\t\t[--failure-threshold integer]\n"
+          "\t\t[--window-length integer]\n"
+          "\t\t[--alpha adaptation-parameter]\n";
+    char help_tune2[] =
+          " * tune -  Modify some basic properties of an RRD\n\n"
+          "\t\t[--beta adaptation-parameter]\n"
+          "\t\t[--gamma adaptation-parameter]\n"
+          "\t\t[--gamma-deviation adaptation-parameter]\n"
+          "\t\t[--aberrant-reset ds-name]\n\n";
+
+    char help_resize[] =
+          " * resize - alter the length of one of the RRAs in an RRD\n\n"
+          "\trrdtool resize filename rranum GROW|SHRINK rows\n\n";
+
+    char help_xport[] =
+          "* xport - generate XML dump from one or several RRD\n\n"
+          "\trrdtool xport [-s|--start seconds] [-e|--end seconds]\n"
+          "\t\t[-m|--maxrows rows]\n"
+          "\t\t[--step seconds]\n"        
+          "\t\t[--enumds]\n"      
+          "\t\t[DEF:vname=rrd:ds-name:CF]\n"
+          "\t\t[CDEF:vname=rpn-expression]\n"
+           "\t\t[XPORT:vname:legend]\n\n";
+
+    char help_quit[] =
+          " * quit - closing a session in remote mode\n\n"
+          "\trrdtool quit\n\n";
+
+    char help_ls[] =
+          " * ls - lists all *.rrd files in current directory\n\n"
+          "\trrdtool ls\n\n";
+
+    char help_cd[] =
+          " * cd - changes the current directory\n\n"
+          "\trrdtool cd new directory\n\n";
+
+    char help_mkdir[] =
+          " * mkdir - creates a new directory\n\n"
+          "\trrdtool mkdir newdirectoryname\n\n";
+
+    char help_pwd[] =
+          " * pwd - returns the current working directory\n\n"
+          "\trrdtool pwd\n\n";
+
+    char help_lic[] =
+          "RRDtool is distributed under the Terms of the GNU General\n"
+          "Public License Version 2. (www.gnu.org/copyleft/gpl.html)\n\n"
+
+          "For more information read the RRD manpages\n\n";
+
+    enum { C_NONE, C_CREATE, C_DUMP, C_INFO, C_RESTORE, C_LAST,
+          C_LASTUPDATE, C_FIRST, C_UPDATE, C_FETCH, C_GRAPH, C_TUNE,
+          C_RESIZE, C_XPORT, C_QUIT, C_LS, C_CD, C_MKDIR, C_PWD,
+          C_UPDATEV };
+
+    int help_cmd = C_NONE;
+
+    if (cmd)
+       {
+           if (!strcmp(cmd,"create"))
+               help_cmd = C_CREATE;
+           else if (!strcmp(cmd,"dump"))
+               help_cmd = C_DUMP;
+           else if (!strcmp(cmd,"info"))
+               help_cmd = C_INFO;
+           else if (!strcmp(cmd,"restore"))
+               help_cmd = C_RESTORE;
+           else if (!strcmp(cmd,"last"))
+               help_cmd = C_LAST;
+           else if (!strcmp(cmd,"lastupdate"))
+               help_cmd = C_LASTUPDATE;
+           else if (!strcmp(cmd,"first"))
+               help_cmd = C_FIRST;
+           else if (!strcmp(cmd,"update"))
+               help_cmd = C_UPDATE;
+           else if (!strcmp(cmd,"updatev"))
+               help_cmd = C_UPDATEV;
+           else if (!strcmp(cmd,"fetch"))
+               help_cmd = C_FETCH;
+           else if (!strcmp(cmd,"graph"))
+               help_cmd = C_GRAPH;
+           else if (!strcmp(cmd,"tune"))
+               help_cmd = C_TUNE;
+           else if (!strcmp(cmd,"resize"))
+               help_cmd = C_RESIZE;
+           else if (!strcmp(cmd,"xport"))
+               help_cmd = C_XPORT;
+            else if (!strcmp(cmd,"quit"))
+                help_cmd = C_QUIT;
+            else if (!strcmp(cmd,"ls"))
+                help_cmd = C_LS;
+            else if (!strcmp(cmd,"cd"))
+                help_cmd = C_CD;
+            else if (!strcmp(cmd,"mkdir"))
+                help_cmd = C_MKDIR;
+            else if (!strcmp(cmd,"pwd"))
+                help_cmd = C_PWD;
+       }
+    fputs(help_main, stdout);
+    switch (help_cmd)
+       {
+           case C_NONE:
+               fputs(help_list, stdout);
+                if (RemoteMode){
+                   fputs(help_listremote, stdout);
+                }
+               break;
+           case C_CREATE:
+               fputs(help_create, stdout);
+               break;
+           case C_DUMP:
+               fputs(help_dump, stdout);
+               break;
+           case C_INFO:
+               fputs(help_info, stdout);
+               break;
+           case C_RESTORE:
+               fputs(help_restore, stdout);
+               break;
+           case C_LAST:
+               fputs(help_last, stdout);
+               break;
+           case C_LASTUPDATE:
+               fputs(help_lastupdate, stdout);
+               break;
+           case C_FIRST:
+               fputs(help_first, stdout);
+               break;
+           case C_UPDATE:
+               fputs(help_update, stdout);
+               break;
+           case C_UPDATEV:
+               fputs(help_updatev, stdout);
+               break;
+           case C_FETCH:
+               fputs(help_fetch, stdout);
+               break;
+           case C_GRAPH:
+               fputs(help_graph1, stdout);
+               fputs(help_graph2, stdout);
+               fputs(help_graph3, stdout);
+               break;
+           case C_TUNE:
+               fputs(help_tune1, stdout);
+               fputs(help_tune2, stdout);
+               break;
+           case C_RESIZE:
+               fputs(help_resize, stdout);
+               break;
+           case C_XPORT:
+               fputs(help_xport, stdout);
+               break;
+           case C_QUIT:
+               fputs(help_quit, stdout);
+               break;
+           case C_LS:
+               fputs(help_ls, stdout);
+               break;
+           case C_CD:
+               fputs(help_cd, stdout);
+               break;
+           case C_MKDIR:
+               fputs(help_mkdir, stdout);
+               break;
+           case C_PWD:
+               fputs(help_pwd, stdout);
+               break;
+       }
+    fputs(help_lic, stdout);
+}
+
+static char *fgetslong(char **aLinePtr, FILE *stream)
+{
+   char *linebuf;
+   size_t bufsize = MAX_LENGTH;
+   int eolpos = 0;
+
+   if (feof(stream)) return *aLinePtr = 0;
+   if (!(linebuf = malloc(bufsize))) {
+      perror("fgetslong: malloc");
+      exit(1);
+   }
+   linebuf[0] = '\0';
+   while (fgets(linebuf + eolpos, MAX_LENGTH, stream)) {
+      eolpos += strlen(linebuf + eolpos);
+      if (linebuf[eolpos - 1] == '\n') return *aLinePtr = linebuf;
+      bufsize += MAX_LENGTH;
+      if (!(linebuf = realloc(linebuf, bufsize))) {
+         perror("fgetslong: realloc");
+         exit(1);
+      }
+   }
+   return *aLinePtr = linebuf[0] ? linebuf : 0;
+}
+
+int main(int argc, char *argv[])
+{
+    char **myargv;
+    char *aLine;
+    char *firstdir="";
+#ifdef MUST_DISABLE_SIGFPE
+    signal(SIGFPE,SIG_IGN);
+#endif
+#ifdef MUST_DISABLE_FPMASK
+    fpsetmask(0);
+#endif
+    if (argc == 1)
+       {
+           PrintUsage("");
+           return 0;
+       }
+    
+    if (((argc == 2)||(argc == 3)) && !strcmp("-",argv[1]))
+       {
+#if HAVE_GETRUSAGE
+         struct rusage  myusage;
+         struct timeval starttime;
+         struct timeval currenttime;
+
+         gettimeofday(&starttime, NULL);
+#endif
+         RemoteMode=1;
+          if ((argc == 3) && strcmp("",argv[2])){
+
+             if (
+#ifdef HAVE_GETUID
+                getuid()
+#else
+                1
+#endif
+                == 0 ){
+
+#ifdef HAVE_CHROOT
+                chroot(argv[2]);
+                if (errno!=0){
+                   fprintf(stderr,"ERROR: can't change root to '%s' errno=%d\n",
+                           argv[2],errno);
+                    exit(errno);
+                }
+                ChangeRoot=1;
+                firstdir="/";
+#else
+                fprintf(stderr,"ERROR: change root is not supported by your OS "
+                         "or at least by this copy of rrdtool\n");
+                exit(1);
+#endif
+             } else {
+                firstdir=argv[2];
+             }
+          }
+          if (strcmp(firstdir,"")){
+             chdir(firstdir);
+             if (errno!=0){
+                fprintf(stderr,"ERROR: %s\n",rrd_strerror(errno));
+                exit(errno);
+             }
+          }
+
+           while (fgetslong(&aLine, stdin)){
+               if ((argc = CountArgs(aLine)) == 0)  {
+                   printf("ERROR: not enough arguments\n");
+               }
+               if ((myargv = (char **) malloc((argc+1) * 
+                                              sizeof(char *))) == NULL)   {
+                   perror("malloc");
+                   exit(1);
+               }
+               if ((argc=CreateArgs(argv[0], aLine, argc, myargv)) < 0) {
+                   printf("ERROR: creating arguments\n");
+               } else {
+                   int ret = HandleInputLine(argc, myargv, stdout);
+                   free(myargv);
+                   if (ret == 0){
+                       
+
+#if HAVE_GETRUSAGE
+                    getrusage(RUSAGE_SELF,&myusage);
+                    gettimeofday(&currenttime,NULL);
+                    printf("OK u:%1.2f s:%1.2f r:%1.2f\n",
+                      (double)myusage.ru_utime.tv_sec+
+                      (double)myusage.ru_utime.tv_usec/1000000.0,
+                      (double)myusage.ru_stime.tv_sec+
+                      (double)myusage.ru_stime.tv_usec/1000000.0,
+                      (double)(currenttime.tv_sec-starttime.tv_sec)
+                      +(double)(currenttime.tv_usec-starttime.tv_usec)
+                      /1000000.0);
+#else
+                     printf("OK\n");
+                   
+#endif          
+                 }
+               }
+               fflush(stdout); /* this is important for pipes to work */
+                free(aLine);
+           }
+       }
+    else if (argc == 2)
+       {
+               PrintUsage(argv[1]);
+               exit(0);
+       }
+    else if (argc == 3 && !strcmp(argv[1],"help"))
+       {
+               PrintUsage(argv[2]);
+               exit(0);
+       }
+    else {
+        exit(HandleInputLine(argc, argv, stderr));
+    }
+    return 0;
+}
+
+/* HandleInputLine is NOT thread safe - due to readdir issues,
+   resolving them portably is not really simple. */
+int HandleInputLine(int argc, char **argv, FILE* out)
+{
+#if defined(HAVE_OPENDIR) && defined (HAVE_READDIR)
+    DIR           *curdir; /* to read current dir with ls */
+    struct dirent *dent;
+#endif
+#if defined(HAVE_SYS_STAT_H)
+    struct stat   st;
+#endif
+    char* cwd; /* To hold current working dir on call to pwd */
+
+    /* Reset errno to 0 before we start.
+    */
+    errno = 0;
+
+    if (RemoteMode){
+       if (argc>1 && strcmp("quit", argv[1]) == 0){
+          if (argc>2){
+             printf("ERROR: invalid parameter count for quit\n");
+             return(1);
+          }
+          exit(0);
+       }
+#if defined(HAVE_OPENDIR) && defined(HAVE_READDIR) && defined(HAVE_CHDIR)
+       if (argc>1 && strcmp("cd", argv[1]) == 0){
+          if (argc>3){
+             printf("ERROR: invalid parameter count for cd\n");
+             return(1);
+          }
+#if ! defined(HAVE_CHROOT) || ! defined(HAVE_GETUID)
+          if (getuid()==0 && ! ChangeRoot){
+             printf("ERROR: chdir security problem - rrdtool is running as "
+                    "root but not chroot!\n");
+             return(1); 
+          }
+#endif
+          chdir(argv[2]);
+          if (errno!=0){
+             printf("ERROR: %s\n",rrd_strerror(errno));
+            return(1);
+          }
+          return(0);
+       }
+       if (argc>1 && strcmp("pwd", argv[1]) == 0){
+          if (argc>2){
+             printf("ERROR: invalid parameter count for pwd\n");
+             return(1);
+          }
+          cwd = getcwd(NULL, MAXPATH);
+          if(cwd == NULL) {
+             printf("ERROR: %s\n",rrd_strerror(errno));
+             return(1);
+          }
+          printf("%s\n", cwd);
+          free(cwd);
+          return(0);
+       }
+       if (argc>1 && strcmp("mkdir", argv[1]) == 0){
+          if (argc>3){
+             printf("ERROR: invalid parameter count for mkdir\n");
+             return(1);
+          }
+#if ! defined(HAVE_CHROOT) || ! defined(HAVE_GETUID)
+          if (getuid()==0 && ! ChangeRoot){
+             printf("ERROR: mkdir security problem - rrdtool is running as "
+                    "root but not chroot!\n");
+             return(1); 
+          }
+#endif
+          mkdir(argv[2],0777);
+          if (errno!=0){
+             printf("ERROR: %s\n",rrd_strerror(errno));
+             return(1);
+          }
+          return(0);
+       }
+       if (argc>1 && strcmp("ls", argv[1]) == 0){
+          if (argc>2){
+             printf("ERROR: invalid parameter count for ls\n");
+             return(1);
+          }
+          if ((curdir=opendir("."))!=NULL){
+             while((dent=readdir(curdir))!=NULL){
+                if (!stat(dent->d_name,&st)){
+                   if (S_ISDIR(st.st_mode)){
+                      printf("d %s\n",dent->d_name);
+                   }
+                   if (strlen(dent->d_name)>4 && S_ISREG(st.st_mode)){
+                      if (!strcmp(dent->d_name+NAMLEN(dent)-4,".rrd") ||
+                          !strcmp(dent->d_name+NAMLEN(dent)-4,".RRD")){
+                         printf("- %s\n",dent->d_name);
+                      }
+                   }
+                }
+             }
+            closedir(curdir);
+          }
+          else{
+             printf("ERROR: %s\n",rrd_strerror(errno));
+             return(errno);
+          }
+          return(0);
+       }
+#endif /* opendir and readdir */
+
+    }
+    if (argc < 3 
+       || strcmp("help", argv[1]) == 0
+       || strcmp("--help", argv[1]) == 0
+       || strcmp("-help", argv[1]) == 0
+       || strcmp("-?", argv[1]) == 0
+       || strcmp("-h", argv[1]) == 0 ) {
+       PrintUsage("");
+       return 0;
+    }
+    
+    if (strcmp("create", argv[1]) == 0)        
+       rrd_create(argc-1, &argv[1]);
+    else if (strcmp("dump", argv[1]) == 0)
+       rrd_dump(argc-1, &argv[1]);
+    else if (strcmp("info", argv[1]) == 0 
+               || strcmp("updatev", argv[1]) == 0){
+       info_t *data,*save;
+       if (strcmp("info",argv[1]) == 0)
+          data=rrd_info(argc-1, &argv[1]);
+    else
+          data=rrd_update_v(argc-1, &argv[1]);
+       while (data) {
+           save=data;
+           printf ("%s = ", data->key);
+           free(data->key);
+           
+           switch (data->type) {
+           case RD_I_VAL:
+               if (isnan (data->value.u_val))
+                   printf("NaN");
+               else
+                   printf ("%0.10e", data->value.u_val);
+               break;
+           case RD_I_CNT:
+               printf ("%lu", data->value.u_cnt);
+               break;
+           case RD_I_INT:
+               printf ("%d", data->value.u_int);
+               break;
+           case RD_I_STR:
+               printf ("\"%s\"", data->value.u_str);
+               free(data->value.u_str);
+               break;
+           }
+           data = data->next;
+           free(save);
+           printf ("\n");
+       }
+       free(data);
+    }
+
+    else if (strcmp("--version", argv[1]) == 0 ||
+            strcmp("version", argv[1]) == 0 || 
+            strcmp("v", argv[1]) == 0 ||
+            strcmp("-v", argv[1]) == 0  ||
+            strcmp("-version", argv[1]) == 0  )
+        printf("RRDtool " PACKAGE_VERSION "  Copyright by Tobi Oetiker, 1997-2005 (%f)\n",
+               rrd_version());
+    else if (strcmp("restore", argv[1]) == 0)
+       rrd_restore(argc-1, &argv[1]);
+    else if (strcmp("resize", argv[1]) == 0)
+       rrd_resize(argc-1, &argv[1]);
+    else if (strcmp("last", argv[1]) == 0)
+        printf("%ld\n",rrd_last(argc-1, &argv[1]));
+    else if (strcmp("lastupdate", argv[1]) == 0) {
+          time_t      last_update;
+           char        **ds_namv;
+           char        **last_ds;
+           unsigned long ds_cnt,
+                       i;
+          if (rrd_lastupdate(argc-1, &argv[1], &last_update,
+                       &ds_cnt, &ds_namv, &last_ds) == 0) {
+               for (i=0; i<ds_cnt; i++)
+                       printf(" %s", ds_namv[i]);
+               printf("\n\n");
+               printf("%10lu:", last_update);
+               for (i=0; i<ds_cnt; i++) {
+                       printf(" %s", last_ds[i]);
+                       free(last_ds[i]);
+                       free(ds_namv[i]);
+               }
+               printf("\n");
+               free(last_ds);
+               free(ds_namv);
+          }
+    } else if (strcmp("first", argv[1]) == 0)
+        printf("%ld\n",rrd_first(argc-1, &argv[1]));
+    else if (strcmp("update", argv[1]) == 0)
+       rrd_update(argc-1, &argv[1]);
+    else if (strcmp("fetch", argv[1]) == 0) {
+       time_t        start,end, ti;
+       unsigned long step, ds_cnt,i,ii;
+       rrd_value_t   *data,*datai;
+       char          **ds_namv;
+       if (rrd_fetch(argc-1, &argv[1],&start,&end,&step,&ds_cnt,&ds_namv,&data) != -1) {
+           datai=data;
+           printf("           ");
+           for (i = 0; i<ds_cnt;i++)
+               printf("%20s",ds_namv[i]);
+           printf ("\n\n");
+           for (ti = start+step; ti <= end; ti += step){
+               printf("%10lu:", ti);
+               for (ii = 0; ii < ds_cnt; ii++)
+                   printf(" %0.10e", *(datai++));
+               printf("\n");
+           }
+           for (i=0;i<ds_cnt;i++)
+                 free(ds_namv[i]);
+           free(ds_namv);
+           free (data);
+       }
+    } else if (strcmp("xport", argv[1]) == 0) {
+        int xxsize;
+       unsigned long int j = 0;
+       time_t        start,end, ti;
+       unsigned long step, col_cnt,row_cnt;
+       rrd_value_t   *data,*ptr;
+       char          **legend_v;
+        int           enumds = 0;
+        int           i;
+        size_t       vtag_s = strlen(COL_DATA_TAG) + 10; 
+        char         *vtag = malloc(vtag_s); 
+       for ( i = 2; i < argc; i++){
+               if (strcmp("--enumds", argv[i]) == 0)
+                       enumds = 1;
+       }
+
+        if(rrd_xport(argc-1, &argv[1], &xxsize,&start,&end,&step,&col_cnt,&legend_v,&data) != -1) {
+         row_cnt = (end-start)/step;
+         ptr = data;
+         printf("<?xml version=\"1.0\" encoding=\"%s\"?>\n\n", XML_ENCODING);
+         printf("<%s>\n", ROOT_TAG);
+         printf("  <%s>\n", META_TAG);
+         printf("    <%s>%lu</%s>\n", META_START_TAG, start+step, META_START_TAG);
+         printf("    <%s>%lu</%s>\n", META_STEP_TAG, step, META_STEP_TAG);
+         printf("    <%s>%lu</%s>\n", META_END_TAG, end, META_END_TAG);
+         printf("    <%s>%lu</%s>\n", META_ROWS_TAG, row_cnt, META_ROWS_TAG);
+         printf("    <%s>%lu</%s>\n", META_COLS_TAG, col_cnt, META_COLS_TAG);
+         printf("    <%s>\n", LEGEND_TAG);
+         for (j = 0; j < col_cnt; j++) {
+           char *entry = NULL;
+           entry = legend_v[j];
+           printf("      <%s>%s</%s>\n", LEGEND_ENTRY_TAG, entry, LEGEND_ENTRY_TAG);
+           free(entry);
+         }
+         free(legend_v);
+         printf("    </%s>\n", LEGEND_TAG);
+         printf("  </%s>\n", META_TAG);
+         printf("  <%s>\n", DATA_TAG);
+         for (ti = start+step; ti <= end; ti += step) {
+           printf ("    <%s>", DATA_ROW_TAG);
+           printf ("<%s>%lu</%s>", COL_TIME_TAG, ti, COL_TIME_TAG);
+           for (j = 0; j < col_cnt; j++) {
+             rrd_value_t newval = DNAN;
+              if (enumds == 1)
+               snprintf(vtag,vtag_s,"%s%lu", COL_DATA_TAG, j);
+             else
+               snprintf(vtag,vtag_s,"%s",COL_DATA_TAG);
+              
+             newval = *ptr;
+             if(isnan(newval)){
+                printf("<%s>NaN</%s>", vtag,vtag);
+             } else {
+               printf("<%s>%0.10e</%s>", vtag, newval, vtag);
+             };
+             ptr++;
+           }
+           printf("</%s>\n", DATA_ROW_TAG);
+         }
+         free(data);
+         printf("  </%s>\n", DATA_TAG);
+         printf("</%s>\n", ROOT_TAG);
+       }
+        free(vtag);
+    }
+    else if (strcmp("graph", argv[1]) == 0) {
+       char **calcpr;
+#ifdef notused  /*XXX*/
+       const char *imgfile = argv[2]; /* rrd_graph changes argv pointer */
+#endif
+       int xsize, ysize;
+       double ymin,ymax;
+       int i;
+       int tostdout = (strcmp(argv[2],"-") == 0);      
+       int imginfo = 0;
+       for (i=2;i<argc;i++){
+               if (strcmp(argv[i],"--imginfo") == 0 || strcmp(argv[i],"-f") == 0){
+                       imginfo = 1;
+                       break;
+               }
+       }
+       if( rrd_graph(argc-1, &argv[1], &calcpr, &xsize, &ysize, NULL, &ymin, &ymax) != -1 ) {
+           if (!tostdout && !imginfo) 
+               printf ("%dx%d\n",xsize,ysize);
+           if (calcpr) {
+               for(i=0;calcpr[i];i++){
+                   if (!tostdout) 
+                       printf("%s\n",calcpr[i]);
+                   free(calcpr[i]);
+               } 
+               free(calcpr);
+           }
+       }
+       
+    } else if (strcmp("tune", argv[1]) == 0) 
+               rrd_tune(argc-1, &argv[1]);
+    else {
+               rrd_set_error("unknown function '%s'",argv[1]);
+    }
+    if (rrd_test_error()) {
+       fprintf(out, "ERROR: %s\n",rrd_get_error());
+       rrd_clear_error();
+       return 1;
+    }
+    return(0);
+}
+
+int CountArgs(char *aLine)
+{
+    int i=0;
+    int aCount = 0;
+    int inarg = 0;
+    while (aLine[i] == ' ') i++;
+    while (aLine[i] != 0){       
+       if((aLine[i]== ' ') && inarg){
+           inarg = 0;
+       }
+       if((aLine[i]!= ' ') && ! inarg){
+           inarg = 1;
+           aCount++;
+       }
+       i++;
+    }
+    return aCount;
+}
+
+/*
+ * CreateArgs - take a string (aLine) and tokenize
+ */
+int CreateArgs(char *pName, char *aLine, int argc, char **argv)
+{
+    char       *getP, *putP;
+    char       **pargv = argv;
+    char        Quote = 0;
+    int inArg = 0;
+    int        len;
+
+    len = strlen(aLine);
+    /* remove trailing space and newlines */
+    while (len && aLine[len] <= ' ') {
+       aLine[len] = 0 ; len--;
+    }
+    /* sikp leading blanks */
+    while (*aLine && *aLine <= ' ') aLine++;
+
+    pargv[0] = pName;
+    argc = 1;
+    getP = aLine;
+    putP = aLine;
+    while (*getP){
+       switch (*getP) {
+       case ' ': 
+           if (Quote){
+               *(putP++)=*getP;
+           } else 
+               if(inArg) {
+                   *(putP++) = 0;
+                   inArg = 0;
+               }
+           break;
+       case '"':
+       case '\'':
+           if (Quote != 0) {
+               if (Quote == *getP) 
+                   Quote = 0;
+               else {
+                   *(putP++)=*getP;
+               }
+           } else {
+               if(!inArg){
+                   pargv[argc++] = putP;
+                   inArg=1;
+               }           
+               Quote = *getP;
+           }
+           break;
+       default:
+           if(!inArg){
+               pargv[argc++] = putP;
+               inArg=1;
+           }
+           *(putP++)=*getP;
+           break;
+       }
+       getP++;
+    }
+
+    *putP = '\0';
+
+    if (Quote) 
+       return -1;
+    else
+       return argc;
+}
+
+
diff --git a/src/rrd_tool.h b/src/rrd_tool.h
new file mode 100644 (file)
index 0000000..852bfec
--- /dev/null
@@ -0,0 +1,207 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_tool.h   Common Header File
+ *****************************************************************************/
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+
+#ifndef _RRD_TOOL_H
+#define _RRD_TOOL_H
+
+#ifdef HAVE_CONFIG_H
+#include "../rrd_config.h"
+#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+#include "../win32/config.h"
+#endif
+
+#ifdef MUST_DISABLE_SIGFPE
+#include <signal.h>
+#endif
+
+#ifdef MUST_DISABLE_FPMASK
+#include <floatingpoint.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <ctype.h>
+
+#if HAVE_SYS_PARAM_H
+#  include <sys/param.h>
+#endif
+
+#ifndef MAXPATH
+#  define MAXPATH 1024
+#endif
+
+#if HAVE_MATH_H
+# include <math.h>
+#endif
+/* Sorry: don't know autoconf as well how to check the exist of
+   dirent.h ans sys/stat.h
+*/
+
+#if HAVE_DIRENT_H
+# include <dirent.h>
+# define NAMLEN(dirent) strlen((dirent)->d_name)
+#else
+# define dirent direct
+# define NAMLEN(dirent) (dirent)->d_namlen
+# if HAVE_SYS_NDIR_H
+#  include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+#  include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+#  include <ndir.h>
+# endif
+#endif
+
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#if HAVE_SYS_TIMES_H
+# include <sys/times.h>
+#endif
+
+
+#if HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#if (defined(__svr4__) && defined(__sun__))
+/* Solaris headers (pre 2.6) don't have a getrusage prototype.
+   Use this instead. */
+extern int getrusage(int, struct rusage *);
+#endif /* __svr4__ && __sun__ */
+#endif
+
+#include "rrd.h"
+
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+
+/* Win32 only includes */
+
+#include <float.h>        /* for _isnan  */
+#include <io.h>           /* for chdir   */
+
+struct tm* localtime_r(const time_t *timep, struct tm* result);
+char* ctime_r(const time_t *timep, char* result);
+struct tm* gmtime_r(const time_t *timep, struct tm* result);
+char *strtok_r(char *str, const char *sep, char **last);
+
+#else
+
+/* unix-only includes */
+#if !defined isnan && !defined HAVE_ISNAN
+int isnan(double value);
+#endif
+
+#endif
+
+/* local include files -- need to be after the system ones */
+#include "rrd_getopt.h"
+#include "rrd_format.h"
+
+#ifndef max
+#define max(a,b) ((a) > (b) ? (a) : (b))
+#endif
+
+#ifndef min
+#define min(a,b) ((a) < (b) ? (a) : (b))
+#endif                                                   
+
+#define DIM(x) (sizeof(x)/sizeof(x[0]))
+
+/* rrd info interface */
+enum info_type   { RD_I_VAL=0,
+              RD_I_CNT,
+              RD_I_STR, 
+                  RD_I_INT };
+
+typedef union infoval { 
+    unsigned long u_cnt; 
+    rrd_value_t   u_val;
+    char         *u_str;
+    int                  u_int;
+} infoval;
+
+typedef struct info_t {
+    char            *key;
+    enum info_type  type;
+    union infoval   value;
+    struct info_t   *next;
+} info_t;
+
+info_t *rrd_info(int, char **);
+int rrd_lastupdate(int argc, char **argv, time_t *last_update,
+                unsigned long *ds_cnt, char ***ds_namv, char ***last_ds);
+info_t *rrd_update_v(int, char **);
+char * sprintf_alloc(char *, ...);
+info_t *info_push(info_t *, char *, enum info_type, infoval);
+
+/* HELPER FUNCTIONS */
+
+int PngSize(FILE *, long *, long *);
+
+int rrd_create_fn(const char *file_name, rrd_t *rrd);
+int rrd_fetch_fn(const char *filename, enum cf_en cf_idx,
+                time_t *start,time_t *end,
+                unsigned long *step,
+                unsigned long *ds_cnt,
+                char        ***ds_namv,
+                rrd_value_t **data);
+
+void rrd_free(rrd_t *rrd);
+void rrd_freemem(void *mem);
+void rrd_init(rrd_t *rrd);
+
+int rrd_open(const char *file_name, FILE **in_file, rrd_t *rrd, int rdwr);
+int readfile(const char *file, char **buffer, int skipfirst);
+
+#define RRD_READONLY    0
+#define RRD_READWRITE   1
+
+enum cf_en cf_conv(const char *string);
+enum dst_en dst_conv(char *string);
+long ds_match(rrd_t *rrd,char *ds_nam);
+double rrd_diff(char *a, char *b);
+
+    /* rrd_strerror is thread safe, but still it uses a global buffer
+       (but one per thread), thus subsequent calls within a single
+       thread overwrite the same buffer */
+const char *rrd_strerror(int err);
+
+#endif
+
+#ifdef  __cplusplus
+}
+#endif
diff --git a/src/rrd_tune.c b/src/rrd_tune.c
new file mode 100644 (file)
index 0000000..3d9f4d9
--- /dev/null
@@ -0,0 +1,406 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * change header parameters of an rrd
+ *****************************************************************************
+ * $Id: rrd_tune.c 1235 2007-11-20 00:15:07Z oetiker $
+ * $Log$
+ * Revision 1.6  2004/05/26 22:11:12  oetiker
+ * reduce compiler warnings. Many small fixes. -- Mike Slifcak <slif@bellsouth.net>
+ *
+ * Revision 1.5  2002/02/01 20:34:49  oetiker
+ * fixed version number and date/time
+ *
+ * Revision 1.4  2001/08/22 22:29:07  jake
+ * Contents of this patch:
+ * (1) Adds/revises documentation for rrd tune in rrd_tool.c and pod files.
+ * (2) Moves some initialization code from rrd_create.c to rrd_hw.c.
+ * (3) Adds another pass to smoothing for SEASONAL and DEVSEASONAL RRAs.
+ * This pass computes the coefficients as deviations from an average; the
+ * average is added the baseline coefficient of HWPREDICT. Statistical texts
+ * suggest this to preserve algorithm stability. It will not invalidate
+ * RRD files created and smoothed with the old code.
+ * (4) Adds the aberrant-reset flag to rrd tune. This operation, which is
+ * specified for a single data source, causes the holt-winters algorithm to
+ * forget everthing it has learned and start over.
+ * (5) Fixes a few out-of-date code comments.
+ *
+ * Revision 1.3  2001/03/07 21:21:54  oetiker
+ * complete rewrite of rrdgraph documentation. This also includs info
+ * on upcomming/planned changes to the rrdgraph interface and functionality
+ * -- Alex van den Bogaerdt <alex@slot.hollandcasino.nl>
+ *
+ * Revision 1.2  2001/03/04 13:01:55  oetiker
+ * Aberrant Behavior Detection support. A brief overview added to rrdtool.pod.
+ * Major updates to rrd_update.c, rrd_create.c. Minor update to other core files.
+ * This is backwards compatible! But new files using the Aberrant stuff are not readable
+ * by old rrdtool versions. See http://cricket.sourceforge.net/aberrant/rrd_hw.htm
+ * -- Jake Brutlag <jakeb@corp.webtv.net>
+ *
+ *****************************************************************************/
+
+#include "rrd_tool.h"
+#include "rrd_rpncalc.h"
+#include "rrd_hw.h"
+
+int set_hwarg(rrd_t *rrd,enum cf_en cf,enum rra_par_en rra_par,char *arg);
+int set_deltaarg(rrd_t *rrd,enum rra_par_en rra_par,char *arg);
+int set_windowarg(rrd_t *rrd,enum rra_par_en,char *arg);
+
+int
+rrd_tune(int argc, char **argv)    
+{   
+    rrd_t               rrd;
+    FILE               *rrd_file;
+    int                 matches;
+    int                 optcnt = 0;
+    long                ds;
+    char                ds_nam[DS_NAM_SIZE];
+    char                ds_new[DS_NAM_SIZE];
+    long                heartbeat;
+    double              min;
+    double              max;
+    char                dst[DST_SIZE];
+    optind = 0; opterr = 0;  /* initialize getopt */
+
+
+    if(rrd_open(argv[1],&rrd_file,&rrd, RRD_READWRITE)==-1){
+        return -1;
+    }
+
+    
+    while (1){
+       static struct option long_options[] =
+       {
+           {"heartbeat",        required_argument, 0, 'h'},
+           {"minimum",          required_argument, 0, 'i'},
+           {"maximum",          required_argument, 0, 'a'},
+           {"data-source-type", required_argument, 0, 'd'},
+           {"data-source-rename", required_argument, 0, 'r'},
+           /* added parameter tuning options for aberrant behavior detection */
+               {"deltapos",required_argument,0,'p'},
+               {"deltaneg",required_argument,0,'n'},
+               {"window-length",required_argument,0,'w'},
+               {"failure-threshold",required_argument,0,'f'},
+           {"alpha",required_argument,0,'x'},
+           {"beta",required_argument,0,'y'},
+           {"gamma",required_argument,0,'z'},
+           {"gamma-deviation",required_argument,0,'v'},
+               {"aberrant-reset",required_argument,0,'b'},
+           {0,0,0,0}
+       };
+       int option_index = 0;
+       int opt;
+       opt = getopt_long(argc, argv, "h:i:a:d:r:p:n:w:f:x:y:z:v:b:", 
+                         long_options, &option_index);
+       if (opt == EOF)
+           break;
+       
+       optcnt++;
+       switch(opt) {       
+       case 'h':
+           if ((matches = sscanf(optarg, DS_NAM_FMT ":%ld",ds_nam,&heartbeat)) != 2){
+               rrd_set_error("invalid arguments for heartbeat");
+               rrd_free(&rrd);
+               fclose(rrd_file);
+               return -1;
+           }
+           if ((ds=ds_match(&rrd,ds_nam))==-1){
+               rrd_free(&rrd);
+                fclose(rrd_file);
+               return -1;
+           }
+           rrd.ds_def[ds].par[DS_mrhb_cnt].u_cnt = heartbeat;
+           break;
+
+       case 'i':
+           if ((matches = sscanf(optarg,DS_NAM_FMT ":%lf",ds_nam,&min)) <1){
+               rrd_set_error("invalid arguments for minimum ds value");
+               rrd_free(&rrd);
+                fclose(rrd_file);
+               return -1;
+           }
+           if ((ds=ds_match(&rrd,ds_nam))==-1){
+               rrd_free(&rrd);
+                fclose(rrd_file);
+               return -1;
+           }
+
+           if(matches == 1)
+               min= DNAN;
+           rrd.ds_def[ds].par[DS_min_val].u_val = min;
+           break;
+
+       case 'a':
+           if ((matches = sscanf(optarg, DS_NAM_FMT ":%lf",ds_nam,&max)) <1){
+               rrd_set_error("invalid arguments for maximum ds value");
+               rrd_free(&rrd);
+               fclose(rrd_file);
+               return -1;
+           }
+           if ((ds=ds_match(&rrd,ds_nam))==-1){
+               rrd_free(&rrd);
+               fclose(rrd_file);
+               return -1;
+           }
+           if(matches == 1) 
+               max= DNAN; 
+           rrd.ds_def[ds].par[DS_max_val].u_val = max;
+           break;
+
+       case 'd':
+           if ((matches = sscanf(optarg, DS_NAM_FMT ":" DST_FMT ,ds_nam,dst)) != 2){
+               rrd_set_error("invalid arguments for data source type");
+               rrd_free(&rrd);
+               fclose(rrd_file);
+               return -1;
+           }
+           if ((ds=ds_match(&rrd,ds_nam))==-1){
+               rrd_free(&rrd);
+               fclose(rrd_file);
+               return -1;
+           }
+           if ((int)dst_conv(dst) == -1){
+               rrd_free(&rrd);
+               fclose(rrd_file);
+               return -1;
+           }
+           strncpy(rrd.ds_def[ds].dst,dst,DST_SIZE-1);
+           rrd.ds_def[ds].dst[DST_SIZE-1]='\0';
+
+           rrd.pdp_prep[ds].last_ds[0] = 'U';
+           rrd.pdp_prep[ds].last_ds[1] = 'N';
+           rrd.pdp_prep[ds].last_ds[2] = 'K';
+           rrd.pdp_prep[ds].last_ds[3] = 'N';
+           rrd.pdp_prep[ds].last_ds[4] = '\0';
+           
+           break;
+       case 'r':
+           if ((matches = 
+                sscanf(optarg,DS_NAM_FMT ":" DS_NAM_FMT , ds_nam,ds_new)) != 2){
+               rrd_set_error("invalid arguments for data source type");
+               rrd_free(&rrd);
+               fclose(rrd_file);
+               return -1;
+           }
+           if ((ds=ds_match(&rrd,ds_nam))==-1){
+               rrd_free(&rrd);
+               fclose(rrd_file);
+               return -1;
+           }
+           strncpy(rrd.ds_def[ds].ds_nam,ds_new,DS_NAM_SIZE-1);
+           rrd.ds_def[ds].ds_nam[DS_NAM_SIZE-1]='\0';
+           break;
+    case 'p':
+               if (set_deltaarg(&rrd,RRA_delta_pos,optarg)) {
+                  rrd_free(&rrd);
+                  return -1;
+               }
+               break;
+       case 'n':
+               if (set_deltaarg(&rrd,RRA_delta_neg,optarg)) {
+                  rrd_free(&rrd);
+                  return -1;
+               }
+               break;
+       case 'f':
+               if (set_windowarg(&rrd,RRA_failure_threshold,optarg)) {
+                  rrd_free(&rrd);
+                  return -1;
+               }
+               break;
+       case 'w':
+               if (set_windowarg(&rrd,RRA_window_len,optarg)) {
+                  rrd_free(&rrd);
+                  return -1;
+               }
+               break;
+       case 'x':
+               if (set_hwarg(&rrd,CF_HWPREDICT,RRA_hw_alpha,optarg)) {
+                  rrd_free(&rrd);
+                  return -1;
+               }
+               break;
+       case 'y':
+               if (set_hwarg(&rrd,CF_HWPREDICT,RRA_hw_beta,optarg)) {
+                  rrd_free(&rrd);
+                  return -1;
+               }
+               break;
+       case 'z':
+               if (set_hwarg(&rrd,CF_SEASONAL,RRA_seasonal_gamma,optarg)) {
+                  rrd_free(&rrd);
+                  return -1;
+               }
+               break;
+       case 'v':
+               if (set_hwarg(&rrd,CF_DEVSEASONAL,RRA_seasonal_gamma,optarg)) {
+                  rrd_free(&rrd);
+                  return -1;
+               }
+               break;
+       case 'b':
+               if (sscanf(optarg,DS_NAM_FMT,ds_nam) != 1){
+               rrd_set_error("invalid argument for aberrant-reset");
+               rrd_free(&rrd);
+               fclose(rrd_file);
+               return -1;
+           }
+           if ((ds=ds_match(&rrd,ds_nam))==-1){
+           /* ds_match handles it own errors */        
+               rrd_free(&rrd);
+               fclose(rrd_file);
+               return -1;
+           }
+           reset_aberrant_coefficients(&rrd,rrd_file,(unsigned long) ds);
+               if (rrd_test_error()) {
+                  rrd_free(&rrd);
+                  fclose(rrd_file);
+                  return -1;
+               }
+               break;
+       case '?':
+            if (optopt != 0)
+                rrd_set_error("unknown option '%c'", optopt);
+            else
+                rrd_set_error("unknown option '%s'",argv[optind-1]);
+           rrd_free(&rrd);         
+            fclose(rrd_file);
+            return -1;
+        }
+    }
+       if(optcnt>0){
+       
+       fseek(rrd_file,0,SEEK_SET);
+       fwrite(rrd.stat_head,
+              sizeof(stat_head_t),1, rrd_file);
+       fwrite(rrd.ds_def,
+              sizeof(ds_def_t), rrd.stat_head->ds_cnt, rrd_file);
+       /* need to write rra_defs for RRA parameter changes */
+       fwrite(rrd.rra_def, sizeof(rra_def_t), rrd.stat_head->rra_cnt,
+                  rrd_file);
+    } else {
+       int i;
+       for(i=0;i< (int)rrd.stat_head->ds_cnt;i++)
+               if (dst_conv(rrd.ds_def[i].dst) != DST_CDEF) {
+           printf("DS[%s] typ: %s\thbt: %ld\tmin: %1.4f\tmax: %1.4f\n",
+                  rrd.ds_def[i].ds_nam,
+                  rrd.ds_def[i].dst,
+                  rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt,
+                  rrd.ds_def[i].par[DS_min_val].u_val,
+                  rrd.ds_def[i].par[DS_max_val].u_val);
+               } else {
+               char *buffer = NULL;
+               rpn_compact2str((rpn_cdefds_t *) &(rrd.ds_def[i].par[DS_cdef]),rrd.ds_def,&buffer);
+               printf("DS[%s] typ: %s\tcdef: %s\n", rrd.ds_def[i].ds_nam,rrd.ds_def[i].dst,buffer);
+           free(buffer);
+               }
+    }
+    fclose(rrd_file);
+    rrd_free(&rrd);
+    return 0;
+}
+
+int set_hwarg(rrd_t *rrd,enum cf_en cf,enum rra_par_en rra_par,char *arg)
+{
+   double param;
+   unsigned long i;
+   signed short rra_idx = -1;
+   /* read the value */
+   param = atof(arg);
+   if (param <= 0.0 || param >= 1.0)
+   {
+         rrd_set_error("Holt-Winters parameter must be between 0 and 1");
+         return -1;
+   }
+   /* does the appropriate RRA exist?  */
+   for (i =  0; i < rrd -> stat_head -> rra_cnt; ++i)
+   {
+         if (cf_conv(rrd -> rra_def[i].cf_nam) == cf)
+         {
+                rra_idx = i;
+                break;
+         }
+   }
+   if (rra_idx == -1) 
+   {
+         rrd_set_error("Holt-Winters RRA does not exist in this RRD");
+         return -1;
+   }
+   
+   /* set the value */
+   rrd -> rra_def[rra_idx].par[rra_par].u_val = param;
+   return 0;
+}
+
+int set_deltaarg(rrd_t *rrd,enum rra_par_en rra_par,char *arg)
+{
+   rrd_value_t param;
+   unsigned long i;
+   signed short rra_idx = -1;
+
+   param = atof(arg);
+   if (param < 0.1)
+   {
+         rrd_set_error("Parameter specified is too small");
+         return -1;
+   }
+   /* does the appropriate RRA exist?  */
+   for (i = 0; i < rrd -> stat_head -> rra_cnt; ++i)
+   {
+         if (cf_conv(rrd -> rra_def[i].cf_nam) == CF_FAILURES) 
+         {
+                rra_idx = i;
+                break;
+         }
+   }
+   if (rra_idx == -1) 
+   {
+         rrd_set_error("Failures RRA does not exist in this RRD");
+         return -1;
+   }
+
+   /* set the value */
+   rrd -> rra_def[rra_idx].par[rra_par].u_val = param;
+   return 0;
+}
+
+int set_windowarg(rrd_t *rrd,enum rra_par_en rra_par,char *arg)
+{
+   unsigned long param;
+   unsigned long i, cdp_idx;
+   signed short rra_idx = -1;
+   /* read the value */
+   param = atoi(arg);
+   if (param < 1 || param > MAX_FAILURES_WINDOW_LEN)
+   {
+         rrd_set_error("Parameter must be between %d and %d",
+                1, MAX_FAILURES_WINDOW_LEN);
+         return -1;
+   }
+   /* does the appropriate RRA exist?  */
+   for (i = 0; i < rrd -> stat_head -> rra_cnt; ++i)
+   {
+         if (cf_conv(rrd -> rra_def[i].cf_nam) == CF_FAILURES) 
+         {
+                rra_idx = i;
+                break;
+         }
+   }
+   if (rra_idx == -1) 
+   {
+         rrd_set_error("Failures RRA does not exist in this RRD");
+         return -1;
+   }
+   
+   /* set the value */
+   rrd -> rra_def[rra_idx].par[rra_par].u_cnt = param;
+
+   /* erase existing violations */
+   for (i = 0; i < rrd -> stat_head -> ds_cnt; i++)
+   {
+         cdp_idx = rra_idx * (rrd -> stat_head -> ds_cnt) + i;
+         erase_violations(rrd,cdp_idx,rra_idx);
+   }
+   return 0;
+}
diff --git a/src/rrd_update.c b/src/rrd_update.c
new file mode 100644 (file)
index 0000000..c224119
--- /dev/null
@@ -0,0 +1,1546 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_update.c  RRD Update Function
+ *****************************************************************************
+ * $Id: rrd_update.c 1235 2007-11-20 00:15:07Z oetiker $
+ *****************************************************************************/
+
+#include "rrd_tool.h"
+#include <sys/types.h>
+#include <fcntl.h>
+#ifdef HAVE_MMAP
+# include <sys/mman.h>
+#endif
+
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+ #include <sys/locking.h>
+ #include <sys/stat.h>
+ #include <io.h>
+#endif
+
+#include "rrd_hw.h"
+#include "rrd_rpncalc.h"
+
+#include "rrd_is_thread_safe.h"
+#include "unused.h"
+
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+/*
+ * WIN32 does not have gettimeofday    and struct timeval. This is a quick and dirty
+ * replacement.
+ */
+#include <sys/timeb.h>
+
+#ifndef __MINGW32__
+struct timeval {
+       time_t tv_sec; /* seconds */
+       long tv_usec;  /* microseconds */
+};
+#endif
+
+struct __timezone {
+       int  tz_minuteswest; /* minutes W of Greenwich */
+       int  tz_dsttime;     /* type of dst correction */
+};
+
+static int gettimeofday(struct timeval *t, struct __timezone *tz) {
+
+       struct _timeb current_time;
+
+       _ftime(&current_time);
+
+       t->tv_sec  = current_time.time;
+       t->tv_usec = current_time.millitm * 1000;
+
+       return 0;
+}
+
+#endif
+/*
+ * normilize time as returned by gettimeofday. usec part must
+ * be always >= 0
+ */
+static void normalize_time(struct timeval *t)
+{
+       if(t->tv_usec < 0) {
+               t->tv_sec--;
+               t->tv_usec += 1000000L;
+       }
+}
+
+/* Local prototypes */
+int LockRRD(FILE *rrd_file);
+#ifdef HAVE_MMAP
+info_t *write_RRA_row (rrd_t *rrd, unsigned long rra_idx, 
+                                       unsigned long *rra_current,
+                                       unsigned short CDP_scratch_idx,
+#ifndef DEBUG
+FILE UNUSED(*rrd_file),
+#else
+FILE *rrd_file,
+#endif
+                                       info_t *pcdp_summary, time_t *rra_time, void *rrd_mmaped_file);
+#else
+info_t *write_RRA_row (rrd_t *rrd, unsigned long rra_idx, 
+                                       unsigned long *rra_current,
+                                       unsigned short CDP_scratch_idx, FILE *rrd_file,
+                                       info_t *pcdp_summary, time_t *rra_time);
+#endif
+int rrd_update_r(const char *filename, const char *tmplt, int argc, const char **argv);
+int _rrd_update(const char *filename, const char *tmplt, int argc, const char **argv, 
+                                       info_t*);
+
+#define IFDNAN(X,Y) (isnan(X) ? (Y) : (X));
+
+
+info_t *rrd_update_v(int argc, char **argv)
+{
+    char             *tmplt = NULL;          
+       info_t *result = NULL;
+       infoval rc;
+      rc.u_int = -1;
+    optind = 0; opterr = 0;  /* initialize getopt */
+
+    while (1) {
+               static struct option long_options[] =
+                       {
+                               {"template",      required_argument, 0, 't'},
+                               {0,0,0,0}
+                       };
+               int option_index = 0;
+               int opt;
+               opt = getopt_long(argc, argv, "t:", 
+                                                 long_options, &option_index);
+               
+               if (opt == EOF)
+                       break;
+               
+               switch(opt) {
+               case 't':
+                       tmplt = optarg;
+                       break;
+               
+               case '?':
+                       rrd_set_error("unknown option '%s'",argv[optind-1]);
+                       goto end_tag;
+               }
+    }
+
+    /* need at least 2 arguments: filename, data. */
+    if (argc-optind < 2) {
+               rrd_set_error("Not enough arguments");
+               goto end_tag;
+    }
+    rc.u_int = 0;
+    result = info_push(NULL,sprintf_alloc("return_value"),RD_I_INT,rc);
+       rc.u_int = _rrd_update(argv[optind], tmplt,
+                     argc - optind - 1, (const char **)(argv + optind + 1), result);
+    result->value.u_int = rc.u_int;
+end_tag:
+    return result;
+}
+
+int
+rrd_update(int argc, char **argv)
+{
+    char             *tmplt = NULL;          
+    int rc;
+    optind = 0; opterr = 0;  /* initialize getopt */
+
+    while (1) {
+               static struct option long_options[] =
+                       {
+                               {"template",      required_argument, 0, 't'},
+                               {0,0,0,0}
+                       };
+               int option_index = 0;
+               int opt;
+               opt = getopt_long(argc, argv, "t:", 
+                                                 long_options, &option_index);
+               
+               if (opt == EOF)
+                       break;
+               
+               switch(opt) {
+               case 't':
+                       tmplt = optarg;
+                       break;
+               
+               case '?':
+                       rrd_set_error("unknown option '%s'",argv[optind-1]);
+                       return(-1);
+               }
+    }
+
+    /* need at least 2 arguments: filename, data. */
+    if (argc-optind < 2) {
+               rrd_set_error("Not enough arguments");
+
+               return -1;
+    }
+       rc = rrd_update_r(argv[optind], tmplt,
+                     argc - optind - 1, (const char **)(argv + optind + 1));
+    return rc;
+}
+
+int
+rrd_update_r(const char *filename, const char *tmplt, int argc, const char **argv)
+{
+   return _rrd_update(filename, tmplt, argc, argv, NULL);
+}
+
+int
+_rrd_update(const char *filename, const char *tmplt, int argc, const char **argv, 
+   info_t *pcdp_summary)
+{
+
+    int              arg_i = 2;
+    short            j;
+    unsigned long    i,ii,iii=1;
+
+    unsigned long    rra_begin;          /* byte pointer to the rra
+                                         * area in the rrd file.  this
+                                         * pointer never changes value */
+    unsigned long    rra_start;          /* byte pointer to the rra
+                                         * area in the rrd file.  this
+                                         * pointer changes as each rrd is
+                                         * processed. */
+    unsigned long    rra_current;        /* byte pointer to the current write
+                                         * spot in the rrd file. */
+    unsigned long    rra_pos_tmp;        /* temporary byte pointer. */
+    double           interval,
+                     pre_int,post_int;   /* interval between this and
+                                         * the last run */
+    unsigned long    proc_pdp_st;        /* which pdp_st was the last
+                                         * to be processed */
+    unsigned long    occu_pdp_st;        /* when was the pdp_st
+                                         * before the last update
+                                         * time */
+    unsigned long    proc_pdp_age;       /* how old was the data in
+                                         * the pdp prep area when it
+                                         * was last updated */
+    unsigned long    occu_pdp_age;       /* how long ago was the last
+                                         * pdp_step time */
+    rrd_value_t      *pdp_new;           /* prepare the incoming data
+                                         * to be added the the
+                                         * existing entry */
+    rrd_value_t      *pdp_temp;          /* prepare the pdp values 
+                                         * to be added the the
+                                         * cdp values */
+
+    long             *tmpl_idx;          /* index representing the settings
+                                           transported by the tmplt index */
+    unsigned long    tmpl_cnt = 2;       /* time and data */
+
+    FILE             *rrd_file;
+    rrd_t            rrd;
+    time_t           current_time = 0;
+    time_t           rra_time = 0;      /* time of update for a RRA */
+    unsigned long    current_time_usec=0;/* microseconds part of current time */
+    struct timeval   tmp_time;           /* used for time conversion */
+
+    char             **updvals;
+    int              schedule_smooth = 0;
+       rrd_value_t      *seasonal_coef = NULL, *last_seasonal_coef = NULL;
+                                        /* a vector of future Holt-Winters seasonal coefs */
+    unsigned long    elapsed_pdp_st;
+                                        /* number of elapsed PDP steps since last update */
+    unsigned long    *rra_step_cnt = NULL;
+                                        /* number of rows to be updated in an RRA for a data
+                                         * value. */
+    unsigned long    start_pdp_offset;
+                                        /* number of PDP steps since the last update that
+                                         * are assigned to the first CDP to be generated
+                                         * since the last update. */
+    unsigned short   scratch_idx;
+                                        /* index into the CDP scratch array */
+    enum cf_en       current_cf;
+                                        /* numeric id of the current consolidation function */
+    rpnstack_t       rpnstack; /* used for COMPUTE DS */
+    int                     version;  /* rrd version */
+    char             *endptr; /* used in the conversion */
+
+#ifdef HAVE_MMAP
+    void            *rrd_mmaped_file;
+    unsigned long    rrd_filesize;
+#endif
+
+
+    rpnstack_init(&rpnstack);
+
+    /* need at least 1 arguments: data. */
+    if (argc < 1) {
+       rrd_set_error("Not enough arguments");
+       return -1;
+    }
+    
+    
+
+    if(rrd_open(filename,&rrd_file,&rrd, RRD_READWRITE)==-1){
+       return -1;
+    }
+
+    /* initialize time */
+    version = atoi(rrd.stat_head->version);
+    gettimeofday(&tmp_time, 0);
+    normalize_time(&tmp_time);
+    current_time = tmp_time.tv_sec;
+    if(version >= 3) {
+        current_time_usec = tmp_time.tv_usec;
+    }
+    else {
+       current_time_usec = 0;
+    }
+
+    rra_current = rra_start = rra_begin = ftell(rrd_file);
+    /* This is defined in the ANSI C standard, section 7.9.5.3:
+
+        When a file is opened with udpate mode ('+' as the second
+        or third character in the ... list of mode argument
+        variables), both input and ouptut may be performed on the
+        associated stream.  However, ...  input may not be directly
+        followed by output without an intervening call to a file
+        positioning function, unless the input oepration encounters
+        end-of-file. */
+#ifdef HAVE_MMAP
+    fseek(rrd_file, 0, SEEK_END);
+    rrd_filesize = ftell(rrd_file);
+    fseek(rrd_file, rra_current, SEEK_SET);
+#else
+    fseek(rrd_file, 0, SEEK_CUR);
+#endif
+
+    
+    /* get exclusive lock to whole file.
+     * lock gets removed when we close the file.
+     */
+    if (LockRRD(rrd_file) != 0) {
+      rrd_set_error("could not lock RRD");
+      rrd_free(&rrd);
+      fclose(rrd_file);
+      return(-1);   
+    } 
+
+    if((updvals = malloc( sizeof(char*) * (rrd.stat_head->ds_cnt+1)))==NULL){
+       rrd_set_error("allocating updvals pointer array");
+       rrd_free(&rrd);
+        fclose(rrd_file);
+       return(-1);
+    }
+
+    if ((pdp_temp = malloc(sizeof(rrd_value_t)
+                          *rrd.stat_head->ds_cnt))==NULL){
+       rrd_set_error("allocating pdp_temp ...");
+       free(updvals);
+       rrd_free(&rrd);
+        fclose(rrd_file);
+       return(-1);
+    }
+
+    if ((tmpl_idx = malloc(sizeof(unsigned long)
+                          *(rrd.stat_head->ds_cnt+1)))==NULL){
+       rrd_set_error("allocating tmpl_idx ...");
+       free(pdp_temp);
+       free(updvals);
+       rrd_free(&rrd);
+        fclose(rrd_file);
+       return(-1);
+    }
+    /* initialize tmplt redirector */
+    /* default config example (assume DS 1 is a CDEF DS)
+       tmpl_idx[0] -> 0; (time)
+       tmpl_idx[1] -> 1; (DS 0)
+       tmpl_idx[2] -> 3; (DS 2)
+       tmpl_idx[3] -> 4; (DS 3) */
+    tmpl_idx[0] = 0; /* time */
+    for (i = 1, ii = 1 ; i <= rrd.stat_head->ds_cnt ; i++) 
+       {
+          if (dst_conv(rrd.ds_def[i-1].dst) != DST_CDEF)
+             tmpl_idx[ii++]=i;
+       }
+    tmpl_cnt= ii;
+
+    if (tmplt) {
+       /* we should work on a writeable copy here */
+       char *dsname;
+       unsigned int tmpl_len;
+       char *tmplt_copy = strdup(tmplt);
+       dsname = tmplt_copy;
+       tmpl_cnt = 1; /* the first entry is the time */
+       tmpl_len = strlen(tmplt_copy);
+       for(i=0;i<=tmpl_len ;i++) {
+           if (tmplt_copy[i] == ':' || tmplt_copy[i] == '\0') {
+               tmplt_copy[i] = '\0';
+               if (tmpl_cnt>rrd.stat_head->ds_cnt){
+                   rrd_set_error("tmplt contains more DS definitions than RRD");
+                   free(updvals); free(pdp_temp);
+                   free(tmpl_idx); rrd_free(&rrd);
+                   fclose(rrd_file); return(-1);
+               }
+               if ((tmpl_idx[tmpl_cnt++] = ds_match(&rrd,dsname)) == -1){
+                   rrd_set_error("unknown DS name '%s'",dsname);
+                   free(updvals); free(pdp_temp);
+                   free(tmplt_copy);
+                   free(tmpl_idx); rrd_free(&rrd);
+                   fclose(rrd_file); return(-1);
+               } else {
+                 /* the first element is always the time */
+                 tmpl_idx[tmpl_cnt-1]++; 
+                 /* go to the next entry on the tmplt_copy */
+                 dsname = &tmplt_copy[i+1];
+                  /* fix the damage we did before */
+                  if (i<tmpl_len) {
+                     tmplt_copy[i]=':';
+                  } 
+
+               }
+           }       
+       }
+       free(tmplt_copy);
+    }
+    if ((pdp_new = malloc(sizeof(rrd_value_t)
+                         *rrd.stat_head->ds_cnt))==NULL){
+       rrd_set_error("allocating pdp_new ...");
+       free(updvals);
+       free(pdp_temp);
+       free(tmpl_idx);
+       rrd_free(&rrd);
+        fclose(rrd_file);
+       return(-1);
+    }
+
+#ifdef HAVE_MMAP
+    rrd_mmaped_file = mmap(0, 
+                       rrd_filesize, 
+                       PROT_READ | PROT_WRITE, 
+                       MAP_SHARED, 
+                       fileno(rrd_file), 
+                       0);
+    if (rrd_mmaped_file == MAP_FAILED) {
+        rrd_set_error("error mmapping file %s", filename);
+       free(updvals);
+       free(pdp_temp);
+       free(tmpl_idx);
+       rrd_free(&rrd);
+        fclose(rrd_file);
+       return(-1);
+    }
+#ifdef HAVE_MADVISE
+    /* when we use mmaping we tell the kernel the mmap equivalent
+       of POSIX_FADV_RANDOM */
+    madvise(rrd_mmaped_file,rrd_filesize,POSIX_MADV_RANDOM);
+#endif
+#endif
+    /* loop through the arguments. */
+    for(arg_i=0; arg_i<argc;arg_i++) {
+       char *stepper = strdup(argv[arg_i]);
+        char *step_start = stepper;
+       char *p;
+       char *parsetime_error = NULL;
+       enum {atstyle, normal} timesyntax;
+       struct rrd_time_value ds_tv;
+        if (stepper == NULL){
+                rrd_set_error("failed duplication argv entry");
+               free(step_start);
+                free(updvals);
+                free(pdp_temp);  
+                free(tmpl_idx);
+                rrd_free(&rrd);
+#ifdef HAVE_MMAP
+               munmap(rrd_mmaped_file, rrd_filesize);
+#endif
+                fclose(rrd_file);
+                return(-1);
+         }
+       /* initialize all ds input to unknown except the first one
+           which has always got to be set */
+       for(ii=1;ii<=rrd.stat_head->ds_cnt;ii++) updvals[ii] = "U";
+       updvals[0]=stepper;
+       /* separate all ds elements; first must be examined separately
+          due to alternate time syntax */
+       if ((p=strchr(stepper,'@'))!=NULL) {
+           timesyntax = atstyle;
+           *p = '\0';
+           stepper = p+1;
+       } else if ((p=strchr(stepper,':'))!=NULL) {
+           timesyntax = normal;
+           *p = '\0';
+           stepper = p+1;
+       } else {
+           rrd_set_error("expected timestamp not found in data source from %s",
+                         argv[arg_i]);
+           free(step_start);
+           break;
+       }
+       ii=1;
+       updvals[tmpl_idx[ii]] = stepper;
+       while (*stepper) {
+           if (*stepper == ':') {
+               *stepper = '\0';
+               ii++;
+               if (ii<tmpl_cnt){                   
+                   updvals[tmpl_idx[ii]] = stepper+1;
+               }
+           }
+           stepper++;
+       }
+
+       if (ii != tmpl_cnt-1) {
+           rrd_set_error("expected %lu data source readings (got %lu) from %s",
+                         tmpl_cnt-1, ii, argv[arg_i]);
+           free(step_start);
+           break;
+       }
+       
+        /* get the time from the reading ... handle N */
+       if (timesyntax == atstyle) {
+            if ((parsetime_error = parsetime(updvals[0], &ds_tv))) {
+                rrd_set_error("ds time: %s: %s", updvals[0], parsetime_error );
+               free(step_start);
+               break;
+           }
+           if (ds_tv.type == RELATIVE_TO_END_TIME ||
+               ds_tv.type == RELATIVE_TO_START_TIME) {
+               rrd_set_error("specifying time relative to the 'start' "
+                             "or 'end' makes no sense here: %s",
+                             updvals[0]);
+               free(step_start);
+               break;
+           }
+
+           current_time = mktime(&ds_tv.tm) + ds_tv.offset;
+           current_time_usec = 0; /* FIXME: how to handle usecs here ? */
+           
+       } else if (strcmp(updvals[0],"N")==0){
+           gettimeofday(&tmp_time, 0);
+           normalize_time(&tmp_time);
+           current_time = tmp_time.tv_sec;
+           current_time_usec = tmp_time.tv_usec;
+       } else {
+           double tmp;
+           tmp = strtod(updvals[0], 0);
+           current_time = floor(tmp);
+           current_time_usec = (long)((tmp-(double)current_time) * 1000000.0);
+       }
+       /* dont do any correction for old version RRDs */
+       if(version < 3) 
+           current_time_usec = 0;
+       
+       if(current_time < rrd.live_head->last_up || 
+         (current_time == rrd.live_head->last_up && 
+          (long)current_time_usec <= (long)rrd.live_head->last_up_usec)) {
+           rrd_set_error("illegal attempt to update using time %ld when "
+                         "last update time is %ld (minimum one second step)",
+                         current_time, rrd.live_head->last_up);
+           free(step_start);
+           break;
+       }
+       
+       
+       /* seek to the beginning of the rra's */
+       if (rra_current != rra_begin) {
+#ifndef HAVE_MMAP
+           if(fseek(rrd_file, rra_begin, SEEK_SET) != 0) {
+               rrd_set_error("seek error in rrd");
+               free(step_start);
+               break;
+           }
+#endif
+           rra_current = rra_begin;
+       }
+       rra_start = rra_begin;
+
+       /* when was the current pdp started */
+       proc_pdp_age = rrd.live_head->last_up % rrd.stat_head->pdp_step;
+       proc_pdp_st = rrd.live_head->last_up - proc_pdp_age;
+
+       /* when did the last pdp_st occur */
+       occu_pdp_age = current_time % rrd.stat_head->pdp_step;
+       occu_pdp_st = current_time - occu_pdp_age;
+
+       /* interval = current_time - rrd.live_head->last_up; */
+       interval    = (double)(current_time - rrd.live_head->last_up) 
+                   + (double)((long)current_time_usec - (long)rrd.live_head->last_up_usec)/1000000.0;
+
+       if (occu_pdp_st > proc_pdp_st){
+           /* OK we passed the pdp_st moment*/
+           pre_int =  (long)occu_pdp_st - rrd.live_head->last_up; /* how much of the input data
+                                                             * occurred before the latest
+                                                             * pdp_st moment*/
+           pre_int -= ((double)rrd.live_head->last_up_usec)/1000000.0; /* adjust usecs */
+           post_int = occu_pdp_age;                         /* how much after it */
+           post_int += ((double)current_time_usec)/1000000.0;  /* adjust usecs */
+       } else {
+           pre_int = interval;
+           post_int = 0;
+       }
+
+#ifdef DEBUG
+       printf(
+              "proc_pdp_age %lu\t"
+              "proc_pdp_st %lu\t" 
+              "occu_pfp_age %lu\t" 
+              "occu_pdp_st %lu\t"
+              "int %lf\t"
+              "pre_int %lf\t"
+              "post_int %lf\n", proc_pdp_age, proc_pdp_st, 
+               occu_pdp_age, occu_pdp_st,
+              interval, pre_int, post_int);
+#endif
+    
+       /* process the data sources and update the pdp_prep 
+        * area accordingly */
+       for(i=0;i<rrd.stat_head->ds_cnt;i++){
+           enum dst_en dst_idx;
+           dst_idx= dst_conv(rrd.ds_def[i].dst);
+
+            /* make sure we do not build diffs with old last_ds values */
+           if(rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt < interval) {
+               strncpy(rrd.pdp_prep[i].last_ds,"U",LAST_DS_LEN-1);
+               rrd.pdp_prep[i].last_ds[LAST_DS_LEN-1]='\0';
+           }
+
+           /* NOTE: DST_CDEF should never enter this if block, because
+             * updvals[i+1][0] is initialized to 'U'; unless the caller
+            * accidently specified a value for the DST_CDEF. To handle 
+             * this case, an extra check is required. */
+
+           if((updvals[i+1][0] != 'U') &&
+                  (dst_idx != DST_CDEF) &&
+              rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt >= interval) {
+              double rate = DNAN;
+              /* the data source type defines how to process the data */
+               /* pdp_new contains rate * time ... eg the bytes
+                * transferred during the interval. Doing it this way saves
+                * a lot of math operations */
+               
+
+               switch(dst_idx){
+               case DST_COUNTER:
+               case DST_DERIVE:
+            for(ii=0;updvals[i+1][ii] != '\0';ii++){
+                 if((updvals[i+1][ii] < '0' || updvals[i+1][ii] > '9') && (ii != 0 && updvals[i+1][ii] != '-')){
+                      rrd_set_error("not a simple integer: '%s'",updvals[i+1]);
+                      break;
+                 }
+            }
+            if (rrd_test_error()){
+                   break;
+            }
+                   if(rrd.pdp_prep[i].last_ds[0] != 'U'){
+                      pdp_new[i]= rrd_diff(updvals[i+1],rrd.pdp_prep[i].last_ds);
+                      if(dst_idx == DST_COUNTER) {
+                         /* simple overflow catcher suggested by Andres Kroonmaa */
+                         /* this will fail terribly for non 32 or 64 bit counters ... */
+                         /* are there any others in SNMP land ? */
+                         if (pdp_new[i] < (double)0.0 ) 
+                           pdp_new[i] += (double)4294967296.0 ;  /* 2^32 */
+                         if (pdp_new[i] < (double)0.0 ) 
+                           pdp_new[i] += (double)18446744069414584320.0; /* 2^64-2^32 */;
+                      }
+                      rate = pdp_new[i] / interval;
+                   }
+                  else {
+                    pdp_new[i]= DNAN;          
+                  }
+                  break;
+               case DST_ABSOLUTE:
+                    errno = 0;
+                    pdp_new[i] = strtod(updvals[i+1],&endptr);
+                    if (errno > 0){
+                        rrd_set_error("converting  '%s' to float: %s",updvals[i+1],rrd_strerror(errno));
+                        break;
+                    };
+                    if (endptr[0] != '\0'){
+                        rrd_set_error("conversion of '%s' to float not complete: tail '%s'",updvals[i+1],endptr);
+                        break;
+                    }
+                   rate = pdp_new[i] / interval;                 
+                   break;
+               case DST_GAUGE:
+                    errno = 0;
+                    pdp_new[i] = strtod(updvals[i+1],&endptr) * interval;
+                    if (errno > 0){
+                        rrd_set_error("converting  '%s' to float: %s",updvals[i+1],rrd_strerror(errno));
+                        break;
+                    };
+                    if (endptr[0] != '\0'){
+                        rrd_set_error("conversion of '%s' to float not complete: tail '%s'",updvals[i+1],endptr);
+                        break;
+                    }
+                   rate = pdp_new[i] / interval;                  
+                   break;
+               default:
+                   rrd_set_error("rrd contains unknown DS type : '%s'",
+                                 rrd.ds_def[i].dst);
+                   break;
+               }
+               /* break out of this for loop if the error string is set */
+               if (rrd_test_error()){
+                   break;
+               }
+              /* make sure pdp_temp is neither too large or too small
+               * if any of these occur it becomes unknown ...
+               * sorry folks ... */
+              if ( ! isnan(rate) && 
+                   (( ! isnan(rrd.ds_def[i].par[DS_max_val].u_val) &&
+                        rate > rrd.ds_def[i].par[DS_max_val].u_val ) ||     
+                   ( ! isnan(rrd.ds_def[i].par[DS_min_val].u_val) &&
+                       rate < rrd.ds_def[i].par[DS_min_val].u_val ))){
+                 pdp_new[i] = DNAN;
+              }               
+           } else {
+               /* no news is news all the same */
+               pdp_new[i] = DNAN;
+           }
+
+           
+           /* make a copy of the command line argument for the next run */
+#ifdef DEBUG
+           fprintf(stderr,
+                   "prep ds[%lu]\t"
+                   "last_arg '%s'\t"
+                   "this_arg '%s'\t"
+                   "pdp_new %10.2f\n",
+                   i,
+                   rrd.pdp_prep[i].last_ds,
+                   updvals[i+1], pdp_new[i]);
+#endif
+           strncpy(rrd.pdp_prep[i].last_ds, updvals[i+1],LAST_DS_LEN-1);
+           rrd.pdp_prep[i].last_ds[LAST_DS_LEN-1]='\0';
+       }
+       /* break out of the argument parsing loop if the error_string is set */
+       if (rrd_test_error()){
+           free(step_start);
+           break;
+       }
+       /* has a pdp_st moment occurred since the last run ? */
+
+       if (proc_pdp_st == occu_pdp_st){
+           /* no we have not passed a pdp_st moment. therefore update is simple */
+
+           for(i=0;i<rrd.stat_head->ds_cnt;i++){
+               if(isnan(pdp_new[i])) {            
+                   /* this is not realy accurate if we use subsecond data arival time
+                      should have thought of it when going subsecond resolution ...
+                       sorry next format change we will have it! */
+                   rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt += floor(interval);          
+               } else {
+                    if (isnan( rrd.pdp_prep[i].scratch[PDP_val].u_val )){
+                       rrd.pdp_prep[i].scratch[PDP_val].u_val= pdp_new[i];
+                    } else {
+                       rrd.pdp_prep[i].scratch[PDP_val].u_val+= pdp_new[i];
+                    }
+               }
+#ifdef DEBUG
+               fprintf(stderr,
+                       "NO PDP  ds[%lu]\t"
+                       "value %10.2f\t"
+                       "unkn_sec %5lu\n",
+                       i,
+                       rrd.pdp_prep[i].scratch[PDP_val].u_val,
+                       rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt);
+#endif
+           }   
+       } else {
+           /* an pdp_st has occurred. */
+
+           /* in pdp_prep[].scratch[PDP_val].u_val we have collected rate*seconds which 
+            * occurred up to the last run.        
+           pdp_new[] contains rate*seconds from the latest run.
+           pdp_temp[] will contain the rate for cdp */
+
+           for(i=0;i<rrd.stat_head->ds_cnt;i++){
+               /* update pdp_prep to the current pdp_st. */
+                double pre_unknown = 0.0;              
+               if(isnan(pdp_new[i]))
+                    /* a final bit of unkonwn to be added bevore calculation
+                    * we use a tempaorary variable for this so that we 
+                    * don't have to turn integer lines before using the value */                
+                   pre_unknown = pre_int;
+               else {
+                    if (isnan( rrd.pdp_prep[i].scratch[PDP_val].u_val )){
+                       rrd.pdp_prep[i].scratch[PDP_val].u_val=         pdp_new[i]/interval*pre_int;
+                    } else {
+                       rrd.pdp_prep[i].scratch[PDP_val].u_val+= pdp_new[i]/interval*pre_int;
+                    }
+                }
+               
+
+               /* if too much of the pdp_prep is unknown we dump it */
+               if ( 
+                   /* removed because this does not agree with the definition
+                      a heart beat can be unknown */
+                   /* (rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt 
+                    > rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt) || */
+                   /* if the interval is larger thatn mrhb we get NAN */
+                   (interval > rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt) ||
+                   (occu_pdp_st-proc_pdp_st <= 
+                    rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt)) {
+                   pdp_temp[i] = DNAN;
+               } else {
+                   pdp_temp[i] = rrd.pdp_prep[i].scratch[PDP_val].u_val
+                       / ((double)(occu_pdp_st - proc_pdp_st
+                                    - rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt)
+                            -pre_unknown);
+               }
+
+               /* process CDEF data sources; remember each CDEF DS can
+                * only reference other DS with a lower index number */
+           if (dst_conv(rrd.ds_def[i].dst) == DST_CDEF) {
+                  rpnp_t *rpnp;
+                  rpnp = rpn_expand((rpn_cdefds_t *) &(rrd.ds_def[i].par[DS_cdef]));
+                  /* substitue data values for OP_VARIABLE nodes */
+                  for (ii = 0; rpnp[ii].op != OP_END; ii++)
+                  {
+                         if (rpnp[ii].op == OP_VARIABLE) {
+                                rpnp[ii].op = OP_NUMBER;
+                                rpnp[ii].val =  pdp_temp[rpnp[ii].ptr];
+                         }
+                  }
+                  /* run the rpn calculator */
+                  if (rpn_calc(rpnp,&rpnstack,0,pdp_temp,i) == -1) {
+                         free(rpnp);
+                         break; /* exits the data sources pdp_temp loop */
+                  }
+               }
+        
+               /* make pdp_prep ready for the next run */
+               if(isnan(pdp_new[i])){
+                   /* this is not realy accurate if we use subsecond data arival time
+                      should have thought of it when going subsecond resolution ...
+                       sorry next format change we will have it! */
+                   rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt = floor(post_int);
+                   rrd.pdp_prep[i].scratch[PDP_val].u_val = DNAN;
+               } else {
+                   rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt = 0;
+                   rrd.pdp_prep[i].scratch[PDP_val].u_val = 
+                       pdp_new[i]/interval*post_int;
+               }
+
+#ifdef DEBUG
+               fprintf(stderr,
+                       "PDP UPD ds[%lu]\t"
+                       "pdp_temp %10.2f\t"
+                       "new_prep %10.2f\t"
+                       "new_unkn_sec %5lu\n",
+                       i, pdp_temp[i],
+                       rrd.pdp_prep[i].scratch[PDP_val].u_val,
+                       rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt);
+#endif
+           }
+
+               /* if there were errors during the last loop, bail out here */
+           if (rrd_test_error()){
+              free(step_start);
+              break;
+           }
+
+               /* compute the number of elapsed pdp_st moments */
+               elapsed_pdp_st = (occu_pdp_st - proc_pdp_st) / rrd.stat_head -> pdp_step;
+#ifdef DEBUG
+               fprintf(stderr,"elapsed PDP steps: %lu\n", elapsed_pdp_st);
+#endif
+               if (rra_step_cnt == NULL)
+               {
+                  rra_step_cnt = (unsigned long *) 
+                         malloc((rrd.stat_head->rra_cnt)* sizeof(unsigned long));
+               }
+
+           for(i = 0, rra_start = rra_begin;
+               i < rrd.stat_head->rra_cnt;
+           rra_start += rrd.rra_def[i].row_cnt * rrd.stat_head -> ds_cnt * sizeof(rrd_value_t),
+               i++)
+               {
+               current_cf = cf_conv(rrd.rra_def[i].cf_nam);
+               start_pdp_offset = rrd.rra_def[i].pdp_cnt -
+                  (proc_pdp_st / rrd.stat_head -> pdp_step) % rrd.rra_def[i].pdp_cnt;
+        if (start_pdp_offset <= elapsed_pdp_st) {
+           rra_step_cnt[i] = (elapsed_pdp_st - start_pdp_offset) / 
+                     rrd.rra_def[i].pdp_cnt + 1;
+           } else {
+                  rra_step_cnt[i] = 0;
+               }
+
+               if (current_cf == CF_SEASONAL || current_cf == CF_DEVSEASONAL) 
+               {
+                  /* If this is a bulk update, we need to skip ahead in the seasonal
+                       * arrays so that they will be correct for the next observed value;
+                       * note that for the bulk update itself, no update will occur to
+                       * DEVSEASONAL or SEASONAL; futhermore, HWPREDICT and DEVPREDICT will
+                       * be set to DNAN. */
+           if (rra_step_cnt[i] > 2) 
+                  {
+                         /* skip update by resetting rra_step_cnt[i],
+                          * note that this is not data source specific; this is due
+                          * to the bulk update, not a DNAN value for the specific data
+                          * source. */
+                         rra_step_cnt[i] = 0;
+              lookup_seasonal(&rrd,i,rra_start,rrd_file,elapsed_pdp_st, 
+                            &last_seasonal_coef);
+                     lookup_seasonal(&rrd,i,rra_start,rrd_file,elapsed_pdp_st + 1,
+                            &seasonal_coef);
+                  }
+               
+                 /* periodically run a smoother for seasonal effects */
+                 /* Need to use first cdp parameter buffer to track
+                  * burnin (burnin requires a specific smoothing schedule).
+                  * The CDP_init_seasonal parameter is really an RRA level,
+                  * not a data source within RRA level parameter, but the rra_def
+                  * is read only for rrd_update (not flushed to disk). */
+                 iii = i*(rrd.stat_head -> ds_cnt);
+                 if (rrd.cdp_prep[iii].scratch[CDP_init_seasonal].u_cnt 
+                         <= BURNIN_CYCLES)
+                 {
+                    if (rrd.rra_ptr[i].cur_row + elapsed_pdp_st 
+                                > rrd.rra_def[i].row_cnt - 1) {
+                          /* mark off one of the burnin cycles */
+                          ++(rrd.cdp_prep[iii].scratch[CDP_init_seasonal].u_cnt);
+                      schedule_smooth = 1;
+                        }  
+                 } else {
+                        /* someone has no doubt invented a trick to deal with this
+                         * wrap around, but at least this code is clear. */
+                        if (rrd.rra_def[i].par[RRA_seasonal_smooth_idx].u_cnt >
+                            rrd.rra_ptr[i].cur_row)
+                        {
+                                /* here elapsed_pdp_st = rra_step_cnt[i] because of 1-1
+                                 * mapping between PDP and CDP */
+                                if (rrd.rra_ptr[i].cur_row + elapsed_pdp_st
+                                       >= rrd.rra_def[i].par[RRA_seasonal_smooth_idx].u_cnt)
+                                {
+#ifdef DEBUG
+                                       fprintf(stderr,
+                                       "schedule_smooth 1: cur_row %lu, elapsed_pdp_st %lu, smooth idx %lu\n",
+                    rrd.rra_ptr[i].cur_row, elapsed_pdp_st, 
+                                       rrd.rra_def[i].par[RRA_seasonal_smooth_idx].u_cnt);
+#endif
+                                       schedule_smooth = 1;
+                                }
+             } else {
+                                /* can't rely on negative numbers because we are working with
+                                 * unsigned values */
+                                /* Don't need modulus here. If we've wrapped more than once, only
+                                 * one smooth is executed at the end. */
+                                if (rrd.rra_ptr[i].cur_row + elapsed_pdp_st >= rrd.rra_def[i].row_cnt
+                                       && rrd.rra_ptr[i].cur_row + elapsed_pdp_st - rrd.rra_def[i].row_cnt
+                                       >= rrd.rra_def[i].par[RRA_seasonal_smooth_idx].u_cnt)
+                                {
+#ifdef DEBUG
+                                       fprintf(stderr,
+                                       "schedule_smooth 2: cur_row %lu, elapsed_pdp_st %lu, smooth idx %lu\n",
+                    rrd.rra_ptr[i].cur_row, elapsed_pdp_st, 
+                                       rrd.rra_def[i].par[RRA_seasonal_smooth_idx].u_cnt);
+#endif
+                                       schedule_smooth = 1;
+                                }
+                        }
+                 }
+
+             rra_current = ftell(rrd_file); 
+               } /* if cf is DEVSEASONAL or SEASONAL */
+
+        if (rrd_test_error()) break;
+
+                   /* update CDP_PREP areas */
+                   /* loop over data soures within each RRA */
+                   for(ii = 0;
+                       ii < rrd.stat_head->ds_cnt;
+                       ii++)
+                       {
+                       
+                       /* iii indexes the CDP prep area for this data source within the RRA */
+                       iii=i*rrd.stat_head->ds_cnt+ii;
+
+                       if (rrd.rra_def[i].pdp_cnt > 1) {
+                         
+                          if (rra_step_cnt[i] > 0) {
+                          /* If we are in this block, as least 1 CDP value will be written to
+                               * disk, this is the CDP_primary_val entry. If more than 1 value needs
+                               * to be written, then the "fill in" value is the CDP_secondary_val
+                               * entry. */
+                                 if (isnan(pdp_temp[ii]))
+                  {
+                                        rrd.cdp_prep[iii].scratch[CDP_unkn_pdp_cnt].u_cnt += start_pdp_offset;
+                                        rrd.cdp_prep[iii].scratch[CDP_secondary_val].u_val = DNAN;
+                                 } else {
+                                        /* CDP_secondary value is the RRA "fill in" value for intermediary
+                                         * CDP data entries. No matter the CF, the value is the same because
+                                         * the average, max, min, and last of a list of identical values is
+                                         * the same, namely, the value itself. */
+                                        rrd.cdp_prep[iii].scratch[CDP_secondary_val].u_val = pdp_temp[ii];
+                                 }
+                     
+                                 if (rrd.cdp_prep[iii].scratch[CDP_unkn_pdp_cnt].u_cnt
+                                     > rrd.rra_def[i].pdp_cnt*
+                                     rrd.rra_def[i].par[RRA_cdp_xff_val].u_val)
+                                 {
+                                        rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val = DNAN;
+                                        /* initialize carry over */
+                                        if (current_cf == CF_AVERAGE) {
+                                                  if (isnan(pdp_temp[ii])) { 
+                                                         rrd.cdp_prep[iii].scratch[CDP_val].u_val = DNAN;
+                                                  } else {
+                                                         rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii] *
+                                                                ((elapsed_pdp_st - start_pdp_offset) % rrd.rra_def[i].pdp_cnt);
+                                                  }
+                                        } else {
+                                               rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii];
+                                        }
+                                 } else {
+                                        rrd_value_t cum_val, cur_val; 
+                                    switch (current_cf) {
+                                               case CF_AVERAGE:
+                                                 cum_val = IFDNAN(rrd.cdp_prep[iii].scratch[CDP_val].u_val, 0.0);
+                                                 cur_val = IFDNAN(pdp_temp[ii],0.0);
+                          rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val =
+                                              (cum_val + cur_val * start_pdp_offset) /
+                                          (rrd.rra_def[i].pdp_cnt
+                                              -rrd.cdp_prep[iii].scratch[CDP_unkn_pdp_cnt].u_cnt);
+                                                  /* initialize carry over value */
+                                                  if (isnan(pdp_temp[ii])) { 
+                                                         rrd.cdp_prep[iii].scratch[CDP_val].u_val = DNAN;
+                                                  } else {
+                                                         rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii] *
+                                                                ((elapsed_pdp_st - start_pdp_offset) % rrd.rra_def[i].pdp_cnt);
+                                                  }
+                                                  break;
+                                               case CF_MAXIMUM:
+                                                 cum_val = IFDNAN(rrd.cdp_prep[iii].scratch[CDP_val].u_val, -DINF);
+                                                 cur_val = IFDNAN(pdp_temp[ii],-DINF);
+#ifdef DEBUG
+                                                 if (isnan(rrd.cdp_prep[iii].scratch[CDP_val].u_val) &&
+                                                         isnan(pdp_temp[ii])) {
+                                                    fprintf(stderr,
+                                                               "RRA %lu, DS %lu, both CDP_val and pdp_temp are DNAN!",
+                                                               i,ii);
+                                                        exit(-1);
+                                                 }
+#endif
+                                                 if (cur_val > cum_val)
+                                                        rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val = cur_val;
+                                                 else
+                                                        rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val = cum_val;
+                                                 /* initialize carry over value */
+                                                 rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii];
+                                                 break;
+                                               case CF_MINIMUM:
+                                                 cum_val = IFDNAN(rrd.cdp_prep[iii].scratch[CDP_val].u_val, DINF);
+                                                 cur_val = IFDNAN(pdp_temp[ii],DINF);
+#ifdef DEBUG
+                                                 if (isnan(rrd.cdp_prep[iii].scratch[CDP_val].u_val) &&
+                                                         isnan(pdp_temp[ii])) {
+                                                    fprintf(stderr,
+                                                               "RRA %lu, DS %lu, both CDP_val and pdp_temp are DNAN!",
+                                                               i,ii);
+                                                        exit(-1);
+                                                 }
+#endif
+                                                 if (cur_val < cum_val)
+                                                        rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val = cur_val;
+                                                 else
+                                                        rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val = cum_val;
+                                                 /* initialize carry over value */
+                                                 rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii];
+                                                 break;
+                                               case CF_LAST:
+                                               default:
+                                                  rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val = pdp_temp[ii];
+                                                  /* initialize carry over value */
+                                                  rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii];
+                                               break;
+                                        }
+                                 } /* endif meets xff value requirement for a valid value */
+                                 /* initialize carry over CDP_unkn_pdp_cnt, this must after CDP_primary_val
+                                  * is set because CDP_unkn_pdp_cnt is required to compute that value. */
+                                 if (isnan(pdp_temp[ii]))
+                                        rrd.cdp_prep[iii].scratch[CDP_unkn_pdp_cnt].u_cnt = 
+                                               (elapsed_pdp_st - start_pdp_offset) % rrd.rra_def[i].pdp_cnt;
+                                 else
+                                        rrd.cdp_prep[iii].scratch[CDP_unkn_pdp_cnt].u_cnt = 0;
+               } else  /* rra_step_cnt[i]  == 0 */
+                          {
+#ifdef DEBUG
+                                 if (isnan(rrd.cdp_prep[iii].scratch[CDP_val].u_val)) {
+                                 fprintf(stderr,"schedule CDP_val update, RRA %lu DS %lu, DNAN\n",
+                                        i,ii);
+                                 } else {
+                                 fprintf(stderr,"schedule CDP_val update, RRA %lu DS %lu, %10.2f\n",
+                                        i,ii,rrd.cdp_prep[iii].scratch[CDP_val].u_val);
+                                 }
+#endif
+                                 if (isnan(pdp_temp[ii])) {
+                                rrd.cdp_prep[iii].scratch[CDP_unkn_pdp_cnt].u_cnt += elapsed_pdp_st;
+                                 } else if (isnan(rrd.cdp_prep[iii].scratch[CDP_val].u_val))
+                                 {
+                                        if (current_cf == CF_AVERAGE) {
+                                           rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii] *
+                                                  elapsed_pdp_st;
+                                        } else {
+                                           rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii];
+                                        }
+#ifdef DEBUG
+                                        fprintf(stderr,"Initialize CDP_val for RRA %lu DS %lu: %10.2f\n",
+                                           i,ii,rrd.cdp_prep[iii].scratch[CDP_val].u_val);
+#endif
+                                 } else {
+                                        switch (current_cf) {
+                                        case CF_AVERAGE:
+                                           rrd.cdp_prep[iii].scratch[CDP_val].u_val += pdp_temp[ii] *
+                                                  elapsed_pdp_st;
+                                               break;
+                                        case CF_MINIMUM:
+                                               if (pdp_temp[ii] < rrd.cdp_prep[iii].scratch[CDP_val].u_val)
+                                                  rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii];
+                                               break; 
+                                        case CF_MAXIMUM:
+                                               if (pdp_temp[ii] > rrd.cdp_prep[iii].scratch[CDP_val].u_val)
+                                                  rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii];
+                                               break; 
+                                        case CF_LAST:
+                                        default:
+                                               rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii];
+                                               break;
+                                        }
+                                 }
+                          }
+                       } else { /* rrd.rra_def[i].pdp_cnt == 1 */
+                          if (elapsed_pdp_st > 2)
+                          {
+                                  switch (current_cf) {
+                                  case CF_AVERAGE:
+                                  default:
+                                 rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val=pdp_temp[ii];
+                                 rrd.cdp_prep[iii].scratch[CDP_secondary_val].u_val=pdp_temp[ii];
+                                         break;
+                   case CF_SEASONAL:
+                                  case CF_DEVSEASONAL:
+                                         /* need to update cached seasonal values, so they are consistent
+                                          * with the bulk update */
+                      /* WARNING: code relies on the fact that CDP_hw_last_seasonal and
+                                          * CDP_last_deviation are the same. */
+                      rrd.cdp_prep[iii].scratch[CDP_hw_last_seasonal].u_val =
+                                                last_seasonal_coef[ii];
+                                         rrd.cdp_prep[iii].scratch[CDP_hw_seasonal].u_val =
+                                                seasonal_coef[ii];
+                                         break;
+                   case CF_HWPREDICT:
+                                         /* need to update the null_count and last_null_count.
+                                          * even do this for non-DNAN pdp_temp because the
+                                          * algorithm is not learning from batch updates. */
+                                         rrd.cdp_prep[iii].scratch[CDP_null_count].u_cnt += 
+                                                elapsed_pdp_st;
+                                         rrd.cdp_prep[iii].scratch[CDP_last_null_count].u_cnt += 
+                                                elapsed_pdp_st - 1;
+                                         /* fall through */
+                                  case CF_DEVPREDICT:
+                                 rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val = DNAN;
+                                 rrd.cdp_prep[iii].scratch[CDP_secondary_val].u_val = DNAN;
+                                         break;
+                   case CF_FAILURES:
+                                         /* do not count missed bulk values as failures */
+                                 rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val = 0;
+                                 rrd.cdp_prep[iii].scratch[CDP_secondary_val].u_val = 0;
+                                         /* need to reset violations buffer.
+                                          * could do this more carefully, but for now, just
+                                          * assume a bulk update wipes away all violations. */
+                      erase_violations(&rrd, iii, i);
+                                         break;
+                                  }
+                          } 
+                       } /* endif rrd.rra_def[i].pdp_cnt == 1 */
+
+                       if (rrd_test_error()) break;
+
+                       } /* endif data sources loop */
+        } /* end RRA Loop */
+
+               /* this loop is only entered if elapsed_pdp_st < 3 */
+               for (j = elapsed_pdp_st, scratch_idx = CDP_primary_val; 
+                        j > 0 && j < 3; j--, scratch_idx = CDP_secondary_val)
+               {
+              for(i = 0, rra_start = rra_begin;
+                  i < rrd.stat_head->rra_cnt;
+              rra_start += rrd.rra_def[i].row_cnt * rrd.stat_head -> ds_cnt * sizeof(rrd_value_t),
+                  i++)
+                  {
+                         if (rrd.rra_def[i].pdp_cnt > 1) continue;
+
+                 current_cf = cf_conv(rrd.rra_def[i].cf_nam);
+                         if (current_cf == CF_SEASONAL || current_cf == CF_DEVSEASONAL)
+                         {
+                        lookup_seasonal(&rrd,i,rra_start,rrd_file,
+                                   elapsed_pdp_st + (scratch_idx == CDP_primary_val ? 1 : 2),
+                               &seasonal_coef);
+                 rra_current = ftell(rrd_file);
+                         }
+                         if (rrd_test_error()) break;
+                     /* loop over data soures within each RRA */
+                     for(ii = 0;
+                         ii < rrd.stat_head->ds_cnt;
+                         ii++)
+                         {
+                            update_aberrant_CF(&rrd,pdp_temp[ii],current_cf,
+                                       i*(rrd.stat_head->ds_cnt) + ii,i,ii,
+                                   scratch_idx, seasonal_coef);
+                         }
+           } /* end RRA Loop */
+                  if (rrd_test_error()) break;
+           } /* end elapsed_pdp_st loop */
+
+               if (rrd_test_error()) break;
+
+               /* Ready to write to disk */
+               /* Move sequentially through the file, writing one RRA at a time.
+                * Note this architecture divorces the computation of CDP with
+                * flushing updated RRA entries to disk. */
+           for(i = 0, rra_start = rra_begin;
+               i < rrd.stat_head->rra_cnt;
+           rra_start += rrd.rra_def[i].row_cnt * rrd.stat_head -> ds_cnt * sizeof(rrd_value_t),
+               i++) {
+               /* is th5Aere anything to write for this RRA? If not, continue. */
+        if (rra_step_cnt[i] == 0) continue;
+
+               /* write the first row */
+#ifdef DEBUG
+        fprintf(stderr,"  -- RRA Preseek %ld\n",ftell(rrd_file));
+#endif
+           rrd.rra_ptr[i].cur_row++;
+           if (rrd.rra_ptr[i].cur_row >= rrd.rra_def[i].row_cnt)
+                  rrd.rra_ptr[i].cur_row = 0; /* wrap around */
+               /* positition on the first row */
+               rra_pos_tmp = rra_start +
+                  (rrd.stat_head->ds_cnt)*(rrd.rra_ptr[i].cur_row)*sizeof(rrd_value_t);
+               if(rra_pos_tmp != rra_current) {
+#ifndef HAVE_MMAP
+                  if(fseek(rrd_file, rra_pos_tmp, SEEK_SET) != 0){
+                     rrd_set_error("seek error in rrd");
+                     break;
+                  }
+#endif
+                  rra_current = rra_pos_tmp;
+               }
+
+#ifdef DEBUG
+           fprintf(stderr,"  -- RRA Postseek %ld\n",ftell(rrd_file));
+#endif
+               scratch_idx = CDP_primary_val;
+               if (pcdp_summary != NULL)
+               {
+                  rra_time = (current_time - current_time 
+                  % (rrd.rra_def[i].pdp_cnt*rrd.stat_head->pdp_step))
+                  - ((rra_step_cnt[i]-1)*rrd.rra_def[i].pdp_cnt*rrd.stat_head->pdp_step);
+               }
+#ifdef HAVE_MMAP
+               pcdp_summary = write_RRA_row(&rrd, i, &rra_current, scratch_idx, rrd_file, 
+                  pcdp_summary, &rra_time, rrd_mmaped_file);
+#else
+               pcdp_summary = write_RRA_row(&rrd, i, &rra_current, scratch_idx, rrd_file, 
+                  pcdp_summary, &rra_time);
+#endif
+               if (rrd_test_error()) break;
+
+               /* write other rows of the bulk update, if any */
+               scratch_idx = CDP_secondary_val;
+               for ( ; rra_step_cnt[i] > 1; rra_step_cnt[i]--)
+               {
+                  if (++rrd.rra_ptr[i].cur_row == rrd.rra_def[i].row_cnt)
+                  {
+#ifdef DEBUG
+              fprintf(stderr,"Wraparound for RRA %s, %lu updates left\n",
+                         rrd.rra_def[i].cf_nam, rra_step_cnt[i] - 1);
+#endif
+                         /* wrap */
+                         rrd.rra_ptr[i].cur_row = 0;
+                         /* seek back to beginning of current rra */
+                     if (fseek(rrd_file, rra_start, SEEK_SET) != 0)
+                         {
+                        rrd_set_error("seek error in rrd");
+                        break;
+                         }
+#ifdef DEBUG
+                 fprintf(stderr,"  -- Wraparound Postseek %ld\n",ftell(rrd_file));
+#endif
+                         rra_current = rra_start;
+                  }
+                  if (pcdp_summary != NULL)
+                  {
+                     rra_time = (current_time - current_time 
+                     % (rrd.rra_def[i].pdp_cnt*rrd.stat_head->pdp_step))
+                     - ((rra_step_cnt[i]-2)*rrd.rra_def[i].pdp_cnt*rrd.stat_head->pdp_step);
+                  }
+#ifdef HAVE_MMAP
+                  pcdp_summary = write_RRA_row(&rrd, i, &rra_current, scratch_idx, rrd_file,
+                     pcdp_summary, &rra_time, rrd_mmaped_file);
+#else
+                  pcdp_summary = write_RRA_row(&rrd, i, &rra_current, scratch_idx, rrd_file,
+                     pcdp_summary, &rra_time);
+#endif
+               }
+               
+               if (rrd_test_error())
+                 break;
+               } /* RRA LOOP */
+
+           /* break out of the argument parsing loop if error_string is set */
+           if (rrd_test_error()){
+                  free(step_start);
+                  break;
+           } 
+           
+       } /* endif a pdp_st has occurred */ 
+       rrd.live_head->last_up = current_time;
+       rrd.live_head->last_up_usec = current_time_usec; 
+       free(step_start);
+    } /* function argument loop */
+
+    if (seasonal_coef != NULL) free(seasonal_coef);
+    if (last_seasonal_coef != NULL) free(last_seasonal_coef);
+       if (rra_step_cnt != NULL) free(rra_step_cnt);
+    rpnstack_free(&rpnstack);
+
+#ifdef HAVE_MMAP
+    if (munmap(rrd_mmaped_file, rrd_filesize) == -1) {
+            rrd_set_error("error writing(unmapping) file: %s", filename);
+    }
+#endif    
+    /* if we got here and if there is an error and if the file has not been
+     * written to, then close things up and return. */
+    if (rrd_test_error()) {
+       free(updvals);
+       free(tmpl_idx);
+       rrd_free(&rrd);
+       free(pdp_temp);
+       free(pdp_new);
+       fclose(rrd_file);
+       return(-1);
+    }
+
+    /* aargh ... that was tough ... so many loops ... anyway, its done.
+     * we just need to write back the live header portion now*/
+
+    if (fseek(rrd_file, (sizeof(stat_head_t)
+                        + sizeof(ds_def_t)*rrd.stat_head->ds_cnt 
+                        + sizeof(rra_def_t)*rrd.stat_head->rra_cnt),
+             SEEK_SET) != 0) {
+       rrd_set_error("seek rrd for live header writeback");
+       free(updvals);
+       free(tmpl_idx);
+       rrd_free(&rrd);
+       free(pdp_temp);
+       free(pdp_new);
+       fclose(rrd_file);
+       return(-1);
+    }
+
+    if(version >= 3) {
+           if(fwrite( rrd.live_head,
+                      sizeof(live_head_t), 1, rrd_file) != 1){
+               rrd_set_error("fwrite live_head to rrd");
+               free(updvals);
+               rrd_free(&rrd);
+               free(tmpl_idx);
+               free(pdp_temp);
+               free(pdp_new);
+               fclose(rrd_file);
+               return(-1);
+           }
+    }
+    else {
+           if(fwrite( &rrd.live_head->last_up,
+                      sizeof(time_t), 1, rrd_file) != 1){
+               rrd_set_error("fwrite live_head to rrd");
+               free(updvals);
+               rrd_free(&rrd);
+               free(tmpl_idx);
+               free(pdp_temp);
+               free(pdp_new);
+               fclose(rrd_file);
+               return(-1);
+           }
+    }
+           
+
+    if(fwrite( rrd.pdp_prep,
+              sizeof(pdp_prep_t),
+              rrd.stat_head->ds_cnt, rrd_file) != rrd.stat_head->ds_cnt){
+       rrd_set_error("ftwrite pdp_prep to rrd");
+       free(updvals);
+       rrd_free(&rrd);
+       free(tmpl_idx);
+       free(pdp_temp);
+       free(pdp_new);
+       fclose(rrd_file);
+       return(-1);
+    }
+
+    if(fwrite( rrd.cdp_prep,
+              sizeof(cdp_prep_t),
+              rrd.stat_head->rra_cnt *rrd.stat_head->ds_cnt, rrd_file) 
+       != rrd.stat_head->rra_cnt *rrd.stat_head->ds_cnt){
+
+       rrd_set_error("ftwrite cdp_prep to rrd");
+       free(updvals);
+       free(tmpl_idx);
+       rrd_free(&rrd);
+       free(pdp_temp);
+       free(pdp_new);
+       fclose(rrd_file);
+       return(-1);
+    }
+
+    if(fwrite( rrd.rra_ptr,
+              sizeof(rra_ptr_t), 
+              rrd.stat_head->rra_cnt,rrd_file) != rrd.stat_head->rra_cnt){
+       rrd_set_error("fwrite rra_ptr to rrd");
+       free(updvals);
+       free(tmpl_idx);
+       rrd_free(&rrd);
+       free(pdp_temp);
+       free(pdp_new);
+       fclose(rrd_file);
+       return(-1);
+    }
+    
+    /* OK now close the files and free the memory */
+    if(fclose(rrd_file) != 0){
+       rrd_set_error("closing rrd");
+       free(updvals);
+       free(tmpl_idx);
+       rrd_free(&rrd);
+       free(pdp_temp);
+       free(pdp_new);
+       return(-1);
+    }
+
+    /* calling the smoothing code here guarantees at most
+        * one smoothing operation per rrd_update call. Unfortunately,
+        * it is possible with bulk updates, or a long-delayed update
+        * for smoothing to occur off-schedule. This really isn't
+        * critical except during the burning cycles. */
+       if (schedule_smooth)
+       {
+         rrd_file = fopen(filename,"rb+");
+          
+
+         rra_start = rra_begin;
+         for (i = 0; i < rrd.stat_head -> rra_cnt; ++i)
+         {
+           if (cf_conv(rrd.rra_def[i].cf_nam) == CF_DEVSEASONAL ||
+               cf_conv(rrd.rra_def[i].cf_nam) == CF_SEASONAL)
+           {
+#ifdef DEBUG
+             fprintf(stderr,"Running smoother for rra %ld\n",i);
+#endif
+             apply_smoother(&rrd,i,rra_start,rrd_file);
+             if (rrd_test_error())
+               break;
+           }
+           rra_start += rrd.rra_def[i].row_cnt
+             *rrd.stat_head->ds_cnt*sizeof(rrd_value_t);
+         }
+         fclose(rrd_file);
+       }
+    rrd_free(&rrd);
+    free(updvals);
+    free(tmpl_idx);
+    free(pdp_new);
+    free(pdp_temp);
+    return(0);
+}
+
+/*
+ * get exclusive lock to whole file.
+ * lock gets removed when we close the file
+ *
+ * returns 0 on success
+ */
+int
+LockRRD(FILE *rrdfile)
+{
+    int        rrd_fd;         /* File descriptor for RRD */
+    int        rcstat;
+
+    rrd_fd = fileno(rrdfile);
+
+       {
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+    struct _stat st;
+
+    if ( _fstat( rrd_fd, &st ) == 0 ) {
+           rcstat = _locking ( rrd_fd, _LK_NBLCK, st.st_size );
+    } else {
+           rcstat = -1;
+    }
+#else
+    struct flock       lock;
+    lock.l_type = F_WRLCK;    /* exclusive write lock */
+    lock.l_len = 0;          /* whole file */
+    lock.l_start = 0;        /* start of file */
+    lock.l_whence = SEEK_SET;   /* end of file */
+
+    rcstat = fcntl(rrd_fd, F_SETLK, &lock);
+#endif
+       }
+
+    return(rcstat);
+}
+
+
+#ifdef HAVE_MMAP
+info_t
+*write_RRA_row (rrd_t *rrd, unsigned long rra_idx, unsigned long *rra_current,
+              unsigned short CDP_scratch_idx, 
+#ifndef DEBUG
+FILE UNUSED(*rrd_file),
+#else
+FILE *rrd_file,
+#endif
+                  info_t *pcdp_summary, time_t *rra_time, void *rrd_mmaped_file)
+#else
+info_t
+*write_RRA_row (rrd_t *rrd, unsigned long rra_idx, unsigned long *rra_current,
+              unsigned short CDP_scratch_idx, FILE *rrd_file,
+                  info_t *pcdp_summary, time_t *rra_time)
+#endif
+{
+   unsigned long ds_idx, cdp_idx;
+   infoval iv;
+  
+   for (ds_idx = 0; ds_idx < rrd -> stat_head -> ds_cnt; ds_idx++)
+   {
+      /* compute the cdp index */
+      cdp_idx =rra_idx * (rrd -> stat_head->ds_cnt) + ds_idx;
+#ifdef DEBUG
+         fprintf(stderr,"  -- RRA WRITE VALUE %e, at %ld CF:%s\n",
+            rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val,ftell(rrd_file),
+            rrd -> rra_def[rra_idx].cf_nam);
+#endif 
+      if (pcdp_summary != NULL)
+         {
+            iv.u_val = rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val;
+            /* append info to the return hash */
+                pcdp_summary = info_push(pcdp_summary,
+                sprintf_alloc("[%d]RRA[%s][%lu]DS[%s]",
+                *rra_time, rrd->rra_def[rra_idx].cf_nam, 
+                rrd->rra_def[rra_idx].pdp_cnt, rrd->ds_def[ds_idx].ds_nam),
+         RD_I_VAL, iv);
+         }
+#ifdef HAVE_MMAP
+         memcpy((char *)rrd_mmaped_file + *rra_current,
+                         &(rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val),
+                         sizeof(rrd_value_t));
+#else
+         if(fwrite(&(rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val),
+                sizeof(rrd_value_t),1,rrd_file) != 1)
+         { 
+            rrd_set_error("writing rrd");
+            return 0;
+         }
+#endif
+         *rra_current += sizeof(rrd_value_t);
+       }
+       return (pcdp_summary);
+}
diff --git a/src/rrd_version.c b/src/rrd_version.c
new file mode 100644 (file)
index 0000000..cd71269
--- /dev/null
@@ -0,0 +1,23 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrd_version Return
+ *****************************************************************************
+ * Initial version by Burton Strauss, ntopSupport.com - 5/2005
+ *****************************************************************************/
+
+#include "rrd_tool.h"
+
+double
+rrd_version(void)
+{
+  return NUMVERS;
+}
+
+char *
+rrd_strversion(void)
+{
+  return PACKAGE_VERSION;
+}
+
+
diff --git a/src/rrd_xport.c b/src/rrd_xport.c
new file mode 100644 (file)
index 0000000..f1e7908
--- /dev/null
@@ -0,0 +1,323 @@
+/****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ ****************************************************************************
+ * rrd_xport.c  export RRD data 
+ ****************************************************************************/
+
+#include <sys/stat.h>
+
+#include "rrd_tool.h"
+#include "rrd_graph.h"
+#include "rrd_xport.h"
+#include "unused.h"
+
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+#include <io.h>
+#include <fcntl.h>
+#endif
+
+
+int rrd_xport(int, char **, int *,
+             time_t *, time_t *,
+             unsigned long *, unsigned long *,
+             char ***, rrd_value_t **);
+
+int rrd_xport_fn(image_desc_t *,
+                time_t *, time_t *,
+                unsigned long *, unsigned long *,
+                char ***, rrd_value_t **);
+
+
+
+
+int 
+rrd_xport(int argc, char **argv, int UNUSED(*xsize),
+         time_t         *start,
+         time_t         *end,        /* which time frame do you want ?
+                                      * will be changed to represent reality */
+         unsigned long  *step,       /* which stepsize do you want? 
+                                      * will be changed to represent reality */
+         unsigned long  *col_cnt,    /* number of data columns in the result */
+         char           ***legend_v, /* legend entries */
+         rrd_value_t    **data)      /* two dimensional array containing the data */
+
+{
+
+    image_desc_t   im;
+    time_t        start_tmp=0,end_tmp=0;
+    struct rrd_time_value start_tv, end_tv;
+    char           *parsetime_error = NULL;
+    optind = 0; opterr = 0;  /* initialize getopt */
+
+    rrd_graph_init(&im);
+
+    parsetime("end-24h", &start_tv);
+    parsetime("now", &end_tv);
+
+    while (1){
+       static struct option long_options[] =
+       {
+           {"start",      required_argument, 0,  's'},
+           {"end",        required_argument, 0,  'e'},
+           {"maxrows",    required_argument, 0,  'm'},
+           {"step",       required_argument, 0,   261},
+           {"enumds",     no_argument,       0,   262}, /* these are handled in the frontend ... */
+           {0,0,0,0}
+       };
+       int option_index = 0;
+       int opt;
+       
+       opt = getopt_long(argc, argv, "s:e:m:",
+                         long_options, &option_index);
+
+       if (opt == EOF)
+           break;
+       
+       switch(opt) {
+       case 261:
+           im.step =  atoi(optarg);
+           break;
+       case 262:
+           break;
+       case 's':
+           if ((parsetime_error = parsetime(optarg, &start_tv))) {
+               rrd_set_error( "start time: %s", parsetime_error );
+               return -1;
+           }
+           break;
+       case 'e':
+           if ((parsetime_error = parsetime(optarg, &end_tv))) {
+               rrd_set_error( "end time: %s", parsetime_error );
+               return -1;
+           }
+           break;
+       case 'm':
+           im.xsize = atol(optarg);
+           if (im.xsize < 10) {
+               rrd_set_error("maxrows below 10 rows");
+               return -1;
+           }
+           break;
+       case '?':
+            rrd_set_error("unknown option '%s'",argv[optind-1]);
+            return -1;
+       }
+    }
+
+    if (proc_start_end(&start_tv,&end_tv,&start_tmp,&end_tmp) == -1){
+       return -1;
+    }  
+    
+    if (start_tmp < 3600*24*365*10){
+       rrd_set_error("the first entry to fetch should be after 1980 (%ld)",start_tmp);
+       return -1;
+    }
+    
+    if (end_tmp < start_tmp) {
+       rrd_set_error("start (%ld) should be less than end (%ld)", 
+              start_tmp, end_tmp);
+       return -1;
+    }
+    
+    im.start = start_tmp;
+    im.end = end_tmp;
+    im.step = max((long)im.step, (im.end-im.start)/im.xsize);
+    
+    rrd_graph_script(argc,argv,&im,0);
+    if (rrd_test_error()) {
+       im_free(&im);
+       return -1;
+    }
+
+    if (im.gdes_c == 0){
+       rrd_set_error("can't make a graph without contents");
+       im_free(&im);
+       return(-1); 
+    }
+    
+    if (rrd_xport_fn(&im, start, end, step, col_cnt, legend_v, data) == -1){
+       im_free(&im);
+       return -1;
+    }
+
+    im_free(&im);
+    return 0;
+}
+
+
+
+int
+rrd_xport_fn(image_desc_t *im,
+            time_t         *start,
+            time_t         *end,        /* which time frame do you want ?
+                                         * will be changed to represent reality */
+            unsigned long  *step,       /* which stepsize do you want? 
+                                         * will be changed to represent reality */
+            unsigned long  *col_cnt,    /* number of data columns in the result */
+            char           ***legend_v, /* legend entries */
+            rrd_value_t    **data)      /* two dimensional array containing the data */
+{
+
+    int            i = 0, j = 0;
+    unsigned long  *ds_cnt;    /* number of data sources in file */
+    unsigned long  col, dst_row, row_cnt;
+    rrd_value_t    *srcptr, *dstptr;
+
+    unsigned long nof_xports = 0;
+    unsigned long xport_counter = 0;
+    int *ref_list;
+    rrd_value_t **srcptr_list;
+    char **legend_list;
+    int ii = 0;
+
+    time_t start_tmp = 0;
+    time_t end_tmp = 0;
+    unsigned long step_tmp = 1;
+
+    /* pull the data from the rrd files ... */
+    if(data_fetch(im)==-1)
+       return -1;
+
+    /* evaluate CDEF  operations ... */
+    if(data_calc(im)==-1)
+       return -1;
+
+    /* how many xports? */
+    for(i = 0; i < im->gdes_c; i++) {  
+       switch(im->gdes[i].gf) {
+       case GF_XPORT:
+         nof_xports++;
+         break;
+       default:
+         break;
+       }
+    }
+
+    if(nof_xports == 0) {
+      rrd_set_error("no XPORT found, nothing to do");
+      return -1;
+    }
+
+    /* a list of referenced gdes */
+    ref_list = malloc(sizeof(int) * nof_xports);
+    if(ref_list == NULL)
+      return -1;
+
+    /* a list to save pointers into each gdes data */
+    srcptr_list = malloc(sizeof(srcptr) * nof_xports);
+    if(srcptr_list == NULL) {
+      free(ref_list);
+      return -1;
+    }
+
+    /* a list to save pointers to the column's legend entry */
+    /* this is a return value! */
+    legend_list = malloc(sizeof(char *) * nof_xports);
+    if(legend_list == NULL) {
+      free(srcptr_list);
+      free(ref_list);
+      return -1;
+    }
+
+    /* find referenced gdes and save their index and */
+    /* a pointer into their data */
+    for(i = 0; i < im->gdes_c; i++) {  
+       switch(im->gdes[i].gf) {
+       case GF_XPORT:
+         ii = im->gdes[i].vidx;
+         if(xport_counter > nof_xports) {
+           rrd_set_error( "too many xports: should not happen. Hmmm");
+           free(srcptr_list);
+           free(ref_list);
+           free(legend_list);
+           return -1;
+         } 
+         srcptr_list[xport_counter] = im->gdes[ii].data;
+         ref_list[xport_counter++] = i;
+         break;
+       default:
+         break;
+       }
+    }
+
+    start_tmp = im->gdes[0].start;
+    end_tmp = im->gdes[0].end;
+    step_tmp = im->gdes[0].step;
+
+    /* fill some return values */
+    *col_cnt = nof_xports;
+    *start = start_tmp;
+    *end = end_tmp;
+    *step = step_tmp;
+
+    row_cnt = ((*end)-(*start))/(*step);
+
+    /* room for rearranged data */
+    /* this is a return value! */
+    if (((*data) = malloc((*col_cnt) * row_cnt * sizeof(rrd_value_t)))==NULL){
+        free(srcptr_list);
+        free(ref_list);
+        free(legend_list);
+        rrd_set_error("malloc xport data area");
+       return(-1);
+    }
+    dstptr = (*data);
+
+    j = 0;
+    for(i = 0; i < im->gdes_c; i++) {  
+       switch(im->gdes[i].gf) {
+       case GF_XPORT:
+         /* reserve room for one legend entry */
+         /* is FMT_LEG_LEN + 5 the correct size? */
+         if ((legend_list[j] = malloc(sizeof(char) * (FMT_LEG_LEN+5)))==NULL) {
+           free(srcptr_list);
+           free(ref_list);
+           free(*data);  *data = NULL;
+           while (--j > -1) free(legend_list[j]);
+           free(legend_list);
+           rrd_set_error("malloc xport legend entry");
+           return(-1);
+         }
+
+         if (im->gdes[i].legend)
+           /* omit bounds check, should have the same size */
+           strcpy (legend_list[j++], im->gdes[i].legend);
+         else
+           legend_list[j++][0] = '\0';
+
+         break;
+       default:
+         break;
+       }
+    }
+
+    /* fill data structure */
+    for(dst_row = 0; (int)dst_row < (int)row_cnt; dst_row++) {
+      for(i = 0; i < (int)nof_xports; i++) {
+        j = ref_list[i];
+       ii = im->gdes[j].vidx;
+       ds_cnt = &im->gdes[ii].ds_cnt;
+
+       srcptr = srcptr_list[i];
+       for(col = 0; col < (*ds_cnt); col++) {
+         rrd_value_t newval = DNAN;
+         newval = srcptr[col];
+
+         if (im->gdes[ii].ds_namv && im->gdes[ii].ds_nam) {
+           if(strcmp(im->gdes[ii].ds_namv[col],im->gdes[ii].ds_nam) == 0)
+             (*dstptr++) = newval;
+         } else {
+           (*dstptr++) = newval;
+         }
+
+       }
+       srcptr_list[i] += (*ds_cnt);
+      }
+    }
+
+    *legend_v = legend_list;
+    free(srcptr_list);
+    free(ref_list);
+    return 0;
+
+}
diff --git a/src/rrd_xport.h b/src/rrd_xport.h
new file mode 100644 (file)
index 0000000..e9e19e8
--- /dev/null
@@ -0,0 +1,34 @@
+/****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ ****************************************************************************
+ * rrd_xport.h  contains XML related constants
+ ****************************************************************************/
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+#ifndef _RRD_XPORT_H
+#define _RRD_XPORT_H
+
+#define XML_ENCODING     "ISO-8859-1"
+#define ROOT_TAG         "xport"
+#define META_TAG         "meta"
+#define META_START_TAG   "start"
+#define META_STEP_TAG    "step"
+#define META_END_TAG     "end"
+#define META_ROWS_TAG    "rows"
+#define META_COLS_TAG    "columns"
+#define LEGEND_TAG       "legend"
+#define LEGEND_ENTRY_TAG "entry"
+#define DATA_TAG         "data"
+#define DATA_ROW_TAG     "row"
+#define COL_TIME_TAG     "t"
+#define COL_DATA_TAG     "v"
+
+
+#endif
+
+
+#ifdef  __cplusplus
+}
+#endif
diff --git a/src/rrdupdate.c b/src/rrdupdate.c
new file mode 100644 (file)
index 0000000..d396522
--- /dev/null
@@ -0,0 +1,35 @@
+/*****************************************************************************
+ * RRDtool 1.2.26  Copyright by Tobi Oetiker, 1997-2007
+ *****************************************************************************
+ * rrdupdate.c  Main program for the (standalone) rrdupdate utility
+ *****************************************************************************
+ * $Id: rrdupdate.c 1235 2007-11-20 00:15:07Z oetiker $
+ *****************************************************************************/
+
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) && !defined(HAVE_CONFIG_H)
+#include "../win32/config.h"
+#else
+#ifdef HAVE_CONFIG_H
+#include "../rrd_config.h"
+#endif
+#endif
+
+#include "rrd.h"
+
+int 
+main(int argc, char **argv){
+        rrd_update(argc,argv);
+        if (rrd_test_error()) {
+                printf("RRDtool " PACKAGE_VERSION "  Copyright by Tobi Oetiker, 1997-2007\n\n"
+                        "Usage: rrdupdate filename\n"
+                        "\t\t\t[--template|-t ds-name:ds-name:...]\n"
+                        "\t\t\ttime|N:value[:value...]\n\n"
+                        "\t\t\tat-time@value[:value...]\n\n"
+                        "\t\t\t[ time:value[:value...] ..]\n\n");
+                                   
+                printf("ERROR: %s\n",rrd_get_error());
+                rrd_clear_error();                                                            
+                return 1;
+        }
+        return 0;
+}
diff --git a/src/strftime.c b/src/strftime.c
new file mode 100644 (file)
index 0000000..c57a726
--- /dev/null
@@ -0,0 +1,356 @@
+/**
+ *
+ * strftime.c
+ *
+ * implements the ansi c function strftime()
+ *
+ * written 6 september 1989 by jim nutt
+ * released into the public domain by jim nutt
+ *
+ * modified 21-Oct-89 by Rob Duff
+ *
+ * modified 08-Dec-04 by Tobi Oetiker (added %V)
+**/
+
+#include <stddef.h>     /* for size_t */
+#include <stdarg.h>     /* for va_arg */
+#include <time.h>       /* for struct tm */
+#include "strftime.h"
+
+/* Define your own defaults in config.h if necessary */
+#if defined(TZNAME_STD) && defined(TZNAME_DST)
+char *tzname_[2] = {TZNAME_STD, TZNAME_DST};
+#else
+#define tzname_ tzname
+#endif
+
+static char *aday[] = {
+    "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
+};
+
+static char *day[] = {
+    "Sunday", "Monday", "Tuesday", "Wednesday",
+    "Thursday", "Friday", "Saturday"
+};
+
+static char *amonth[] = {
+    "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+    "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+};
+
+static char *month[] = {
+    "January", "February", "March", "April", "May", "June",
+    "July", "August", "September", "October", "November", "December"
+};
+
+static char buf[26];
+
+static void strfmt(char *str, const char *fmt, ...);
+
+/**
+ *
+ * size_t strftime_(char *str,
+ *                  size_t maxs,
+ *                  const char *fmt,
+ *                  const struct tm *t)
+ *
+ *      this functions acts much like a sprintf for time/date output.
+ *      given a pointer to an output buffer, a format string and a
+ *      time, it copies the time to the output buffer formatted in
+ *      accordance with the format string.  the parameters are used
+ *      as follows:
+ *
+ *          str is a pointer to the output buffer, there should
+ *          be at least maxs characters available at the address
+ *          pointed to by str.
+ *
+ *          maxs is the maximum number of characters to be copied
+ *          into the output buffer, included the '\0' terminator
+ *
+ *          fmt is the format string.  a percent sign (%) is used
+ *          to indicate that the following character is a special
+ *          format character.  the following are valid format
+ *          characters:
+ *
+ *              %A      full weekday name (Monday)
+ *              %a      abbreviated weekday name (Mon)
+ *              %B      full month name (January)
+ *              %b      abbreviated month name (Jan)
+ *              %c      standard date and time representation
+ *              %d      day-of-month (01-31)
+ *              %H      hour (24 hour clock) (00-23)
+ *              %I      hour (12 hour clock) (01-12)
+ *              %j      day-of-year (001-366)
+ *              %M      minute (00-59)
+ *              %m      month (01-12)
+ *              %p      local equivalent of AM or PM
+ *              %S      second (00-59)
+ *              %U      week-of-year, first day sunday (00-53)
+ *              %W      week-of-year, first day monday (00-53)
+ *              %V      ISO 8601 Week number 
+ *              %w      weekday (0-6, sunday is 0)
+ *              %X      standard time representation
+ *              %x      standard date representation
+ *              %Y      year with century
+ *              %y      year without century (00-99)
+ *              %Z      timezone name
+ *              %%      percent sign
+ *
+ *      the standard date string is equivalent to:
+ *
+ *          %a %b %d %Y
+ *
+ *      the standard time string is equivalent to:
+ *
+ *          %H:%M:%S
+ *
+ *      the standard date and time string is equivalent to:
+ *
+ *          %a %b %d %H:%M:%S %Y
+ *
+ *      strftime_() returns the number of characters placed in the
+ *      buffer, not including the terminating \0, or zero if more
+ *      than maxs characters were produced.
+ *
+**/
+
+size_t strftime_(char *s, size_t maxs, const char *f, const struct tm *t)
+{
+      int w,d;
+      char *p, *q, *r;
+
+      p = s;
+      q = s + maxs - 1;
+      while ((*f != '\0'))
+      {
+            if (*f++ == '%')
+            {
+                  r = buf;
+                  switch (*f++)
+                  {
+                  case '%' :
+                        r = "%";
+                        break;
+
+                  case 'a' :
+                        r = aday[t->tm_wday];
+                        break;
+
+                  case 'A' :
+                        r = day[t->tm_wday];
+                        break;
+
+                  case 'b' :
+                        r = amonth[t->tm_mon];
+                        break;
+
+                  case 'B' :
+                        r = month[t->tm_mon];
+                        break;
+
+                  case 'c' :
+                        strfmt(r, "%0 %0 %2 %2:%2:%2 %4",
+                              aday[t->tm_wday], amonth[t->tm_mon],
+                              t->tm_mday,t->tm_hour, t->tm_min,
+                              t->tm_sec, t->tm_year+1900);
+                        break;
+
+                  case 'd' :
+                        strfmt(r,"%2",t->tm_mday);
+                        break;
+
+                  case 'H' :
+                        strfmt(r,"%2",t->tm_hour);
+                        break;
+
+                  case 'I' :
+                        strfmt(r,"%2",(t->tm_hour%12)?t->tm_hour%12:12);
+                        break;
+
+                  case 'j' :
+                        strfmt(r,"%3",t->tm_yday+1);
+                        break;
+
+                  case 'm' :
+                        strfmt(r,"%2",t->tm_mon+1);
+                        break;
+
+                  case 'M' :
+                        strfmt(r,"%2",t->tm_min);
+                        break;
+
+                  case 'p' :
+                        r = (t->tm_hour>11)?"PM":"AM";
+                        break;
+
+                  case 'S' :
+                        strfmt(r,"%2",t->tm_sec);
+                        break;
+
+                  case 'U' :
+                        w = t->tm_yday/7;
+                        if (t->tm_yday%7 > t->tm_wday)
+                              w++;
+                        strfmt(r, "%2", w);
+                        break;
+
+                  case 'W' :
+                        w = t->tm_yday/7;
+                        if (t->tm_yday%7 > (t->tm_wday+6)%7)
+                              w++;
+                        strfmt(r, "%2", w);
+                        break;
+
+                  case 'V':
+
+                        /* ISO 8601 Week Of Year:
+                           If the week (Monday - Sunday) containing January 1 has four or more
+                           days in the new year, then it is week 1; otherwise it is week 53 of
+                           the previous year and the next week is week one. */
+
+                       w  =  (t->tm_yday + 7 - (t->tm_wday ? t->tm_wday - 1 : 6)) / 7;
+                        d  =  (t->tm_yday + 7 - (t->tm_wday ? t->tm_wday - 1 : 6)) % 7;
+
+                        if (d >= 4) { w++; } else if (w == 0) { w = 53; }
+                        strfmt(r, "%2", w);
+                        break;
+
+                  case 'w' :
+                        strfmt(r,"%1",t->tm_wday);
+                        break;
+
+                  case 'x' :
+                        strfmt(r, "%3s %3s %2 %4", aday[t->tm_wday],
+                              amonth[t->tm_mon], t->tm_mday, t->tm_year+1900);
+                        break;
+
+                  case 'X' :
+                        strfmt(r, "%2:%2:%2", t->tm_hour,
+                              t->tm_min, t->tm_sec);
+                        break;
+
+                  case 'y' :
+                        strfmt(r,"%2",t->tm_year%100);
+                        break;
+
+                  case 'Y' :
+                        strfmt(r,"%4",t->tm_year+1900);
+                        break;
+
+                  case 'Z' :
+                        r = (t->tm_isdst && tzname_[1][0]) ?
+                              tzname_[1] : tzname_[0];
+                        break;
+
+                  default:
+                        buf[0] = '%';     /* reconstruct the format */
+                        buf[1] = f[-1];
+                        buf[2] = '\0';
+                        if (buf[1] == 0)
+                              f--;        /* back up if at end of string */
+                  }
+                  while (*r)
+                  {
+                        if (p == q)
+                        {
+                              *q = '\0';
+                              return 0;
+                        }
+                        *p++ = *r++;
+                  }
+            }
+            else
+            {
+                  if (p == q)
+                  {
+                        *q = '\0';
+                        return 0;
+                  }
+                  *p++ = f[-1];
+            }
+      }
+      *p = '\0';
+      return p - s;
+}
+
+/*
+ *  stdarg.h
+ *
+typedef void *va_list;
+#define va_start(vp,v) (vp=((char*)&v)+sizeof(v))
+#define va_arg(vp,t) (*((t*)(vp))++)
+#define va_end(vp)
+ *
+ */
+
+static int powers[5] = { 1, 10, 100, 1000, 10000 };
+
+/**
+ * static void strfmt(char *str, char *fmt);
+ *
+ * simple sprintf for strftime
+ *
+ * each format descriptor is of the form %n
+ * where n goes from zero to four
+ *
+ * 0    -- string %s
+ * 1..4 -- int %?.?d
+ *
+**/
+
+static void strfmt(char *str, const char *fmt, ...)
+{
+      int ival, ilen;
+      char *sval;
+      va_list vp;
+
+      va_start(vp, fmt);
+      while (*fmt)
+      {
+            if (*fmt++ == '%')
+            {
+                  ilen = *fmt++ - '0';
+                  if (ilen == 0)                /* zero means string arg */
+                  {
+                        sval = va_arg(vp, char*);
+                        while (*sval)
+                              *str++ = *sval++;
+                  }
+                  else                          /* always leading zeros */
+                  {
+                        ival = va_arg(vp, int);
+                        while (ilen)
+                        {
+                              ival %= powers[ilen--];
+                              *str++ = (char)('0' + ival / powers[ilen]);
+                        }
+                  }
+            }
+            else  *str++ = fmt[-1];
+      }
+      *str = '\0';
+      va_end(vp);
+}
+
+#ifdef TEST
+
+#include <stdio.h>      /* for printf */
+#include <time.h>       /* for strftime */
+
+char test[80];
+
+int main(int argc, char *argv[])
+{
+      int len;
+      char *fmt;
+      time_t now;
+
+      time(&now);
+
+      fmt = (argc == 1) ? "%I:%M %p\n%c\n" : argv[1];
+      len = strftime_(test,sizeof test, fmt, localtime(&now));
+      printf("%d: %s\n", len, test);
+      return !len;
+}
+
+#endif /* TEST */
diff --git a/src/strftime.h b/src/strftime.h
new file mode 100644 (file)
index 0000000..c9d45e3
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+**  STRFTIME.H - For older compilers which lack strftime()
+**
+**  Note: To avoid name collision with newer compilers, the function name
+**         strftime_() is used.
+*/
+
+#ifndef STRFTIME__H
+#define STRFTIME__H
+
+#include <stddef.h>     /* for size_t */
+#include <time.h>       /* for struct tm */
+
+size_t strftime_(char *s, size_t maxs, const char *f, const struct tm *t);
+
+#if defined(TZNAME_STD) && defined(TZNAME_DST)
+extern char * tzname_[2];
+#endif
+
+#endif /* STRFTIME__H */
diff --git a/src/unused.h b/src/unused.h
new file mode 100644 (file)
index 0000000..b5ac841
--- /dev/null
@@ -0,0 +1,11 @@
+/* define a macro to wrap variables in that would
+   otherwhise generate UNUSED variable warnings */
+
+#ifdef UNUSED
+#elif defined(__GNUC__)
+# define UNUSED(x) x __attribute__((unused))
+#elif defined(__LCLINT__)
+# define UNUSED(x) /*@unused@*/ x
+#else
+# define UNUSED(x) x
+#endif
diff --git a/src/win32comp.c b/src/win32comp.c
new file mode 100644 (file)
index 0000000..32f5337
--- /dev/null
@@ -0,0 +1,67 @@
+// compatibility routines, non reentrant ....
+
+#include <string.h> 
+#include <time.h>
+
+struct tm* localtime_r(const time_t* t, struct tm* r) {
+  struct tm * temp;
+  temp = localtime(t);
+  memcpy(r,temp,sizeof(struct tm));
+  return(r);
+}
+
+struct tm* gmtime_r(const time_t* t, struct tm* r) {
+  struct tm * temp;
+  temp = gmtime(t);
+  memcpy(r,temp,sizeof(struct tm));
+  return r;
+}
+
+char* ctime_r (const time_t* t, char* buf) {
+  char * temp;
+  temp = asctime(localtime(t));
+  strcpy(buf,temp);
+  return(buf);
+}
+
+/*
+       s  
+       Points to the string from which to extract tokens. 
+
+       delim  
+       Points to a null-terminated set of delimiter characters. 
+
+       save_ptr
+       Is a value-return parameter used by strtok_r() to record its progress through s1. 
+*/
+
+
+char * strtok_r (char *s, const char *delim, char **save_ptr) {
+  char *token;
+
+  if (s == NULL)  s = *save_ptr;
+
+  /* Scan leading delimiters.  */
+  s += strspn(s, delim);
+  if (*s == '\0')
+    {
+      *save_ptr = s;
+      return NULL;
+    }
+
+  /* Find the end of the token.  */
+  token = s;
+  s = strpbrk (token, delim);
+  if (s == NULL) {
+    /* This token finishes the string.  */
+         *save_ptr = token;
+         while (**save_ptr != '\0') (*save_ptr)++;
+  }  else
+    {
+      /* Terminate the token and make *SAVE_PTR point past it.  */
+      *s = '\0';
+      *save_ptr = s + 1;
+    }
+  return token;
+}
+
diff --git a/win32/Makefile b/win32/Makefile
new file mode 100644 (file)
index 0000000..8c392d5
--- /dev/null
@@ -0,0 +1,460 @@
+# Gnu Makefile for Win32 target
+# for use with MingW32 gcc or Metrowerks CodeWarrior compiler
+# use with: make -f Makefile [help|all|clean|dev|devclean|dist|distclean]
+#
+# $id: $
+#
+
+DESCR  = Round Robin Database Tool
+COPYR  = Copyright (c) 1997-2007 by Tobias Oetiker
+WWWURL = http://www.rrdtool.org/
+ICON   = $(PROOT)/favicon.ico
+
+# You can set the default font used in graphs.
+# If not set here RRD defaults to DejaVuSansMono-Roman.ttf
+#RRD_DEFAULT_FONT = "arial.ttf"
+#RRD_DEFAULT_FONT = "VeraMono.ttf"
+
+# Vertical label angle: 90.0 (default) or 270.0
+RRDGRAPH_YLEGEND_ANGLE = 90.0
+
+# Set to one if you want to have piecharts.
+WITH_PIECHART = 0
+
+# Set the extension used for rrdcgi.
+ifndef CGIEXT
+CGIEXT = exe
+endif
+
+# Base for the lib sources
+ifndef LIBBASE
+LIBBASE        = ../..
+endif
+# All library code is statically linked to avoid problems with other lib DLLs.
+# Edit the path below to point to your libpng sources or set environment var.
+ifndef LIBPNG
+LIBPNG = $(LIBBASE)/libpng-1.2.16
+endif
+# Edit the path below to point to your freetype sources or set environment var.
+ifndef LIBFT2
+#LIBFT2        = $(LIBBASE)/freetype-2.3.4
+LIBFT2 = $(LIBBASE)/../mingw32/freetype-2.3.4
+endif
+# Edit the path below to point to your libart sources or set environment var.
+ifndef LIBART
+LIBART = $(LIBBASE)/libart_lgpl-2.3.17
+endif
+# Edit the path below to point to your zlib sources or set environment var.
+ifndef ZLIBSDK
+ZLIBSDK        = $(LIBBASE)/zlib-1.2.3
+endif
+
+# Edit the path below to point to your distribution folder.
+ifndef DISTDIR
+DISTDIR        = rrdtool-$(RRD_VERSION_STR)-w32
+endif
+DISTARC = $(DISTDIR).zip
+
+# Edit the path below to point to your distribution folder.
+ifndef DEVLDIR
+DEVLDIR        = rrdtool-$(RRD_VERSION_STR)-sdk-w32
+endif
+DEVLARC = $(DEVLDIR).zip
+
+# whatever...
+NO_NULL_REALLOC = 1
+
+# The following line defines your compiler.
+ifdef METROWERKS
+       CC = mwcc
+else
+       CC = gcc
+endif
+# RM   = rm -f
+CP     = cp -afv
+# Here you can find a native Win32 binary of the original awk:
+# http://www.gknw.net/development/prgtools/awk.zip
+AWK    = awk
+ZIP    = zip -qzr9
+
+# must be equal to DEBUG or NDEBUG
+DB     = NDEBUG
+# DB   = DEBUG
+# Optimization: -O<n> or debugging: -g
+ifeq ($(DB),NDEBUG)
+       OPT     = -O2
+       OBJDIR  = release
+else
+       OPT     = -g
+       OBJDIR  = debug
+endif
+
+# Project root
+PROOT  = ..
+
+# Include the version info retrieved from source.
+-include $(OBJDIR)/version.inc
+
+# Global flags for all compilers
+CFLAGS = $(OPT) -D$(DB) -DHAVE_CONFIG_H
+
+ifeq ($(CC),mwcc)
+LD     = mwld
+RC     = mwwinrc
+LDFLAGS        = -nostdlib
+AR     = $(LD)
+ARFLAGS        = -type library -w nocmdline $(OBJS) -o
+LIBEXT = lib
+LIBPATH        += -lr "$(METROWERKS)/MSL" -lr "$(METROWERKS)/Win32-x86 Support"
+LDLIBS += -lkernel32.lib -luser32.lib
+LDLIBS += -lMSL_Runtime_x86.lib -lMSL_C_x86.lib -lMSL_Extras_x86.lib
+RCFLAGS        =
+CFLAGS += -DWIN32
+CFLAGS += -nostdinc -gccinc -msgstyle gcc -inline off -opt nointrinsics -proc 586
+CFLAGS += -ir "$(METROWERKS)/MSL" -ir "$(METROWERKS)/Win32-x86 Support"
+CFLAGS += -w on,nounused,nounusedexpr # -ansi strict
+else
+LD     = gcc
+RC     = windres
+LDFLAGS        = -s
+AR     = ar
+ARFLAGS        = -cq
+LIBEXT = a
+RCFLAGS        = -O coff -i
+CFLAGS += -fno-strict-aliasing
+CFLAGS += -Wall -Wno-unused # -pedantic
+endif
+
+ifeq ($(findstring msys,$(OSTYPE)),msys)
+DL     = '
+DS     = /
+else
+DS     = \\
+endif
+
+ifndef DESCR
+       DESCR = $(notdir $(@:.rc=)) Command Extension
+endif
+DESCR += - $(CC) build
+
+INCLUDES += -I$(PROOT) -I$(PROOT)/src -I$(LIBPNG) -I$(LIBFT2)/include -I$(LIBART) -I$(ZLIBSDK)
+
+CFLAGS += $(INCLUDES)
+
+vpath %.c $(PROOT)/src $(LIBPNG) $(LIBART)/libart_lgpl $(ZLIBSDK)
+
+RRDLIBOBJS     = \
+       $(OBJDIR)/rrd_afm.o \
+       $(OBJDIR)/rrd_afm_data.o \
+       $(OBJDIR)/rrd_create.o \
+       $(OBJDIR)/rrd_diff.o \
+       $(OBJDIR)/rrd_dump.o \
+       $(OBJDIR)/rrd_error.o \
+       $(OBJDIR)/rrd_fetch.o \
+       $(OBJDIR)/rrd_first.o \
+       $(OBJDIR)/rrd_format.o \
+       $(OBJDIR)/rrd_gfx.o \
+       $(OBJDIR)/rrd_graph.o \
+       $(OBJDIR)/rrd_graph_helper.o \
+       $(OBJDIR)/rrd_hw.o \
+       $(OBJDIR)/rrd_info.o \
+       $(OBJDIR)/rrd_last.o \
+       $(OBJDIR)/rrd_lastupdate.o \
+       $(OBJDIR)/rrd_nan_inf.o \
+       $(OBJDIR)/rrd_open.o \
+       $(OBJDIR)/rrd_resize.o \
+       $(OBJDIR)/rrd_restore.o \
+       $(OBJDIR)/rrd_rpncalc.o \
+       $(OBJDIR)/rrd_tune.o \
+       $(OBJDIR)/rrd_update.o \
+       $(OBJDIR)/rrd_version.o \
+       $(OBJDIR)/rrd_xport.o \
+       $(OBJDIR)/rrd_thread_safe_nt.o \
+       $(EOLIST)
+
+XLIBOBJS       = \
+       $(OBJDIR)/rrd_getopt.o \
+       $(OBJDIR)/rrd_getopt1.o \
+       $(OBJDIR)/art_rgba_svp.o \
+       $(OBJDIR)/hash_32.o \
+       $(OBJDIR)/parsetime.o \
+       $(OBJDIR)/pngsize.o \
+       $(OBJDIR)/strftime.o \
+       $(EOLIST)
+
+PNGLIBOBJS     = \
+       $(OBJDIR)/png.o \
+       $(OBJDIR)/pngerror.o \
+       $(OBJDIR)/pngget.o \
+       $(OBJDIR)/pngmem.o \
+       $(OBJDIR)/pngpread.o \
+       $(OBJDIR)/pngread.o \
+       $(OBJDIR)/pngrio.o \
+       $(OBJDIR)/pngrtran.o \
+       $(OBJDIR)/pngrutil.o \
+       $(OBJDIR)/pngset.o \
+       $(OBJDIR)/pngtrans.o \
+       $(OBJDIR)/pngwio.o \
+       $(OBJDIR)/pngwrite.o \
+       $(OBJDIR)/pngwtran.o \
+       $(OBJDIR)/pngwutil.o \
+       $(EOLIST)
+ifeq "$(wildcard $(LIBPNG)/pnggccrd.c)" "$(LIBPNG)/pnggccrd.c"
+PNGLIBOBJS     += \
+       $(OBJDIR)/pnggccrd.o \
+       $(OBJDIR)/pngvcrd.o \
+       $(EOLIST)
+endif
+
+ZLIBOBJS       = \
+       $(OBJDIR)/adler32.o \
+       $(OBJDIR)/compress.o \
+       $(OBJDIR)/crc32.o \
+       $(OBJDIR)/deflate.o \
+       $(OBJDIR)/inflate.o \
+       $(OBJDIR)/inffast.o \
+       $(OBJDIR)/inftrees.o \
+       $(OBJDIR)/trees.o \
+       $(OBJDIR)/zutil.o \
+       $(EOLIST)
+ifeq "$(wildcard $(ZLIBSDK)/infblock.c)" "$(ZLIBSDK)/infblock.c"
+ZLIBOBJS       += \
+       $(OBJDIR)/infblock.o \
+       $(OBJDIR)/infcodes.o \
+       $(OBJDIR)/infutil.o \
+       $(EOLIST)
+endif
+
+ARTLIBOBJS     = \
+       $(patsubst $(LIBART)/libart_lgpl/%.c,$(OBJDIR)/%.o,$(wildcard $(LIBART)/libart_lgpl/art_*.c))
+
+OBJS   := $(RRDLIBOBJS) $(XLIBOBJS) $(PNGLIBOBJS) $(ARTLIBOBJS) $(ZLIBOBJS)
+OBJCGI := $(OBJS) $(OBJDIR)/rrd_cgi.o
+OBJTOOL        := $(OBJS) $(OBJDIR)/rrd_tool.o
+
+LDLIBS += $(LIBFT2)/objs/freetype.$(LIBEXT)
+
+
+all: rrdtool rrdcgi
+
+rrdtool: $(OBJDIR) $(PROOT)/rrd_config.h $(OBJDIR)/rrdtool.exe
+rrdcgi: $(OBJDIR) $(PROOT)/rrd_config.h $(OBJDIR)/rrdcgi.$(CGIEXT)
+librrd: $(OBJDIR) $(PROOT)/rrd_config.h $(OBJDIR)/librrd.$(LIBEXT)
+
+FORCE: ;
+
+dist: all $(DISTDIR) $(DISTDIR)/readme.txt
+       @-$(CP) $(OBJDIR)/rrdcgi.$(CGIEXT) $(DISTDIR)
+       @-$(CP) $(OBJDIR)/rrdtool.exe $(DISTDIR)
+       @-$(CP) $(PROOT)/src/*.ttf $(DISTDIR)
+       @-$(CP) $(PROOT)/CHANGES $(DISTDIR)
+       @-$(CP) $(PROOT)/COPYING $(DISTDIR)
+       @-$(CP) $(PROOT)/COPYRIGHT $(DISTDIR)
+       @-$(CP) $(PROOT)/NEWS $(DISTDIR)
+       @-$(CP) $(PROOT)/README $(DISTDIR)
+       @echo Creating $(DISTARC)
+       @$(ZIP) $(DISTARC) $(DISTDIR)/* < $(DISTDIR)/readme.txt
+
+dev: librrd $(DEVLDIR) $(DEVLDIR)/readme.txt
+       @-mkdir $(DEVLDIR)$(DS)include
+       @-mkdir $(DEVLDIR)$(DS)lib
+       @-mkdir $(DEVLDIR)$(DS)src
+       @-$(CP) $(OBJDIR)/librrd.$(LIBEXT) $(DEVLDIR)/lib
+       @-$(CP) $(PROOT)/rrd_config.h $(DEVLDIR)/include
+       @-$(CP) $(PROOT)/src/rrd.h $(DEVLDIR)/include
+       @-$(CP) $(PROOT)/src/*.ttf $(DEVLDIR)/src
+       @-$(CP) $(PROOT)/CHANGES $(DEVLDIR)
+       @-$(CP) $(PROOT)/COPYING $(DEVLDIR)
+       @-$(CP) $(PROOT)/COPYRIGHT $(DEVLDIR)
+       @-$(CP) $(PROOT)/NEWS $(DEVLDIR)
+       @-$(CP) $(PROOT)/README $(DEVLDIR)
+       @echo Creating $(DEVLARC)
+       @$(ZIP) $(DEVLARC) $(DEVLDIR)/* < $(DEVLDIR)/readme.txt
+
+clean:
+       -$(RM) -r $(OBJDIR)
+       -$(RM) $(PROOT)/rrd_config.h
+
+distclean: clean
+       -$(RM) -r $(DISTDIR)
+       -$(RM) $(DISTARC)
+
+devclean: clean
+       -$(RM) -r $(DEVLDIR)
+       -$(RM) $(DEVLARC)
+
+$(OBJDIR):
+       @mkdir $@
+
+$(DISTDIR):
+       @mkdir $@
+
+$(DEVLDIR):
+       @mkdir $@
+
+$(OBJDIR)/version.inc: $(PROOT)/configure.ac $(OBJDIR) $(PROOT)/src/get_ver.awk
+       @echo Creating $@
+       @$(AWK) -f $(PROOT)/src/get_ver.awk $< > $@
+
+$(OBJDIR)/%.o: %.c
+       @echo Compiling $<
+       @$(CC) $(CFLAGS) -c $< -o $@
+
+$(OBJDIR)/rrdcgi.$(CGIEXT): $(OBJCGI) $(OBJDIR)/rrdcgi.res
+       @echo Linking $@
+       @-$(RM) $@
+       @$(LD) $(LDFLAGS) $^ -o $@ $(LIBPATH) $(LDLIBS)
+
+$(OBJDIR)/rrdtool.exe: $(OBJTOOL) $(OBJDIR)/rrdtool.res
+       @echo Linking $@
+       @-$(RM) $@
+       @$(LD) $(LDFLAGS) $^ -o $@ $(LIBPATH) $(LDLIBS)
+
+$(OBJDIR)/librrd.$(LIBEXT): $(OBJS)
+       @echo Creating $@
+       @-$(RM) $@
+       @$(AR) $(ARFLAGS) $@ $^
+
+$(OBJDIR)/%.res: $(OBJDIR)/%.rc
+       @echo Creating $@
+       @$(RC) $(RCFLAGS) $< -o $@
+
+$(OBJDIR)/%.rc: Makefile $(OBJDIR)/version.inc
+       @echo $(DL)1 VERSIONINFO$(DL) > $@
+       @echo $(DL) FILEVERSION $(RRD_VERSION),0$(DL) >> $@
+       @echo $(DL) PRODUCTVERSION $(RRD_VERSION),0$(DL) >> $@
+       @echo $(DL) FILEFLAGSMASK 0x3fL$(DL) >> $@
+       @echo $(DL) FILEOS 0x40004L$(DL) >> $@
+       @echo $(DL) FILEFLAGS 0x0L$(DL) >> $@
+       @echo $(DL) FILETYPE 0x1L$(DL) >> $@
+       @echo $(DL) FILESUBTYPE 0x0L$(DL) >> $@
+       @echo $(DL)BEGIN$(DL) >> $@
+       @echo $(DL)  BLOCK "StringFileInfo"$(DL) >> $@
+       @echo $(DL)  BEGIN$(DL) >> $@
+       @echo $(DL)    BLOCK "040904E4"$(DL) >> $@
+       @echo $(DL)    BEGIN$(DL) >> $@
+       @echo $(DL)      VALUE "LegalCopyright","$(COPYR)\0"$(DL) >> $@
+ifdef COMPANY
+       @echo $(DL)      VALUE "CompanyName","$(COMPANY)\0"$(DL) >> $@
+endif
+       @echo $(DL)      VALUE "ProductName","$(notdir $(@:.rc=.exe))\0"$(DL) >> $@
+       @echo $(DL)      VALUE "ProductVersion","$(RRD_VERSION_STR)\0"$(DL) >> $@
+       @echo $(DL)      VALUE "License","Released under GPL.\0"$(DL) >> $@
+       @echo $(DL)      VALUE "FileDescription","$(DESCR)\0"$(DL) >> $@
+       @echo $(DL)      VALUE "FileVersion","$(RRD_VERSION_STR)\0"$(DL) >> $@
+       @echo $(DL)      VALUE "InternalName","$(notdir $(@:.rc=))\0"$(DL) >> $@
+       @echo $(DL)      VALUE "OriginalFilename","$(notdir $(@:.rc=.exe))\0"$(DL) >> $@
+       @echo $(DL)      VALUE "WWW","$(WWWURL)\0"$(DL) >> $@
+       @echo $(DL)    END$(DL) >> $@
+       @echo $(DL)  END$(DL) >> $@
+       @echo $(DL)  BLOCK "VarFileInfo"$(DL) >> $@
+       @echo $(DL)  BEGIN$(DL) >> $@
+       @echo $(DL)    VALUE "Translation", 0x409, 1252$(DL) >> $@
+       @echo $(DL)  END$(DL) >> $@
+       @echo $(DL)END$(DL) >> $@
+ifdef ICON
+       @echo $(DL)10 ICON DISCARDABLE "$(ICON)"$(DL) >> $@
+endif
+
+$(PROOT)/rrd_config.h: FORCE Makefile $(OBJDIR)/version.inc
+       @echo Creating $@
+       @echo $(DL)/* $(notdir $@) for Win32 target.$(DL) > $@
+       @echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@
+       @echo $(DL)** All your changes will be lost!!$(DL) >> $@
+       @echo $(DL)*/$(DL) >> $@
+       @echo $(DL)#ifndef WIN32$(DL) >> $@
+       @echo $(DL)#error This $(notdir $@) is created for Win32 platform!$(DL) >> $@
+       @echo $(DL)#endif$(DL) >> $@
+       @echo $(DL)#ifndef RRD_CONFIG_H$(DL) >> $@
+       @echo $(DL)#define RRD_CONFIG_H$(DL) >> $@
+       @echo $(DL)#define OS "i586-pc-Win32"$(DL) >> $@
+       @echo $(DL)#define PACKAGE_VERSION "$(RRD_VERSION_STR)"$(DL) >> $@
+       @echo $(DL)#define PACKAGE_BUGREPORT "tobi@oetiker.ch"$(DL) >> $@
+       @echo $(DL)#define NUMVERS $(RRD_NUMVERS)$(DL) >> $@
+       @echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
+       @echo $(DL)#define HAVE_ERRNO_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@
+       @echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
+       @echo $(DL)#define HAVE_LOCALE_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_MATH_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_MBSTOWCS 1$(DL) >> $@
+       @echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_SNPRINTF 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STDARG_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STDDEF_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@
+       @echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@
+       @echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_VSNPRINTF 1$(DL) >> $@
+       @echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
+       @echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
+       @echo $(DL)#define HAVE_ZLIB_H 1$(DL) >> $@
+       @echo $(DL)#define HAVE_LIBZ 1$(DL) >> $@
+ifdef NO_NULL_REALLOC
+       @echo $(DL)#define NO_NULL_REALLOC 1$(DL) >> $@
+       @echo $(DL)#define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) ))$(DL) >> $@
+else
+       @echo $(DL)#define rrd_realloc(a,b) realloc((a), (b))$(DL) >> $@
+endif
+ifdef RRD_DEFAULT_FONT
+       @echo $(DL)#define RRD_DEFAULT_FONT $(RRD_DEFAULT_FONT)$(DL) >> $@
+endif
+       @echo $(DL)#define RRDGRAPH_YLEGEND_ANGLE $(RRDGRAPH_YLEGEND_ANGLE)$(DL) >> $@
+       @echo $(DL)#define strftime strftime_$(DL) >> $@
+ifdef WITH_PIECHART
+       @echo $(DL)#define WITH_PIECHART $(WITH_PIECHART)$(DL) >> $@
+endif
+       @echo $(DL)#endif /* RRD_CONFIG_H */$(DL) >> $@
+
+$(DISTDIR)/readme.txt: Makefile
+       @echo Creating $@
+       @echo $(DL)This is a binary distribution for Win32 platform.$(DL) > $@
+       @echo $(DL)RRDTool version $(RRD_VERSION_STR)$(DL) >> $@
+       @echo $(DL)Please download the complete RRDTool package for$(DL) >> $@
+       @echo $(DL)any further documentation:$(DL) >> $@
+       @echo $(DL)$(WWWURL)$(DL) >> $@
+
+$(DEVLDIR)/readme.txt: Makefile
+       @echo Creating $@
+       @echo $(DL)This is a development distribution for Win32 platform.$(DL) > $@
+       @echo $(DL)RRDTool version $(RRD_VERSION_STR)$(DL) >> $@
+       @echo $(DL)Please download the complete RRDTool package for$(DL) >> $@
+       @echo $(DL)any further documentation:$(DL) >> $@
+       @echo $(DL)$(WWWURL)$(DL) >> $@
+
+help:
+       @echo $(DL)===========================================================$(DL)
+       @echo $(DL)libpng Source   = $(LIBPNG)$(DL)
+       @echo $(DL)libart Source   = $(LIBART)$(DL)
+       @echo $(DL)Freetype 2 SDK  = $(LIBFT2)$(DL)
+       @echo $(DL)Zlib SDK        = $(ZLIBSDK)$(DL)
+       @echo $(DL)===========================================================$(DL)
+       @echo $(DL)RRDTool $(RRD_VERSION_STR) - available targets are:$(DL)
+       @echo $(DL)$(MAKE) all$(DL)
+       @echo $(DL)$(MAKE) rrdtool$(DL)
+       @echo $(DL)$(MAKE) rrdcgi$(DL)
+       @echo $(DL)$(MAKE) librrd$(DL)
+       @echo $(DL)$(MAKE) clean$(DL)
+       @echo $(DL)$(MAKE) dev$(DL)
+       @echo $(DL)$(MAKE) devclean$(DL)
+       @echo $(DL)$(MAKE) dist$(DL)
+       @echo $(DL)$(MAKE) distclean$(DL)
+       @echo $(DL)===========================================================$(DL)
+
+
diff --git a/win32/config.h b/win32/config.h
new file mode 100644 (file)
index 0000000..965d525
--- /dev/null
@@ -0,0 +1,60 @@
+/* config.h.msvc.  Hand-tweaked config.h for MSVC compiler.  */
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#include <math.h>
+#include <float.h>
+#include <direct.h>
+
+/* realloc does not support NULL as argument */
+
+#define HAVE_STRFTIME 1
+#define HAVE_TIME_H 1
+#define HAVE_LOCALE_H 1
+#define HAVE_TZSET 1
+#define HAVE_SETLOCALE 1
+#define HAVE_MATH_H 1
+#define HAVE_FLOAT_H 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MALLOC_H 1
+#define HAVE_MKTIME 1
+#define HAVE_STRFTIME 1
+#define HAVE_STRING_H 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+#define NUMVERS 1.2015
+#define PACKAGE_NAME "rrdtool"
+#define PACKAGE_VERSION "1.2.15"
+#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION
+
+#define isinf(a) (_fpclass(a) == _FPCLASS_NINF || _fpclass(a) == _FPCLASS_PINF)
+#define isnan _isnan
+#define finite _finite
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+#define strftime strftime_ 
+
+#define NO_NULL_REALLOC 1
+#if NO_NULL_REALLOC
+# define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) ))
+#else
+# define rrd_realloc(a,b) realloc((a), (b))
+#endif      
+
+/* Vertical label angle: 90.0 (default) or 270.0 */
+#define RRDGRAPH_YLEGEND_ANGLE 90.0
+
+#define RRD_DEFAULT_FONT "arial.ttf"
+/* #define RRD_DEFAULT_FONT "DejaVuSansMono-Roman.ttf" */
+
+/* #define WITH_PIECHART 1 */
+
+/* #define DEBUG 1 */
+
+#endif /* CONFIG_H */
+
diff --git a/win32/rrd.dsp b/win32/rrd.dsp
new file mode 100644 (file)
index 0000000..fbc0c1d
--- /dev/null
@@ -0,0 +1,247 @@
+# Microsoft Developer Studio Project File - Name="rrd" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Static Library" 0x0104\r
+\r
+CFG=rrd - Win32 Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "rrd.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "rrd.mak" CFG="rrd - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "rrd - Win32 Release" (based on "Win32 (x86) Static Library")\r
+!MESSAGE "rrd - Win32 Debug" (based on "Win32 (x86) Static Library")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF  "$(CFG)" == "rrd - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "rrd___Wi"\r
+# PROP BASE Intermediate_Dir "rrd___Wi"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "release"\r
+# PROP Intermediate_Dir "release"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c\r
+# ADD CPP /nologo /MD /W3 /GX /I "../src" /I "../../zlib-1.2.3" /I "../../libpng-1.2.16" /I "../../libart_lgpl-2.3.17" /I "../../freetype-2.3.1/include" /D "HAVE_CONFIG_H" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_CTYPE_DISABLE_MACROS" /FD /c\r
+# SUBTRACT CPP /X /YX\r
+# ADD BASE RSC /l 0x100c\r
+# ADD RSC /l 0x409\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo\r
+\r
+!ELSEIF  "$(CFG)" == "rrd - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "rrd___W0"\r
+# PROP BASE Intermediate_Dir "rrd___W0"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "debug"\r
+# PROP Intermediate_Dir "debug"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c\r
+# ADD CPP /nologo /MD /W3 /Gm /GX /ZI /Od /I "../src" /I "../../zlib-1.2.3" /I "../../libpng-1.2.16" /I "../../libart_lgpl-2.3.17" /I "../../freetype-2.3.1/include" /D "HAVE_CONFIG_H" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_CTYPE_DISABLE_MACROS" /FR /FD /c\r
+# SUBTRACT CPP /X /YX\r
+# ADD BASE RSC /l 0x100c\r
+# ADD RSC /l 0x409\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo /o"rrd.bsc"\r
+LIB32=link.exe -lib\r
+# ADD BASE LIB32 /nologo\r
+# ADD LIB32 /nologo\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "rrd - Win32 Release"\r
+# Name "rrd - Win32 Debug"\r
+# Begin Source File\r
+\r
+SOURCE="..\src\get_ver.awk"\r
+\r
+!IF  "$(CFG)" == "rrd - Win32 Release"\r
+\r
+# PROP Ignore_Default_Tool 1\r
+# Begin Custom Build - Creating ..\rrd_config.h\r
+InputPath="..\src\get_ver.awk"\r
+\r
+"..\rrd_config.h" : $(SOURCE) "..\configure.ac" "..\win32\rrd_config.h.msvc"\r
+       awk -f ..\src\get_ver.awk ..\configure.ac ..\win32\rrd_config.h.msvc > ..\rrd_config.h\r
+\r
+# End Custom Build\r
+\r
+!ELSEIF  "$(CFG)" == "rrd - Win32 Debug"\r
+\r
+# PROP Ignore_Default_Tool 1\r
+# Begin Custom Build - Creating ..\rrd_config.h\r
+InputPath="..\src\get_ver.awk"\r
+\r
+"..\rrd_config.h" : $(SOURCE) "..\configure.ac" "..\win32\rrd_config.h.msvc"\r
+       awk -f ..\src\get_ver.awk ..\configure.ac ..\win32\rrd_config.h.msvc > ..\rrd_config.h\r
+\r
+# End Custom Build\r
+\r
+!ENDIF\r
+\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_afm.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_afm_data.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_create.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_diff.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_dump.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_error.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_fetch.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_first.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_format.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_gfx.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_graph.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_graph_helper.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_hw.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_info.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_last.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_lastupdate.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_nan_inf.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_open.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_resize.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_restore.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_rpncalc.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_thread_safe_nt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_tune.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_update.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_version.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_xport.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_getopt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_getopt1.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\art_rgba_svp.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\hash_32.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\parsetime.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\pngsize.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\src\strftime.c\r
+# End Source File\r
+# End Target\r
+# End Project\r
diff --git a/win32/rrd.vcproj b/win32/rrd.vcproj
new file mode 100644 (file)
index 0000000..30ca966
--- /dev/null
@@ -0,0 +1,648 @@
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+       ProjectType="Visual C++"\r
+       Version="7.10"\r
+       Name="rrd"\r
+       SccProjectName=""\r
+       SccLocalPath="">\r
+       <Platforms>\r
+               <Platform\r
+                       Name="Win32"/>\r
+       </Platforms>\r
+       <Configurations>\r
+               <Configuration\r
+                       Name="Release|Win32"\r
+                       OutputDirectory=".\release"\r
+                       IntermediateDirectory=".\release"\r
+                       ConfigurationType="4"\r
+                       UseOfMFC="0"\r
+                       ATLMinimizesCRunTimeLibraryUsage="FALSE"\r
+                       CharacterSet="2">\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="4"\r
+                               AdditionalIncludeDirectories="\Program Files\GnuWin32\include,\Program Files\GnuWin32\include\freetype2"\r
+                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CTYPE_DISABLE_MACROS"\r
+                               RuntimeLibrary="2"\r
+                               PrecompiledHeaderFile=".\release/rrd.pch"\r
+                               AssemblerListingLocation=".\release/"\r
+                               ObjectFile=".\release/"\r
+                               ProgramDataBaseFileName=".\release/"\r
+                               WarningLevel="3"\r
+                               SuppressStartupBanner="TRUE"\r
+                               CompileAs="0"/>\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"/>\r
+                       <Tool\r
+                               Name="VCLibrarianTool"\r
+                               OutputFile=".\release\rrd.lib"\r
+                               SuppressStartupBanner="TRUE"/>\r
+                       <Tool\r
+                               Name="VCMIDLTool"/>\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"/>\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"/>\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"/>\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                               Culture="4108"/>\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCManagedWrapperGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Debug|Win32"\r
+                       OutputDirectory=".\debug"\r
+                       IntermediateDirectory=".\debug"\r
+                       ConfigurationType="4"\r
+                       UseOfMFC="0"\r
+                       ATLMinimizesCRunTimeLibraryUsage="FALSE"\r
+                       CharacterSet="2">\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
+                               AdditionalIncludeDirectories="\Program Files\GnuWin32\include\freetype2,\Program Files\GnuWin32\include"\r
+                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CTYPE_DISABLE_MACROS"\r
+                               RuntimeLibrary="2"\r
+                               PrecompiledHeaderFile=".\debug/rrd.pch"\r
+                               AssemblerListingLocation=".\debug/"\r
+                               ObjectFile=".\debug/"\r
+                               ProgramDataBaseFileName=".\debug/"\r
+                               BrowseInformation="1"\r
+                               WarningLevel="3"\r
+                               SuppressStartupBanner="TRUE"\r
+                               DebugInformationFormat="4"\r
+                               CompileAs="0"/>\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"/>\r
+                       <Tool\r
+                               Name="VCLibrarianTool"\r
+                               OutputFile=".\debug\rrd.lib"\r
+                               SuppressStartupBanner="TRUE"/>\r
+                       <Tool\r
+                               Name="VCMIDLTool"/>\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"/>\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"/>\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"/>\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                               Culture="4108"/>\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCManagedWrapperGeneratorTool"/>\r
+                       <Tool\r
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>\r
+               </Configuration>\r
+       </Configurations>\r
+       <References>\r
+       </References>\r
+       <Files>\r
+               <File\r
+                       RelativePath="getopt.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="getopt1.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="hash_32.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="parsetime.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="pngsize.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_afm.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_afm_data.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_create.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_diff.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_dump.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_error.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_fetch.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_format.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_gfx.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_graph.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_graph_helper.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_hw.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_info.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_last.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_nan_inf.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_open.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_resize.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_restore.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_rpncalc.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_thread_safe_nt.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_tune.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_update.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+               <File\r
+                       RelativePath="rrd_xport.c">\r
+                       <FileConfiguration\r
+                               Name="Release|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""/>\r
+                       </FileConfiguration>\r
+                       <FileConfiguration\r
+                               Name="Debug|Win32">\r
+                               <Tool\r
+                                       Name="VCCLCompilerTool"\r
+                                       Optimization="0"\r
+                                       AdditionalIncludeDirectories=""\r
+                                       PreprocessorDefinitions=""\r
+                                       BrowseInformation="1"/>\r
+                       </FileConfiguration>\r
+               </File>\r
+       </Files>\r
+       <Globals>\r
+       </Globals>\r
+</VisualStudioProject>\r
diff --git a/win32/rrd_config.h.msvc b/win32/rrd_config.h.msvc
new file mode 100644 (file)
index 0000000..8a83923
--- /dev/null
@@ -0,0 +1,65 @@
+/* rrd_config.h.msvc. Hand-tweaked rrd_config.h for MSVC compiler. */\r
+#ifndef WIN32 \r
+#error This rrd_config.h is created for Win32 platform! \r
+#endif \r
+#ifndef RRD_CONFIG_H\r
+#define RRD_CONFIG_H\r
+\r
+#include <math.h>\r
+#include <float.h>\r
+#include <direct.h>\r
+\r
+/* the placeholders will be filled in by get_ver.awk */\r
+/* http://cm.bell-labs.com/cm/cs/awkbook/index.html */\r
+#define NUMVERS @@NUMVERS@@\r
+#define PACKAGE_VERSION "@@PACKAGE_VERSION@@"\r
+\r
+#define PACKAGE_NAME "rrdtool"\r
+#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION\r
+\r
+#define HAVE_STRFTIME 1\r
+#define HAVE_TIME_H 1\r
+#define HAVE_LOCALE_H 1\r
+#define HAVE_TZSET 1\r
+#define HAVE_SETLOCALE 1\r
+#define HAVE_MATH_H 1\r
+#define HAVE_FLOAT_H 1\r
+#define HAVE_MEMMOVE 1\r
+#define HAVE_MALLOC_H 1\r
+#define HAVE_MKTIME 1\r
+#define HAVE_STRFTIME 1\r
+#define HAVE_STRING_H 1\r
+#define HAVE_VSNPRINTF 1\r
+#define HAVE_SYS_TYPES_H 1\r
+#define HAVE_SYS_STAT_H 1\r
+\r
+/* Define to 1 if you have the ANSI C header files. */\r
+#define STDC_HEADERS 1\r
+\r
+#define isinf(a) (_fpclass(a) == _FPCLASS_NINF || _fpclass(a) == _FPCLASS_PINF)\r
+#define isnan _isnan\r
+#define finite _finite\r
+#define snprintf _snprintf\r
+#define vsnprintf _vsnprintf\r
+#define strftime strftime_ \r
+\r
+/* realloc does not support NULL as argument */\r
+#define NO_NULL_REALLOC 1\r
+#if NO_NULL_REALLOC\r
+# define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) ))\r
+#else\r
+# define rrd_realloc(a,b) realloc((a), (b))\r
+#endif      \r
+\r
+/* Vertical label angle: 90.0 (default) or 270.0 */\r
+#define RRDGRAPH_YLEGEND_ANGLE 90.0\r
+\r
+#define RRD_DEFAULT_FONT "arial.ttf"\r
+/* #define RRD_DEFAULT_FONT "DejaVuSansMono-Roman.ttf" */\r
+\r
+/* #define WITH_PIECHART 1 */\r
+\r
+/* #define DEBUG 1 */\r
+\r
+#endif /* RRD_CONFIG_H */\r
+\r
diff --git a/win32/rrdtool.dsp b/win32/rrdtool.dsp
new file mode 100644 (file)
index 0000000..1a192fe
--- /dev/null
@@ -0,0 +1,92 @@
+# Microsoft Developer Studio Project File - Name="rrdtool" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=rrdtool - Win32 Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "rrdtool.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "rrdtool.mak" CFG="rrdtool - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "rrdtool - Win32 Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "rrdtool - Win32 Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF  "$(CFG)" == "rrdtool - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "rrdtool_"\r
+# PROP BASE Intermediate_Dir "rrdtool_"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "toolrelease"\r
+# PROP Intermediate_Dir "toolrelease"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /MD /W3 /GX /I "../src" /I "../../zlib-1.2.3" /I "../../libpng-1.2.16" /I "../../libart_lgpl-2.3.17" /I "../../freetype-2.3.1/include" /D "HAVE_CONFIG_H" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_CTYPE_DISABLE_MACROS" /FD /c\r
+# SUBTRACT CPP /YX\r
+# ADD BASE RSC /l 0x100c /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 libpng.lib zlib.lib libart.lib freetype231MT.lib kernel32.lib user32.lib /nologo /subsystem:console /incremental:yes /debug /machine:I386 /libpath:"../../libpng-1.2.16/projects/visualc6/Win32_LIB_Release" /libpath:"../../zlib-1.2.3" /libpath:"../../libart_lgpl-2.3.17/win32/release" /libpath:"../../freetype-2.3.1/objs"\r
+\r
+!ELSEIF  "$(CFG)" == "rrdtool - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "rrdtool0"\r
+# PROP BASE Intermediate_Dir "rrdtool0"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "tooldebug"\r
+# PROP Intermediate_Dir "tooldebug"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /MD /W3 /Gm /GX /ZI /Od /I "../src" /I "../../zlib-1.2.3" /I "../../libpng-1.2.16" /I "../../libart_lgpl-2.3.17" /I "../../freetype-2.3.1/include" /D "HAVE_CONFIG_H" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_CTYPE_DISABLE_MACROS" /FR /FD /c\r
+# SUBTRACT CPP /YX\r
+# ADD BASE RSC /l 0x100c /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo /o"rrdtool.bsc"\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 libpng.lib zlib.lib libart.lib freetype231MT.lib kernel32.lib user32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"../../libpng-1.2.16/projects/visualc6/Win32_LIB_Release" /libpath:"../../zlib-1.2.3" /libpath:"../../libart_lgpl-2.3.17/win32/release" /libpath:"../../freetype-2.3.1/objs"\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "rrdtool - Win32 Release"\r
+# Name "rrdtool - Win32 Debug"\r
+# Begin Source File\r
+\r
+SOURCE=..\src\rrd_tool.c\r
+# End Source File\r
+# End Target\r
+# End Project\r
diff --git a/win32/rrdtool.dsw b/win32/rrdtool.dsw
new file mode 100644 (file)
index 0000000..07103ba
--- /dev/null
@@ -0,0 +1,44 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00\r
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\r
+\r
+###############################################################################\r
+\r
+Project: "rrd"=".\rrd.dsp" - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "rrdtool"=".\rrdtool.dsp" - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+    Begin Project Dependency\r
+    Project_Dep_Name rrd\r
+    End Project Dependency\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Global:\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<3>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
diff --git a/win32/rrdtool.vcproj b/win32/rrdtool.vcproj
new file mode 100644 (file)
index 0000000..7ba111a
--- /dev/null
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="7.10"
+       Name="rrdtool"
+       SccProjectName=""
+       SccLocalPath="">
+       <Platforms>
+               <Platform
+                       Name="Win32"/>
+       </Platforms>
+       <Configurations>
+               <Configuration
+                       Name="Release|Win32"
+                       OutputDirectory=".\toolrelease"
+                       IntermediateDirectory=".\toolrelease"
+                       ConfigurationType="1"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="FALSE"
+                       CharacterSet="2">
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="4"
+                               AdditionalIncludeDirectories="\Program Files\GnuWin32\include,\Program Files\GnuWin32\include\freetype2"
+                               PreprocessorDefinitions="NDEBUG;_WINDOWS;WIN32;_CTYPE_DISABLE_MACROS"
+                               RuntimeLibrary="2"
+                               PrecompiledHeaderFile=".\toolrelease/rrdtool.pch"
+                               AssemblerListingLocation=".\toolrelease/"
+                               ObjectFile=".\toolrelease/"
+                               ProgramDataBaseFileName=".\toolrelease/"
+                               WarningLevel="3"
+                               SuppressStartupBanner="TRUE"
+                               CompileAs="0"/>
+                       <Tool
+                               Name="VCCustomBuildTool"/>
+                       <Tool
+                               Name="VCLinkerTool"
+                               AdditionalDependencies="libpng.lib libz.lib libart_lgpl.lib libfreetype.lib"
+                               OutputFile=".\toolrelease/rrdtool.exe"
+                               LinkIncremental="1"
+                               SuppressStartupBanner="TRUE"
+                               AdditionalLibraryDirectories="\Program Files\GnuWin32\lib"
+                               GenerateDebugInformation="TRUE"
+                               ProgramDatabaseFile=".\toolrelease/rrdtool.pdb"
+                               SubSystem="1"
+                               TargetMachine="1"/>
+                       <Tool
+                               Name="VCMIDLTool"
+                               TypeLibraryName=".\toolrelease/rrdtool.tlb"
+                               HeaderFileName=""/>
+                       <Tool
+                               Name="VCPostBuildEventTool"/>
+                       <Tool
+                               Name="VCPreBuildEventTool"/>
+                       <Tool
+                               Name="VCPreLinkEventTool"/>
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="NDEBUG"
+                               Culture="4108"/>
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"/>
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"/>
+                       <Tool
+                               Name="VCWebDeploymentTool"/>
+                       <Tool
+                               Name="VCManagedWrapperGeneratorTool"/>
+                       <Tool
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+               </Configuration>
+               <Configuration
+                       Name="Debug|Win32"
+                       OutputDirectory=".\tooldebug"
+                       IntermediateDirectory=".\tooldebug"
+                       ConfigurationType="1"
+                       UseOfMFC="0"
+                       ATLMinimizesCRunTimeLibraryUsage="FALSE"
+                       CharacterSet="2">
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               AdditionalIncludeDirectories="\Program Files\GnuWin32\include\freetype2,\Program Files\GnuWin32\include"
+                               PreprocessorDefinitions="_DEBUG;_CONSOLE;WIN32;_CTYPE_DISABLE_MACROS"
+                               RuntimeLibrary="2"
+                               PrecompiledHeaderFile=".\tooldebug/rrdtool.pch"
+                               AssemblerListingLocation=".\tooldebug/"
+                               ObjectFile=".\tooldebug/"
+                               ProgramDataBaseFileName=".\tooldebug/"
+                               BrowseInformation="1"
+                               WarningLevel="3"
+                               SuppressStartupBanner="TRUE"
+                               DebugInformationFormat="4"
+                               CompileAs="0"/>
+                       <Tool
+                               Name="VCCustomBuildTool"/>
+                       <Tool
+                               Name="VCLinkerTool"
+                               AdditionalDependencies="libpng.lib libz.lib libart_lgpl.lib libfreetype.lib"
+                               OutputFile=".\tooldebug/rrdtool.exe"
+                               LinkIncremental="1"
+                               SuppressStartupBanner="TRUE"
+                               AdditionalLibraryDirectories="\Program Files\GnuWin32\lib"
+                               GenerateDebugInformation="TRUE"
+                               ProgramDatabaseFile=".\tooldebug/rrdtool.pdb"
+                               SubSystem="1"
+                               TargetMachine="1"/>
+                       <Tool
+                               Name="VCMIDLTool"
+                               TypeLibraryName=".\tooldebug/rrdtool.tlb"
+                               HeaderFileName=""/>
+                       <Tool
+                               Name="VCPostBuildEventTool"/>
+                       <Tool
+                               Name="VCPreBuildEventTool"/>
+                       <Tool
+                               Name="VCPreLinkEventTool"/>
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                               PreprocessorDefinitions="_DEBUG"
+                               Culture="4108"/>
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"/>
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"/>
+                       <Tool
+                               Name="VCWebDeploymentTool"/>
+                       <Tool
+                               Name="VCManagedWrapperGeneratorTool"/>
+                       <Tool
+                               Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+               </Configuration>
+       </Configurations>
+       <References>
+       </References>
+       <Files>
+               <File
+                       RelativePath="rrd_tool.c">
+                       <FileConfiguration
+                               Name="Release|Win32">
+                               <Tool
+                                       Name="VCCLCompilerTool"
+                                       AdditionalIncludeDirectories=""
+                                       PreprocessorDefinitions=""/>
+                       </FileConfiguration>
+                       <FileConfiguration
+                               Name="Debug|Win32">
+                               <Tool
+                                       Name="VCCLCompilerTool"
+                                       Optimization="0"
+                                       AdditionalIncludeDirectories=""
+                                       PreprocessorDefinitions=""
+                                       BrowseInformation="1"/>
+                       </FileConfiguration>
+               </File>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>