From f2d6e10b4fba24f1613af65cacf4b7df1576703b Mon Sep 17 00:00:00 2001 From: William Robinet Date: Wed, 6 Jan 2021 18:25:45 +0100 Subject: [PATCH] Add checks for libjson-c to configure.ac --- .github/workflows/clang.yml | 2 +- .github/workflows/gcc.yml | 2 +- configure.ac | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/clang.yml b/.github/workflows/clang.yml index 0f1acb0..e87c3f4 100644 --- a/.github/workflows/clang.yml +++ b/.github/workflows/clang.yml @@ -19,6 +19,6 @@ jobs: - name: autogen run: ./autogen.sh - name: configure - run: ./configure CC=/usr/bin/clang LDFLAGS="-ljson-c" + run: ./configure CC=/usr/bin/clang - name: make run: make diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml index baae453..d09f539 100644 --- a/.github/workflows/gcc.yml +++ b/.github/workflows/gcc.yml @@ -19,6 +19,6 @@ jobs: - name: autogen run: ./autogen.sh - name: configure - run: ./configure CC=/usr/bin/gcc LDFLAGS="-ljson-c" + run: ./configure CC=/usr/bin/gcc - name: make run: make diff --git a/configure.ac b/configure.ac index 3e4ebf0..2101fdb 100644 --- a/configure.ac +++ b/configure.ac @@ -94,6 +94,27 @@ files with ]) fi +have_libjson_c=no +AC_SEARCH_LIBS([json_object_new_object], [json-c], [have_libjson_c=yes]) + +if test "x${have_libjson_c}" = xyes; then + AC_CHECK_HEADERS([json-c/json.h], [], [have_libjson_c=no]) +fi + +if test "x${have_libjson_c}" = xno; then + AC_MSG_ERROR([ +--------------------------------------- +Unable to find libjson-c on this system +Check 'config.log' for more information + +On Debian and Ubuntu systems you can +install the required library and header +files with + apt install libjson-c-dev +--------------------------------------- + ]) +fi + AC_ARG_ENABLE([optimization], [ --disable-optimization disable compiler optimizations], [optimization=${enableval}], [optimization=yes])