r26255: Work around another broken aspect of sys/capability.h on RHEL5.
authorMichael Adam <obnox@samba.org>
Mon, 3 Dec 2007 15:46:45 +0000 (16:46 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:47:30 +0000 (05:47 +0100)
This is synced from samba3 v3-2-test/11bcdf780e164659b89:

The /usr/include/sys/capability.h defines _LINUX_TYPES_H
which prevents /usr/include/linux/types.h from being parsed
(when included afterwards). Thus certain types are undefined
that are for instance needed in /usr/include/linux/dqblk_xfs.h.
This breaks the build of lib/sysquotas_xfs.c in Samba3.

This commit adds a configure check and a workaround for this.

Michael

source/lib/replace/system/capability.h
source/lib/replace/system/config.m4

index 59b5845721ca43ab5091ad4ac4b77e1c4b939e4a..a7b78f02756e94cba8983c0d57b949fe0c490999 100644 (file)
 #define BROKEN_REDHAT_7_STATFS_WORKAROUND
 #endif
 
+#if defined(BROKEN_RHEL5_SYS_CAP_HEADER) && !defined(_LINUX_TYPES_H)
+#define BROKEN_RHEL5_SYS_CAP_HEADER_WORKAROUND
+#endif
+
 #include <sys/capability.h>
 
+#ifdef BROKEN_RHEL5_SYS_CAP_HEADER_WORKAROUND
+#undef _LINUX_TYPES_H
+#undef BROKEN_RHEL5_SYS_CAP_HEADER_WORKAROUND
+#endif
+
 #ifdef BROKEN_REDHAT_7_STATFS_WORKAROUND
 #undef _PPC_STATFS_H
 #undef _I386_STATFS_H
index 64143fe3715840f8410e05cd526d8bfd9e2204bb..799187af7d47d00eb914238a6a699a5207161165 100644 (file)
@@ -35,6 +35,22 @@ AC_TRY_COMPILE([
 if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
        AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files])
 fi
+
+AC_CACHE_CHECK([for broken RHEL5 sys/capability.h],samba_cv_BROKEN_RHEL5_SYS_CAP_HEADER,[
+AC_TRY_COMPILE([
+       #ifdef HAVE_SYS_CAPABILITY_H
+       #include <sys/capability.h>
+       #endif
+       #include <linux/types.h>
+       ],[
+       __s8 i;
+       ],
+       samba_cv_BROKEN_RHEL5_SYS_CAP_HEADER=no,
+       samba_cv_BROKEN_RHEL5_SYS_CAP_HEADER=yes
+)])
+if test x"$samba_cv_BROKEN_RHEL5_SYS_CAP_HEADER" = x"yes"; then
+       AC_DEFINE(BROKEN_RHEL5_SYS_CAP_HEADER,1,[Broken RHEL5 sys/capability.h])
+fi
 ;;
 esac