mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-09 01:50:21 +01:00
build: fix wrong jansson prerequisites
Currently there are multiple features that require Jansson support, but WITH_JANSSON=1 is set only when configuring with --enable-json-validation. Therefore a build with "--disable-json-validation --enable-ovs" fails. The availability of Jansson (WITH_JANSSON) should only be used: - to check if dependent features can be enabled - to determine compiler and linker flags in the Makefile - in nm-jansson.h to define compatibility functions if needed Everything else must be controlled by a configure switch. https://bugzilla.gnome.org/show_bug.cgi?id=790233
This commit is contained in:
parent
79482c9a9e
commit
07d5c86e78
4 changed files with 15 additions and 8 deletions
13
configure.ac
13
configure.ac
|
|
@ -642,6 +642,14 @@ PKG_CHECK_MODULES(UUID, uuid)
|
|||
# Teamd control checks
|
||||
|
||||
PKG_CHECK_MODULES(JANSSON, [jansson], [have_jansson=yes], [have_jansson=no])
|
||||
if test "$have_jansson" = "yes"; then
|
||||
AC_DEFINE(WITH_JANSSON, 1, [Define if JANSSON is enabled])
|
||||
else
|
||||
AC_DEFINE(WITH_JANSSON, 0, [Define if JANSSON is enabled])
|
||||
fi
|
||||
AM_CONDITIONAL(WITH_JANSSON, test "${have_jansson}" = "yes")
|
||||
|
||||
|
||||
PKG_CHECK_MODULES(LIBTEAMDCTL, [libteamdctl >= 1.9], [have_teamdctl=yes],[have_teamdctl=no])
|
||||
if test "$have_jansson" = "yes" -a "$have_teamdctl" = "yes"; then
|
||||
have_team_prereq=yes
|
||||
|
|
@ -673,14 +681,13 @@ AC_ARG_ENABLE(json-validation,
|
|||
[enable_json_validation=${enableval}],
|
||||
[enable_json_validation=${have_jansson}])
|
||||
if (test "${enable_json_validation}" == "no"); then
|
||||
AC_DEFINE(WITH_JANSSON, 0, [Define if JANSSON is enabled])
|
||||
AC_DEFINE(WITH_JSON_VALIDATION, 0, [Define if JSON validation in libnm is enabled])
|
||||
else
|
||||
if test "$have_jansson" = "no"; then
|
||||
AC_MSG_ERROR([jansson is needed for team configuration validation. Use --disable-json-validation to build without it.])
|
||||
fi
|
||||
AC_DEFINE(WITH_JANSSON, 1, [Define if JANSSON is enabled])
|
||||
AC_DEFINE(WITH_JSON_VALIDATION, 1, [Define if JSON validation in libnm is enabled])
|
||||
fi
|
||||
AM_CONDITIONAL(WITH_JANSSON, test "${enable_json_validation}" != "no")
|
||||
|
||||
# we usually compile with polkit support. --enable-polkit=yes|no only sets the
|
||||
# default configuration for main.auth-polkit. User can always enable/disable polkit
|
||||
|
|
|
|||
|
|
@ -4304,7 +4304,7 @@ const char **nm_utils_enum_get_values (GType type, gint from, gint to)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
#if WITH_JANSSON
|
||||
#if WITH_JSON_VALIDATION
|
||||
/**
|
||||
* nm_utils_is_json_object:
|
||||
* @str: the JSON string to test
|
||||
|
|
@ -4715,7 +4715,7 @@ done:
|
|||
return updated;
|
||||
}
|
||||
|
||||
#else /* WITH_JANSSON */
|
||||
#else /* !WITH_JSON_VALIDATION */
|
||||
|
||||
gboolean
|
||||
nm_utils_is_json_object (const char *str, GError **error)
|
||||
|
|
|
|||
|
|
@ -5848,7 +5848,7 @@ test_nm_utils_check_valid_json (void)
|
|||
{
|
||||
_json_config_check_valid (NULL, FALSE);
|
||||
_json_config_check_valid ("", FALSE);
|
||||
#if WITH_JANSSON
|
||||
#if WITH_JSON_VALIDATION
|
||||
_json_config_check_valid ("{ }", TRUE);
|
||||
_json_config_check_valid ("{ \"a\" : 1 }", TRUE);
|
||||
_json_config_check_valid ("{ \"a\" : }", FALSE);
|
||||
|
|
@ -5873,7 +5873,7 @@ _team_config_equal_check (const char *conf1,
|
|||
static void
|
||||
test_nm_utils_team_config_equal (void)
|
||||
{
|
||||
#if WITH_JANSSON
|
||||
#if WITH_JSON_VALIDATION
|
||||
_team_config_equal_check ("", "", TRUE, TRUE);
|
||||
_team_config_equal_check ("{}",
|
||||
"{ }",
|
||||
|
|
|
|||
|
|
@ -623,7 +623,7 @@ test_team_conf_read_valid (void)
|
|||
static void
|
||||
test_team_conf_read_invalid (void)
|
||||
{
|
||||
#if WITH_JANSSON
|
||||
#if WITH_JSON_VALIDATION
|
||||
GKeyFile *keyfile = NULL;
|
||||
gs_unref_object NMConnection *con = NULL;
|
||||
NMSettingTeam *s_team;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue