]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
detect whether cgmanager_list_controllers is available
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Wed, 3 Jun 2015 05:03:39 +0000 (05:03 +0000)
committerStéphane Graber <stgraber@ubuntu.com>
Wed, 1 Jul 2015 17:41:46 +0000 (13:41 -0400)
and don't use it if not. This fixes failure to build with older
cgmanager.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
configure.ac
src/lxc/cgmanager.c

index 574b2cd0be3e492023681ec2da1e04959e30f78c..153096d69f3ddeb3f420c537a30d1460a4c6db5c 100644 (file)
@@ -284,6 +284,17 @@ else
        AC_MSG_RESULT([no])
 fi
 
+AC_MSG_CHECKING(for cgmanager_list_controllers)
+save_LIBS=$LIBS
+AC_SEARCH_LIBS([cgmanager_list_controllers_sync], [cgmanager], [have_list_controllers=yes], [have_list_controllers=no], [-lnih -lnih-dbus -ldbus-1])
+LIBS=$save_LIBS
+if test "x$have_list_controllers" = "xyes"; then
+       AC_DEFINE([HAVE_CGMANAGER_LIST_CONTROLLERS], 1, [Have cgmanager_list_controllers])
+       AC_MSG_RESULT([yes])
+else
+       AC_MSG_RESULT([no])
+fi
+
 # Check for static libcap, make sure the function checked for differs from the
 # the one checked below so the cache doesn't give a wrong answer
 OLD_CFLAGS="$CFLAGS"
index 6b6c2d878918e42eec8869f82a25406c26b26308..6df530ca535ff3340615bc5a6f9faadce4cff755 100644 (file)
@@ -818,6 +818,7 @@ out:
        return pids_len;
 }
 
+#if HAVE_CGMANAGER_LIST_CONTROLLERS
 static bool lxc_list_controllers(char ***list)
 {
        if (!cgm_dbus_connect()) {
@@ -836,6 +837,12 @@ static bool lxc_list_controllers(char ***list)
        cgm_dbus_disconnect();
        return true;
 }
+#else
+static bool lxc_list_controllers(char ***list)
+{
+       return false;
+}
+#endif
 
 static inline void free_abs_cgroup(char *cgroup)
 {