[lxc-devel] [PATCH] don't build init.lxc.static if libcap.a isn't available

Serge Hallyn serge.hallyn at ubuntu.com
Fri Jun 20 20:48:57 UTC 2014


Quoting Dwight Engen (dwight.engen at oracle.com):
> 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 at oracle.com>

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

Ok if needed, but didn't you just pull the lxc_caps* out of
lxc_init.c?  Are we inheriting the depends through some other
includes?

> ---
>  configure.ac        | 13 +++++++++++++
>  src/lxc/Makefile.am |  6 +++++-
>  2 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 37eb9d5..73deefa 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -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]])],
> diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am
> index 009b446..310d3e8 100644
> --- a/src/lxc/Makefile.am
> +++ b/src/lxc/Makefile.am
> @@ -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
> @@ -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
> @@ -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
> -- 
> 1.9.3
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel


More information about the lxc-devel mailing list