From 81352e1deb49f0a5827a82124ced81392dce005a Mon Sep 17 00:00:00 2001 From: Vaibhav Jain Date: Tue, 13 Sep 2016 20:43:56 +0530 Subject: [PATCH 1/2] chilli: Fix a build error with --enable-json This fixes a build error that occurs when --enable-json config flag is set and libjson-c is not available. This adds a check in configure.ac for availability of libjson-c library. Also libjson-c wasnt present in the list of linked libraries for chilli binary. Hence a linker error complaining about missing json_object_xxx functions used to occur. To fix this a new m4 macro named LIBJSON is added to configure.ac that expands to -ljson-c and is added to list of libraries to be linked to chill in src/Makefile.am. Signed-off-by: Vaibhav Jain --- configure.ac | 6 ++++++ src/Makefile.am | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 211ae286..6c391baa 100644 --- a/configure.ac +++ b/configure.ac @@ -210,6 +210,12 @@ AC_ARG_ENABLE(json, [AS_HELP_STRING([--enable-json],[Enable support for JSON])], if test x"$enable_json" = xyes; then AC_DEFINE(ENABLE_JSON,1,[Define to enable Chilli JSON]) + AC_CHECK_LIB([json-c], [json_object_new_object], + [AC_SUBST([LIBJSON], ["-ljson-c"])], + [AC_CHECK_LIB([json], [json_object_new_object], + [AC_SUBST([LIBJSON], ["-ljson"])], + [AC_MSG_FAILURE( + [--enable-json was given, but test for libjson failed])],)]) fi AC_ARG_ENABLE(debug, [AS_HELP_STRING([--disable-debug],[Disable debugging messages])], diff --git a/src/Makefile.am b/src/Makefile.am index eb92d8fe..ab5f2480 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -39,7 +39,7 @@ chilli_query_SOURCES = main-query.c chilli_opt_SOURCES = main-opt.c libchilli_la_LIBADD = $(top_builddir)/bstring/libbstring.la -LDADD = libchilli.la ${LIBRT} $(top_builddir)/bstring/libbstring.la +LDADD = libchilli.la ${LIBRT} $(top_builddir)/bstring/libbstring.la ${LIBJSON} if WITH_MINICONFIG chilli_opt_SOURCES += cmdline.mini.c From 56f5c8d8c4925a7aaa5d257ca52a02e21a56fc09 Mon Sep 17 00:00:00 2001 From: Vaibhav Jain Date: Tue, 13 Sep 2016 16:19:27 +0530 Subject: [PATCH 2/2] travis: Update .yml file to pull libjson-dev This updates the .travis.yml file to install the build dependency libjson-dev on the build system. Signed-off-by: Vaibhav Jain --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 39b84730..9951ab0b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: c before_install: - sudo apt-get update -qq - - sudo apt-get install -y gengetopt + - sudo apt-get install -y gengetopt libjson0-dev - ./bootstrap script: - ./configure --enable-largelimits --enable-proxyvsa --enable-miniportal