configure.ac 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. # Configure template for GNU tar. -*- autoconf -*-
  2. # Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
  3. # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
  4. # Software Foundation, Inc.
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 3, or (at your option)
  8. # any later version.
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software
  15. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. # 02110-1301, USA.
  17. AC_INIT([GNU tar], [1.26.90], [[email protected]])
  18. AC_CONFIG_SRCDIR([src/tar.c])
  19. AC_CONFIG_AUX_DIR([build-aux])
  20. AC_CONFIG_HEADERS([config.h])
  21. AC_PREREQ([2.63])
  22. AM_INIT_AUTOMAKE([1.11 gnits tar-ustar dist-bzip2 dist-xz dist-shar std-options silent-rules])
  23. # Enable silent rules by default:
  24. AM_SILENT_RULES([yes])
  25. AC_PROG_CC
  26. AC_EXEEXT
  27. AC_PROG_RANLIB
  28. AC_PROG_YACC
  29. gl_EARLY
  30. AC_SYS_LARGEFILE
  31. AC_ISC_POSIX
  32. AC_C_INLINE
  33. AC_CHECK_HEADERS_ONCE(fcntl.h linux/fd.h memory.h net/errno.h \
  34. sgtty.h string.h \
  35. sys/param.h sys/device.h sys/gentape.h \
  36. sys/inet.h sys/io/trioctl.h \
  37. sys/mtio.h sys/time.h sys/tprintf.h sys/tape.h \
  38. unistd.h locale.h)
  39. AC_CHECK_HEADERS([sys/buf.h], [], [],
  40. [#if HAVE_SYS_PARAM_H
  41. #include <sys/param.h>
  42. #endif])
  43. AC_HEADER_SYS_WAIT
  44. AC_HEADER_DIRENT
  45. AC_HEADER_MAJOR
  46. AC_HEADER_STAT
  47. AC_HEADER_STDC
  48. AC_MSG_CHECKING([for st_fstype string in struct stat])
  49. AC_CACHE_VAL(diff_cv_st_fstype_string,
  50. [AC_TRY_COMPILE([#include <sys/types.h>
  51. #include <sys/stat.h>], [struct stat s; s.st_fstype[0] = 'x';],
  52. diff_cv_st_fstype_string=yes,
  53. diff_cv_st_fstype_string=no)])
  54. AC_MSG_RESULT($diff_cv_st_fstype_string)
  55. if test $diff_cv_st_fstype_string = yes; then
  56. AC_DEFINE(HAVE_ST_FSTYPE_STRING, 1,
  57. [Define if struct stat has a char st_fstype[] member.])
  58. fi
  59. AC_TYPE_SIGNAL
  60. AC_TYPE_MODE_T
  61. AC_TYPE_PID_T
  62. AC_TYPE_OFF_T
  63. AC_TYPE_SIZE_T
  64. AC_TYPE_UID_T
  65. AC_CHECK_TYPE(major_t, , AC_DEFINE(major_t, int,
  66. [Type of major device numbers.]))
  67. AC_CHECK_TYPE(minor_t, , AC_DEFINE(minor_t, int,
  68. [Type of minor device numbers.]))
  69. AC_CHECK_TYPE(dev_t, unsigned)
  70. AC_CHECK_TYPE(ino_t, unsigned)
  71. gt_TYPE_SSIZE_T
  72. # gnulib modules
  73. gl_INIT
  74. # paxutils modules
  75. tar_PAXUTILS
  76. TAR_HEADERS_ATTR_XATTR_H
  77. AC_CHECK_FUNCS_ONCE([fchmod fchown fsync lstat mkfifo readlink symlink])
  78. # we use gnulib's acl.h - because of very useful file_has_acl() function. M4
  79. # file from gnulib/acl does a quite good job of course. The problem is that
  80. # this function works on wide list of platforms and we need to restrict tar to
  81. # use POSIX.1e ACLs only.
  82. AC_ARG_WITH([posix-acls],
  83. AS_HELP_STRING([--without-posix-acls],
  84. [do not use POSIX.1e access control lists]),
  85. [with_posix_acls=no])
  86. AC_CHECK_HEADERS(sys/acl.h,, [with_posix_acl=no])
  87. AC_SEARCH_LIBS([acl_get_file], [acl pacl],, [with_posix_acl=no])
  88. AC_SEARCH_LIBS([acl_get_fd], [acl pacl],, [with_posix_acl=no])
  89. AC_SEARCH_LIBS([acl_set_file], [acl pacl],, [with_posix_acl=no])
  90. AC_SEARCH_LIBS([acl_set_fd], [acl pacl],, [with_posix_acl=no])
  91. AC_SEARCH_LIBS([acl_to_text], [acl pacl],, [with_posix_acl=no])
  92. AC_SEARCH_LIBS([acl_from_text], [acl pacl],, [with_posix_acl=no])
  93. if test "x$with_posix_acls" != xno; then
  94. AC_DEFINE(HAVE_POSIX_ACLS,,[Define when we have working POSIX acls])
  95. fi
  96. AC_CHECK_DECLS([getgrgid],,, [#include <grp.h>])
  97. AC_CHECK_DECLS([getpwuid],,, [#include <pwd.h>])
  98. AC_CHECK_DECLS([time],,, [#include <time.h>])
  99. AC_REPLACE_FUNCS(waitpid)
  100. AC_CACHE_CHECK(for remote shell, tar_cv_path_RSH,
  101. [if test -n "$RSH"; then
  102. tar_cv_path_RSH=$RSH
  103. else
  104. tar_cv_path_RSH=no
  105. for ac_file in /usr/ucb/rsh /usr/bin/remsh /usr/bin/rsh /usr/bsd/rsh \
  106. /usr/bin/nsh /usr/bin/rcmd
  107. do
  108. # Prefer a non-symlink rsh to a symlink one, so that binaries built
  109. # on AIX 4.1.4, where /usr/ucb/rsh is a symlink to /usr/bin/rsh
  110. # will run on AIX 4.3.0, which has only /usr/bin/rsh.
  111. if test -f $ac_file; then
  112. if (test -h $ac_file) 2>/dev/null; then
  113. test $tar_cv_path_RSH = no && tar_cv_path_RSH=$ac_file
  114. else
  115. tar_cv_path_RSH=$ac_file
  116. break
  117. fi
  118. fi
  119. done
  120. fi])
  121. if test $tar_cv_path_RSH = no; then
  122. AC_CHECK_HEADERS(netdb.h)
  123. else
  124. AC_DEFINE_UNQUOTED(REMOTE_SHELL, "$tar_cv_path_RSH",
  125. [Define to the full path of your rsh, if any.])
  126. fi
  127. TAR_COMPR_PROGRAM(compress)
  128. TAR_COMPR_PROGRAM(gzip)
  129. TAR_COMPR_PROGRAM(bzip2)
  130. TAR_COMPR_PROGRAM(lzip)
  131. TAR_COMPR_PROGRAM(lzma)
  132. TAR_COMPR_PROGRAM(lzop)
  133. TAR_COMPR_PROGRAM(xz)
  134. AC_MSG_CHECKING(for default archive format)
  135. AC_ARG_VAR([DEFAULT_ARCHIVE_FORMAT],
  136. [Set the default archive format. Allowed values are: V7, OLDGNU, USTAR, POSIX, GNU. Default is GNU])
  137. if test -z "$DEFAULT_ARCHIVE_FORMAT"; then
  138. DEFAULT_ARCHIVE_FORMAT="GNU"
  139. fi
  140. case $DEFAULT_ARCHIVE_FORMAT in
  141. V7|OLDGNU|USTAR|POSIX|GNU) ;;
  142. *) AC_MSG_ERROR(Invalid format name);;
  143. esac
  144. AC_DEFINE_UNQUOTED(DEFAULT_ARCHIVE_FORMAT, ${DEFAULT_ARCHIVE_FORMAT}_FORMAT,
  145. [By default produce archives of this format])
  146. AC_MSG_RESULT($DEFAULT_ARCHIVE_FORMAT)
  147. AC_MSG_CHECKING(for default archive)
  148. AC_ARG_VAR([DEFAULT_ARCHIVE],
  149. [Set the name of the default archive (default: -)])
  150. if test -z "$DEFAULT_ARCHIVE"; then
  151. DEFAULT_ARCHIVE=-
  152. else
  153. if test -z "`ls $DEFAULT_ARCHIVE 2>/dev/null`"; then
  154. AC_MSG_WARN(DEFAULT_ARCHIVE '$DEFAULT_ARCHIVE' not found on this system)
  155. fi
  156. # FIXME: Look for DEFTAPE in <sys/mtio.h>.
  157. # FIXME: Let DEVICE_PREFIX be configured from the environment.
  158. # FIXME: Rearrange, here.
  159. case $DEFAULT_ARCHIVE in
  160. *[[0-7][lmh]])
  161. AC_DEFINE(DENSITY_LETTER, 1,
  162. [Define to 1 if density may be indicated by [lmh] at end of device.])
  163. device_prefix=`echo $DEFAULT_ARCHIVE | sed 's/[0-7][lmh]$//'`
  164. ;;
  165. *[[0-7]])
  166. device_prefix=`echo $DEFAULT_ARCHIVE | sed 's/[0-7]$//'`
  167. ;;
  168. *)
  169. device_prefix=
  170. ;;
  171. esac
  172. case "$device_prefix" in
  173. ?*)
  174. AC_DEFINE_UNQUOTED(DEVICE_PREFIX, "$device_prefix",
  175. [Define to a string giving the prefix of the default device, without the part specifying the unit and density.])
  176. ;;
  177. esac
  178. fi
  179. AC_DEFINE_UNQUOTED(DEFAULT_ARCHIVE, "$DEFAULT_ARCHIVE",
  180. [Define to a string giving the full name of the default archive file.])
  181. AC_MSG_RESULT($DEFAULT_ARCHIVE)
  182. AC_ARG_VAR([DEFAULT_BLOCKING],
  183. [Define default blocking factor (default: 20)])
  184. AC_MSG_CHECKING(for default blocking)
  185. DEFAULT_BLOCKING=${DEFAULT_BLOCKING-20}
  186. AC_DEFINE_UNQUOTED(DEFAULT_BLOCKING, $DEFAULT_BLOCKING,
  187. [Define to a number giving the default blocking size for archives.])
  188. AC_MSG_RESULT($DEFAULT_BLOCKING)
  189. AC_MSG_CHECKING(for default quoting style)
  190. m4_define([QUOTING_STYLES],dnl
  191. [literal|shell|shell-always|c|escape|locale|clocale])
  192. DEFAULT_QUOTING_STYLE="escape"
  193. AC_ARG_VAR([DEFAULT_QUOTING_STYLE],
  194. [Set the default quoting style. Allowed values are: ] m4_bpatsubst(QUOTING_STYLES,[|], [[, ]]) [. Default is "escape".])
  195. case $DEFAULT_QUOTING_STYLE in
  196. QUOTING_STYLES) ;;
  197. *) AC_MSG_ERROR(Invalid quoting style);;
  198. esac
  199. AC_MSG_RESULT($DEFAULT_QUOTING_STYLE)
  200. DEFAULT_QUOTING_STYLE=`echo ${DEFAULT_QUOTING_STYLE}|sed 's/-/_/g'`_quoting_style
  201. AC_DEFINE_UNQUOTED(DEFAULT_QUOTING_STYLE, $DEFAULT_QUOTING_STYLE,
  202. [Define to a default quoting style (see lib/quoteargs.c for the list)])
  203. # Iconv
  204. AM_ICONV
  205. AC_CHECK_HEADERS(iconv.h)
  206. AC_CHECK_TYPE(iconv_t,:,
  207. AC_DEFINE(iconv_t, int,
  208. [Conversion descriptor type]),
  209. [
  210. #ifdef HAVE_ICONV_H
  211. # include <iconv.h>
  212. #endif
  213. ])
  214. # Gettext.
  215. AM_GNU_GETTEXT([external], [need-formatstring-macros])
  216. AM_GNU_GETTEXT_VERSION([0.16])
  217. # Initialize the test suite.
  218. AC_CONFIG_TESTDIR(tests)
  219. AC_CONFIG_FILES([tests/Makefile tests/atlocal]) # FIXME: tests/preset?
  220. AM_MISSING_PROG([AUTOM4TE], [autom4te])
  221. AC_SUBST(BACKUP_LIBEXEC_SCRIPTS)
  222. AC_SUBST(BACKUP_SBIN_SCRIPTS)
  223. AC_ARG_ENABLE(backup-scripts,
  224. AC_HELP_STRING([--enable-backup-scripts],
  225. [Create and install backup and restore scripts]),
  226. [case $enableval in
  227. yes) BACKUP_LIBEXEC_SCRIPTS='$(BACKUP_LIBEXEC_SCRIPTS_LIST)'
  228. BACKUP_SBIN_SCRIPTS='$(BACKUP_SBIN_SCRIPTS_LIST)'
  229. ;;
  230. esac])
  231. AC_SUBST(BACKUP_SED_COND)
  232. if date +%Y-%m-%d 2>/dev/null >&2; then
  233. BACKUP_SED_COND='/^\#ELSE_DATE_FORMAT_OK/,/^\#ENDIF_DATE_FORMAT_OK/d;/^\#IF_DATE_FORMAT_OK/d'
  234. else
  235. BACKUP_SED_COND='/^\#IF_DATE_FORMAT_OK/,/^\#ELSE_DATE_FORMAT_OK/d;/^\#ENDIF_DATE_FORMAT_OK/d'
  236. fi
  237. AC_OUTPUT([Makefile\
  238. doc/Makefile\
  239. gnu/Makefile\
  240. lib/Makefile\
  241. po/Makefile.in\
  242. scripts/Makefile\
  243. rmt/Makefile\
  244. src/Makefile])