]> code.delx.au - gnu-emacs/blobdiff - m4/acl.m4
Fix configure summary for hybrid malloc configurations
[gnu-emacs] / m4 / acl.m4
index 186353c395b634a268e6b9779b175fdfc2594830..ce0fe6bc1ea89a1cf960479e12c0fb218c4b2b7e 100644 (file)
--- a/m4/acl.m4
+++ b/m4/acl.m4
@@ -1,7 +1,7 @@
 # acl.m4 - check for access control list (ACL) primitives
-# serial 18
+# serial 22
 
-# Copyright (C) 2002, 2004-2015 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004-2016 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -163,9 +163,8 @@ AC_DEFUN([gl_ACL_GET_FILE],
            #include <sys/acl.h>
            #include <errno.h>
           ]],
-          [[if (!acl_get_file (".", ACL_TYPE_ACCESS) && errno == ENOENT)
-              return 1;
-            return 0;
+          [[acl_t acl = acl_get_file (".", ACL_TYPE_ACCESS);
+            return acl ? acl_free (acl) != 0 : errno == ENOENT;
           ]])],
        [if test $cross_compiling = yes; then
           gl_cv_func_working_acl_get_file="guessing yes"
@@ -181,12 +180,26 @@ AC_DEFUN([gl_FILE_HAS_ACL],
 [
   AC_REQUIRE([gl_FUNC_ACL_ARG])
   if test "$enable_acl" != no; then
-    AC_CHECK_HEADERS([linux/xattr.h],
-      [AC_CHECK_HEADERS([sys/xattr.h],
-         [AC_CHECK_FUNCS([getxattr])])])
+    AC_CACHE_CHECK([for getxattr with XATTR_NAME_POSIX_ACL macros],
+      [gl_cv_getxattr_with_posix_acls],
+      [gl_cv_getxattr_with_posix_acls=no
+       AC_LINK_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <sys/types.h>
+              #include <sys/xattr.h>
+              #include <linux/xattr.h>
+            ]],
+            [[ssize_t a = getxattr (".", XATTR_NAME_POSIX_ACL_ACCESS, 0, 0);
+              ssize_t b = getxattr (".", XATTR_NAME_POSIX_ACL_DEFAULT, 0, 0);
+              return a < 0 || b < 0;
+            ]])],
+         [gl_cv_getxattr_with_posix_acls=yes])])
   fi
-  if test "$ac_cv_header_sys_xattr_h,$ac_cv_header_linux_xattr_h,$ac_cv_func_getxattr" = yes,yes,yes; then
+  if test "$gl_cv_getxattr_with_posix_acls" = yes; then
     LIB_HAS_ACL=
+    AC_DEFINE([GETXATTR_WITH_POSIX_ACLS], 1,
+      [Define to 1 if getxattr works with XATTR_NAME_POSIX_ACL_ACCESS
+       and XATTR_NAME_POSIX_ACL_DEFAULT.])
   else
     dnl Set gl_need_lib_has_acl to a nonempty value, so that any
     dnl later gl_FUNC_ACL call will set LIB_HAS_ACL=$LIB_ACL.