summaryrefslogtreecommitdiff
blob: 2fe3eff45d51a8985b26069ce05817bf9c0d7b0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
From e89cbae294685195de51aca1e8e6cd400dc0822b Mon Sep 17 00:00:00 2001
From: Alexandre Rostovtsev <tetromino@gentoo.org>
Date: Sat, 10 May 2014 15:14:05 -0400
Subject: [PATCH 3/5] Make networkmanager dependency optional for Gentoo

---
 configure.ac         | 36 ++++++++++++++++++++++++++++++++++--
 js/misc/config.js.in |  2 ++
 src/Makefile.am      |  5 ++++-
 3 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1977da8..920d256 100644
--- a/configure.ac
+++ b/configure.ac
@@ -81,8 +81,40 @@ PKG_CHECK_MODULES(CINNAMON, gio-2.0 >= $GIO_MIN_VERSION
 			       clutter-x11-1.0 >= $CLUTTER_MIN_VERSION
                                libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_MIN_VERSION
                                gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_MIN_VERSION
-                               polkit-agent-1 >= $POLKIT_MIN_VERSION xfixes
-                               libnm-glib libnm-util gnome-keyring-1)
+                               polkit-agent-1 >= $POLKIT_MIN_VERSION xfixes)
+
+##########################
+# Check for NetworkManager
+##########################
+NM_MIN_VERSION=0.9
+AC_ARG_ENABLE(networkmanager,
+              AS_HELP_STRING([--disable-networkmanager],
+                             [disable NetworkManager support @<:@default=auto@:>@]),,
+              [enable_networkmanager=auto])
+
+if test "x$enable_networkmanager" != "xno"; then
+   PKG_CHECK_MODULES(NETWORKMANAGER,
+                     [libnm-glib libnm-util gnome-keyring-1],
+                     [have_networkmanager=yes],
+                     [have_networkmanager=no])
+
+   CINNAMON_CFLAGS="$CINNAMON_CFLAGS $NETWORKMANAGER_CFLAGS"
+   CINNAMON_LIBS="$CINNAMON_LIBS $NETWORKMANAGER_LIBS"
+else
+   have_networkmanager="no  (disabled)"
+fi
+
+if test "x$have_networkmanager" = "xyes"; then
+   AC_DEFINE(HAVE_NETWORKMANAGER, [1], [Define if we have NetworkManager])
+   AC_SUBST([HAVE_NETWORKMANAGER], [1])
+else
+   if test "x$enable_networkmanager" = "xyes"; then
+      AC_MSG_ERROR([Couldn't find NetworkManager.])
+   fi
+   AC_SUBST([HAVE_NETWORKMANAGER], [0])
+fi
+
+AM_CONDITIONAL(HAVE_NETWORKMANAGER, test "$have_networkmanager" = "yes")
 
 PKG_CHECK_MODULES(CINNAMON_JS, gio-2.0 cjs-internals-1.0 >= $GJS_MIN_VERSION)
 
diff --git a/js/misc/config.js.in b/js/misc/config.js.in
index 704989b..df7e014 100644
--- a/js/misc/config.js.in
+++ b/js/misc/config.js.in
@@ -8,5 +8,7 @@ const PACKAGE_VERSION = '@PACKAGE_VERSION@';
 const GJS_VERSION = '@GJS_VERSION@';
 /* 1 if gnome-bluetooth is available, 0 otherwise */
 const HAVE_BLUETOOTH = @HAVE_BLUETOOTH@;
+/* 1 if networkmanager is available, 0 otherwise */
+const HAVE_NETWORKMANAGER = @HAVE_NETWORKMANAGER@;
 /* The system TLS CA list */
 const CINNAMON_SYSTEM_CA_FILE = '@CINNAMON_SYSTEM_CA_FILE@';
diff --git a/src/Makefile.am b/src/Makefile.am
index c0c6e7e..fc2dd14 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -286,7 +286,10 @@ libcinnamon_la_LIBADD =		\
 libcinnamon_la_CPPFLAGS = $(cinnamon_cflags)
 
 Cinnamon-0.1.gir: libcinnamon.la St-1.0.gir
-Cinnamon_0_1_gir_INCLUDES = Clutter-1.0 ClutterX11-1.0 Meta-Muffin.0 Soup-2.4 CMenu-3.0 NetworkManager-1.0 NMClient-1.0
+Cinnamon_0_1_gir_INCLUDES = Clutter-1.0 ClutterX11-1.0 Meta-Muffin.0 Soup-2.4 CMenu-3.0
+if HAVE_NETWORKMANAGER
+Cinnamon_0_1_gir_INCLUDES += NetworkManager-1.0 NMClient-1.0
+endif
 Cinnamon_0_1_gir_CFLAGS = $(libcinnamon_la_CPPFLAGS) -I $(srcdir)
 Cinnamon_0_1_gir_LIBS = libcinnamon.la
 Cinnamon_0_1_gir_FILES = $(libcinnamon_la_gir_sources)
-- 
2.2.1