]> git.proxmox.com Git - mirror_lxc.git/commitdiff
don't build init.lxc.static if libcap.a isn't available
authorDwight Engen <dwight.engen@oracle.com>
Fri, 20 Jun 2014 20:45:09 +0000 (16:45 -0400)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 23 Jun 2014 16:06:30 +0000 (12:06 -0400)
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>
configure.ac
src/lxc/Makefile.am

index 5ade4b57abe4b0483ac114a95fb2e92877f1dfa4..6ee9aaa041fd8c6887c32697ed30a02fdeb109bb 100644 (file)
@@ -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]])],
index 009b4462fe3ff18fd873d0f707b81175dc633950..310d3e8a2340a6e394f3443b475abbb4d731099d 100644 (file)
@@ -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