]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Detect broken libcap better
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 9 Aug 2009 07:31:39 +0000 (19:31 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 9 Aug 2009 07:31:39 +0000 (19:31 +1200)
libcap v1 is still common and broken.
some libcap2 may also be.

compat/os/linux.h
configure.in

index 27ea415b141cadc0f7a35683613e039c1c554527..21f6663b4b762df5de2463055ed07a1a73dbe920 100644 (file)
 /*
  * sys/capability.h is only needed in Linux apparently.
  *
- * HACK: Ugly glue to get around linux header madness colliding with glibc
- * NP: if you need to use the hack labeled MAYBE_DEAD please report to
- *     the developers.
+ * HACK: LIBCAP_BROKEN Ugly glue to get around linux header madness colliding with glibc
  */
 #if HAVE_SYS_CAPABILITY_H
 
-#if MAYBE_DEAD
+#if LIBCAP_BROKEN
 #undef _POSIX_SOURCE
 #define _LINUX_TYPES_H
 #define _LINUX_FS_H
index 2c13b60d0e7a9df5d1bb9e4131e877a6ce59280b..ade54a2148ca82cf61c55d0b41ada51d09e8cbd7 100644 (file)
@@ -2166,8 +2166,7 @@ AC_CHECK_HEADERS( \
        inttypes.h \
        grp.h \
        db.h \
-       db_185.h \
-       sys/capability.h
+       db_185.h
 )
 
 AC_CHECK_HEADERS(
@@ -2434,6 +2433,17 @@ AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the
 #include <stddef.h>
 #endif])
 
+dnl Check for libcap1 breakage or libcap2 fixed
+AC_CHECK_HEADERS(sys/capability.h)
+libcap_broken=1
+AC_CACHE_CHECK([for operational libcap2], $libcap_broken,
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/capability.h>]], [[
+                  capget(NULL, NULL);
+                  capset(NULL, NULL);
+                 ]])],[libcap_broken=0],[])
+)
+AC_DEFINE_UNQUOTED([LIBCAP_BROKEN],$libcap_broken,[if libcap2 is available and not clashing with libc])
+
 AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,[mtyp_t is defined by the system headers]),,[#include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/msg.h>])