configure.ac 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. # Configure template for GNU tar.
  2. # Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
  3. # 2002, 2003 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.13.26], [bug-tar@gnu.org])
  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.57])
  21. AM_INIT_AUTOMAKE([1.7.5 gnits dist-bzip2 dist-shar])
  22. gl_USE_SYSTEM_EXTENSIONS
  23. AC_PROG_CC
  24. AC_EXEEXT
  25. AC_PROG_RANLIB
  26. AC_SYS_LARGEFILE
  27. AC_ISC_POSIX
  28. AC_C_INLINE
  29. AC_CHECK_HEADERS(fcntl.h linux/fd.h memory.h net/errno.h \
  30. sgtty.h string.h \
  31. sys/buf.h sys/device.h sys/gentape.h \
  32. sys/inet.h sys/io/trioctl.h \
  33. sys/mtio.h sys/tprintf.h sys/tape.h \
  34. unistd.h)
  35. AC_HEADER_SYS_WAIT
  36. AM_STDBOOL_H
  37. if test $ac_cv_header_sys_mtio_h = yes; then
  38. AC_CACHE_CHECK(for remote tape header files, tar_cv_header_rmt,
  39. [AC_TRY_CPP([
  40. #if HAVE_SGTTY_H
  41. # include <sgtty.h>
  42. #endif
  43. #include <sys/socket.h>],
  44. tar_cv_header_rmt=yes, tar_cv_header_rmt=no)])
  45. test $tar_cv_header_rmt = yes && RMT='rmt$(EXEEXT)'
  46. AC_SUBST(RMT)
  47. fi
  48. AC_CACHE_CHECK(which ioctl field to test for reversed bytes,
  49. tar_cv_header_mtio_check_field,
  50. [AC_EGREP_HEADER(mt_model, sys/mtio.h,
  51. tar_cv_header_mtio_check_field=mt_model,
  52. tar_cv_header_mtio_check_field=mt_type)])
  53. AC_DEFINE_UNQUOTED(MTIO_CHECK_FIELD, $tar_cv_header_mtio_check_field,
  54. [Define to mt_model (v.g., for DG/UX), else to mt_type.])
  55. AC_HEADER_DIRENT
  56. AC_HEADER_MAJOR
  57. AC_HEADER_STAT
  58. AC_HEADER_STDC
  59. AC_STRUCT_ST_BLKSIZE
  60. AC_STRUCT_ST_BLOCKS
  61. AC_MSG_CHECKING([for st_fstype string in struct stat])
  62. AC_CACHE_VAL(diff_cv_st_fstype_string,
  63. [AC_TRY_COMPILE([#include <sys/types.h>
  64. #include <sys/stat.h>], [struct stat s; s.st_fstype[0] = 'x';],
  65. diff_cv_st_fstype_string=yes,
  66. diff_cv_st_fstype_string=no)])
  67. AC_MSG_RESULT($diff_cv_st_fstype_string)
  68. if test $diff_cv_st_fstype_string = yes; then
  69. AC_DEFINE(HAVE_ST_FSTYPE_STRING, 1,
  70. [Define if struct stat has a char st_fstype[] member.])
  71. fi
  72. AC_TYPE_SIGNAL
  73. AC_TYPE_MODE_T
  74. AC_TYPE_PID_T
  75. AC_TYPE_OFF_T
  76. AC_TYPE_SIZE_T
  77. AC_TYPE_UID_T
  78. AC_CHECK_TYPE(major_t, , AC_DEFINE(major_t, int,
  79. [Type of major device numbers.]))
  80. AC_CHECK_TYPE(minor_t, , AC_DEFINE(minor_t, int,
  81. [Type of minor device numbers.]))
  82. gt_TYPE_SSIZE_T
  83. jm_AC_TYPE_UINTMAX_T
  84. # gnulib modules
  85. AM_FUNC_GETLINE
  86. gl_BACKUPFILE
  87. gl_DIRNAME
  88. gl_ERROR
  89. gl_EXCLUDE
  90. gl_FILEBLOCKS
  91. gl_FUNC_ALLOCA
  92. gl_FUNC_FNMATCH_GNU
  93. gl_FUNC_MEMSET
  94. gl_FUNC_MKTIME
  95. gl_FUNC_RMDIR
  96. gl_FUNC_STRTOL
  97. gl_FUNC_STRTOUL
  98. gl_GETDATE
  99. gl_GETOPT
  100. gl_HASH
  101. gl_HUMAN
  102. gl_MODECHANGE
  103. gl_OBSTACK
  104. gl_PATHMAX
  105. gl_QUOTE
  106. gl_QUOTEARG
  107. gl_SAFE_READ
  108. gl_SAFE_WRITE
  109. gl_SAVE_CWD
  110. gl_SAVEDIR
  111. gl_STRCASE
  112. gl_XALLOC
  113. gl_XGETCWD
  114. gl_XSTRTOL
  115. jm_FUNC_FTRUNCATE
  116. jm_FUNC_GLIBC_UNLOCKED_IO
  117. jm_FUNC_LCHOWN
  118. jm_FUNC_MALLOC
  119. jm_FUNC_REALLOC
  120. jm_FUNC_UTIME
  121. jm_XSTRTOUMAX
  122. # Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all*
  123. # programs in the package would end up linked with that potentially-shared
  124. # library, inducing unnecessary run-time overhead.
  125. # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
  126. # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
  127. tar_save_LIBS=$LIBS
  128. LIB_CLOCK_GETTIME=
  129. AC_SEARCH_LIBS(clock_gettime, [rt posix4],
  130. [LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
  131. AC_SUBST(LIB_CLOCK_GETTIME)
  132. AC_CHECK_FUNCS(clock_gettime)
  133. LIBS=$tar_save_LIBS
  134. AC_CHECK_FUNCS(fsync lstat mkfifo readlink strerror symlink)
  135. AC_CHECK_DECLS([getgrgid],,, [#include <grp.h>])
  136. AC_CHECK_DECLS([getpwuid],,, [#include <pwd.h>])
  137. AC_CHECK_DECLS([valloc])
  138. # Set LIB_SETSOCKOPT to -lnsl -lsocket if necessary.
  139. tar_save_LIBS=$LIBS
  140. LIB_SETSOCKOPT=
  141. AC_SEARCH_LIBS(setsockopt, [socket], ,
  142. [AC_SEARCH_LIBS(setsockopt, [socket], , , [-lnsl])])
  143. AC_SEARCH_LIBS(setsockopt, [nsl])
  144. if test " $LIBS" != " $tar_save_LIBS"; then
  145. LIB_SETSOCKOPT=$ac_cv_search_setsockopt
  146. fi
  147. AC_SUBST(LIB_SETSOCKOPT)
  148. LIBS=$tar_save_LIBS
  149. AC_REPLACE_FUNCS(waitpid)
  150. AC_CACHE_CHECK(for remote shell, tar_cv_path_RSH,
  151. [if test -n "$RSH"; then
  152. tar_cv_path_RSH=$RSH
  153. else
  154. tar_cv_path_RSH=no
  155. for ac_file in /usr/ucb/rsh /usr/bin/remsh /usr/bin/rsh /usr/bsd/rsh \
  156. /usr/bin/nsh /usr/bin/rcmd
  157. do
  158. # Prefer a non-symlink rsh to a symlink one, so that binaries built
  159. # on AIX 4.1.4, where /usr/ucb/rsh is a symlink to /usr/bin/rsh
  160. # will run on AIX 4.3.0, which has only /usr/bin/rsh.
  161. if test -f $ac_file; then
  162. if (test -h $ac_file) 2>/dev/null; then
  163. test $tar_cv_path_RSH = no && tar_cv_path_RSH=$ac_file
  164. else
  165. tar_cv_path_RSH=$ac_file
  166. break
  167. fi
  168. fi
  169. done
  170. fi])
  171. if test $tar_cv_path_RSH = no; then
  172. AC_CHECK_HEADERS(netdb.h)
  173. else
  174. AC_DEFINE_UNQUOTED(REMOTE_SHELL, "$tar_cv_path_RSH",
  175. [Define to the full path of your rsh, if any.])
  176. fi
  177. AC_MSG_CHECKING(for default archive format)
  178. if test -z "$DEFAULT_ARCHIVE_FORMAT"; then
  179. DEFAULT_ARCHIVE_FORMAT="GNU"
  180. fi
  181. case $DEFAULT_ARCHIVE_FORMAT in
  182. V7|OLDGNU|POSIX|GNU) ;;
  183. *) AC_MSG_ERROR(Invalid format name);;
  184. esac
  185. AC_DEFINE_UNQUOTED(DEFAULT_ARCHIVE_FORMAT, ${DEFAULT_ARCHIVE_FORMAT}_FORMAT,
  186. [By default produce archives of this format])
  187. AC_MSG_RESULT($DEFAULT_ARCHIVE_FORMAT)
  188. AC_MSG_CHECKING(for default archive)
  189. if test -z "$DEFAULT_ARCHIVE"; then
  190. DEFAULT_ARCHIVE=-
  191. else
  192. if test -z "`ls $DEFAULT_ARCHIVE 2>/dev/null`"; then
  193. AC_MSG_WARN(DEFAULT_ARCHIVE \`$DEFAULT_ARCHIVE' not found on this system)
  194. fi
  195. # FIXME: Look for DEFTAPE in <sys/mtio.h>.
  196. # FIXME: Let DEVICE_PREFIX be configured from the environment.
  197. # FIXME: Rearrange, here.
  198. case $DEFAULT_ARCHIVE in
  199. *[[0-7][lmh]])
  200. AC_DEFINE(DENSITY_LETTER, 1,
  201. [[Define to 1 if density may be indicated by [lmh] at end of device.]])
  202. device_prefix=`echo $DEFAULT_ARCHIVE | sed 's/[0-7][lmh]$//'`
  203. ;;
  204. *[[0-7]])
  205. device_prefix=`echo $DEFAULT_ARCHIVE | sed 's/[0-7]$//'`
  206. ;;
  207. *)
  208. device_prefix=
  209. ;;
  210. esac
  211. case "$device_prefix" in
  212. ?*)
  213. AC_DEFINE_UNQUOTED(DEVICE_PREFIX, "$device_prefix",
  214. [Define to a string giving the prefix of the default device, without the part specifying the unit and density.])
  215. ;;
  216. esac
  217. fi
  218. AC_DEFINE_UNQUOTED(DEFAULT_ARCHIVE, "$DEFAULT_ARCHIVE",
  219. [Define to a string giving the full name of the default archive file.])
  220. AC_MSG_RESULT($DEFAULT_ARCHIVE)
  221. AC_MSG_CHECKING(for default blocking)
  222. DEFAULT_BLOCKING=${DEFAULT_BLOCKING-20}
  223. AC_DEFINE_UNQUOTED(DEFAULT_BLOCKING, $DEFAULT_BLOCKING,
  224. [Define to a number giving the default blocking size for archives.])
  225. AC_MSG_RESULT($DEFAULT_BLOCKING)
  226. # Gettext.
  227. AM_GNU_GETTEXT([external], [need-ngettext])
  228. AM_GNU_GETTEXT_VERSION(0.12.1)
  229. AC_OUTPUT([Makefile doc/Makefile lib/Makefile \
  230. m4/Makefile po/Makefile.in \
  231. scripts/Makefile src/Makefile tests/Makefile tests/preset])