Skip to content

Commit

Permalink
don't build init.lxc.static if libcap.a isn't available
Browse files Browse the repository at this point in the history
Note that building init.lxc.static still requires a static libutil.a
and libpthread.a, but these are available on most distro's through
glibc-static.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
  • Loading branch information
Dwight Engen authored and stgraber committed Jun 23, 2014
1 parent 513e150 commit e78884c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions configure.ac
Expand Up @@ -266,6 +266,19 @@ if test "x$have_abs_cgroups" = "xyes"; then
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]])],
Expand Down
6 changes: 5 additions & 1 deletion src/lxc/Makefile.am
Expand Up @@ -199,7 +199,7 @@ bin_PROGRAMS = \
lxc-usernsexec \
lxc-wait

sbin_PROGRAMS = init.lxc init.lxc.static
sbin_PROGRAMS = init.lxc
pkglibexec_PROGRAMS = \
lxc-monitord \
lxc-user-nic
Expand Down Expand Up @@ -233,6 +233,9 @@ lxc_snapshot_SOURCES = lxc_snapshot.c
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
Expand All @@ -243,6 +246,7 @@ endif

init_lxc_static_LDFLAGS = -static
init_lxc_static_LDADD = @CAP_LIBS@
endif

install-exec-local: install-soPROGRAMS
mkdir -p $(DESTDIR)$(datadir)/lxc
Expand Down

0 comments on commit e78884c

Please sign in to comment.