Add checks for libjson-c to configure.ac

This commit is contained in:
William Robinet 2021-01-06 18:25:45 +01:00
parent 317d843a58
commit f2d6e10b4f
3 changed files with 23 additions and 2 deletions

View file

@ -19,6 +19,6 @@ jobs:
- name: autogen - name: autogen
run: ./autogen.sh run: ./autogen.sh
- name: configure - name: configure
run: ./configure CC=/usr/bin/clang LDFLAGS="-ljson-c" run: ./configure CC=/usr/bin/clang
- name: make - name: make
run: make run: make

View file

@ -19,6 +19,6 @@ jobs:
- name: autogen - name: autogen
run: ./autogen.sh run: ./autogen.sh
- name: configure - name: configure
run: ./configure CC=/usr/bin/gcc LDFLAGS="-ljson-c" run: ./configure CC=/usr/bin/gcc
- name: make - name: make
run: make run: make

View file

@ -94,6 +94,27 @@ files with
]) ])
fi 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], AC_ARG_ENABLE([optimization],
[ --disable-optimization disable compiler optimizations], [ --disable-optimization disable compiler optimizations],
[optimization=${enableval}], [optimization=yes]) [optimization=${enableval}], [optimization=yes])