From c2f4c19cdc46601a651d620fa78b8e0186b23f34 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 4 Jun 2016 19:55:22 -0400 Subject: [PATCH] configure: Auto pick-up the correct json env Fix the code to allow Quagga to automatically compile with the correct json library. Signed-off-by: Donald Sharp Conflicts: configure.ac --- configure.ac | 8 ++++++-- lib/json.h | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 6719580976..78d3cda268 100755 --- a/configure.ac +++ b/configure.ac @@ -49,8 +49,6 @@ dnl XXX add --pkgsrcrcdir to autoconf standard directory list somehow AC_SUBST(pkgsrcdir) AC_SUBST(pkgsrcrcdir) -LIBS="$LIBS -L/usr/include/json/ -ljson" - dnl ------------ dnl Check CFLAGS dnl ------------ @@ -314,6 +312,12 @@ if test x"${enable_gcc_ultra_verbose}" = x"yes" ; then CFLAGS="${CFLAGS} -Wpacked -Wpadded" fi +AC_CHECK_HEADERS(json-c/json.h) +AC_CHECK_LIB(json-c, json_object_get, LIBS="$LIBS -ljson-c") +if test $ac_cv_lib_json_c_json_object_get = no; then + AC_MSG_ERROR([lib json is needed to compile]) +fi + if test x"${enable_gcc_rdynamic}" != x"no" ; then if test x"${enable_gcc_rdynamic}" = x"yes" -o x"$COMPILER" = x"GCC"; then LDFLAGS="${LDFLAGS} -rdynamic" diff --git a/lib/json.h b/lib/json.h index e69b10acd2..561f7cc405 100644 --- a/lib/json.h +++ b/lib/json.h @@ -22,7 +22,11 @@ #ifndef _QUAGGA_JSON_H #define _QUAGGA_JSON_H +#if defined(HAVE_JSON_C_JSON_H) +#include +#else #include +#endif extern int use_json(const int argc, const char *argv[]); extern void json_object_string_add(struct json_object* obj, const char *key, -- 2.39.5