commit ad48f4b53fa70b2b995fe884a87307298b737a52 Author: Nicolas Morey-Chaisemartin Date: Thu Apr 1 09:06:56 2021 +0200 autogen: only deal with json/yaksa if enabled --without-(json|yaksa) is partially ignored as submodule is not checked but still configured Signed-off-by: Nicolas Morey-Chaisemartin diff --git configure.ac configure.ac index e7a46106155a..5966d21ed4dc 100644 --- configure.ac +++ configure.ac @@ -1070,14 +1070,23 @@ AC_SUBST([jsonsrcdir]) jsonlib="" AC_SUBST([jsonlib]) -PAC_PUSH_ALL_FLAGS() -PAC_RESET_ALL_FLAGS() -PAC_CONFIG_SUBDIR_ARGS([modules/json-c],[--enable-embedded --disable-werror],[],[AC_MSG_ERROR(json-c configure failed)]) -PAC_POP_ALL_FLAGS() -jsonsrcdir="${main_top_builddir}/modules/json-c" -jsonlib="${main_top_builddir}/modules/json-c/libjson-c.la" -PAC_APPEND_FLAG([-I${use_top_srcdir}/modules/json-c],[CPPFLAGS]) -PAC_APPEND_FLAG([-I${main_top_builddir}/modules/json-c],[CPPFLAGS]) +PAC_CHECK_HEADER_LIB([json-c/json.h], [json-c], [json_object_get], [have_json=yes], [have_json=no]) + +if test "${have_json}" = "no" ; then + AC_MSG_NOTICE([Using an embedded libjson-c]) + PAC_PUSH_ALL_FLAGS() + PAC_RESET_ALL_FLAGS() + PAC_CONFIG_SUBDIR_ARGS([modules/json-c],[--enable-embedded --disable-werror],[],[AC_MSG_ERROR(json-c configure failed)]) + PAC_POP_ALL_FLAGS() + jsonsrcdir="${main_top_builddir}/modules/json-c" + jsonlib="${main_top_builddir}/modules/json-c/libjson-c.la" + PAC_APPEND_FLAG([-I${use_top_srcdir}/modules/json-c],[CPPFLAGS]) + PAC_APPEND_FLAG([-I${main_top_builddir}/modules/json-c],[CPPFLAGS]) +else + AC_MSG_NOTICE([Using an external libjson-c]) + PAC_APPEND_FLAG([-I/usr/include/json-c],[CPPFLAGS]) + PAC_APPEND_FLAG([-ljson-c],[WRAPPER_LIBS]) +fi # ---------------------------------------------------------------------------- # HWLOC / NETLOC