acinclude.m4 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. dnl Special Autoconf macros for GNU tar -*- autoconf -*-
  2. dnl Copyright 2009-2023 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. AS_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. if test "$ac_cv_header_sys_xattr_h" != yes; then
  39. AC_CHECK_HEADERS([attr/xattr.h])
  40. AM_CONDITIONAL([TAR_COND_XATTR_H],[test "$ac_cv_header_attr_xattr_h" = yes])
  41. fi
  42. if test "$with_xattrs" != no; then
  43. for i in getxattr fgetxattr lgetxattr \
  44. setxattr fsetxattr lsetxattr \
  45. listxattr flistxattr llistxattr
  46. do
  47. AC_SEARCH_LIBS($i, attr)
  48. eval found=\$ac_cv_search_$i
  49. test "$found" = "no" && break
  50. done
  51. if test "$found" != no; then
  52. AC_DEFINE([HAVE_XATTRS],,[Define when we have working linux xattrs.])
  53. fi
  54. fi
  55. ])