acinclude.m4 3.1 KB

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