configure.ac 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. dnl Process this file with autoconf to produce a configure script.
  2. dnl First, define all of the version numbers up front.
  3. dnl In particular, this allows the version macro to be used in AC_INIT
  4. # Pull in tarsnap version number and server name from files
  5. m4_define([TAR_VERS],m4_include([tar-version]))
  6. m4_define([TS_SERVER],m4_include([tsserver]))
  7. dnl These first two version numbers are updated automatically on each release.
  8. m4_define([LIBARCHIVE_VERSION_S],[2.7.0])
  9. m4_define([LIBARCHIVE_VERSION_N],[2007000])
  10. #
  11. # Now starts the "real" configure script.
  12. #
  13. AC_INIT([tarsnap],[TAR_VERS()],[cperciva@tarsnap.com])
  14. # Make sure the srcdir contains "libarchive" directory
  15. AC_CONFIG_SRCDIR([libarchive])
  16. # Use auxiliary subscripts from this subdirectory (cleans up root)
  17. AC_CONFIG_AUX_DIR([config.aux])
  18. AC_CONFIG_MACRO_DIR([m4])
  19. # Check for host and target type
  20. AC_CANONICAL_TARGET
  21. AC_CANONICAL_HOST
  22. # Must follow AC_CONFIG macros above...
  23. AM_INIT_AUTOMAKE()
  24. # Stick the version numbers into config.h
  25. AC_DEFINE([LIBARCHIVE_VERSION_STRING],"LIBARCHIVE_VERSION_S()",
  26. [Version number of libarchive])
  27. AC_DEFINE_UNQUOTED([LIBARCHIVE_VERSION_NUMBER],"LIBARCHIVE_VERSION_N()",
  28. [Version number of libarchive as a single integer])
  29. AC_SUBST([TSSERVER],"TS_SERVER()")
  30. # The shell variables here must be the same as the AC_SUBST() variables
  31. # below, but the shell variable names apparently cannot be the same as
  32. # the m4 macro names above. Why? Ask autoconf.
  33. LIBARCHIVE_VERSION_STRING=LIBARCHIVE_VERSION_S()
  34. LIBARCHIVE_VERSION_NUMBER=LIBARCHIVE_VERSION_N()
  35. # Substitute the above version numbers into the various files below.
  36. # Yes, I believe this is the fourth time we define what are essentially
  37. # the same symbols. Why? Ask autoconf.
  38. AC_SUBST(LIBARCHIVE_VERSION_STRING)
  39. AC_SUBST(LIBARCHIVE_VERSION_NUMBER)
  40. AC_CONFIG_HEADERS([config.h])
  41. AC_CONFIG_FILES([Makefile])
  42. dnl Compilation on mingw and Cygwin needs special Makefile rules
  43. inc_windows_files=no
  44. inc_cygwin_files=no
  45. case "$host_os" in
  46. *mingw* ) inc_windows_files=yes ;;
  47. *cygwin*) inc_cygwin_files=yes ;;
  48. esac
  49. AM_CONDITIONAL([INC_WINDOWS_FILES], [test $inc_windows_files = yes])
  50. AM_CONDITIONAL([INC_CYGWIN_FILES], [test $inc_cygwin_files = yes])
  51. # Checks for programs.
  52. m4_version_prereq([2.70], [AC_PROG_CC], [AC_PROG_CC_C99])
  53. AM_PROG_CC_C_O
  54. AC_PROG_RANLIB
  55. AC_CHECK_TOOL([STRIP],[strip])
  56. # We use some _GNU_SOURCE bits on Linux; this also enables other extensions.
  57. m4_version_prereq([2.70], [AC_USE_SYSTEM_EXTENSIONS], [AC_GNU_SOURCE])
  58. # Don't rebuild the configure script. I'm distributing a perfectly good one.
  59. AM_MAINTAINER_MODE
  60. # Get the POSIX sh early, in case the configure script causes
  61. # `command -p getconf` to fail in a broken environment.
  62. CHECK_POSIX_SH
  63. #
  64. # Locate some specific link objects for cygwin
  65. #
  66. prog_ldadd_extra=
  67. case "$host_os" in
  68. *cygwin*)
  69. binmode_path=`$CC -print-file-name=binmode.o`
  70. if test -n "$binmode_path" && test -f "$binmode_path" ; then
  71. prog_ldadd_extra="$binmode_path"
  72. fi
  73. ;;
  74. esac
  75. PROG_LDADD_EXTRA=$prog_ldadd_extra
  76. AC_SUBST(PROG_LDADD_EXTRA)
  77. # Checks for header files.
  78. m4_version_prereq([2.70], [], [AC_HEADER_STDC])
  79. AC_HEADER_DIRENT
  80. AC_HEADER_SYS_WAIT
  81. AC_CHECK_HEADERS_ONCE([acl/libacl.h attr/xattr.h ctype.h err.h errno.h])
  82. AC_CHECK_HEADERS_ONCE([fcntl.h grp.h])
  83. AC_CHECK_HEADERS_ONCE([inttypes.h langinfo.h limits.h linux/fs.h])
  84. AC_CHECK_HEADERS_ONCE([locale.h paths.h poll.h pwd.h regex.h signal.h stdarg.h])
  85. AC_CHECK_HEADERS_ONCE([stdint.h stdlib.h string.h])
  86. AC_CHECK_HEADERS_ONCE([sys/acl.h sys/cdefs.h sys/extattr.h sys/ioctl.h sys/mkdev.h])
  87. AC_CHECK_HEADERS_ONCE([sys/param.h sys/poll.h sys/select.h sys/time.h sys/utime.h])
  88. AC_CHECK_HEADERS_ONCE([time.h unistd.h utime.h wchar.h wctype.h windows.h])
  89. # Check for clock_gettime. On some systems, this is provided via librt.
  90. AC_CHECK_LIB(rt, clock_gettime)
  91. AC_CHECK_FUNCS_ONCE([clock_gettime])
  92. # Check for <sys/mount.h>, <sys/statvfs.h>, <sys/vfs.h>, and <sys/statfs.h>,
  93. # which are used on various OSes to provide statfs(2) and statvfs(2).
  94. AC_CHECK_HEADERS([sys/mount.h sys/statfs.h sys/statvfs.h sys/vfs.h], [], [],
  95. [#ifdef HAVE_SYS_PARAM_H
  96. #include <sys/param.h>
  97. #endif])
  98. # Check how we can find out the available memory.
  99. CHECK_MEMLIMIT_SUPPORT
  100. # Check for members of struct statfs and struct statvfs.
  101. AC_CHECK_MEMBERS([struct statfs.f_fstypename, struct statfs.f_type,
  102. struct statvfs.f_fstypename, struct statvfs.f_basetype], [], [],
  103. [#ifdef HAVE_SYS_PARAM_H
  104. #include <sys/param.h>
  105. #endif
  106. #ifdef HAVE_SYS_MOUNT_H
  107. #include <sys/mount.h>
  108. #endif
  109. #ifdef HAVE_SYS_STATFS_H
  110. #include <sys/statfs.h>
  111. #endif
  112. #ifdef HAVE_SYS_STATVFS_H
  113. #include <sys/statvfs.h>
  114. #endif
  115. #ifdef HAVE_SYS_VFS_H
  116. #include <sys/vfs.h>
  117. #endif])
  118. # Check for <linux/magic.h>, which contains magic numbers for statfs on
  119. # Linux 2.6. (We hard-code values for Linux 2.4.)
  120. AC_CHECK_HEADERS_ONCE([linux/magic.h])
  121. # If we're on Solaris, we need to add some extra paths to the Makefile.
  122. # This needs to be done *before* we look for OpenSSL; otherwise we won't
  123. # be able to find it...
  124. CHECK_SOLARIS_PATHS
  125. # Ditto for Darwin.
  126. CHECK_DARWIN_PATHS
  127. # Check if we need -std=c99 in LDFLAGS (for gcc on Solaris).
  128. CHECK_SOLARIS_C99
  129. # Check if we should use mdoc versions of the man pages or versions which
  130. # are uglier but more portable.
  131. CHECK_MDOC_OR_MAN
  132. # On Linux, we need ext2fs/ext2_fs.h
  133. CHECK_LINUX_EXT2FS
  134. # Check if we're on an operating system with a broken TCP_NOPUSH
  135. CHECK_BROKEN_TCP_NOPUSH
  136. # Check if we have FreeBSD's randomized TCP source port bug
  137. CHECK_FREEBSD_PORTRANGE_BUG
  138. # Checks for required libraries.
  139. AC_CHECK_HEADER(zlib.h,
  140. AC_CHECK_LIB(z,inflate, ,
  141. AC_MSG_ERROR([*** zlib missing ***])),
  142. AC_MSG_ERROR([*** zlib header file missing ***]))
  143. AC_CHECK_HEADER(openssl/rsa.h,
  144. AC_CHECK_LIB(crypto,RSA_private_encrypt, ,
  145. AC_MSG_ERROR([*** OpenSSL missing ***])),
  146. AC_MSG_ERROR([*** OpenSSL header files missing ***]))
  147. # Checks for optional libraries.
  148. AC_ARG_WITH([bz2lib],
  149. AS_HELP_STRING([--without-bz2lib], [Don't build support for bzip2 through bz2lib]))
  150. if test "x$with_bz2lib" != "xno"; then
  151. AC_CHECK_HEADERS_ONCE([bzlib.h])
  152. AC_CHECK_LIB(bz2,BZ2_bzDecompressInit)
  153. fi
  154. AC_ARG_WITH([lzmadec],
  155. AS_HELP_STRING([--without-lzmadec], [Don't build support for lzma through lzmadec]))
  156. if test "x$with_lzmadec" != "xno"; then
  157. AC_CHECK_HEADERS_ONCE([lzmadec.h])
  158. AC_CHECK_LIB(lzmadec,lzmadec_decode)
  159. fi
  160. AC_ARG_WITH([lzma],
  161. AS_HELP_STRING([--without-lzma], [Don't build support for xz through lzma]))
  162. if test "x$with_lzma" != "xno"; then
  163. AC_CHECK_HEADERS_ONCE([lzma.h])
  164. AC_CHECK_LIB(lzma,lzma_stream_decoder)
  165. fi
  166. AC_CHECK_HEADERS_ONCE([openssl/md5.h openssl/ripemd.h openssl/sha.h])
  167. AC_CHECK_HEADERS_ONCE([md5.h])
  168. AC_CHECK_HEADERS_ONCE([ripemd.h rmd160.h])
  169. AC_CHECK_HEADERS_ONCE([sha.h sha1.h sha2.h sha256.h])
  170. AC_SEARCH_LIBS(SHA1_Init, crypto ssl md)
  171. AC_CHECK_FUNC(MD5_Init)
  172. if test "x$ac_cv_func_MD5_Init" != "xyes"; then
  173. AC_CHECK_FUNC(MD5Init,
  174. [AC_DEFINE(MD5_Init, MD5Init,
  175. [Define to the initializes MD5 context function.])
  176. AC_DEFINE(MD5_Update, MD5Update,
  177. [Define to the updates MD5 context function.])
  178. AC_DEFINE(MD5_Final, MD5Final,
  179. [Define to the generates final MD5 hash function.])
  180. ])
  181. fi
  182. if test "x$ac_cv_func_MD5_Init" = "xyes" -o "x$ac_cv_func_MD5Init" = "xyes" ; then
  183. AC_DEFINE(HAVE_MD5, 1, [Define to 1 if you have the `MD5' functions.])
  184. fi
  185. AC_CHECK_FUNC(RIPEMD160_Init)
  186. if test "x$ac_cv_func_RIPEMD160_Init" != "xyes"; then
  187. AC_CHECK_FUNC(RMD160Init,
  188. [AC_DEFINE(RIPEMD160_Init, RMD160Init,
  189. [Define to the initializes RIPEMD160 context function.])
  190. AC_DEFINE(RIPEMD160_Update, RMD160Update,
  191. [Define to the updates RIPEMD160 context function.])
  192. AC_DEFINE(RIPEMD160_Final, RMD160Final,
  193. [Define to the generates final RIPEMD160 hash function.])
  194. ])
  195. fi
  196. if test "x$ac_cv_func_RIPEMD160_Init" = "xyes" -o "x$ac_cv_func_RMD160Init" = "xyes" ; then
  197. AC_DEFINE(HAVE_RMD160, 1, [Define to 1 if you have the `RIPEMD160' functions.])
  198. fi
  199. AC_CHECK_FUNC(SHA1_Init)
  200. if test "x$ac_cv_func_SHA1_Init" != "xyes"; then
  201. AC_CHECK_FUNC(SHA1Init,
  202. [AC_DEFINE(SHA1_Init, SHA1Init,
  203. [Define to the initializes SHA1 context function.])
  204. AC_DEFINE(SHA1_Update, SHA1Update,
  205. [Define to the updates SHA1 context function.])
  206. AC_DEFINE(SHA1_Final, SHA1Final,
  207. [Define to the generates final SHA1 hash function.])
  208. ])
  209. fi
  210. if test "x$ac_cv_func_SHA1_Init" = "xyes" -o "x$ac_cv_func_SHA1Init" = "xyes" ; then
  211. AC_DEFINE(HAVE_SHA1, 1, [Define to 1 if you have the `SHA1' functions.])
  212. fi
  213. AC_CHECK_FUNC(SHA256_Init)
  214. if test "x$ac_cv_func_SHA256_Init" = "xyes" ; then
  215. AC_DEFINE(HAVE_SHA256, 1, [Define to 1 if you have the `SHA256' functions.])
  216. fi
  217. AC_CHECK_FUNC(SHA384_Init)
  218. if test "x$ac_cv_func_SHA384_Init" = "xyes" ; then
  219. AC_DEFINE(HAVE_SHA384, 1, [Define to 1 if you have the `SHA384' functions.])
  220. fi
  221. AC_CHECK_FUNC(SHA512_Init)
  222. if test "x$ac_cv_func_SHA512_Init" = "xyes" ; then
  223. AC_DEFINE(HAVE_SHA512, 1, [Define to 1 if you have the `SHA512' functions.])
  224. fi
  225. # Checks for typedefs, structures, and compiler characteristics.
  226. AC_C_CONST
  227. AC_C_INLINE
  228. AC_TYPE_UID_T
  229. AC_TYPE_MODE_T
  230. # AC_TYPE_OFF_T defaults to "long", which limits us to 4GB files on
  231. # most systems... default to "long long" instead.
  232. AC_CHECK_TYPE(off_t, [long long])
  233. AC_TYPE_SIZE_T
  234. AC_CHECK_TYPE(id_t, [unsigned long])
  235. AC_CHECK_TYPE(uintptr_t, [unsigned int])
  236. # Check for birthtime in struct stat
  237. AC_CHECK_MEMBERS([struct stat.st_birthtime])
  238. # Check for high-resolution timestamps in struct stat
  239. AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec])
  240. AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec])
  241. AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec])
  242. AC_CHECK_MEMBERS([struct stat.st_mtime_n]) # AIX
  243. AC_CHECK_MEMBERS([struct stat.st_umtime]) # Tru64
  244. AC_CHECK_MEMBERS([struct stat.st_mtime_usec]) # Hurd
  245. # Check for block size support in struct stat
  246. AC_CHECK_MEMBERS([struct stat.st_blksize])
  247. # Check for st_flags in struct stat (BSD fflags)
  248. AC_CHECK_MEMBERS([struct stat.st_flags])
  249. # If you have uintmax_t, we assume printf supports %ju
  250. # If you have unsigned long long, we assume printf supports %llu
  251. # TODO: Check for %ju and %llu support directly.
  252. AC_CHECK_TYPES([uintmax_t, unsigned long long])
  253. # We need int64_t, uint64_t, intmax_t, and uintmax_t
  254. AC_TYPE_INTMAX_T
  255. AC_TYPE_INT64_T
  256. AC_TYPE_UINTMAX_T
  257. AC_TYPE_UINT64_T
  258. # TODO: If any of these are missing, define them right here.
  259. AC_CHECK_DECLS_ONCE([SIZE_MAX, SSIZE_MAX, INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX])
  260. AC_CHECK_DECL([EFTYPE],
  261. [AC_DEFINE(HAVE_EFTYPE, 1, [A possible errno value for invalid file format errors])],
  262. [],
  263. [#include <errno.h>])
  264. AC_CHECK_DECL([EILSEQ],
  265. [AC_DEFINE(HAVE_EILSEQ, 1, [A possible errno value for invalid file format errors])],
  266. [],
  267. [#include <errno.h>])
  268. AC_CHECK_TYPE([wchar_t],
  269. [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]wchar_t), 1, [Define to 1 if the system has the type `wchar_t'.])dnl
  270. AC_CHECK_SIZEOF([wchar_t])],
  271. [])
  272. m4_version_prereq([2.70], [], [AC_HEADER_TIME])
  273. # Checks for library functions.
  274. AC_PROG_GCC_TRADITIONAL
  275. AC_HEADER_MAJOR
  276. AC_FUNC_FSEEKO
  277. AC_FUNC_MEMCMP
  278. AC_FUNC_LSTAT
  279. AC_FUNC_STAT
  280. AC_FUNC_STRERROR_R
  281. AC_FUNC_STRFTIME
  282. AC_FUNC_VPRINTF
  283. AC_CHECK_FUNCS_ONCE([chflags chown chroot])
  284. AC_CHECK_FUNCS_ONCE([fchdir fchflags fchmod fchown fcntl fork])
  285. AC_CHECK_FUNCS_ONCE([fstat ftruncate futimes geteuid getpid])
  286. AC_CHECK_FUNCS_ONCE([lchflags lchmod lchown])
  287. AC_CHECK_FUNCS_ONCE([lutimes memmove memset mkdir mkfifo mknod])
  288. AC_CHECK_FUNCS_ONCE([nl_langinfo pipe poll readlink select setenv setlocale])
  289. AC_CHECK_FUNCS_ONCE([strchr strdup strerror strrchr timegm])
  290. AC_CHECK_FUNCS_ONCE([tzset unsetenv utime utimes vfork])
  291. AC_CHECK_FUNCS_ONCE([wcrtomb wcscpy wcslen wctomb wmemcmp wmemcpy])
  292. AC_CHECK_FUNCS_ONCE([lockf posix_memalign qsort_r])
  293. # Check for mmap so we can work around its absence on Minix
  294. AC_CHECK_FUNCS_ONCE([mmap])
  295. # FreeBSD's nl_langinfo supports an option to specify whether the
  296. # current locale uses month/day or day/month ordering. It makes the
  297. # output a little prettier...
  298. AC_CHECK_DECL([D_MD_ORDER],
  299. [AC_DEFINE(HAVE_D_MD_ORDER, 1, [Define to 1 if nl_langinfo supports D_MD_ORDER])],
  300. [],
  301. [#if HAVE_LANGINFO_H
  302. #include <langinfo.h>
  303. #endif
  304. ])
  305. # If fnmatch() exists and supports FNM_LEADING_DIR, then bsdtar uses that,
  306. # otherwise it uses some usable (but less featureful) built-in code for
  307. # filename pattern matching.
  308. AC_FUNC_FNMATCH
  309. AC_CHECK_DECL([FNM_LEADING_DIR],
  310. [AC_DEFINE(HAVE_FNM_LEADING_DIR, 1, [Define to 1 if fnmatch(3) supports the FNM_LEADING_DIR flag])],
  311. [],
  312. [#if HAVE_FNMATCH
  313. #define _GNU_SOURCE /* Required on Linux to get GNU extensions */
  314. #include <fnmatch.h>
  315. #endif
  316. ])
  317. # Check for dirent.d_namlen field explicitly
  318. # (This is a bit more straightforward than, if not quite as portable as,
  319. # the recipe given by the autoconf maintainers.)
  320. AC_CHECK_MEMBER(struct dirent.d_namlen,,,
  321. [#if HAVE_DIRENT_H
  322. #include <dirent.h>
  323. #endif
  324. ])
  325. # Check for Extended Attributes support
  326. AC_ARG_ENABLE([xattr],
  327. AS_HELP_STRING([--disable-xattr],
  328. [Disable Extended Attributes support (default: check)]))
  329. if test "x$enable_xattr" != "xno"; then
  330. AC_CHECK_HEADERS_ONCE([attr/xattr.h])
  331. AC_CHECK_HEADERS_ONCE([sys/xattr.h])
  332. AC_CHECK_LIB(attr,setxattr)
  333. AC_CHECK_FUNCS_ONCE([extattr_get_file extattr_list_file])
  334. AC_CHECK_FUNCS_ONCE([extattr_set_fd extattr_set_file])
  335. AC_CHECK_FUNCS_ONCE([fsetxattr getxattr])
  336. AC_CHECK_FUNCS_ONCE([lgetxattr listxattr llistxattr lsetxattr])
  337. fi
  338. # Check for ACL support
  339. #
  340. # The ACL support in libarchive is written against the POSIX1e draft,
  341. # which was never officially approved and varies quite a bit across
  342. # platforms. Worse, some systems have completely non-POSIX acl functions,
  343. # which makes the following checks rather more complex than I would like.
  344. #
  345. AC_ARG_ENABLE([acl],
  346. AS_HELP_STRING([--disable-acl],
  347. [Disable ACL support (default: check)]))
  348. if test "x$enable_acl" != "xno"; then
  349. AC_CHECK_HEADERS_ONCE([sys/acl.h])
  350. AC_CHECK_LIB([acl],[acl_get_file])
  351. AC_CHECK_FUNCS_ONCE([acl_create_entry acl_init acl_set_fd acl_set_fd_np acl_set_file])
  352. AC_CHECK_TYPES(acl_permset_t,,,
  353. [#if HAVE_SYS_TYPES_H
  354. #include <sys/types.h>
  355. #endif
  356. #if HAVE_SYS_ACL_H
  357. #include <sys/acl.h>
  358. #endif
  359. ])
  360. # The "acl_get_perm()" function was omitted from the POSIX draft.
  361. # (It's a pretty obvious oversight; otherwise, there's no way to
  362. # test for specific permissions in a permset.) Linux uses the obvious
  363. # name, FreeBSD adds _np to mark it as "non-Posix extension."
  364. # Test for both as a double-check that we really have POSIX-style ACL support.
  365. AC_CHECK_FUNCS(acl_get_perm_np acl_get_perm,,,
  366. [#if HAVE_SYS_TYPES_H
  367. #include <sys/types.h>
  368. #endif
  369. #if HAVE_SYS_ACL_H
  370. #include <sys/acl.h>
  371. #endif
  372. ])
  373. # MacOS has an acl.h that isn't POSIX. It can be detected by
  374. # checking for ACL_USER
  375. AC_CHECK_DECL([ACL_USER],
  376. [AC_DEFINE(HAVE_ACL_USER, 1, [True for systems with POSIX ACL support])],
  377. [],
  378. [#include <sys/acl.h>])
  379. fi
  380. # Additional requirements
  381. AC_SYS_LARGEFILE
  382. # Interix doesn't provide optarg and optind
  383. AC_CHECK_DECLS_ONCE([optarg])
  384. AC_CHECK_DECLS_ONCE([optind])
  385. # Strip the .sample from tarsnap.conf.sample (if requested by the user).
  386. AC_ARG_WITH([conf-no-sample],
  387. AS_HELP_STRING([--with-conf-no-sample],
  388. [Install tarsnap.conf without the .sample suffix.]),
  389. [], [with_conf_no_sample=no])
  390. AM_CONDITIONAL([INSTALL_CONF_NO_SAMPLE],
  391. [test "x$with_conf_no_sample" != "xno"])
  392. # install bash completion
  393. AC_ARG_WITH([bash-completion-dir],
  394. AS_HELP_STRING([--with-bash-completion-dir@<:@=DIRNAME@:>@],
  395. [Install bash completion script. @<:@default=no@:>@]),
  396. [], [with_bash_completion_dir=no])
  397. # by default, use what the user told us
  398. BASH_COMPLETION_DIR="$with_bash_completion_dir"
  399. # install zsh completion. Unlike --with-bash-completion-dir, DIRNAME is not
  400. # optional; this script has no mechanism for automatically determining the zsh
  401. # completion directory.
  402. AC_ARG_WITH([zsh-completion-dir],
  403. AS_HELP_STRING([--with-zsh-completion-dir=DIRNAME],
  404. [Install zsh completion script. @<:@default=no@:>@]),
  405. [], [with_zsh_completion_dir=no])
  406. # use what the user told us
  407. ZSH_COMPLETION_DIR="$with_zsh_completion_dir"
  408. # print results
  409. AC_MSG_CHECKING([whether to install bash completion])
  410. AS_IF([test "x$with_bash_completion_dir" != "xno"],
  411. [AC_MSG_RESULT([yes])],
  412. [AC_MSG_RESULT([no])])
  413. # Check whether the user has requested to disable compiler warnings
  414. CHECK_DISABLE_COMPILER_WARNINGS
  415. # should we set the value automatically?
  416. if test "x$with_bash_completion_dir" = "xyes"; then
  417. # try to use pkg-config
  418. AC_CHECK_PROG(HAS_PKG_CONFIG, pkg-config, yes)
  419. if test "x$HAS_PKG_CONFIG" != "xyes"; then
  420. AC_MSG_ERROR([Automatic detection of bash-completion directory requires pkg-config.])
  421. else
  422. # find the actual value from the system
  423. PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0],
  424. [BASH_COMPLETION_DIR="`pkg-config --variable=completionsdir bash-completion`"],
  425. [BASH_COMPLETION_DIR="/etc/bash_completion.d/";
  426. AC_MSG_WARN([Automatic detection of bash-completion directory requires bash-completion >= 2.0; guessing a directory.])])
  427. AC_MSG_CHECKING([bash completions directory])
  428. AC_MSG_RESULT([$BASH_COMPLETION_DIR])
  429. fi
  430. fi
  431. # pass values to Makefile.am
  432. AC_SUBST([BASH_COMPLETION_DIR])
  433. AM_CONDITIONAL([INSTALL_BASH_COMPLETION],[test "x$with_bash_completion_dir" != "xno"])
  434. AC_SUBST([ZSH_COMPLETION_DIR])
  435. AM_CONDITIONAL([INSTALL_ZSH_COMPLETION],[test "x$with_zsh_completion_dir" != "xno"])
  436. # Run the libcperciva POSIX compatibility tests and pass values to the Makefile.
  437. CHECK_LIBCPERCIVA_POSIX([${srcdir}/libcperciva])
  438. AC_OUTPUT