cp/mv: add xattr support
[coreutils.git] / m4 / xattr.m4
blobc5bf12988ef04b7143f800ab00276e0ad5bf75b1
1 # xattr.m4 - check for Extended Attributes (Linux)
3 # Copyright (C) 2003, 2008 Free Software Foundation, Inc.
4 # This file is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
8 # Originally written by Andreas Gruenbacher.
9 # http://www.suse.de/~agruen/coreutils/5.91/coreutils-xattr.diff
11 AC_DEFUN([gl_FUNC_XATTR],
13   AC_ARG_ENABLE([xattr],
14         AC_HELP_STRING([--disable-xattr],
15                        [do not support extended attributes]),
16         [use_xattr=$enableval], [use_xattr=yes])
18   if test "$use_xattr" = "yes"; then
19     AC_CHECK_HEADERS([attr/error_context.h attr/libattr.h])
20     if test $ac_cv_header_attr_libattr_h = yes \
21        && test $ac_cv_header_attr_error_context_h = yes; then
22       use_xattr=1
23     else
24       use_xattr=0
25     fi
26     AC_DEFINE_UNQUOTED([USE_XATTR], [$use_xattr],
27                        [Define if you want extended attribute support.])
28     xattr_saved_LIBS=$LIBS
29     AC_SEARCH_LIBS([attr_copy_file], [attr],
30                    [test "$ac_cv_search_attr_copy_file" = "none required" ||
31                       LIB_XATTR=$ac_cv_search_attr_copy_file])
32     AC_CHECK_FUNCS([attr_copy_file])
33     LIBS=$xattr_saved_LIBS
34     AC_SUBST([LIB_XATTR])
35   fi