[rrd-users] rrdtool 1.4.x without graphing support?

Tobias Oetiker tobi at oetiker.ch
Thu Nov 5 05:53:20 CET 2009


Hi Ulf,

Yesterday Ulf Zimmermann wrote:

> Anyone got an idea how much work would be involved to build/patch
> rrdtool 1.4.x to remove graphing support? Library dependency for
> EL4 is just hell at this point. And as I need librrd, I am not
> sure how far I can work with a static build to work with collectd
> together.

you may want to try the appended patch.

cheers
tobi


>
> Ulf.
>
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900
-------------- next part --------------
Index: src/rrd_tool.c
===================================================================
--- src/rrd_tool.c	(revision 1966)
+++ src/rrd_tool.c	(working copy)
@@ -693,6 +693,7 @@
             free(data);
         }
     } else if (strcmp("xport", argv[1]) == 0) {
+#ifdef HAVE_RRD_GRAPH
         int       xxsize;
         unsigned long int j = 0;
         time_t    start, end, ti;
@@ -766,7 +767,11 @@
             printf("</%s>\n", ROOT_TAG);
         }
         free(vtag);
+#else
+       rrd_set_error("the instance of rrdtool has been compiled without graphcs");
+#endif
     } else if (strcmp("graph", argv[1]) == 0) {
+#ifdef HAVE_RRD_GRAPH
         char    **calcpr;
 
 #ifdef notused /*XXX*/
@@ -799,8 +804,11 @@
                 free(calcpr);
             }
         }
-
+#else
+       rrd_set_error("the instance of rrdtool has been compiled without graphcs");
+#endif
     } else if (strcmp("graphv", argv[1]) == 0) {
+#ifdef HAVE_RRD_GRAPH
         rrd_info_t *grinfo = NULL;  /* 1 to distinguish it from the NULL that rrd_graph sends in */
 
         grinfo = rrd_graph_v(argc - 1, &argv[1]);
@@ -808,7 +816,9 @@
             rrd_info_print(grinfo);
             rrd_info_free(grinfo);
         }
-
+#else
+       rrd_set_error("the instance of rrdtool has been compiled without graphcs");
+#endif
     } else if (strcmp("tune", argv[1]) == 0)
         rrd_tune(argc - 1, &argv[1]);
     else if (strcmp("flushcached", argv[1]) == 0)
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 1966)
+++ src/Makefile.am	(working copy)
@@ -29,27 +29,30 @@
 	rrd_nan_inf.c	\
 	rrd_rpncalc.c	\
 	rrd_utils.c	\
-	rrd_update.c
+	rrd_update.c    \
+	hash_32.c	
 
 RRD_C_FILES =		\
-	hash_32.c	\
-	pngsize.c	\
 	rrd_create.c	\
-	rrd_graph.c	\
-	rrd_graph_helper.c	\
 	rrd_version.c	\
 	rrd_last.c	\
 	rrd_lastupdate.c	\
 	rrd_first.c	\
 	rrd_restore.c	\
-	rrd_xport.c	\
-	rrd_gfx.c \
 	rrd_dump.c	\
 	rrd_flushcached.c \
 	rrd_fetch.c	\
 	rrd_resize.c \
 	rrd_tune.c
 
+if BUILD_RRDGRAPH
+RRD_C_FILES += rrd_graph.c	\
+	rrd_graph_helper.c	\
+	rrd_xport.c	\
+	rrd_gfx.c \
+	pngsize.c
+endif
+
 noinst_HEADERS = \
 	unused.h \
         gettext.h \
Index: configure.ac
===================================================================
--- configure.ac	(revision 1966)
+++ configure.ac	(working copy)
@@ -102,6 +102,13 @@
 AC_ARG_ENABLE(rrdcgi,AS_HELP_STRING([--disable-rrdcgi],[disable building of rrdcgi]),
 [],[enable_rrdcgi=yes])
 
+AC_ARG_ENABLE(rrd_graph,AS_HELP_STRING([--disable-rrd_graph],[disable all rrd_graph functions]),
+[enable_rrdcgi=no],[enable_rrd_graph=yes])
+
+if test $enable_rrd_graph != no; then
+ AC_DEFINE([HAVE_RRD_GRAPH], [], [is rrd_graph supported by this install])
+fi
+
 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.],
@@ -510,19 +517,21 @@
 
 AM_CONDITIONAL(BUILD_RRDCGI,[test $enable_rrdcgi != no])
 
+AM_CONDITIONAL(BUILD_RRDGRAPH,[test $enable_rrd_graph != no])
 
+
 CORE_LIBS="$LIBS"
 
-dnl EX_CHECK_ALL(z,          zlibVersion,               zlib.h,                 zlib,        1.2.3,  http://www.gzip.org/zlib/, "")
-dnl EX_CHECK_ALL(png,        png_access_version_number, png.h,                  libpng,      1.2.10,  http://prdownloads.sourceforge.net/libpng/, "")
-dnl EX_CHECK_ALL(freetype,   FT_Init_FreeType,          ft2build.h,		freetype2,   2.1.10,  http://prdownloads.sourceforge.net/freetype/, /usr/include/freetype2)
-dnl EX_CHECK_ALL(fontconfig, FcInit,                    fontconfig.h,		fontconfig,  2.3.1,  http://fontconfig.org/release/, /usr/include)
+if test $enable_rrd_graph != no; then
 EX_CHECK_ALL(cairo,      cairo_font_options_create,     cairo.h,                cairo-png,   1.4.6,  http://cairographics.org/releases/, "")
 EX_CHECK_ALL(cairo,      cairo_svg_surface_create,      cairo-svg.h,            cairo-svg,   1.4.6,  http://cairographics.org/releases/, "")
 EX_CHECK_ALL(cairo,      cairo_pdf_surface_create,      cairo-pdf.h,            cairo-pdf,   1.4.6,  http://cairographics.org/releases/, "")
 EX_CHECK_ALL(cairo,      cairo_ps_surface_create,       cairo-ps.h,             cairo-ps,    1.4.6,  http://cairographics.org/releases/, "")
+fi
 EX_CHECK_ALL(glib-2.0,   glib_check_version,            glib.h,                 glib-2.0,    2.12.12, ftp://ftp.gtk.org/pub/glib/2.12/, "")
+if test $enable_rrd_graph != no; then
 EX_CHECK_ALL(pango-1.0,  pango_cairo_context_set_font_options,  pango/pango.h,  pangocairo,  1.17,    http://ftp.gnome.org/pub/GNOME/sources/pango/1.17, "")
+fi
 EX_CHECK_ALL(xml2,       xmlParseFile,                  libxml/parser.h,        libxml-2.0,        2.6.31,  http://xmlsoft.org/downloads.html, /usr/include/libxml2)
 
 if test "$EX_CHECK_ALL_ERR" = "YES"; then
@@ -932,6 +941,7 @@
 echo
 echo "          With MMAP IO: $enable_mmap"
 echo "      Build rrd_getopt: $build_getopt"
+echo "       Build rrd_graph: $enable_rrd_graph"
 echo "       Static programs: $staticprogs"
 echo "          Perl Modules: $COMP_PERL"
 echo "           Perl Binary: $PERL"


More information about the rrd-users mailing list