Commit 8a9bac8d authored by Mark Andrews's avatar Mark Andrews

4133. [port] Update how various json libraries are handled.

                        [RT #39646]
parent e545fce9
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]
......
......@@ -20,6 +20,7 @@
#include <isc/buffer.h>
#include <isc/httpd.h>
#include <isc/json.h>
#include <isc/mem.h>
#include <isc/once.h>
#include <isc/print.h>
......@@ -42,10 +43,6 @@
#include <named/server.h>
#include <named/statschannel.h>
#ifdef HAVE_JSON_H
#include <json/json.h>
#endif
#include "bind9.xsl.h"
struct ns_statschannel {
......
......@@ -260,6 +260,9 @@ int sigwait(const unsigned int *set, int *sig);
/* 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
......
......@@ -16599,6 +16599,7 @@ fi
have_libjson=""
have_libjson_c=""
case "$use_libjson" in
no)
libjson_libs=""
......@@ -16608,34 +16609,36 @@ case "$use_libjson" in
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
......@@ -16719,6 +16722,12 @@ then
$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
#
......
......@@ -2150,6 +2150,7 @@ AC_ARG_WITH(libjson,
use_libjson="$withval", use_libjson="auto")
have_libjson=""
have_libjson_c=""
case "$use_libjson" in
no)
libjson_libs=""
......@@ -2159,34 +2160,36 @@ case "$use_libjson" in
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
......@@ -2210,6 +2213,10 @@ if test "X${have_libjson}" != "X"
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
#
......
......@@ -17,6 +17,7 @@
#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
......@@ -24,9 +25,21 @@
* 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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment