]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Explain why the graphs are not produced
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Wed, 1 Feb 2012 13:30:08 +0000 (14:30 +0100)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Wed, 1 Feb 2012 13:30:08 +0000 (14:30 +0100)
Some messages have been added to explain what are the consequences of not
building sarg with libgd.

In addition, some more messages explain why the graphs are not rendered
along with the report.

It should help the users to track the graphs problems by themselves.

configure.in
getconf.c
grepday.c

index a5732e0048c70332c04485b5d8753aa020460a81..c8d6709ea0a98f1c887e537bc11f0a0a1aa8497a 100644 (file)
@@ -85,9 +85,16 @@ AS_HELP_STRING([--with-gd],[Compile with support for the graphical gd library]),
 [],[with_gd=check])
 if ( test "x$with_gd" != "xno" ) ; then
        AC_CHECK_HEADERS(gd.h gdfontl.h gdfontt.h gdfonts.h gdfontmb.h gdfontg.h)
-       AC_CHECK_LIB(gd, gdImagePng,LIBS="-lgd ${LIBS}"; HAVE_GD_LIB="yes", HAVE_GD_LIB="")
+       if ( test "x$ac_cv_header_gd_h" == "xyes" ) ; then
+               AC_CHECK_LIB(gd, gdImagePng,LIBS="-lgd ${LIBS}"; HAVE_GD_LIB="yes", HAVE_GD_LIB="")
+               if ( test "x$HAVE_GD_LIB" != "xyes" ) ; then
+                       AC_MSG_ERROR([ligbd is required to compile sarg with gd])
+               fi
+       else
+               gd_status="not found"
+       fi
 else
-       AC_MSG_NOTICE([Not building with gd as requested on the configuration command line])
+       gd_status="disabled"
 fi
 
 # Build with LDAP
@@ -278,3 +285,9 @@ AC_SUBST(VERSION,"$PACKAGE_VERSION")
 
 AC_CONFIG_FILES([Makefile po/Makefile.in])
 AC_OUTPUT
+
+if ( test "x$gd_status" == "xdisabled" ) ; then
+       AC_MSG_NOTICE([Not building with gd as requested on the configuration command line])
+elif ( test "x$gd_status" == "xnot found" ) ; then
+       AC_MSG_NOTICE([gd.h was not found so the graphs won't be available in the report])
+fi
index e4326c5b34832a2e24cb44a40dceac64ced07995..22c544daadda8961410f9d9b83e426723c5e2d54 100644 (file)
--- a/getconf.c
+++ b/getconf.c
@@ -674,7 +674,14 @@ static void parmtest(char *buf)
                return;
        }
 
-       if (getparam_bool("graphs",buf,&Graphs)>0) return;
+       if (getparam_bool("graphs",buf,&Graphs)>0) {
+#ifndef HAVE_GD
+               if (Graphs)
+                       debugaz(_("No graphs available as sarg was not compiled with libgd. Set \"graphs\" to \"no\" in %s to disable this warning\n"),
+                               ConfigFile);
+#endif
+               return;
+       }
 
        if (getparam_string("graph_days_bytes_bar_color",buf,GraphDaysBytesBarColor,sizeof(GraphDaysBytesBarColor))>0) return;
 
index 208de3ebe76df840abcb50f8ad9e586180128eb0..ed83a03ff598b7721a67c36e425d3010e7b9ee10 100644 (file)
--- a/grepday.c
+++ b/grepday.c
@@ -633,6 +633,17 @@ static void greport_plot(const struct userinfostruct *uinfo,struct PlotStruct *p
 void greport_prepare(void)
 {
 #ifdef HAVE_GD
+       if (!Graphs) {
+               if (debugz)
+                       debugaz(_("Graphs disabled as requested in %s\n"),ConfigFile);
+               return;
+       }
+       if (GraphFont[0]=='\0') {
+               if (debugz)
+                       debugaz(_("Graphs disabled as no font names were provided in %s\n"),ConfigFile);
+               return;
+       }
+
        if(access(GraphFont, R_OK) != 0) {
                debuga(_("(grepday) Fontname %s not found\n"),GraphFont);
                exit(EXIT_FAILURE);