chiark / gitweb /
Link against -lcap only where required
authorMichael Biebl <biebl@debian.org>
Thu, 28 Jul 2011 02:02:32 +0000 (04:02 +0200)
committerMichael Biebl <biebl@debian.org>
Thu, 28 Jul 2011 03:01:12 +0000 (05:01 +0200)
Don't put -lcap into LIBS as otherwise everything will be linked against
it, like libsystemd-daemon, where this is not desired.

Makefile.am
configure.ac

index 25ce3f4704fba9ac8be8de61c9b224a5e8a9c889..15349a1aefedf188211ce0192d26dc2786aa384f 100644 (file)
@@ -545,7 +545,8 @@ libsystemd_basic_la_CFLAGS = \
        $(SELINUX_CFLAGS)
 
 libsystemd_basic_la_LIBADD = \
-       $(SELINUX_LIBS)
+       $(SELINUX_LIBS) \
+       $(CAP_LIBS)
 
 libsystemd_core_la_SOURCES = \
        src/unit.c \
@@ -614,7 +615,8 @@ libsystemd_core_la_LIBADD = \
        $(UDEV_LIBS) \
        $(LIBWRAP_LIBS) \
        $(PAM_LIBS) \
-       $(AUDIT_LIBS)
+       $(AUDIT_LIBS) \
+       $(CAP_LIBS)
 
 # This is needed because automake is buggy in how it generates the
 # rules for C programs, but not Vala programs.  We therefore can't
index 82ed85c3f89faffa7d9734d7951e252fff470896..a551d2367282b1da8eb1dbcb918d21e5f6f02435 100644 (file)
@@ -111,8 +111,14 @@ LT_INIT
 
 AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
 AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([*** Dynamic linking loader library not found])])
+
+save_LIBS="$LIBS"
+LIBS=
 AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
 AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
+CAP_LIBS="$LIBS"
+LIBS="$save_LIBS"
+AC_SUBST(CAP_LIBS)
 
 # This makes sure pkg.m4 is available.
 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])