From 6887d73545db62bcda8c7cf829389ac6f19d5131 Mon Sep 17 00:00:00 2001 From: "Austin S. Hemmelgarn" Date: Tue, 1 Sep 2020 08:48:30 -0400 Subject: Added code to bundle libJudy on systems which do not provide a usable copy of it. (#9776) * Add installer code to bundle libJudy. * Update libJudy build to work on more systems. * Added libtool to deps. * First part of configure changes - detection of library * Configure change part two: integrating flags into the build I've tested the build works and that the symbols end up correct in the compiled binary, but I have not tested that dbengine is working properly after the changes. * Add required configure options for bundling libJudy. * Bail early if a libJudy build step fails. * Added messges for specific reasons libJudy is being built. * Fix bail condition for bundling failures. We don't care about whether the cloud is required or not, just whether the user asked for a local build of libJudy or not. * Fix logic for deciding when to bundle libJudy. * Fix judy build to clean up properly if it fails. Co-authored-by: Andrew Moss <1043609+amoss@users.noreply.github.com> --- configure.ac | 80 +++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 55 insertions(+), 25 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 190f3cd50a..239e961b51 100644 --- a/configure.ac +++ b/configure.ac @@ -328,14 +328,6 @@ AC_CHECK_LIB( [LZ4_LIBS="-llz4"] ) -# ----------------------------------------------------------------------------- -# Judy General purpose dynamic array - -AC_CHECK_LIB( - [Judy], - [JudyLIns], - [JUDY_LIBS="-lJudy"] -) # ----------------------------------------------------------------------------- @@ -416,6 +408,44 @@ OPTIONAL_JSONC_LIBS="${JSONC_LIBS}" test "${enable_dbengine}" = "yes" -a -z "${LZ4_LIBS}" && \ AC_MSG_ERROR([liblz4 required but not found. Try installing 'liblz4-dev' or 'lz4-devel'.]) + +AC_ARG_WITH([libJudy], + [AS_HELP_STRING([--with-libJudy=PREFIX],[Use a specific Judy library (default is system-library)])], + [ + libJudy_dir="$withval" + AC_MSG_CHECKING(for libJudy in $withval) + if test -f "${libJudy_dir}/libJudy.a" -a -f "${libJudy_dir}/Judy.h"; then + LIBS_BACKUP="${LIBS}" + LIBS="${libJudy_dir}/libJudy.a" + AC_LINK_IFELSE([AC_LANG_SOURCE([[#include "${libJudy_dir}/Judy.h" + int main (int argc, char **argv) { + Pvoid_t PJLArray = (Pvoid_t) NULL; + Word_t * PValue; + Word_t Index; + JLI(PValue, PJLArray, Index); + }]])], + [HAVE_libJudy_a="yes"], + [HAVE_libJudy_a="no"]) + LIBS="${LIBS_BACKUP}" + JUDY_LIBS="${libJudy_dir}/libJudy.a" + JUDY_CFLAGS="-I${libJudy_dir}" + AC_MSG_RESULT([$HAVE_libJudy_a]) + else + libjudy_dir="" + HAVE_libJudy_a="no" + AC_MSG_RESULT([$HAVE_libJudy_a]) + fi + ], + [HAVE_libJudy_a="no"]) + +if test "${HAVE_libJudy_a}" = "no"; then + AC_CHECK_LIB( + [Judy], + [JudyLIns], + [JUDY_LIBS="-lJudy"] + ) +fi + test "${enable_dbengine}" = "yes" -a -z "${JUDY_LIBS}" && \ AC_MSG_ERROR([libJudy required but not found. Try installing 'libjudy-dev' or 'Judy-devel'.]) @@ -457,23 +487,23 @@ AM_CONDITIONAL([ENABLE_HTTPS], [test "${enable_https}" = "yes"]) # JSON-C if test "${enable_jsonc}" != "no" -a -z "${JSONC_LIBS}"; then - # Try and detect manual static build presence (from netdata-installer.sh) - AC_MSG_CHECKING([if statically built json-c is present]) - HAVE_libjson_c_a="no" - if test -f "externaldeps/jsonc/libjson-c.a"; then - LIBS_BKP="${LIBS}" - LIBS="externaldeps/jsonc/libjson-c.a" - AC_LINK_IFELSE([AC_LANG_SOURCE([[#include "externaldeps/jsonc/json-c/json.h" - int main (int argc, char **argv) { - struct json_object *jobj; - char *str = "{ \"msg-type\": \"random\" }"; - jobj = json_tokener_parse(str); - json_object_get_type(jobj); - }]])], - [HAVE_libjson_c_a="yes"], - [HAVE_libjson_c_a="no"]) - LIBS="${LIBS_BKP}" - fi + # Try and detect manual static build presence (from netdata-installer.sh) + AC_MSG_CHECKING([if statically built json-c is present]) + HAVE_libjson_c_a="no" + if test -f "externaldeps/jsonc/libjson-c.a"; then + LIBS_BKP="${LIBS}" + LIBS="externaldeps/jsonc/libjson-c.a" + AC_LINK_IFELSE([AC_LANG_SOURCE([[#include "externaldeps/jsonc/json-c/json.h" + int main (int argc, char **argv) { + struct json_object *jobj; + char *str = "{ \"msg-type\": \"random\" }"; + jobj = json_tokener_parse(str); + json_object_get_type(jobj); + }]])], + [HAVE_libjson_c_a="yes"], + [HAVE_libjson_c_a="no"]) + LIBS="${LIBS_BKP}" + fi if test "${HAVE_libjson_c_a}" = "yes"; then AC_DEFINE([LINK_STATIC_JSONC], [1], [static json-c should be used]) -- cgit v1.2.3