/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* Build with JSON support from json-c */
+#undef HAVE_JSON
+
/* Define to 1 if you have the <json/json.h> header file. */
#undef HAVE_JSON_JSON_H
unset _libcurl_with
- if test x$libcurl_cv_lib_curl_usable != xyes; then
+ if test "x$libcurl_cv_lib_curl_usable" != "xyes"; then
fail="$fail libcurl"
else
if test x$libcurl_protocol_HTTP != xyes; then
fi
fi
+ have_json=
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
done
- if test "$ac_cv_header_json_json_h" != "yes"; then
+ if test "x$ac_cv_header_json_json_h" == "xyes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for json_object_init in -ljson-c" >&5
+$as_echo_n "checking for json_object_init in -ljson-c... " >&6; }
+if ${ac_cv_lib_json_c_json_object_init+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ljson-c $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char json_object_init ();
+int
+main ()
+{
+return json_object_init ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_json_c_json_object_init=yes
+else
+ ac_cv_lib_json_c_json_object_init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_json_c_json_object_init" >&5
+$as_echo "$ac_cv_lib_json_c_json_object_init" >&6; }
+if test "x$ac_cv_lib_json_c_json_object_init" = xyes; then :
+ have_json="yes"
+fi
+
+ fi
+
+ if test "x$have_json" == "xyes"; then
+ rest_ldflags+=" -ljson-c"
+ $as_echo "#define HAVE_JSON 1" >>confdefs.h
+
+ else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: silently building without JSON support. requires: json-c." >&5
$as_echo "$as_me: WARNING: silently building without JSON support. requires: json-c." >&2;}
- else
- rest_ldflags+=-ljson-c
fi
targetname=rlm_rest # keep this! Don't change!
LIBCURL_CHECK_CONFIG
- if test x$libcurl_cv_lib_curl_usable != xyes; then
+ if test "x$libcurl_cv_lib_curl_usable" != "xyes"; then
fail="$fail libcurl"
else
if test x$libcurl_protocol_HTTP != xyes; then
fi
fi
+ have_json=
AC_CHECK_HEADERS(json/json.h)
- if test "$ac_cv_header_json_json_h" != "yes"; then
- AC_MSG_WARN([silently building without JSON support. requires: json-c.])
+ if test "x$ac_cv_header_json_json_h" == "xyes"; then
+ AC_CHECK_LIB([json-c], [json_object_init], [have_json="yes"], [])
+ fi
+
+ if test "x$have_json" == "xyes"; then
+ rest_ldflags+=" -ljson-c"
+ AC_DEFINE([HAVE_JSON],[1],[Build with JSON support from json-c])
else
- rest_ldflags+=-ljson-c
+ AC_MSG_WARN([silently building without JSON support. requires: json-c.])
fi
targetname=modname # keep this! Don't change!
HTTP_BODY_UNSUPPORTED, // HTTP_BODY_UNSUPPORTED
HTTP_BODY_UNSUPPORTED, // HTTP_BODY_INVALID
HTTP_BODY_POST, // HTTP_BODY_POST
-#ifdef WITH_JSON
+#ifdef HAVE_JSON
HTTP_BODY_JSON, // HTTP_BODY_JSON
#else
HTTP_BODY_UNAVAILABLE,
* @see json_pairmake
* @see json_pairmake_leaf
*/
-#ifdef WITH_JSON
+#ifdef HAVE_JSON
typedef struct json_flags {
boolean do_xlat; //!< If TRUE value will be expanded with xlat.
boolean is_json; //!< If TRUE value will be inserted as raw JSON
* @param[in] leaf object containing the VALUE_PAIR value.
* @return The VALUE_PAIR just created, or NULL on error.
*/
-#ifdef WITH_JSON
+#ifdef HAVE_JSON
static VALUE_PAIR *json_pairmake_leaf(rlm_rest_t *instance,
UNUSED rlm_rest_section_t *section,
REQUEST *request, const DICT_ATTR *da,
switch (type)
{
-#ifdef WITH_JSON
+#ifdef HAVE_JSON
case HTTP_BODY_JSON:
rest_read_ctx_init(request,
&ctx->read, 1);
handle, ctx->write.buffer,
ctx->write.used);
break;
-#ifdef WITH_JSON
+#ifdef HAVE_JSON
case HTTP_BODY_JSON:
ret = rest_decode_json(instance, section, request,
handle, ctx->write.buffer,
#include "config.h"
#ifdef HAVE_JSON_JSONH
-#define WITH_JSON
+#define HAVE_JSON
#endif
#include <curl/curl.h>
-#ifdef WITH_JSON
+#ifdef HAVE_JSON
#include <json/json.h>
#endif