static isc_once_t once = ISC_ONCE_INIT;
+#if defined(HAVE_LIBXML2) || defined(HAVE_JSON)
+#define EXTENDED_STATS
+#else
+#undef EXTENDED_STATS
+#endif
+
/*%
* Statistics descriptions. These could be statistically initialized at
* compile time, but we configure them run time in the init_desc() function
static const char *zonestats_desc[dns_zonestatscounter_max];
static const char *sockstats_desc[isc_sockstatscounter_max];
static const char *dnssecstats_desc[dns_dnssecstats_max];
-#ifdef HAVE_LIBXML2
+#if defined(EXTENDED_STATS)
static const char *nsstats_xmldesc[dns_nsstatscounter_max];
static const char *resstats_xmldesc[dns_resstatscounter_max];
static const char *adbstats_xmldesc[dns_adbstats_max];
#define zonestats_xmldesc NULL
#define sockstats_xmldesc NULL
#define dnssecstats_xmldesc NULL
-#endif /* HAVE_LIBXML2 */
+#endif /* EXTENDED_STATS */
#define TRY0(a) do { xmlrc = (a); if (xmlrc < 0) goto error; } while(0)
const char *xdesc, const char **xdescs)
{
REQUIRE(counter < maxcounter);
- REQUIRE(fdescs[counter] == NULL);
-#ifdef HAVE_LIBXML2
- REQUIRE(xdescs[counter] == NULL);
+ REQUIRE(fdescs != NULL && fdescs[counter] == NULL);
+#if defined(EXTENDED_STATS)
+ REQUIRE(xdescs != NULL && xdescs[counter] == NULL);
#endif
fdescs[counter] = fdesc;
-#ifdef HAVE_LIBXML2
+#if defined(EXTENDED_STATS)
xdescs[counter] = xdesc;
#else
UNUSED(xdesc);
/* Initialize name server statistics */
for (i = 0; i < dns_nsstatscounter_max; i++)
nsstats_desc[i] = NULL;
-#ifdef HAVE_LIBXML2
+#if defined(EXTENDED_STATS)
for (i = 0; i < dns_nsstatscounter_max; i++)
nsstats_xmldesc[i] = NULL;
#endif
/* Initialize resolver statistics */
for (i = 0; i < dns_resstatscounter_max; i++)
resstats_desc[i] = NULL;
-#ifdef HAVE_LIBXML2
+#if defined(EXTENDED_STATS)
for (i = 0; i < dns_resstatscounter_max; i++)
resstats_xmldesc[i] = NULL;
#endif
/* Initialize adb statistics */
for (i = 0; i < dns_adbstats_max; i++)
adbstats_desc[i] = NULL;
-#ifdef HAVE_LIBXML2
+#if defined(EXTENDED_STATS)
for (i = 0; i < dns_adbstats_max; i++)
adbstats_xmldesc[i] = NULL;
#endif
/* Initialize zone statistics */
for (i = 0; i < dns_zonestatscounter_max; i++)
zonestats_desc[i] = NULL;
-#ifdef HAVE_LIBXML2
+#if defined(EXTENDED_STATS)
for (i = 0; i < dns_zonestatscounter_max; i++)
zonestats_xmldesc[i] = NULL;
#endif
/* Initialize socket statistics */
for (i = 0; i < isc_sockstatscounter_max; i++)
sockstats_desc[i] = NULL;
-#ifdef HAVE_LIBXML2
+#if defined(EXTENDED_STATS)
for (i = 0; i < isc_sockstatscounter_max; i++)
sockstats_xmldesc[i] = NULL;
#endif
/* Initialize DNSSEC statistics */
for (i = 0; i < dns_dnssecstats_max; i++)
dnssecstats_desc[i] = NULL;
-#ifdef HAVE_LIBXML2
+#if defined(EXTENDED_STATS)
for (i = 0; i < dns_dnssecstats_max; i++)
dnssecstats_xmldesc[i] = NULL;
#endif
INSIST(sockstats_desc[i] != NULL);
for (i = 0; i < dns_dnssecstats_max; i++)
INSIST(dnssecstats_desc[i] != NULL);
-#ifdef HAVE_LIBXML2
+#if defined(EXTENDED_STATS)
for (i = 0; i < dns_nsstatscounter_max; i++)
INSIST(nsstats_xmldesc[i] != NULL);
for (i = 0; i < dns_resstatscounter_max; i++)
json_object *job, *cat, *counter;
#endif
-#if !defined(HAVE_LIBXML2) && !defined(HAVE_JSON)
+#if !defined(EXTENDED_STATS)
UNUSED(category);
#endif
* address-in-use error.
*/
if (statschannellist != NULL) {
-#if !defined(HAVE_LIBXML2) && !defined(HAVE_JSON)
+#ifndef EXTENDED_STATS
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_SERVER, ISC_LOG_WARNING,
"statistics-channels specified but not effective "
libjson_libs=""
;;
auto|yes)
- if test -f "/usr/include/json/json.h"
- then
- libjson_cflags="-I /usr/include/json"
- have_libjson="yes"
- elif test -f "/usr/include/json-c/json.h"
- then
- libjson_cflags="-I /usr/include/json-c"
- have_libjson="yes"
- fi
+ for d in /usr /usr/local /opt/local
+ do
+ if test -f "${d}/include/json/json.h"
+ then
+ libjson_cflags="-I ${d}/include/json"
+ if test ${d} != /usr
+ then
+ LIBS="$LIBS -L${d}/lib"
+ fi
+ have_libjson="yes"
+ elif test -f "${d}/include/json-c/json.h"
+ then
+ libjson_cflags="-I ${d}/include/json-c"
+ if test ${d} != /usr
+ then
+ LIBS="$LIBS -L${d}/lib"
+ fi
+ have_libjson="yes"
+ fi
+ done
;;
*)
if test -f "${use_libjson}/include/json/json.h"
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: found libjson include but not library." >&5
-$as_echo "$as_me: WARNING: found libjson include but not library." >&2;}
+ as_fn_error $? "found libjson include but not library." "$LINENO" 5
have_libjson=""
fi
+elif test "X$use_libjson" = Xyes
+then
+ as_fn_error $? "include/json{,-c}/json.h not found." "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
libjson_libs=""
;;
auto|yes)
- if test -f "/usr/include/json/json.h"
- then
- libjson_cflags="-I /usr/include/json"
- have_libjson="yes"
- elif test -f "/usr/include/json-c/json.h"
- then
- libjson_cflags="-I /usr/include/json-c"
- have_libjson="yes"
- fi
+ for d in /usr /usr/local /opt/local
+ do
+ if test -f "${d}/include/json/json.h"
+ then
+ libjson_cflags="-I ${d}/include/json"
+ if test ${d} != /usr
+ then
+ LIBS="$LIBS -L${d}/lib"
+ fi
+ have_libjson="yes"
+ elif test -f "${d}/include/json-c/json.h"
+ then
+ libjson_cflags="-I ${d}/include/json-c"
+ if test ${d} != /usr
+ then
+ LIBS="$LIBS -L${d}/lib"
+ fi
+ have_libjson="yes"
+ fi
+ done
;;
*)
if test -f "${use_libjson}/include/json/json.h"
then
AC_MSG_RESULT(yes)
AC_SEARCH_LIBS([json_object_new_int64], [json json-c], [],
- [AC_MSG_WARN([found libjson include but not library.])
+ [AC_MSG_ERROR([found libjson include but not library.])
have_libjson=""])
+elif test "X$use_libjson" = Xyes
+then
+ AC_MSG_ERROR([include/json{,-c}/json.h not found.])
else
AC_MSG_RESULT(no)
fi