1 dnl Special Autoconf macros for GNU tar -*- autoconf -*-
3 dnl Copyright 2009, 2013-2014, 2016-2017 Free Software Foundation, Inc.
5 dnl This file is part of GNU tar.
7 dnl GNU tar is free software; you can redistribute it and/or modify
8 dnl it under the terms of the GNU General Public License as published by
9 dnl the Free Software Foundation; either version 3 of the License, or
10 dnl (at your option) any later version.
12 dnl GNU tar is distributed in the hope that it will be useful,
13 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 dnl GNU General Public License for more details.
17 dnl You should have received a copy of the GNU General Public License
18 dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
20 AC_DEFUN([TAR_COMPR_PROGRAM],[
21 m4_pushdef([tar_compr_define],translit($1,[a-z+-],[A-ZX_])[_PROGRAM])
22 m4_pushdef([tar_compr_var],[tar_cv_compressor_]translit($1,[+-],[x_]))
24 AC_HELP_STRING([--with-]$1[=PROG],
25 [use PROG as ]$1[ compressor program]),
26 [tar_compr_var=${withval}],
27 [tar_compr_var=m4_if($2,,$1,$2)])
28 AC_DEFINE_UNQUOTED(tar_compr_define, "$tar_compr_var",
29 [Define to the program name of ]$1[ compressor program])])
31 # Provide <attr/xattr.h>, if necessary
33 AC_DEFUN([TAR_HEADERS_ATTR_XATTR_H],
36 AS_HELP_STRING([--without-xattrs], [don't use linux extended attributes]),
37 [], [with_xattrs=maybe]
40 # First check for <sys/xattr.h>
41 AC_CHECK_HEADERS([sys/xattr.h])
42 AM_CONDITIONAL([TAR_COND_XATTR_H],[test "$ac_cv_header_sys_xattr_h" = yes])
43 if test "$ac_cv_header_sys_xattr_h" != yes; then
44 AC_CHECK_HEADERS([attr/xattr.h])
45 AM_CONDITIONAL([TAR_COND_XATTR_H],[test "$ac_cv_header_attr_xattr_h" = yes])
48 if test "$with_xattrs" != no; then
49 for i in getxattr fgetxattr lgetxattr \
50 setxattr fsetxattr lsetxattr \
51 listxattr flistxattr llistxattr
53 AC_SEARCH_LIBS($i, attr)
54 eval found=\$ac_cv_search_$i
55 test "$found" = "no" && break
58 if test "$found" != no; then
59 AC_DEFINE([HAVE_XATTRS],,[Define when we have working linux xattrs.])