re-mark 1.29b-2 as not yet uploaded (merge madness!)
[debian/tar] / acinclude.m4
index d48c881dd1ae4d95c694e93617feabe8235571f1..ca902858004fe8c0659260ce9c6838e8ab37631f 100644 (file)
@@ -1,6 +1,6 @@
 dnl Special Autoconf macros for GNU tar         -*- autoconf -*-
 
-dnl Copyright 2009, 2013 Free Software Foundation, Inc.
+dnl Copyright 2009, 2013-2014, 2016 Free Software Foundation, Inc.
 dnl
 dnl This file is part of GNU tar.
 dnl
@@ -37,18 +37,26 @@ AC_DEFUN([TAR_HEADERS_ATTR_XATTR_H],
     [], [with_xattrs=maybe]
   )
 
-  AC_CHECK_HEADERS([attr/xattr.h])
-  AM_CONDITIONAL([TAR_COND_XATTR_H],[test "$ac_cv_header_attr_xattr_h" = yes])
-  if test "$ac_cv_header_attr_xattr_h" = yes; then
-    AC_CHECK_FUNCS(getxattr  fgetxattr  lgetxattr \
-                   setxattr  fsetxattr  lsetxattr \
-                   listxattr flistxattr llistxattr,
-        # only when functions are present
-        AC_DEFINE([HAVE_ATTR_XATTR_H], [1],
-                    [define to 1 if we have <attr/xattr.h> header])
-        if test "$with_xattrs" != no; then
-          AC_DEFINE([HAVE_XATTRS],,[Define when we have working linux xattrs.])
-        fi
-    )
+  # First check for <sys/xattr.h>
+  AC_CHECK_HEADERS([sys/xattr.h])
+  AM_CONDITIONAL([TAR_COND_XATTR_H],[test "$ac_cv_header_sys_xattr_h" = yes])
+  if test "$ac_cv_header_sys_xattr_h" != yes; then
+    AC_CHECK_HEADERS([attr/xattr.h])
+    AM_CONDITIONAL([TAR_COND_XATTR_H],[test "$ac_cv_header_attr_xattr_h" = yes])
+  fi
+
+  if test "$with_xattrs" != no; then
+    for i in getxattr  fgetxattr  lgetxattr \
+             setxattr  fsetxattr  lsetxattr \
+             listxattr flistxattr llistxattr
+    do
+      AC_SEARCH_LIBS($i, attr)
+      eval found=\$ac_cv_search_$i
+      test "$found" = "no" && break
+    done
+
+    if test "$found" != no; then
+      AC_DEFINE([HAVE_XATTRS],,[Define when we have working linux xattrs.])
+    fi
   fi
 ])