From: Floris Bos Date: Fri, 19 Sep 2014 15:49:58 +0000 (+0200) Subject: Add configure option to disable rrd_restore support X-Git-Tag: v1.5.0-rc1~27^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91ce7bd4c0fbce253f8de3006070be4830ab1971;p=thirdparty%2Frrdtool-1.x.git Add configure option to disable rrd_restore support For systems that do not have libxml2 installed Signed-off-by: Floris Bos --- diff --git a/configure.ac b/configure.ac index 53e03ce3..b1def9ad 100644 --- a/configure.ac +++ b/configure.ac @@ -105,6 +105,9 @@ AC_ARG_ENABLE(rrdcgi,AS_HELP_STRING([--disable-rrdcgi],[disable building of rrdc AC_ARG_ENABLE(rrd_graph,AS_HELP_STRING([--disable-rrd_graph],[disable all rrd_graph functions]), [enable_rrdcgi=no],[enable_rrd_graph=yes]) +AC_ARG_ENABLE(rrd_restore,AS_HELP_STRING([--disable-rrd_restore],[disable rrd_restore XML import functions]), +[],[enable_rrd_restore=yes]) + AM_CONDITIONAL(BUILD_RRDCGI,[test $enable_rrdcgi != no]) @@ -112,6 +115,10 @@ if test $enable_rrd_graph != no; then AC_DEFINE([HAVE_RRD_GRAPH], [], [is rrd_graph supported by this install]) fi +if test $enable_rrd_restore != no; then + AC_DEFINE([HAVE_RRD_RESTORE], [], [is rrd_restore 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.], @@ -533,6 +540,8 @@ AM_CONDITIONAL(BUILD_LIBWRAP,[test $have_libwrap != no]) AM_CONDITIONAL(BUILD_RRDGRAPH,[test $enable_rrd_graph != no]) +AM_CONDITIONAL(BUILD_RRDRESTORE,[test $enable_rrd_restore != no]) + EX_CHECK_ALL(glib-2.0, glib_check_version, glib.h, glib-2.0, 2.28.7, ftp://ftp.gtk.org/pub/glib/2.28/, "") CORE_LIBS="$LIBS" @@ -549,7 +558,10 @@ dnl EX_CHECK_ALL(cairo, cairo_ps_surface_create, cairo-ps.h, EX_CHECK_ALL(pangocairo-1.0, pango_font_map_create_context, pango/pango.h, pangocairo, 1.28.4, http://ftp.gnome.org/pub/GNOME/sources/pango/1.28, "") fi + +if test $enable_rrd_restore != no; then EX_CHECK_ALL(xml2, xmlParseFile, libxml/parser.h, libxml-2.0, 2.7.8, http://xmlsoft.org/downloads.html, "") +fi if test "$EX_CHECK_ALL_ERR" = "YES"; then AC_MSG_ERROR([Please fix the library issues listed above and try again.]) @@ -977,6 +989,7 @@ echo " With MMAP IO: $enable_mmap" echo " With Locking: $enable_flock" echo " Build rrd_getopt: $build_getopt" echo " Build rrd_graph: $enable_rrd_graph" +echo " Build rrd_restore: $enable_rrd_restore" echo " Static programs: $staticprogs" echo " Perl Modules: $COMP_PERL" echo " Perl Binary: $PERL" diff --git a/src/Makefile.am b/src/Makefile.am index 5bf3f327..408cb221 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -44,7 +44,6 @@ RRD_C_FILES = \ rrd_last.c \ rrd_lastupdate.c \ rrd_first.c \ - rrd_restore.c \ rrd_dump.c \ rrd_flushcached.c \ rrd_fetch.c \ @@ -60,6 +59,10 @@ RRD_C_FILES += rrd_graph.c \ pngsize.c endif +if BUILD_RRDRESTORE +RRD_C_FILES += rrd_restore.c +endif + noinst_HEADERS = \ unused.h \ gettext.h \ diff --git a/src/rrd_tool.c b/src/rrd_tool.c index 018e4c54..d917fbdd 100644 --- a/src/rrd_tool.c +++ b/src/rrd_tool.c @@ -668,7 +668,11 @@ int HandleInputLine( " Copyright by Tobi Oetiker, 1997-2008 (%f)\n", rrd_version()); else if (strcmp("restore", argv[1]) == 0) +#ifdef HAVE_RRD_RESTORE rrd_restore(argc - 1, &argv[1]); +#else + rrd_set_error("the instance of rrdtool has been compiled without XML import functions"); +#endif else if (strcmp("resize", argv[1]) == 0) rrd_resize(argc - 1, &argv[1]); else if (strcmp("last", argv[1]) == 0)