Commit a0411275 by Serge Hallyn Committed by Stéphane Graber

detect whether cgmanager_list_controllers is available

and don't use it if not. This fixes failure to build with older cgmanager. Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent 454ec0ab
...@@ -284,6 +284,17 @@ else ...@@ -284,6 +284,17 @@ else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
fi 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 # 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 # the one checked below so the cache doesn't give a wrong answer
OLD_CFLAGS="$CFLAGS" OLD_CFLAGS="$CFLAGS"
......
...@@ -818,6 +818,7 @@ out: ...@@ -818,6 +818,7 @@ out:
return pids_len; return pids_len;
} }
#if HAVE_CGMANAGER_LIST_CONTROLLERS
static bool lxc_list_controllers(char ***list) static bool lxc_list_controllers(char ***list)
{ {
if (!cgm_dbus_connect()) { if (!cgm_dbus_connect()) {
...@@ -836,6 +837,12 @@ static bool lxc_list_controllers(char ***list) ...@@ -836,6 +837,12 @@ static bool lxc_list_controllers(char ***list)
cgm_dbus_disconnect(); cgm_dbus_disconnect();
return true; return true;
} }
#else
static bool lxc_list_controllers(char ***list)
{
return false;
}
#endif
static inline void free_abs_cgroup(char *cgroup) static inline void free_abs_cgroup(char *cgroup)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment