summaryrefslogtreecommitdiff
path: root/m4/xattr.m4
diff options
context:
space:
mode:
authorOndrej Valousek <ondrej.valousek.xm@renesas.com>2023-01-04 15:34:26 +0100
committerBruno Haible <bruno@clisp.org>2023-01-12 21:38:43 +0100
commiteb6a8a4dfbe89f9f74666df082255cfefa10a407 (patch)
treef59c818d20b4145d00193c479cd56bb01225e8cc /m4/xattr.m4
parent2886cca8398f4c5a4d68368a19c0e6d0ff97c739 (diff)
downloadgnulib-eb6a8a4dfbe89f9f74666df082255cfefa10a407.tar.gz
qcopy-acl: Optimize copying of ACLs by directly copying the attributes.
* lib/qcopy-acl.c (is_attr_permissions): New functions. (qcopy_acl): If USE_XATTR, copy the ACL related attributes directly. * m4/xattr.m4: New file. * modules/qcopy-acl (Files): Add it. (configure.ac): Invoke gl_FUNC_XATTR.
Diffstat (limited to 'm4/xattr.m4')
-rw-r--r--m4/xattr.m442
1 files changed, 42 insertions, 0 deletions
diff --git a/m4/xattr.m4 b/m4/xattr.m4
new file mode 100644
index 0000000000..6efdfa475a
--- /dev/null
+++ b/m4/xattr.m4
@@ -0,0 +1,42 @@
+# xattr.m4 - check for Extended Attributes (Linux)
+# serial 4
+
+# Copyright (C) 2003-2021 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.
+
+AC_DEFUN([gl_FUNC_XATTR],
+[
+ AC_ARG_ENABLE([xattr],
+ AS_HELP_STRING([--disable-xattr],
+ [do not support extended attributes]),
+ [use_xattr=$enableval], [use_xattr=yes])
+
+ LIB_XATTR=
+ AC_SUBST([LIB_XATTR])
+
+ if test "$use_xattr" = "yes"; then
+ AC_CHECK_HEADERS([attr/error_context.h attr/libattr.h])
+ use_xattr=no
+ if test "$ac_cv_header_attr_libattr_h" = yes \
+ && test "$ac_cv_header_attr_error_context_h" = yes; then
+ xattr_saved_LIBS=$LIBS
+ AC_SEARCH_LIBS([attr_copy_file], [attr],
+ [test "$ac_cv_search_attr_copy_file" = "none required" ||
+ LIB_XATTR="$ac_cv_search_attr_copy_file"])
+ AC_CHECK_FUNCS([attr_copy_file])
+ LIBS=$xattr_saved_LIBS
+ if test "$ac_cv_func_attr_copy_file" = yes; then
+ use_xattr=yes
+ fi
+ fi
+ if test $use_xattr = no; then
+ AC_MSG_WARN([libattr development library was not found or not usable.])
+ AC_MSG_WARN([AC_PACKAGE_NAME will be built without xattr support.])
+ fi
+ fi
+ if test $use_xattr = yes; then
+ AC_DEFINE_UNQUOTED([USE_XATTR], 1)
+ fi
+])