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"
+CFLAGS="$CFLAGS -static"
+AC_CHECK_LIB([cap],[cap_init],[have_static_libcap=yes],[have_static_libcap=no])
+AM_CONDITIONAL([HAVE_STATIC_LIBCAP], [test "x$have_static_libcap" = "xyes"])
+if test "x$have_static_libcap" = "xyes"; then
+ AC_DEFINE([HAVE_STATIC_LIBCAP], 1, [Have static libcap])
+fi
+CFLAGS="$OLD_CFLAGS"
+
+
# Linux capabilities
AC_ARG_ENABLE([capabilities],
[AC_HELP_STRING([--enable-capabilities], [enable kernel capabilities support [default=auto]])],
lxc-usernsexec \
lxc-wait
-sbin_PROGRAMS = init.lxc init.lxc.static
+sbin_PROGRAMS = init.lxc
pkglibexec_PROGRAMS = \
lxc-monitord \
lxc-user-nic
lxc_usernsexec_SOURCES = lxc_usernsexec.c
lxc_user_nic_SOURCES = lxc_user_nic.c network.c network.h
+if HAVE_STATIC_LIBCAP
+sbin_PROGRAMS += init.lxc.static
+
init_lxc_static_SOURCES = lxc_init.c error.c log.c utils.c caps.c
if !HAVE_GETLINE
init_lxc_static_LDFLAGS = -static
init_lxc_static_LDADD = @CAP_LIBS@
+endif
install-exec-local: install-soPROGRAMS
mkdir -p $(DESTDIR)$(datadir)/lxc