diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2017-11-04 20:41:45 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2017-11-06 11:47:05 +0100 |
commit | 4d1f090aedf05c0e2955d431638e311d1e18a52f (patch) | |
tree | a4ba2dab0c144b48407cbe125d06c007f40a6c07 /configure.ac | |
parent | d529641756b5443ba86141ab13ed14952b02bdbf (diff) | |
download | NetworkManager-4d1f090aedf05c0e2955d431638e311d1e18a52f.tar.gz |
libnm: register empty NMClient and NetworkManager when loading libnm with GIR
Register empty "NMClient" and "NetworkManager" GIR modules as soon as libnm is
loaded witch gnome-introspection. This prevents the real modules from being
loaded because they would in turn load libnm-glib and abort() and crash.
In particular this prevents the GNOME shell from crashing with
libnm-glib abort and allows gracefully disabling the extensions which
use the obsolete library.
Test:
$ cat test.js
const NM = imports.gi.NM;
print (NM.SecretAgentGetSecretsFlags.ALLOW_INTERACTION);
const NMClient = imports.gi.NMClient;
print (NMClient.SecretAgentGetSecretsFlags.ALLOW_INTERACTION);
Before:
$ gjs test.js
1
(gjs:16253): libnm-util-ERROR **: libnm symbols detected; Mixing libnm with libnm-util/libnm-glib is not supported
Trace/breakpoint trap (core dumped)
$
After:
$ gjs test.js
1
Gjs-Message: JS WARNING: [test.js 5]: reference to undefined property "SecretAgentGetSecretsFlags"
(gjs:16228): Gjs-WARNING **: JS ERROR: TypeError: NMClient.SecretAgentGetSecretsFlags is undefined
@test.js:5:1
JS_EvaluateScript() failed
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 061c7738e3..ad188a7763 100644 --- a/configure.ac +++ b/configure.ac @@ -322,9 +322,12 @@ GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32 -DGLIB_V AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) +GOBJECT_INTROSPECTION_CHECK([0.9.6]) + AC_ARG_WITH(libnm-glib, AS_HELP_STRING([--without-libnm-glib], - [don't build legacy libraries])) + [don"'"t build legacy libraries])) +fake_typelibs=no if test "$with_libnm_glib" != "no"; then PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.1 dbus-glib-1 >= 0.94, :, [AC_MSG_FAILURE([$DBUS_PKG_ERRORS @@ -333,13 +336,24 @@ Configure with --without-libnm-glib if you do not need the legacy libraries]) ]) with_libnm_glib=yes + + if test "${found_introspection}" = "yes"; then + AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources) + if ! test x"$GLIB_COMPILE_RESOURCES" = x""; then + fake_typelibs=yes + fi + fi fi AM_CONDITIONAL(WITH_LEGACY_LIBRARIES, test "$with_libnm_glib" != "no") +if test "$fake_typelibs" = "yes"; then + AC_DEFINE(WITH_FAKE_TYPELIBS, 1, [Define for libnm to prevent GIR from loading libnm-glib]) +else + AC_DEFINE(WITH_FAKE_TYPELIBS, 0, [Define for libnm to prevent GIR from loading libnm-glib]) +fi +AM_CONDITIONAL(WITH_FAKE_TYPELIBS, test "${fake_typelibs}" = "yes") PKG_CHECK_MODULES([LIBUDEV], [libudev >= 175]) -GOBJECT_INTROSPECTION_CHECK([0.9.6]) - # Qt4 PKG_CHECK_MODULES(QT, [QtCore >= 4 QtDBus QtNetwork], [have_qt=yes],[have_qt=no]) AC_ARG_ENABLE(qt, |