1dnl Special Autoconf macros for GNU tar         -*- autoconf -*-
2
3dnl Copyright 2009-2021 Free Software Foundation, Inc.
4dnl
5dnl This file is part of GNU tar.
6dnl
7dnl GNU tar is free software; you can redistribute it and/or modify
8dnl it under the terms of the GNU General Public License as published by
9dnl the Free Software Foundation; either version 3 of the License, or
10dnl (at your option) any later version.
11dnl
12dnl GNU tar is distributed in the hope that it will be useful,
13dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15dnl GNU General Public License for more details.
16dnl
17dnl You should have received a copy of the GNU General Public License
18dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20AC_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_]))
23 AC_ARG_WITH($1,
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])])
30
31# Provide <attr/xattr.h>, if necessary
32
33AC_DEFUN([TAR_HEADERS_ATTR_XATTR_H],
34[
35  AC_ARG_WITH([xattrs],
36    AS_HELP_STRING([--without-xattrs], [don't use linux extended attributes]),
37    [], [with_xattrs=maybe]
38  )
39
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])
46  fi
47
48  if test "$with_xattrs" != no; then
49    for i in getxattr  fgetxattr  lgetxattr \
50             setxattr  fsetxattr  lsetxattr \
51             listxattr flistxattr llistxattr
52    do
53      AC_SEARCH_LIBS($i, attr)
54      eval found=\$ac_cv_search_$i
55      test "$found" = "no" && break
56    done
57
58    if test "$found" != no; then
59      AC_DEFINE([HAVE_XATTRS],,[Define when we have working linux xattrs.])
60    fi
61  fi
62])
63