diff options
author | Pavel Raiskup <praiskup@redhat.com> | 2016-04-05 17:53:47 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-04-05 17:55:19 +0300 |
commit | 733e2741b1b35915b7cddf4fa3b30425289e6e07 (patch) | |
tree | 4ef4f209f1c72a340c4eea511810adb497c00741 | |
parent | 195a25316cccced5832a749eb5351a715ded4157 (diff) | |
download | tar-733e2741b1b35915b7cddf4fa3b30425289e6e07.tar.gz |
xattrs: fix build on Darwin
Be careful to define HAVE_XATTRS when not all needed xattr-related
functions are properly defined either in libc or libattr.
Reported independently by Denis Excoffier and Dominyk Tille.
* acinclude.m4 (TAR_HEADERS_ATTR_XATTR_H): Check for each xattr
function separately. Don't AC_CHECK_LIB (LIBS is filled by
AC_SEARCH_LIBS when necessary).
* src/Makefile.am: The LDADD -lattr was redundant.
-rw-r--r-- | acinclude.m4 | 42 | ||||
-rw-r--r-- | src/Makefile.am | 4 |
2 files changed, 14 insertions, 32 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 812340b3..ca902858 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -40,37 +40,23 @@ AC_DEFUN([TAR_HEADERS_ATTR_XATTR_H], # 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]) - AM_CONDITIONAL([TAR_LIB_ATTR],[false]) - if test "$ac_cv_header_sys_xattr_h" = yes; then - AC_CHECK_FUNCS(getxattr fgetxattr lgetxattr \ - setxattr fsetxattr lsetxattr \ - listxattr flistxattr llistxattr, - # only when functions are present - AC_DEFINE([HAVE_SYS_XATTR_H], [1], - [define to 1 if we have <sys/xattr.h> header]) - if test "$with_xattrs" != no; then - AC_DEFINE([HAVE_XATTRS],,[Define when we have working linux xattrs.]) - fi - ) - fi - - # If <sys/xattr.h> is not found, then check for <attr/xattr.h> 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]) - AC_CHECK_LIB([attr],[fgetxattr]) - AM_CONDITIONAL([TAR_LIB_ATTR],[test "$ac_cv_lib_attr_fgetxattr" = 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 - ) + 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 ]) diff --git a/src/Makefile.am b/src/Makefile.am index dc05d5c4..08fc24c7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -53,7 +53,3 @@ AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) LDADD = ../lib/libtar.a ../gnu/libgnu.a $(LIBINTL) $(LIBICONV) tar_LDADD = $(LIBS) $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS) $(LIB_SELINUX) - -if TAR_LIB_ATTR -tar_LDADD += -lattr -endif |