# HG changeset patch
# User Daniel Mierswa <impulze@impulze.org>
# Date 1245757676 -7200
# Branch HEAD
# Node ID 343390a32894c654c8646650eba2cf130ca480d2
# Parent  d77225a6412873528b3c94abe8268436df5dbe82
do not automagically depend on libcap if it's installed

diff --git a/configure.in b/configure.in
--- a/configure.in
+++ b/configure.in
@@ -196,6 +196,11 @@
   TEST_WITH(bzlib, $withval),
   want_bzlib=auto)
 
+AC_ARG_WITH(libcap,
+[  --with-libcap           Build with libcap support (Dropping capabilities).],
+  TEST_WITH(libcap, $withval),
+  want_libcap=auto)
+
 AC_ARG_WITH(ssl,
 [  --with-ssl=gnutls|openssl Build with GNUTLS or OpenSSL (default)],
 	if test x$withval = xno; then
@@ -358,11 +363,13 @@
   AC_DEFINE(HAVE_FDATASYNC,, Define if you have fdatasync())
 ])
 
-AC_CHECK_LIB(cap, cap_init, [
-  AC_DEFINE(HAVE_LIBCAP,, libcap is installed for cap_init())
-  LIBCAP="-lcap"
-])
-AC_SUBST(LIBCAP)
+if test $want_libcap != no; then
+  AC_CHECK_LIB(cap, cap_init, [
+    AC_DEFINE(HAVE_LIBCAP,, libcap is installed for cap_init())
+    LIBCAP="-lcap"
+  ])
+  AC_SUBST(LIBCAP)
+fi
 
 AC_DEFINE(PACKAGE_WEBPAGE, "http://www.dovecot.org/", Support URL)
 
