From: Pavel Raiskup Date: Tue, 5 Apr 2016 14:53:47 +0000 (+0300) Subject: xattrs: fix build on Darwin X-Git-Tag: release_1_29~4 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=733e2741b1b35915b7cddf4fa3b30425289e6e07;p=debian%2Ftar 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. --- 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 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 header]) - if test "$with_xattrs" != no; then - AC_DEFINE([HAVE_XATTRS],,[Define when we have working linux xattrs.]) - fi - ) - fi - - # If is not found, then check for 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 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