3 dnl Copyright (C) 2003-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 # Check for Extended Attributes (Linux)
10 AC_DEFUN([gl_FUNC_XATTR],
12 AC_ARG_ENABLE([xattr],
13 AS_HELP_STRING([[--disable-xattr]],
14 [do not support extended attributes]),
15 [use_xattr=$enableval], [use_xattr=yes])
20 if test "$use_xattr" = yes; then
21 AC_CACHE_CHECK([for xattr library with ATTR_ACTION_PERMISSIONS],
26 [[#include <attr/error_context.h>
27 #include <attr/libattr.h>
29 is_attr_permissions (const char *name, struct error_context *ctx)
31 return attr_copy_action (name, ctx) == ATTR_ACTION_PERMISSIONS;
34 [[return attr_copy_fd ("/", 0, "/", 0, is_attr_permissions, 0);
37 [gl_cv_xattr_lib='none required'],
38 [xattr_saved_LIBS=$LIBS
40 AC_LINK_IFELSE([], [gl_cv_xattr_lib=-lattr])
41 LIBS=$xattr_saved_LIBS])])
42 if test "$gl_cv_xattr_lib" = no; then
43 AC_MSG_WARN([libattr development library was not found or not usable.])
44 AC_MSG_WARN([AC_PACKAGE_NAME will be built without xattr support.])
46 elif test "$gl_cv_xattr_lib" != 'none required'; then
47 LIB_XATTR=$gl_cv_xattr_lib
50 if test "$use_xattr" = yes; then
51 AC_DEFINE([USE_XATTR], [1],
52 [Define to 1 to use the Linux extended attributes library.])