configure.ac 16 KB

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