]> git.puffer.fish Git - mirror/frr.git/commitdiff
configure: Auto pick-up the correct json env
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 4 Jun 2016 23:55:22 +0000 (19:55 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 15 Jun 2016 11:36:41 +0000 (07:36 -0400)
Fix the code to allow Quagga to automatically
compile with the correct json library.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Conflicts:
configure.ac

configure.ac
lib/json.h

index 671958097665db1148169a37279452eb2f9fefee..78d3cda2684c140e484558bcbc690e3a4347073f 100755 (executable)
@@ -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"
index e69b10acd21a758d586c20aa79934207874ff9aa..561f7cc4053ea570f38597852b2428115f43a591 100644 (file)
 #ifndef _QUAGGA_JSON_H
 #define _QUAGGA_JSON_H
 
+#if defined(HAVE_JSON_C_JSON_H)
+#include <json-c/json.h>
+#else
 #include <json/json.h>
+#endif
 
 extern int use_json(const int argc, const char *argv[]);
 extern void json_object_string_add(struct json_object* obj, const char *key,