configure.ac 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. # Configure template for GNU tar.
  2. # Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
  3. # 2002, 2003, 2004 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 2, 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., 59 Temple Place - Suite 330, Boston, MA
  15. # 02111-1307, USA.
  16. AC_INIT([GNU tar], [1.14.90], [[email protected]])
  17. AC_CONFIG_SRCDIR([src/tar.c])
  18. AC_CONFIG_AUX_DIR([config])
  19. AC_CONFIG_HEADERS([config.h:config.hin])
  20. AC_PREREQ([2.59])
  21. AM_INIT_AUTOMAKE([1.8 gnits dist-bzip2 dist-shar std-options])
  22. gl_USE_SYSTEM_EXTENSIONS
  23. AC_PROG_CC
  24. AC_EXEEXT
  25. AC_PROG_RANLIB
  26. AC_PROG_YACC
  27. AC_SYS_LARGEFILE
  28. AC_ISC_POSIX
  29. AC_C_INLINE
  30. AC_CHECK_HEADERS(fcntl.h linux/fd.h memory.h net/errno.h \
  31. sgtty.h string.h \
  32. sys/param.h sys/device.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)
  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. AM_STDBOOL_H
  42. enable_rmt() {
  43. if test $ac_cv_header_sys_mtio_h = yes; then
  44. AC_CACHE_CHECK(for remote tape header files, tar_cv_header_rmt,
  45. [AC_TRY_CPP([
  46. #if HAVE_SGTTY_H
  47. # include <sgtty.h>
  48. #endif
  49. #include <sys/socket.h>],
  50. tar_cv_header_rmt=yes, tar_cv_header_rmt=no)])
  51. test $tar_cv_header_rmt = yes && RMT='rmt'
  52. AC_SUBST(RMT)
  53. fi
  54. }
  55. AC_CACHE_CHECK(which ioctl field to test for reversed bytes,
  56. tar_cv_header_mtio_check_field,
  57. [AC_EGREP_HEADER(mt_model, sys/mtio.h,
  58. tar_cv_header_mtio_check_field=mt_model,
  59. tar_cv_header_mtio_check_field=mt_type)])
  60. AC_DEFINE_UNQUOTED(MTIO_CHECK_FIELD, $tar_cv_header_mtio_check_field,
  61. [Define to mt_model (v.g., for DG/UX), else to mt_type.])
  62. AC_HEADER_DIRENT
  63. AC_HEADER_MAJOR
  64. AC_HEADER_STAT
  65. AC_HEADER_STDC
  66. AC_STRUCT_ST_BLKSIZE
  67. AC_STRUCT_ST_BLOCKS
  68. AC_MSG_CHECKING([for st_fstype string in struct stat])
  69. AC_CACHE_VAL(diff_cv_st_fstype_string,
  70. [AC_TRY_COMPILE([#include <sys/types.h>
  71. #include <sys/stat.h>], [struct stat s; s.st_fstype[0] = 'x';],
  72. diff_cv_st_fstype_string=yes,
  73. diff_cv_st_fstype_string=no)])
  74. AC_MSG_RESULT($diff_cv_st_fstype_string)
  75. if test $diff_cv_st_fstype_string = yes; then
  76. AC_DEFINE(HAVE_ST_FSTYPE_STRING, 1,
  77. [Define if struct stat has a char st_fstype[] member.])
  78. fi
  79. AC_TYPE_SIGNAL
  80. AC_TYPE_MODE_T
  81. AC_TYPE_PID_T
  82. AC_TYPE_OFF_T
  83. AC_TYPE_SIZE_T
  84. AC_TYPE_UID_T
  85. AC_CHECK_TYPE(major_t, , AC_DEFINE(major_t, int,
  86. [Type of major device numbers.]))
  87. AC_CHECK_TYPE(minor_t, , AC_DEFINE(minor_t, int,
  88. [Type of minor device numbers.]))
  89. AC_CHECK_TYPE(dev_t, unsigned)
  90. AC_CHECK_TYPE(ino_t, unsigned)
  91. gt_TYPE_SSIZE_T
  92. gl_AC_TYPE_INTMAX_T
  93. jm_AC_TYPE_UINTMAX_T
  94. # gnulib modules
  95. tar_GNULIB
  96. AC_CHECK_MEMBERS([struct stat.st_spare1, struct stat.st_atim.tv_nsec, struct stat.st_atimespec.tv_nsec, struct stat.st_atimensec], , ,
  97. [
  98. #include <sys/types.h>
  99. #include <sys/stat.h>])
  100. # Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all*
  101. # programs in the package would end up linked with that potentially-shared
  102. # library, inducing unnecessary run-time overhead.
  103. # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
  104. # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
  105. tar_save_LIBS=$LIBS
  106. LIB_CLOCK_GETTIME=
  107. AC_SEARCH_LIBS(clock_gettime, [rt posix4])
  108. case "$ac_cv_search_clock_gettime" in
  109. -l*) LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime;;
  110. esac
  111. AC_SUBST(LIB_CLOCK_GETTIME)
  112. AC_CHECK_FUNCS(clock_gettime)
  113. LIBS=$tar_save_LIBS
  114. AC_CHECK_FUNCS(fsync lstat mkfifo readlink strerror symlink setlocale utimes)
  115. AC_CHECK_DECLS([getgrgid],,, [#include <grp.h>])
  116. AC_CHECK_DECLS([getpwuid],,, [#include <pwd.h>])
  117. AC_CHECK_DECLS([time],,, [#include <time.h>])
  118. # Set LIB_SETSOCKOPT to -lnsl -lsocket if necessary.
  119. tar_save_LIBS=$LIBS
  120. LIB_SETSOCKOPT=
  121. AC_SEARCH_LIBS(setsockopt, [socket], ,
  122. [AC_SEARCH_LIBS(setsockopt, [socket], , , [-lnsl])])
  123. AC_SEARCH_LIBS(setsockopt, [nsl])
  124. case "$ac_cv_search_setsockopt" in
  125. -l*) LIB_SETSOCKOPT=$ac_cv_search_setsockopt
  126. esac
  127. AC_SUBST(LIB_SETSOCKOPT)
  128. LIBS=$tar_save_LIBS
  129. AC_REPLACE_FUNCS(waitpid)
  130. AC_CACHE_CHECK(for remote shell, tar_cv_path_RSH,
  131. [if test -n "$RSH"; then
  132. tar_cv_path_RSH=$RSH
  133. else
  134. tar_cv_path_RSH=no
  135. for ac_file in /usr/ucb/rsh /usr/bin/remsh /usr/bin/rsh /usr/bsd/rsh \
  136. /usr/bin/nsh /usr/bin/rcmd
  137. do
  138. # Prefer a non-symlink rsh to a symlink one, so that binaries built
  139. # on AIX 4.1.4, where /usr/ucb/rsh is a symlink to /usr/bin/rsh
  140. # will run on AIX 4.3.0, which has only /usr/bin/rsh.
  141. if test -f $ac_file; then
  142. if (test -h $ac_file) 2>/dev/null; then
  143. test $tar_cv_path_RSH = no && tar_cv_path_RSH=$ac_file
  144. else
  145. tar_cv_path_RSH=$ac_file
  146. break
  147. fi
  148. fi
  149. done
  150. fi])
  151. if test $tar_cv_path_RSH = no; then
  152. AC_CHECK_HEADERS(netdb.h)
  153. else
  154. AC_DEFINE_UNQUOTED(REMOTE_SHELL, "$tar_cv_path_RSH",
  155. [Define to the full path of your rsh, if any.])
  156. fi
  157. AC_MSG_CHECKING(for default archive format)
  158. AC_ARG_VAR([DEFAULT_ARCHIVE_FORMAT],
  159. [Set the default archive format. Allowed values are: V7, OLDGNU, USTAR, POSIX, GNU. Default is GNU])
  160. if test -z "$DEFAULT_ARCHIVE_FORMAT"; then
  161. DEFAULT_ARCHIVE_FORMAT="GNU"
  162. fi
  163. case $DEFAULT_ARCHIVE_FORMAT in
  164. V7|OLDGNU|USTAR|POSIX|GNU) ;;
  165. *) AC_MSG_ERROR(Invalid format name);;
  166. esac
  167. AC_DEFINE_UNQUOTED(DEFAULT_ARCHIVE_FORMAT, ${DEFAULT_ARCHIVE_FORMAT}_FORMAT,
  168. [By default produce archives of this format])
  169. AC_MSG_RESULT($DEFAULT_ARCHIVE_FORMAT)
  170. AC_MSG_CHECKING(for default archive)
  171. AC_ARG_VAR([DEFAULT_ARCHIVE],
  172. [Set the name of the default archive (default: -)])
  173. if test -z "$DEFAULT_ARCHIVE"; then
  174. DEFAULT_ARCHIVE=-
  175. else
  176. if test -z "`ls $DEFAULT_ARCHIVE 2>/dev/null`"; then
  177. AC_MSG_WARN(DEFAULT_ARCHIVE \`$DEFAULT_ARCHIVE' not found on this system)
  178. fi
  179. # FIXME: Look for DEFTAPE in <sys/mtio.h>.
  180. # FIXME: Let DEVICE_PREFIX be configured from the environment.
  181. # FIXME: Rearrange, here.
  182. case $DEFAULT_ARCHIVE in
  183. *[[0-7][lmh]])
  184. AC_DEFINE(DENSITY_LETTER, 1,
  185. [[Define to 1 if density may be indicated by [lmh] at end of device.]])
  186. device_prefix=`echo $DEFAULT_ARCHIVE | sed 's/[0-7][lmh]$//'`
  187. ;;
  188. *[[0-7]])
  189. device_prefix=`echo $DEFAULT_ARCHIVE | sed 's/[0-7]$//'`
  190. ;;
  191. *)
  192. device_prefix=
  193. ;;
  194. esac
  195. case "$device_prefix" in
  196. ?*)
  197. AC_DEFINE_UNQUOTED(DEVICE_PREFIX, "$device_prefix",
  198. [Define to a string giving the prefix of the default device, without the part specifying the unit and density.])
  199. ;;
  200. esac
  201. fi
  202. AC_DEFINE_UNQUOTED(DEFAULT_ARCHIVE, "$DEFAULT_ARCHIVE",
  203. [Define to a string giving the full name of the default archive file.])
  204. AC_MSG_RESULT($DEFAULT_ARCHIVE)
  205. AC_ARG_VAR([DEFAULT_BLOCKING],
  206. [Define default blocking factor (default: 20)])
  207. AC_MSG_CHECKING(for default blocking)
  208. DEFAULT_BLOCKING=${DEFAULT_BLOCKING-20}
  209. AC_DEFINE_UNQUOTED(DEFAULT_BLOCKING, $DEFAULT_BLOCKING,
  210. [Define to a number giving the default blocking size for archives.])
  211. AC_MSG_RESULT($DEFAULT_BLOCKING)
  212. AC_ARG_VAR([DEFAULT_RMT_DIR],
  213. [Define full file name of the directory where to install `rmt'. (default: $(libexecdir))])
  214. if test "x$DEFAULT_RMT_DIR" != x; then
  215. DEFAULT_RMT_COMMAND=$DEFAULT_RMT_DIR/rmt
  216. else
  217. DEFAULT_RMT_DIR='$(libexecdir)'
  218. fi
  219. AC_MSG_CHECKING([whether to build rmt])
  220. AC_ARG_WITH([rmt],
  221. AC_HELP_STRING([--with-rmt=FILE],
  222. [Use FILE as the default `rmt' program. Do not build included copy of `rmt'.]),
  223. [case $withval in
  224. yes|no) AC_MSG_ERROR([Invalid argument to --with-rmt]);;
  225. /*) DEFAULT_RMT_COMMAND=$withval
  226. AC_MSG_RESULT([no, use $withval instead]);;
  227. *) AC_MSG_ERROR([Argument to --with-rmt must be an absolute file name]);;
  228. esac],
  229. [AC_MSG_RESULT([yes])
  230. enable_rmt
  231. if test "$RMT" = ""; then
  232. AC_MSG_WARN([not building rmt, required header files are missing])
  233. fi])
  234. AC_SUBST(DEFAULT_RMT_COMMAND)
  235. if test "x$DEFAULT_RMT_COMMAND" != x; then
  236. AC_DEFINE_UNQUOTED(DEFAULT_RMT_COMMAND, "$DEFAULT_RMT_COMMAND",
  237. [Define full file name of rmt program.])
  238. fi
  239. # Gettext.
  240. AM_GNU_GETTEXT([external], [need-ngettext])
  241. AM_GNU_GETTEXT_VERSION(0.12.1)
  242. # Iconv
  243. AM_ICONV
  244. AC_CHECK_HEADERS(iconv.h)
  245. AC_CHECK_TYPE(iconv_t,:,
  246. AC_DEFINE(iconv_t, int,
  247. [Conversion descriptor type]),
  248. [
  249. #ifdef HAVE_ICONV_H
  250. # include <iconv.h>
  251. #endif
  252. ])
  253. AC_SUBST(BACKUP_LIBEXEC_SCRIPTS)
  254. AC_SUBST(BACKUP_SBIN_SCRIPTS)
  255. AC_ARG_ENABLE(backup-scripts,
  256. AC_HELP_STRING([--enable-backup-scripts],
  257. [Create and install backup and restore scripts]),
  258. [case $enableval in
  259. yes) BACKUP_LIBEXEC_SCRIPTS='$(BACKUP_LIBEXEC_SCRIPTS_LIST)'
  260. BACKUP_SBIN_SCRIPTS='$(BACKUP_SBIN_SCRIPTS_LIST)'
  261. ;;
  262. esac])
  263. AC_SUBST(BACKUP_SED_COND)
  264. if date +%Y-%m-%d 2>/dev/null >&2; then
  265. BACKUP_SED_COND='/^\#ELSE_DATE_FORMAT_OK/,/^\#ENDIF_DATE_FORMAT_OK/d;/^\#IF_DATE_FORMAT_OK/d'
  266. else
  267. BACKUP_SED_COND='/^\#IF_DATE_FORMAT_OK/,/^\#ELSE_DATE_FORMAT_OK/d;/^\#ENDIF_DATE_FORMAT_OK/d'
  268. fi
  269. AC_OUTPUT([Makefile\
  270. doc/Makefile\
  271. lib/Makefile\
  272. po/Makefile.in\
  273. scripts/Makefile\
  274. src/Makefile\
  275. tests/Makefile\
  276. tests/preset])