configure.ac 7.8 KB

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