configure.ac 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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], [bug-tar@gnu.org])
  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. # even if we use gnulib's acl.h with integrated m4 file later on (used because
  60. # of very useful file_has_acl() function) we need following checks that restrict
  61. # tar to use POSIX.1e ACLs only.
  62. AC_ARG_WITH([posix-acls],
  63. AS_HELP_STRING([--without-posix-acls],
  64. [do not use POSIX.1e access control lists]),
  65. [with_posix_acls=no])
  66. if test "x$with_posix_acls" != "xno"; then
  67. AC_CHECK_HEADERS(sys/acl.h,, [with_posix_acls=no])
  68. for tar_acl_func in acl_get_file acl_get_fd acl_set_file acl_set_fd \
  69. acl_to_text acl_from_text; do \
  70. test "x$with_posix_acls" = xno && break
  71. AC_SEARCH_LIBS([$tar_acl_func], [acl pacl], [], [with_posix_acls=no])
  72. done
  73. if test "x$with_posix_acls" != xno; then
  74. AC_DEFINE(HAVE_POSIX_ACLS,,[Define when we have working POSIX acls])
  75. fi
  76. else
  77. # disable acls in gnulib's checks
  78. export enable_acl=no
  79. fi
  80. AC_TYPE_SIGNAL
  81. AC_TYPE_MODE_T
  82. AC_TYPE_PID_T
  83. AC_TYPE_OFF_T
  84. AC_TYPE_SIZE_T
  85. AC_TYPE_UID_T
  86. AC_CHECK_TYPE(major_t, , AC_DEFINE(major_t, int,
  87. [Type of major device numbers.]))
  88. AC_CHECK_TYPE(minor_t, , AC_DEFINE(minor_t, int,
  89. [Type of minor device numbers.]))
  90. AC_CHECK_TYPE(dev_t, unsigned)
  91. AC_CHECK_TYPE(ino_t, unsigned)
  92. gt_TYPE_SSIZE_T
  93. # gnulib modules
  94. gl_INIT
  95. # paxutils modules
  96. tar_PAXUTILS
  97. # gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
  98. # ------------------------------------------------
  99. # If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
  100. # Otherwise, run RUN-IF-NOT-FOUND.
  101. AC_DEFUN([gl_GCC_VERSION_IFELSE],
  102. [AC_PREPROC_IFELSE(
  103. [AC_LANG_PROGRAM(
  104. [[
  105. #if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__)
  106. /* ok */
  107. #else
  108. # error "your version of gcc is older than $1.$2"
  109. #endif
  110. ]]),
  111. ], [$3], [$4])
  112. ]
  113. )
  114. AC_ARG_ENABLE([gcc-warnings],
  115. [AS_HELP_STRING([--enable-gcc-warnings],
  116. [turn on many GCC warnings (for developers; best with GNU make)])],
  117. [case $enableval in
  118. yes|no) ;;
  119. *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
  120. esac
  121. gl_gcc_warnings=$enableval],
  122. [gl_gcc_warnings=no
  123. if test -d "$srcdir"/.git; then
  124. gl_GCC_VERSION_IFELSE([4], [6], [gl_gcc_warnings=yes])
  125. fi]
  126. )
  127. if test "$gl_gcc_warnings" = yes; then
  128. gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
  129. AC_SUBST([WERROR_CFLAGS])
  130. nw=
  131. # This, $nw, is the list of warnings we disable.
  132. nw="$nw -Wformat-nonliteral" # warnings in Fedora 17 stdio.h
  133. nw="$nw -Wvla" # warnings in gettext.h
  134. nw="$nw -Wswitch-default" # Too many warnings for now
  135. nw="$nw -Wunsafe-loop-optimizations" # It's OK to omit unsafe optimizations.
  136. nw="$nw -Winline" # It's OK to not inline.
  137. nw="$nw -Wstrict-overflow" # It's OK to optimize strictly.
  138. nw="$nw -Wsuggest-attribute=pure" # Too many warnings for now.
  139. gl_MANYWARN_ALL_GCC([ws])
  140. gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
  141. for w in $ws; do
  142. gl_WARN_ADD([$w])
  143. done
  144. gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
  145. gl_WARN_ADD([-Wno-type-limits]) # It's OK to optimize based on types.
  146. gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
  147. gl_WARN_ADD([-Wno-format-nonliteral])
  148. gl_WARN_ADD([-fdiagnostics-show-option])
  149. gl_WARN_ADD([-funit-at-a-time])
  150. AC_SUBST([WARN_CFLAGS])
  151. AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
  152. AH_VERBATIM([FORTIFY_SOURCE],
  153. [/* Enable compile-time and run-time bounds-checking, and some warnings,
  154. without upsetting glibc 2.15+. */
  155. #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
  156. # define _FORTIFY_SOURCE 2
  157. #endif
  158. ])
  159. AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
  160. # Use a slightly smaller set of warning options for lib/.
  161. # Remove the following and save the result in GNULIB_WARN_CFLAGS.
  162. nw=
  163. nw="$nw -Wmissing-prototypes"
  164. nw="$nw -Wunused-macros"
  165. #
  166. # These are for argp.
  167. nw="$nw -Wmissing-field-initializers"
  168. nw="$nw -Wshadow"
  169. #
  170. gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
  171. # This is also for argp.
  172. gl_WARN_ADD([-Wno-missing-field-initializers], [GNULIB_WARN_CFLAGS])
  173. AC_SUBST([GNULIB_WARN_CFLAGS])
  174. # For gnulib-tests, the set is slightly smaller still.
  175. nw=
  176. # It's not worth being this picky about test programs.
  177. nw="$nw -Wsuggest-attribute=const"
  178. gl_MANYWARN_COMPLEMENT([GNULIB_TEST_WARN_CFLAGS],
  179. [$GNULIB_WARN_CFLAGS], [$nw])
  180. AC_SUBST([GNULIB_TEST_WARN_CFLAGS])
  181. fi
  182. TAR_HEADERS_ATTR_XATTR_H
  183. AC_CHECK_FUNCS_ONCE([fchmod fchown fsync lstat mkfifo readlink symlink])
  184. AC_CHECK_DECLS([getgrgid],,, [#include <grp.h>])
  185. AC_CHECK_DECLS([getpwuid],,, [#include <pwd.h>])
  186. AC_CHECK_DECLS([time],,, [#include <time.h>])
  187. AC_REPLACE_FUNCS(waitpid)
  188. AC_CACHE_CHECK(for remote shell, tar_cv_path_RSH,
  189. [if test -n "$RSH"; then
  190. tar_cv_path_RSH=$RSH
  191. else
  192. tar_cv_path_RSH=no
  193. for ac_file in /usr/ucb/rsh /usr/bin/remsh /usr/bin/rsh /usr/bsd/rsh \
  194. /usr/bin/nsh /usr/bin/rcmd
  195. do
  196. # Prefer a non-symlink rsh to a symlink one, so that binaries built
  197. # on AIX 4.1.4, where /usr/ucb/rsh is a symlink to /usr/bin/rsh
  198. # will run on AIX 4.3.0, which has only /usr/bin/rsh.
  199. if test -f $ac_file; then
  200. if (test -h $ac_file) 2>/dev/null; then
  201. test $tar_cv_path_RSH = no && tar_cv_path_RSH=$ac_file
  202. else
  203. tar_cv_path_RSH=$ac_file
  204. break
  205. fi
  206. fi
  207. done
  208. fi])
  209. if test $tar_cv_path_RSH = no; then
  210. AC_CHECK_HEADERS(netdb.h)
  211. else
  212. AC_DEFINE_UNQUOTED(REMOTE_SHELL, "$tar_cv_path_RSH",
  213. [Define to the full path of your rsh, if any.])
  214. fi
  215. TAR_COMPR_PROGRAM(compress)
  216. TAR_COMPR_PROGRAM(gzip)
  217. TAR_COMPR_PROGRAM(bzip2)
  218. TAR_COMPR_PROGRAM(lzip)
  219. TAR_COMPR_PROGRAM(lzma)
  220. TAR_COMPR_PROGRAM(lzop)
  221. TAR_COMPR_PROGRAM(xz)
  222. AC_MSG_CHECKING(for default archive format)
  223. AC_ARG_VAR([DEFAULT_ARCHIVE_FORMAT],
  224. [Set the default archive format. Allowed values are: V7, OLDGNU, USTAR, POSIX, GNU. Default is GNU])
  225. if test -z "$DEFAULT_ARCHIVE_FORMAT"; then
  226. DEFAULT_ARCHIVE_FORMAT="GNU"
  227. fi
  228. case $DEFAULT_ARCHIVE_FORMAT in
  229. V7|OLDGNU|USTAR|POSIX|GNU) ;;
  230. *) AC_MSG_ERROR(Invalid format name);;
  231. esac
  232. AC_DEFINE_UNQUOTED(DEFAULT_ARCHIVE_FORMAT, ${DEFAULT_ARCHIVE_FORMAT}_FORMAT,
  233. [By default produce archives of this format])
  234. AC_MSG_RESULT($DEFAULT_ARCHIVE_FORMAT)
  235. AC_MSG_CHECKING(for default archive)
  236. AC_ARG_VAR([DEFAULT_ARCHIVE],
  237. [Set the name of the default archive (default: -)])
  238. if test -z "$DEFAULT_ARCHIVE"; then
  239. DEFAULT_ARCHIVE=-
  240. else
  241. if test -z "`ls $DEFAULT_ARCHIVE 2>/dev/null`"; then
  242. AC_MSG_WARN(DEFAULT_ARCHIVE '$DEFAULT_ARCHIVE' not found on this system)
  243. fi
  244. # FIXME: Look for DEFTAPE in <sys/mtio.h>.
  245. # FIXME: Let DEVICE_PREFIX be configured from the environment.
  246. # FIXME: Rearrange, here.
  247. case $DEFAULT_ARCHIVE in
  248. *[[0-7][lmh]])
  249. AC_DEFINE(DENSITY_LETTER, 1,
  250. [Define to 1 if density may be indicated by [lmh] at end of device.])
  251. device_prefix=`echo $DEFAULT_ARCHIVE | sed 's/[0-7][lmh]$//'`
  252. ;;
  253. *[[0-7]])
  254. device_prefix=`echo $DEFAULT_ARCHIVE | sed 's/[0-7]$//'`
  255. ;;
  256. *)
  257. device_prefix=
  258. ;;
  259. esac
  260. case "$device_prefix" in
  261. ?*)
  262. AC_DEFINE_UNQUOTED(DEVICE_PREFIX, "$device_prefix",
  263. [Define to a string giving the prefix of the default device, without the part specifying the unit and density.])
  264. ;;
  265. esac
  266. fi
  267. AC_DEFINE_UNQUOTED(DEFAULT_ARCHIVE, "$DEFAULT_ARCHIVE",
  268. [Define to a string giving the full name of the default archive file.])
  269. AC_MSG_RESULT($DEFAULT_ARCHIVE)
  270. AC_ARG_VAR([DEFAULT_BLOCKING],
  271. [Define default blocking factor (default: 20)])
  272. AC_MSG_CHECKING(for default blocking)
  273. DEFAULT_BLOCKING=${DEFAULT_BLOCKING-20}
  274. AC_DEFINE_UNQUOTED(DEFAULT_BLOCKING, $DEFAULT_BLOCKING,
  275. [Define to a number giving the default blocking size for archives.])
  276. AC_MSG_RESULT($DEFAULT_BLOCKING)
  277. AC_MSG_CHECKING(for default quoting style)
  278. m4_define([QUOTING_STYLES],dnl
  279. [literal|shell|shell-always|c|escape|locale|clocale])
  280. DEFAULT_QUOTING_STYLE="escape"
  281. AC_ARG_VAR([DEFAULT_QUOTING_STYLE],
  282. [Set the default quoting style. Allowed values are: ] m4_bpatsubst(QUOTING_STYLES,[|], [[, ]]) [. Default is "escape".])
  283. case $DEFAULT_QUOTING_STYLE in
  284. QUOTING_STYLES) ;;
  285. *) AC_MSG_ERROR(Invalid quoting style);;
  286. esac
  287. AC_MSG_RESULT($DEFAULT_QUOTING_STYLE)
  288. DEFAULT_QUOTING_STYLE=`echo ${DEFAULT_QUOTING_STYLE}|sed 's/-/_/g'`_quoting_style
  289. AC_DEFINE_UNQUOTED(DEFAULT_QUOTING_STYLE, $DEFAULT_QUOTING_STYLE,
  290. [Define to a default quoting style (see lib/quoteargs.c for the list)])
  291. # Iconv
  292. AM_ICONV
  293. AC_CHECK_HEADERS(iconv.h)
  294. AC_CHECK_TYPE(iconv_t,:,
  295. AC_DEFINE(iconv_t, int,
  296. [Conversion descriptor type]),
  297. [
  298. #ifdef HAVE_ICONV_H
  299. # include <iconv.h>
  300. #endif
  301. ])
  302. # Gettext.
  303. AM_GNU_GETTEXT([external], [need-formatstring-macros])
  304. AM_GNU_GETTEXT_VERSION([0.16])
  305. # Initialize the test suite.
  306. AC_CONFIG_TESTDIR(tests)
  307. AC_CONFIG_FILES([tests/Makefile tests/atlocal]) # FIXME: tests/preset?
  308. AM_MISSING_PROG([AUTOM4TE], [autom4te])
  309. AC_SUBST(BACKUP_LIBEXEC_SCRIPTS)
  310. AC_SUBST(BACKUP_SBIN_SCRIPTS)
  311. AC_ARG_ENABLE(backup-scripts,
  312. AC_HELP_STRING([--enable-backup-scripts],
  313. [Create and install backup and restore scripts]),
  314. [case $enableval in
  315. yes) BACKUP_LIBEXEC_SCRIPTS='$(BACKUP_LIBEXEC_SCRIPTS_LIST)'
  316. BACKUP_SBIN_SCRIPTS='$(BACKUP_SBIN_SCRIPTS_LIST)'
  317. ;;
  318. esac])
  319. AC_SUBST(BACKUP_SED_COND)
  320. if date +%Y-%m-%d 2>/dev/null >&2; then
  321. BACKUP_SED_COND='/^\#ELSE_DATE_FORMAT_OK/,/^\#ENDIF_DATE_FORMAT_OK/d;/^\#IF_DATE_FORMAT_OK/d'
  322. else
  323. BACKUP_SED_COND='/^\#IF_DATE_FORMAT_OK/,/^\#ELSE_DATE_FORMAT_OK/d;/^\#ENDIF_DATE_FORMAT_OK/d'
  324. fi
  325. AC_OUTPUT([Makefile\
  326. doc/Makefile\
  327. gnu/Makefile\
  328. lib/Makefile\
  329. po/Makefile.in\
  330. scripts/Makefile\
  331. rmt/Makefile\
  332. src/Makefile])