+4133. [port] Update how various json libraries are handled.
+ [RT #39646]
+
4132. [cleanup] dig: added +rd as a synonym for +recurse,
added +class as an unabbreviated alternative
to +cl. [RT #39686]
#include <isc/buffer.h>
#include <isc/httpd.h>
+#include <isc/json.h>
#include <isc/mem.h>
#include <isc/once.h>
#include <isc/print.h>
#include <named/server.h>
#include <named/statschannel.h>
-#ifdef HAVE_JSON_H
-#include <json/json.h>
-#endif
-
#include "bind9.xsl.h"
struct ns_statschannel {
/* Define if libjson was found */
#undef HAVE_JSON
+/* Define if json-c was found */
+#undef HAVE_JSON_C
+
/* Define to 1 if you have the <kerberosv5/krb5.h> header file. */
#undef HAVE_KERBEROSV5_KRB5_H
have_libjson=""
+have_libjson_c=""
case "$use_libjson" in
no)
libjson_libs=""
do
if test -f "${d}/include/json/json.h"
then
- libjson_cflags="-I ${d}/include/json"
if test ${d} != /usr
then
+ libjson_cflags="-I ${d}/include"
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
+ libjson_cflags="-I ${d}/include"
LIBS="$LIBS -L${d}/lib"
fi
have_libjson="yes"
+ have_libjson_c="yes"
fi
done
;;
*)
if test -f "${use_libjson}/include/json/json.h"
then
- libjson_cflags="-I${use_libjson}/include/json"
+ libjson_cflags="-I${use_libjson}/include"
LIBS="$LIBS -L${use_libjson}/lib"
have_libjson="yes"
elif test -f "${use_libjson}/include/json-c/json.h"
then
- libjson_cflags="-I${use_libjson}/include/json-c"
+ libjson_cflags="-I${use_libjson}/include"
LIBS="$LIBS -L${use_libjson}/lib"
have_libjson="yes"
+ have_libjson_c="yes"
else
as_fn_error $? "$use_libjson/include/json{,-c}/json.h not found." "$LINENO" 5
fi
$as_echo "#define HAVE_JSON 1" >>confdefs.h
+ if test "X${have_libjson_c}" = Xyes
+ then
+
+$as_echo "#define HAVE_JSON_C 1" >>confdefs.h
+
+ fi
fi
#
use_libjson="$withval", use_libjson="auto")
have_libjson=""
+have_libjson_c=""
case "$use_libjson" in
no)
libjson_libs=""
do
if test -f "${d}/include/json/json.h"
then
- libjson_cflags="-I ${d}/include/json"
if test ${d} != /usr
then
+ libjson_cflags="-I ${d}/include"
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
+ libjson_cflags="-I ${d}/include"
LIBS="$LIBS -L${d}/lib"
fi
have_libjson="yes"
+ have_libjson_c="yes"
fi
done
;;
*)
if test -f "${use_libjson}/include/json/json.h"
then
- libjson_cflags="-I${use_libjson}/include/json"
+ libjson_cflags="-I${use_libjson}/include"
LIBS="$LIBS -L${use_libjson}/lib"
have_libjson="yes"
elif test -f "${use_libjson}/include/json-c/json.h"
then
- libjson_cflags="-I${use_libjson}/include/json-c"
+ libjson_cflags="-I${use_libjson}/include"
LIBS="$LIBS -L${use_libjson}/lib"
have_libjson="yes"
+ have_libjson_c="yes"
else
AC_MSG_ERROR([$use_libjson/include/json{,-c}/json.h not found.])
fi
then
CFLAGS="$CFLAGS $libjson_cflags"
AC_DEFINE(HAVE_JSON, 1, [Define if libjson was found])
+ if test "X${have_libjson_c}" = Xyes
+ then
+ AC_DEFINE(HAVE_JSON_C, 1, [Define if json-c was found])
+ fi
fi
#
#ifndef ISC_JSON_H
#define ISC_JSON_H 1
+#ifdef HAVE_JSON
/*
* This file is here mostly to make it easy to add additional libjson header
* files as needed across all the users of this file. Rather than place
* the ifdef as well as adding the ability to add additional functions
* which may be useful.
*/
-
-#ifdef HAVE_JSON
-#include <json.h>
+#ifdef HAVE_JSON_C
+/*
+ * We don't include <json-c/json.h> as the subsequent includes do not
+ * prefix the header file names with "json-c/" and using
+ * -I <prefix>/include/json-c results in too many filename collisions.
+ */
+#include <json-c/linkhash.h>
+#include <json-c/json_util.h>
+#include <json-c/json_object.h>
+#include <json-c/json_tokener.h>
+#include <json-c/json_object_iterator.h>
+#include <json-c/json_c_version.h>
+#else
+#include <json/json.h>
+#endif
#endif
#define ISC_JSON_RENDERCONFIG 0x00000001 /* render config data */