mirror of
https://https.git.savannah.gnu.org/git/tar.git
synced 2026-01-26 16:09:29 +00:00
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.
This commit is contained in:
parent
195a25316c
commit
733e2741b1
42
acinclude.m4
42
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
|
||||
])
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user