]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4133. [port] Update how various json libraries are handled.
authorMark Andrews <marka@isc.org>
Fri, 5 Jun 2015 00:16:24 +0000 (10:16 +1000)
committerMark Andrews <marka@isc.org>
Fri, 5 Jun 2015 00:16:24 +0000 (10:16 +1000)
                        [RT #39646]

CHANGES
bin/named/statschannel.c
config.h.in
configure
configure.in
lib/isc/include/isc/json.h

diff --git a/CHANGES b/CHANGES
index d51199b117d3444e4f19f6a73659cf0dfcdfde77..33888a2f87e471f534c467e841b7b03708db409e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+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]
index 4e5d31fd3480368dd202f2b6bff224198cb7b1c8..2b4ffbb88b09d5aca510301516fb0f6f626f3926 100644 (file)
@@ -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>
 #include <named/server.h>
 #include <named/statschannel.h>
 
-#ifdef HAVE_JSON_H
-#include <json/json.h>
-#endif
-
 #include "bind9.xsl.h"
 
 struct ns_statschannel {
index 3f35e2e1f3744307b2d20e5d5c0793d5e43acffc..594518851cf41e14bdb78778ec0201f266941416 100644 (file)
@@ -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
 
index 3c8132d31689dd4580e0b0ecabdea20c2a53091e..75cf58444d34ea8ba2e9dc64a8899f3e9be73905 100755 (executable)
--- a/configure
+++ b/configure
@@ -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
 
 #
index 95ad0e2a01eefd85505ee30f440a4ba28b3a7833..f6393ab39e57cf4f2bc60d81f8bd6e3884ad81f3 100644 (file)
@@ -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
 
 #
index 69ac4ffa18ac99786faa28b27379e7a535000265..2d779fd1ae341e6f46d8f0f2921c703ef1b16233 100644 (file)
@@ -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
  * 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 */