configure.ac 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. # Configure template for GNU tar.
  2. # Copyright (C) 1991, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
  3. # Process this file with autoconf to produce a configure script.
  4. AC_INIT(src/tar.c)
  5. AM_CONFIG_HEADER(config.h)
  6. AC_PREREQ(2.12)
  7. AM_INIT_AUTOMAKE(tar, 1.12)
  8. AC_DEFINE(_GNU_SOURCE)
  9. ALL_LINGUAS="de fr it ko nl no pl pt sl sv"
  10. fp_PROG_ECHO
  11. test $fp_cv_prog_echo_nonl = no \
  12. && echo 2>&1 "WARNING: \`echo' not powerful enough for \`make check'"
  13. AC_PROG_CC
  14. AC_PROG_GCC_TRADITIONAL
  15. AC_AIX
  16. AC_MINIX
  17. AC_PROG_RANLIB
  18. AC_PROG_YACC
  19. AC_ISC_POSIX
  20. AM_C_PROTOTYPES
  21. AC_C_CONST
  22. AC_C_INLINE
  23. AC_CHECK_SIZEOF(unsigned long, 4)
  24. AC_CHECK_SIZEOF(long long, 0)
  25. AC_CHECK_HEADERS(fcntl.h limits.h linux/fd.h memory.h net/errno.h poll.h \
  26. sgtty.h string.h stropts.h \
  27. sys/buf.h sys/device.h sys/gentape.h sys/inet.h sys/io/trioctl.h sys/ioccom.h \
  28. sys/mtio.h sys/param.h sys/tprintf.h sys/tape.h sys/time.h sys/timeb.h \
  29. sys/wait.h unistd.h)
  30. # It seems that that many machines where <utime.h> seems to be
  31. # broken just require something like -D_XXX_SOURCE, where XXX might
  32. # be POSIX, POSIX_C, ALL, HPUX or whatever, depending on the machine.
  33. AC_CACHE_CHECK(for utime.h, tar_cv_header_utime_h,
  34. [AC_TRY_COMPILE([
  35. #include <sys/types.h>
  36. #include <utime.h>], [struct utimbuf foo],
  37. tar_cv_header_utime_h=yes, tar_cv_header_utime_h=no)])
  38. test $tar_cv_header_utime_h = yes && AC_DEFINE(HAVE_UTIME_H)
  39. if test $ac_cv_header_sys_mtio_h = yes; then
  40. AC_CACHE_CHECK(for remote tape header files, tar_cv_header_rmt,
  41. [AC_TRY_CPP([
  42. #if HAVE_SGTTY_H
  43. # include <sgtty.h>
  44. #endif
  45. #include <sys/socket.h>],
  46. tar_cv_header_rmt=yes, tar_cv_header_rmt=no)])
  47. test $tar_cv_header_rmt = yes && RMT=rmt
  48. AC_SUBST(RMT)
  49. fi
  50. AC_CACHE_CHECK(for getgrgid declaration, tar_cv_header_getgrgid,
  51. [AC_EGREP_HEADER(getgrgid, grp.h,
  52. tar_cv_header_getgrgid=yes, tar_cv_header_getgrgid=no)])
  53. test $tar_cv_header_getgrgid = yes && AC_DEFINE(HAVE_GETGRGID)
  54. AC_CACHE_CHECK(for getpwuid declaration, tar_cv_header_getpwuid,
  55. [AC_EGREP_HEADER(getpwuid, pwd.h,
  56. tar_cv_header_getpwuid=yes, tar_cv_header_getpwuid=no)])
  57. test $tar_cv_header_getpwuid = yes && AC_DEFINE(HAVE_GETPWUID)
  58. AC_CACHE_CHECK(which ioctl field to test for reversed bytes,
  59. tar_cv_header_mtio_check_field,
  60. [AC_EGREP_HEADER(mt_model, sys/mtio.h,
  61. tar_cv_header_mtio_check_field=mt_model,
  62. tar_cv_header_mtio_check_field=mt_type)])
  63. AC_DEFINE_UNQUOTED(MTIO_CHECK_FIELD, $tar_cv_header_mtio_check_field)
  64. AC_HEADER_DIRENT
  65. AC_HEADER_MAJOR
  66. AC_HEADER_STAT
  67. AC_HEADER_STDC
  68. AC_HEADER_TIME
  69. AC_STRUCT_ST_BLKSIZE
  70. AC_STRUCT_ST_BLOCKS
  71. AC_TYPE_SIGNAL
  72. AC_TYPE_SIZE_T
  73. AC_TYPE_UID_T
  74. AC_CHECK_FUNCS(fsync ftime getcwd isascii lchown mkfifo nap napms poll \
  75. select strerror strstr usleep)
  76. AC_CACHE_CHECK(for mknod, tar_cv_func_mknod,
  77. [AC_TRY_LINK([
  78. #include <sys/types.h>
  79. #include <sys/stat.h>],
  80. [mknod (0, 0, 0)],
  81. tar_cv_func_mknod=yes, tar_cv_func_mknod=no)])
  82. test $tar_cv_func_mknod = yes && AC_DEFINE(HAVE_MKNOD)
  83. # Whenever both -lsocket and -lnsl are needed, it seems to be always the
  84. # case that gethostbyname requires -lnsl. So, check -lnsl first, for it
  85. # to be in LIBS before the setsockopt checks are performed. *However*,
  86. # on SINIX-N 5.43, this is false, and gethostent seems to be a better
  87. # candidate. So, let's use it below instead of gethostbyname, and see.
  88. AC_CHECK_FUNC(gethostent)
  89. if test $ac_cv_func_gethostent = no; then
  90. AC_CHECK_LIB(nsl, gethostent)
  91. fi
  92. AC_CHECK_FUNC(setsockopt)
  93. if test $ac_cv_func_setsockopt = no; then
  94. AC_CHECK_LIB(socket, setsockopt)
  95. fi
  96. AC_FUNC_ALLOCA
  97. AC_FUNC_FNMATCH
  98. test $ac_cv_func_fnmatch_works = yes || LIBOBJS="$LIBOBJS fnmatch.o"
  99. AC_FUNC_VPRINTF
  100. AC_REPLACE_FUNCS(basename dirname execlp ftruncate memset mkdir rename rmdir)
  101. test "$ac_cv_func_strstr" = yes || LIBOBJS="$LIBOBJS strstr.o"
  102. # The 3-argument open happens to go along with the O_* defines, which
  103. # are easier to check for.
  104. AC_CACHE_CHECK(for 3-argument open, tar_cv_func_open3,
  105. [AC_TRY_COMPILE([
  106. #if HAVE_FCNTL_H
  107. # include <fcntl.h>
  108. #else
  109. # include <sys/file.h>
  110. #endif],
  111. [int x = O_RDONLY],
  112. tar_cv_func_open3=yes, tar_cv_func_open3=no)])
  113. if test $tar_cv_func_open3 = no; then
  114. AC_DEFINE(EMUL_OPEN3)
  115. fi
  116. # `union wait' is preferrably avoided. We merely assume below
  117. # that if `int pid;' fails, `union wait pid;' would have worked.
  118. # Directly trying `union wait pid;' is seeking for trouble, as
  119. # some POSIX systems are offering compatibility hacks generating
  120. # ugly diagnostics. Also, on some systems, WEXITSTATUS exists,
  121. # but fails when called on `union wait' variables.
  122. AC_CACHE_CHECK(for union wait, tar_cv_header_union_wait,
  123. [AC_TRY_COMPILE([
  124. #include <sys/types.h>
  125. #if HAVE_SYS_WAIT_H
  126. # include <sys/wait.h>
  127. #endif],
  128. [int status; int pid; pid = wait (&status);],
  129. tar_cv_header_union_wait=no, tar_cv_header_union_wait=yes)])
  130. test $tar_cv_header_union_wait = yes && AC_DEFINE(HAVE_UNION_WAIT)
  131. AC_CACHE_CHECK(for remote shell, tar_cv_path_RSH,
  132. [if test -n "$RSH"; then
  133. tar_cv_path_RSH=$RSH
  134. else
  135. tar_cv_path_RSH=no
  136. for ac_file in /usr/ucb/rsh /usr/bin/remsh /usr/bin/rsh /usr/bsd/rsh \
  137. /usr/bin/nsh /usr/bin/rcmd
  138. do
  139. if test -f $ac_file; then
  140. tar_cv_path_RSH=$ac_file
  141. break
  142. fi
  143. done
  144. fi])
  145. if test $tar_cv_path_RSH = no; then
  146. AC_CHECK_HEADERS(netdb.h)
  147. else
  148. AC_DEFINE_UNQUOTED(REMOTE_SHELL, "$tar_cv_path_RSH")
  149. fi
  150. AC_MSG_CHECKING(for default archive)
  151. if test -z "$DEFAULT_ARCHIVE"; then
  152. DEFAULT_ARCHIVE=-
  153. else
  154. if test -z "`ls $DEFAULT_ARCHIVE 2>/dev/null`"; then
  155. AC_MSG_WARN(DEFAULT_ARCHIVE \`$DEFAULT_ARCHIVE' not found on this system)
  156. fi
  157. # FIXME: Look for DEFTAPE in <sys/mtio.h>.
  158. # FIXME: Let DEVICE_PREFIX be configured from the environment.
  159. # FIXME: Rearrange, here.
  160. case $DEFAULT_ARCHIVE in
  161. changequote(, )dnl
  162. *[0-7][lmh])
  163. device_prefix=`echo $DEFAULT_ARCHIVE | sed 's/[0-7][lmh]$//'`
  164. changequote([, ])dnl
  165. AC_DEFINE_UNQUOTED(DEVICE_PREFIX, "$device_prefix")
  166. AC_DEFINE(DENSITY_LETTER)
  167. ;;
  168. changequote(, )dnl
  169. *[0-7])
  170. device_prefix=`echo $DEFAULT_ARCHIVE | sed 's/[0-7]$//'`
  171. changequote([, ])dnl
  172. AC_DEFINE_UNQUOTED(DEVICE_PREFIX, "$device_prefix")
  173. ;;
  174. esac
  175. fi
  176. AC_DEFINE_UNQUOTED(DEFAULT_ARCHIVE, "$DEFAULT_ARCHIVE")
  177. AC_MSG_RESULT($DEFAULT_ARCHIVE)
  178. AC_MSG_CHECKING(for default blocking)
  179. DEFAULT_BLOCKING=${DEFAULT_BLOCKING-20}
  180. AC_DEFINE_UNQUOTED(DEFAULT_BLOCKING, $DEFAULT_BLOCKING)
  181. AC_MSG_RESULT($DEFAULT_BLOCKING)
  182. fp_WITH_INCLUDED_MALLOC
  183. AM_WITH_DMALLOC
  184. AM_GNU_GETTEXT
  185. AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
  186. AC_OUTPUT([Makefile doc/Makefile intl/Makefile lib/Makefile po/Makefile.in \
  187. scripts/Makefile src/Makefile tests/Makefile tests/preset],
  188. [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])