Merge branch 'master' of git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev
[xfstests-dev.git] / m4 / package_attrdev.m4
1 AC_DEFUN([AC_PACKAGE_NEED_ATTR_XATTR_H],
2   [ AC_CHECK_HEADERS([attr/xattr.h])
3     if test "$ac_cv_header_attr_xattr_h" != "yes"; then
4         echo
5         echo 'FATAL ERROR: attr/xattr.h does not exist.'
6         echo 'Install the extended attributes (attr) development package.'
7         echo 'Alternatively, run "make install-dev" from the attr source.'
8         exit 1
9     fi
10   ])
11
12 AC_DEFUN([AC_PACKAGE_NEED_ATTR_ERROR_H],
13   [ AC_CHECK_HEADERS([attr/error_context.h])
14     if test "$ac_cv_header_attr_error_context_h" != "yes"; then
15         echo
16         echo 'FATAL ERROR: attr/error_context.h does not exist.'
17         echo 'Install the extended attributes (attr) development package.'
18         echo 'Alternatively, run "make install-dev" from the attr source.'
19         exit 1
20     fi
21   ])
22
23 AC_DEFUN([AC_PACKAGE_NEED_ATTRIBUTES_H],
24   [ have_attributes_h=false
25     AC_CHECK_HEADERS([attr/attributes.h sys/attributes.h], [have_attributes_h=true], )
26     if test "$have_attributes_h" = "false"; then
27         echo
28         echo 'FATAL ERROR: attributes.h does not exist.'
29         echo 'Install the extended attributes (attr) development package.'
30         echo 'Alternatively, run "make install-dev" from the attr source.'
31         exit 1
32     fi
33   ])
34
35 AC_DEFUN([AC_PACKAGE_WANT_ATTRLIST_LIBATTR],
36   [ AC_CHECK_LIB(attr, attr_list, [have_attr_list=true], [have_attr_list=false])
37     AC_SUBST(have_attr_list)
38   ])
39
40 AC_DEFUN([AC_PACKAGE_NEED_GETXATTR_LIBATTR],
41   [ AC_CHECK_LIB(attr, getxattr,, [
42         echo
43         echo 'FATAL ERROR: could not find a valid Extended Attributes library.'
44         echo 'Install the extended attributes (attr) development package.'
45         echo 'Alternatively, run "make install-lib" from the attr source.'
46         exit 1
47     ])
48     libattr="-lattr"
49     test -f ${libexecdir}${libdirsuffix}/libattr.la && \
50         libattr="${libexecdir}${libdirsuffix}/libattr.la"
51     AC_SUBST(libattr)
52   ])
53
54 AC_DEFUN([AC_PACKAGE_NEED_ATTRGET_LIBATTR],
55   [ AC_CHECK_LIB(attr, attr_get,, [
56         echo
57         echo 'FATAL ERROR: could not find a valid Extended Attributes library.'
58         echo 'Install the extended attributes (attr) development package.'
59         echo 'Alternatively, run "make install-lib" from the attr source.'
60         exit 1
61     ])
62     libattr="-lattr"
63     test -f ${libexecdir}${libdirsuffix}/libattr.la && \
64         libattr="${libexecdir}${libdirsuffix}/libattr.la"
65     AC_SUBST(libattr)
66   ])
67
68 AC_DEFUN([AC_PACKAGE_NEED_ATTRIBUTES_MACROS],
69   [ AC_MSG_CHECKING([macros in attr/attributes.h])
70     AC_TRY_LINK([
71 #include <sys/types.h>
72 #include <attr/attributes.h>],
73     [ int x = ATTR_SECURE; ], [ echo ok ], [
74         echo
75         echo 'FATAL ERROR: could not find a current attributes header.'
76         echo 'Upgrade the extended attributes (attr) development package.'
77         echo 'Alternatively, run "make install-dev" from the attr source.'
78         exit 1 ])
79   ])