chiark / gitweb /
Add --with-libcap option
authorAndy Wingo <wingo@pobox.com>
Wed, 26 Aug 2015 21:19:06 +0000 (23:19 +0200)
committerAndy Wingo <wingo@pobox.com>
Wed, 26 Aug 2015 21:19:51 +0000 (23:19 +0200)
* configure.ac: Add --with-libcap option.
* Makefile.am (libelogind_shared_la_LDFLAGS): Add CAP_LDFLAGS.

Makefile.am
configure.ac

index bb4885d..84e15e9 100644 (file)
@@ -503,6 +503,9 @@ libelogind_shared_la_LIBADD = \
        $(CAP_LIBS) \
        -lm
 
+libelogind_shared_la_LDFLAGS = \
+       $(CAP_LDFLAGS)
+
 # ------------------------------------------------------------------------------
 if HAVE_ACL
 noinst_LTLIBRARIES += \
index 54b5330..16e0343 100644 (file)
@@ -234,11 +234,18 @@ AC_CHECK_HEADERS([linux/memfd.h], [], [])
 # unconditionally pull-in librt with old glibc versions
 AC_SEARCH_LIBS([clock_gettime], [rt], [], [])
 
+AC_ARG_WITH([libcap],
+            AS_HELP_STRING([--with-libcap=DIR], [Prefix for libcap]),
+            [CAP_LDFLAGS="-L$with_libcap/lib"],
+            [CAP_LDFLAGS=""])
 save_LIBS="$LIBS"
 LIBS=
+LDFLAGS="$LDFLAGS $CAP_LDFLAGS"
 AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
 CAP_LIBS="$LIBS"
 AC_SUBST(CAP_LIBS)
+AC_SUBST(CAP_LDFLAGS)
+LDFLAGS="$save_LDFLAGS"
 
 AC_CHECK_FUNCS([memfd_create])
 AC_CHECK_FUNCS([__secure_getenv secure_getenv])