Import upstream version 1.27
[debian/tar] / acinclude.m4
1 dnl Special Autoconf macros for GNU tar         -*- autoconf -*-
2
3 dnl Copyright 2009, 2013 Free Software Foundation, Inc.
4 dnl
5 dnl This file is part of GNU tar.
6 dnl
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.
11 dnl
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.
16 dnl
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/>.
19
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_]))
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
33 AC_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   AC_CHECK_HEADERS([attr/xattr.h])
41   AM_CONDITIONAL([TAR_COND_XATTR_H],[test "$ac_cv_header_attr_xattr_h" = yes])
42   if test "$ac_cv_header_attr_xattr_h" = yes; then
43     AC_CHECK_FUNCS(getxattr  fgetxattr  lgetxattr \
44                    setxattr  fsetxattr  lsetxattr \
45                    listxattr flistxattr llistxattr,
46         # only when functions are present
47         AC_DEFINE([HAVE_ATTR_XATTR_H], [1],
48                     [define to 1 if we have <attr/xattr.h> header])
49         if test "$with_xattrs" != no; then
50           AC_DEFINE([HAVE_XATTRS],,[Define when we have working linux xattrs.])
51         fi
52     )
53   fi
54 ])