diff --git a/Makefile.am b/Makefile.am index 0292c8a87..4b3e613f9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -398,6 +398,7 @@ shared_nm_glib_aux_libnm_glib_aux_la_SOURCES = \ shared/nm-glib-aux/nm-dbus-aux.h \ shared/nm-glib-aux/nm-dedup-multi.c \ shared/nm-glib-aux/nm-dedup-multi.h \ + shared/nm-glib-aux/nm-default-glib.h \ shared/nm-glib-aux/nm-enum-utils.c \ shared/nm-glib-aux/nm-enum-utils.h \ shared/nm-glib-aux/nm-errno.c \ @@ -2986,7 +2987,6 @@ src_core_dhcp_nm_dhcp_helper_CPPFLAGS = \ -I$(srcdir)/shared \ -I$(builddir)/shared \ -DG_LOG_DOMAIN=\""nm-dhcp-helper"\" \ - -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_GLIB \ $(GLIB_CFLAGS) \ $(NULL) @@ -3049,7 +3049,6 @@ src_core_ppp_nm_pppd_plugin_la_CPPFLAGS = \ -I$(builddir)/shared \ -I$(srcdir)/libnm-core \ -DG_LOG_DOMAIN=\""nm-pppd-plugin"\" \ - -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_GLIB \ $(GLIB_CFLAGS) src_core_ppp_nm_pppd_plugin_la_SOURCES = \ diff --git a/shared/nm-default.h b/shared/nm-default.h index 282131219..c771cca51 100644 --- a/shared/nm-default.h +++ b/shared/nm-default.h @@ -22,7 +22,8 @@ #error Define NETWORKMANAGER_COMPILATION accordingly #endif -#if NETWORKMANAGER_COMPILATION < NM_NETWORKMANAGER_COMPILATION_WITH_GLIB +#if NETWORKMANAGER_COMPILATION \ + < (NM_NETWORKMANAGER_COMPILATION_GLIB | NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB) #error Dont include this header with such NETWORKMANAGER_COMPILATION #endif diff --git a/shared/nm-glib-aux/nm-default-glib.h b/shared/nm-glib-aux/nm-default-glib.h new file mode 100644 index 000000000..1a75bcbc3 --- /dev/null +++ b/shared/nm-glib-aux/nm-default-glib.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2015 Red Hat, Inc. + */ + +#ifndef __NM_DEFAULT_GLIB_H__ +#define __NM_DEFAULT_GLIB_H__ + +#include "nm-std-aux/nm-default-std.h" + +#undef NETWORKMANAGER_COMPILATION +#define NETWORKMANAGER_COMPILATION NM_NETWORKMANAGER_COMPILATION_WITH_GLIB + +/*****************************************************************************/ + +#include + +#if defined(_NETWORKMANAGER_COMPILATION_GLIB_I18N_PROG) + #if defined(_NETWORKMANAGER_COMPILATION_GLIB_I18N_LIB) + #error Cannot define _NETWORKMANAGER_COMPILATION_GLIB_I18N_LIB and _NETWORKMANAGER_COMPILATION_GLIB_I18N_PROG together + #endif + #undef _NETWORKMANAGER_COMPILATION_GLIB_I18N_PROG + #include +#elif defined(_NETWORKMANAGER_COMPILATION_GLIB_I18N_LIB) + #undef _NETWORKMANAGER_COMPILATION_GLIB_I18N_LIB + #include +#endif + +/*****************************************************************************/ + +#include "nm-gassert-patch.h" + +#include "nm-std-aux/nm-std-aux.h" +#include "nm-std-aux/nm-std-utils.h" +#include "nm-glib-aux/nm-macros-internal.h" +#include "nm-glib-aux/nm-shared-utils.h" +#include "nm-glib-aux/nm-errno.h" +#include "nm-glib-aux/nm-hash-utils.h" + +/*****************************************************************************/ + +#endif /* __NM_DEFAULT_GLIB_H__ */ diff --git a/src/core/dhcp/meson.build b/src/core/dhcp/meson.build index ea0d05626..1bb004cd2 100644 --- a/src/core/dhcp/meson.build +++ b/src/core/dhcp/meson.build @@ -1,17 +1,12 @@ # SPDX-License-Identifier: LGPL-2.1-or-later -name = 'nm-dhcp-helper' - -c_flags = [ - '-DG_LOG_DOMAIN="@0@"'.format(name), - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_GLIB', -] - executable( - name, - name + '.c', + 'nm-dhcp-helper', + 'nm-dhcp-helper.c', dependencies: glib_nm_default_dep, - c_args: c_flags, + c_args: [ + '-DG_LOG_DOMAIN="nm-dhcp-helper"', + ], link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, install: true, diff --git a/src/core/dhcp/nm-dhcp-helper.c b/src/core/dhcp/nm-dhcp-helper.c index 94ee181e6..0f98add12 100644 --- a/src/core/dhcp/nm-dhcp-helper.c +++ b/src/core/dhcp/nm-dhcp-helper.c @@ -3,7 +3,7 @@ * Copyright (C) 2007 - 2013 Red Hat, Inc. */ -#include "nm-default.h" +#include "nm-glib-aux/nm-default-glib.h" #include #include diff --git a/src/core/ppp/meson.build b/src/core/ppp/meson.build index 991f0b3dc..607b47187 100644 --- a/src/core/ppp/meson.build +++ b/src/core/ppp/meson.build @@ -7,7 +7,6 @@ nm_pppd_plugin = shared_module( dependencies: libnm_core_nm_default_dep, c_args: [ '-DG_LOG_DOMAIN="nm-pppd-plugin"', - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_GLIB', ], install: true, install_dir: pppd_plugin_dir, diff --git a/src/core/ppp/nm-pppd-plugin.c b/src/core/ppp/nm-pppd-plugin.c index 519e637e2..c9016dac5 100644 --- a/src/core/ppp/nm-pppd-plugin.c +++ b/src/core/ppp/nm-pppd-plugin.c @@ -20,7 +20,7 @@ #include #include -#include "nm-default.h" +#include "nm-glib-aux/nm-default-glib.h" #include "nm-dbus-interface.h"