diff options
author | Thomas Haller <thaller@redhat.com> | 2018-01-02 13:37:06 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-01-08 12:38:53 +0100 |
commit | 22ef6a507a308f2fe495b60bef78ac2ca00fb6d2 (patch) | |
tree | 3bd2f287df3db9c5254f9b27607b4f0735b938d7 /shared/nm-test-utils-impl.c | |
parent | 31b6abd4b533c56c91c616498ee2080d56d0fd48 (diff) | |
download | NetworkManager-22ef6a507a308f2fe495b60bef78ac2ca00fb6d2.tar.gz |
build: refine the NETWORKMANAGER_COMPILATION define
Note that:
- we compile some source files multiple times. Most notably those
under "shared/".
- we include a default header "shared/nm-default.h" in every source
file. This header is supposed to setup a common environment by defining
and including parts that are commonly used. As we always include the
same header, the header must behave differently depending
one whether the compilation is for libnm-core, NetworkManager or
libnm-glib. E.g. it must include <glib/gi18n.h> or <glib/gi18n-lib.h>
depending on whether we compile a library or an application.
For that, the source files need the NETWORKMANAGER_COMPILATION #define
to behave accordingly.
Extend the define to be composed of flags. These flags are all named
NM_NETWORKMANAGER_COMPILATION_WITH_*, they indicate which part of the
build are available. E.g. when building libnm-core.la itself, then
WITH_LIBNM_CORE, WITH_LIBNM_CORE_INTERNAL, and WITH_LIBNM_CORE_PRIVATE
are available. When building NetworkManager, WITH_LIBNM_CORE_PRIVATE
is not available but the internal parts are still accessible. When
building nmcli, only WITH_LIBNM_CORE (the public part) is available.
This granularily controls the build.
Diffstat (limited to 'shared/nm-test-utils-impl.c')
-rw-r--r-- | shared/nm-test-utils-impl.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/shared/nm-test-utils-impl.c b/shared/nm-test-utils-impl.c index 3eb726d91f..998d792a2a 100644 --- a/shared/nm-test-utils-impl.c +++ b/shared/nm-test-utils-impl.c @@ -25,10 +25,6 @@ #include "NetworkManager.h" #include "nm-dbus-compat.h" -#if ((NETWORKMANAGER_COMPILATION) == NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY) -#include "nm-dbus-glib-types.h" -#endif - #include "nm-test-libnm-utils.h" /*****************************************************************************/ @@ -58,8 +54,7 @@ name_exists (GDBusConnection *c, const char *name) return exists; } -#if ((NETWORKMANAGER_COMPILATION) == NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY) - +#if (NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_GLIB static DBusGProxy * _libdbus_create_proxy_test (DBusGConnection *bus) { @@ -75,7 +70,6 @@ _libdbus_create_proxy_test (DBusGConnection *bus) return proxy; } - #endif NMTstcServiceInfo * @@ -121,7 +115,7 @@ nmtstc_service_init (void) NULL, &error); g_assert_no_error (error); -#if ((NETWORKMANAGER_COMPILATION) == NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY) +#if (NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_GLIB info->libdbus.bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error); g_assert_no_error (error); g_assert (info->libdbus.bus); @@ -148,7 +142,7 @@ nmtstc_service_cleanup (NMTstcServiceInfo *info) g_object_unref (info->bus); nm_close (info->keepalive_fd); -#if ((NETWORKMANAGER_COMPILATION) == NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY) +#if (NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_GLIB g_clear_pointer (&info->libdbus.bus, dbus_g_connection_unref); #endif @@ -156,8 +150,7 @@ nmtstc_service_cleanup (NMTstcServiceInfo *info) g_free (info); } -#if ((NETWORKMANAGER_COMPILATION) == NM_NETWORKMANAGER_COMPILATION_LIB) - +#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_GLIB) typedef struct { GMainLoop *loop; const char *ifname; @@ -270,8 +263,7 @@ nmtstc_service_add_wired_device (NMTstcServiceInfo *sinfo, NMClient *client, { return add_device_common (sinfo, client, "AddWiredDevice", ifname, hwaddr, subchannels); } - -#endif /* NM_NETWORKMANAGER_COMPILATION_LIB */ +#endif void nmtstc_service_add_connection (NMTstcServiceInfo *sinfo, @@ -279,7 +271,7 @@ nmtstc_service_add_connection (NMTstcServiceInfo *sinfo, gboolean verify_connection, char **out_path) { -#if ((NETWORKMANAGER_COMPILATION) == NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY) +#if (NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_GLIB gs_unref_hashtable GHashTable *new_settings = NULL; gboolean success; gs_free_error GError *error = NULL; @@ -353,7 +345,7 @@ nmtstc_service_update_connection (NMTstcServiceInfo *sinfo, path = nm_connection_get_path (connection); g_assert (path); -#if ((NETWORKMANAGER_COMPILATION) == NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY) +#if (NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_GLIB { gs_unref_hashtable GHashTable *new_settings = NULL; gboolean success; @@ -414,8 +406,7 @@ nmtstc_service_update_connection_variant (NMTstcServiceInfo *sinfo, /*****************************************************************************/ -#if ((NETWORKMANAGER_COMPILATION) == NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY) - +#if (NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_GLIB NMClient * nmtstc_nm_client_new (void) { @@ -461,7 +452,6 @@ nmtstc_nm_remote_settings_new (void) return settings; } - -#endif /* NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY */ +#endif /*****************************************************************************/ |