[],[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
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
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;
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);