configure.ac 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. #
  4. AC_PREREQ([2.67])
  5. LT_PREREQ([2.2.6])
  6. AC_INIT([aria2],[1.15.1],[t-tujikawa@users.sourceforge.net],[aria2],[http://aria2.sourceforge.net/])
  7. AC_USE_SYSTEM_EXTENSIONS
  8. LT_INIT()
  9. AC_CONFIG_MACRO_DIR([m4])
  10. AC_CANONICAL_HOST
  11. AC_CANONICAL_TARGET
  12. AM_INIT_AUTOMAKE()
  13. AM_PATH_CPPUNIT(1.10.2)
  14. AC_CONFIG_SRCDIR([src/a2io.h])
  15. AC_CONFIG_HEADERS([config.h])
  16. case "$target" in
  17. *mingw*|*cygwin*)
  18. win_build=yes
  19. LIBS="-lws2_32 -lwsock32 -lgdi32 -lwinmm $LIBS"
  20. ;;
  21. esac
  22. AC_DEFINE_UNQUOTED([TARGET], ["$target"], [Define target-type])
  23. # Checks for arguments.
  24. ARIA2_ARG_WITH([gnutls])
  25. ARIA2_ARG_WITH([libnettle])
  26. ARIA2_ARG_WITH([libgmp])
  27. ARIA2_ARG_WITH([libgcrypt])
  28. ARIA2_ARG_WITH([openssl])
  29. ARIA2_ARG_WITH([sqlite3])
  30. ARIA2_ARG_WITH([libxml2])
  31. ARIA2_ARG_WITH([libexpat])
  32. ARIA2_ARG_WITH([libcares])
  33. ARIA2_ARG_WITH([libz])
  34. ARIA2_ARG_ENABLE([bittorrent])
  35. ARIA2_ARG_ENABLE([metalink])
  36. ARIA2_ARG_ENABLE([epoll])
  37. AC_ARG_WITH([ca-bundle],
  38. AS_HELP_STRING([--with-ca-bundle=FILE],[Use FILE as default CA bundle.]),
  39. [ca_bundle=$withval], [ca_bundle=""])
  40. AC_ARG_WITH([bashcompletiondir],
  41. AS_HELP_STRING([--with-bashcompletiondir=DIR],
  42. [Directory to install bash_completion file]),
  43. [bashcompletiondir=$withval], [bashcompletiondir=$docdir/bash_completion])
  44. # Checks for programs.
  45. AC_PROG_CXX
  46. AC_PROG_CC
  47. AC_PROG_INSTALL
  48. AC_PROG_MKDIR_P
  49. AC_PROG_YACC
  50. AC_CHECK_TOOL([AR], [ar], [:])
  51. if test "x$AR" = "x:"; then
  52. AC_MSG_FAILURE([ar is not found in the system.])
  53. fi
  54. AC_SUBST([AR])
  55. AC_PATH_PROG([A2X], [a2x])
  56. AC_SUBST([A2X])
  57. AM_CONDITIONAL([HAVE_A2X], [ test "x$A2X" != "x" ])
  58. AC_PATH_PROG([ASCIIDOC], [asciidoc])
  59. AC_SUBST([ASCIIDOC])
  60. AM_CONDITIONAL([HAVE_ASCIIDOC], [ test "x$ASCIIDOC" != "x" ])
  61. # Setting language choice
  62. AC_LANG([C++])
  63. # Check pkg-config is available
  64. PKG_PROG_PKG_CONFIG([0.20])
  65. # Checks for libraries.
  66. if test "x$with_libxml2" = "xyes"; then
  67. AM_PATH_XML2([2.6.24], [have_libxml2=yes])
  68. if test "x$have_libxml2" = "xyes"; then
  69. AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have libxml2.])
  70. LIBS="$XML_LIBS $LIBS"
  71. CPPFLAGS="$XML_CPPFLAGS $CPPFLAGS"
  72. elif test "x$with_libxml2_requested" = "xyes"; then
  73. ARIA2_DEP_NOT_MET([libxml2])
  74. fi
  75. fi
  76. if test "x$with_libexpat" = "xyes" && test "x$have_libxml2" != "xyes"; then
  77. AM_PATH_LIBEXPAT
  78. if test "x$have_libexpat" = "xyes"; then
  79. LIBS="$EXPAT_LIBS $LIBS"
  80. CPPFLAGS="$EXPAT_CFLAGS $CPPFLAGS"
  81. elif test "x$with_libexpat_requested" = "xyes"; then
  82. ARIA2_DEP_NOT_MET([libexpat])
  83. fi
  84. fi
  85. if test "x$with_sqlite3" = "xyes"; then
  86. PKG_CHECK_MODULES([SQLITE3],[sqlite3],[have_sqlite3=yes],[have_sqlite3=no])
  87. if test "x$have_sqlite3" = "xyes"; then
  88. AC_DEFINE([HAVE_SQLITE3], [1], [Define to 1 if you have sqlite3.])
  89. LIBS="$SQLITE3_LIBS $LIBS"
  90. CPPFLAGS="$SQLITE3_CFLAGS $CPPFLAGS"
  91. AC_CHECK_FUNCS([sqlite3_open_v2])
  92. else
  93. AC_MSG_WARN([$SQLITE3_PKG_ERRORS])
  94. if test "x$with_sqlite3_requested" = "xyes"; then
  95. ARIA2_DEP_NOT_MET([sqlite3])
  96. fi
  97. fi
  98. fi
  99. if test "x$with_gnutls" = "xyes"; then
  100. # gnutls >= 2.8 doesn't have libgnutls-config anymore. We require
  101. # 2.2.0 because we use gnutls_priority_set_direct()
  102. PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.2.0],
  103. [have_libgnutls=yes], [have_libgnutls=no])
  104. if test "x$have_libgnutls" = "xyes"; then
  105. AC_DEFINE([HAVE_LIBGNUTLS], [1], [Define to 1 if you have libgnutls.])
  106. LIBS="$LIBGNUTLS_LIBS $LIBS"
  107. CPPFLAGS="$LIBGNUTLS_CFLAGS $CPPFLAGS"
  108. else
  109. AC_MSG_WARN([$LIBGNUTLS_PKG_ERRORS])
  110. if test "x$with_gnutls_requested" = "xyes"; then
  111. ARIA2_DEP_NOT_MET([gnutls])
  112. fi
  113. fi
  114. fi
  115. if test "x$with_openssl" = "xyes" && test "x$have_libgnutls" != "xyes"; then
  116. PKG_CHECK_MODULES([OPENSSL], [openssl >= 0.9.8],
  117. [have_openssl=yes], [have_openssl=no])
  118. if test "x$have_openssl" = "xyes"; then
  119. AC_DEFINE([HAVE_OPENSSL], [1], [Define to 1 if you have openssl.])
  120. LIBS="$OPENSSL_LIBS $LIBS"
  121. CPPFLAGS="$OPENSSL_CFLAGS $CPPFLAGS"
  122. AC_CHECK_FUNCS([EVP_DigestInit_ex], [have_digestinit_ex=yes])
  123. if test "x$have_digestinit_ex" = "x"; then
  124. AC_DEFINE([HAVE_OLD_OPENSSL], [1], [Define to 1 if you have old openssl.])
  125. fi
  126. AC_CHECK_FUNCS([EVP_sha224])
  127. AC_CHECK_FUNCS([EVP_sha256])
  128. AC_CHECK_FUNCS([EVP_sha384])
  129. AC_CHECK_FUNCS([EVP_sha512])
  130. else
  131. AC_MSG_WARN([$OPENSSL_PKG_ERRORS])
  132. if test "x$with_openssl_requested" = "xyes"; then
  133. ARIA2_DEP_NOT_MET([openssl])
  134. fi
  135. fi
  136. fi
  137. if test "x$have_openssl" != "xyes"; then
  138. if test "x$with_libnettle" = "xyes"; then
  139. AC_SEARCH_LIBS([nettle_sha1_init], [nettle],
  140. [have_libnettle=yes], [have_libnettle=no])
  141. if test "x$have_libnettle" = "xyes"; then
  142. AC_DEFINE([HAVE_LIBNETTLE], [1], [Define to 1 if you have libnettle.])
  143. fi
  144. fi
  145. if test "x$with_libgmp" = "xyes" &&
  146. test "x$have_libnettle" = "xyes" &&
  147. test "x$enable_bittorrent" = "xyes"; then
  148. AC_SEARCH_LIBS([__gmpz_init], [gmp], [have_libgmp=yes], [have_libgmp=no])
  149. if test "x$have_libgmp" = "xyes"; then
  150. AC_DEFINE([HAVE_LIBGMP], [1], [Define to 1 if you have libgmp.])
  151. fi
  152. fi
  153. if test "x$with_libgcrypt" = "xyes" &&
  154. test "x$have_libnettle" != "xyes"; then
  155. AM_PATH_LIBGCRYPT([1.2.4], [have_libgcrypt=yes])
  156. if test "x$have_libgcrypt" = "xyes"; then
  157. AC_DEFINE([HAVE_LIBGCRYPT], [1], [Define to 1 if you have libgcrypt.])
  158. LIBS="$LIBGCRYPT_LIBS $LIBS"
  159. CPPFLAGS="$LIBGCRYPT_CFLAGS $CPPFLAGS"
  160. fi
  161. fi
  162. fi
  163. if test "x$with_libcares" = "xyes"; then
  164. PKG_CHECK_MODULES([LIBCARES], [libcares >= 1.7.0], [have_libcares=yes],
  165. [have_libcares=no])
  166. if test "x$have_libcares" = "xyes"; then
  167. AC_DEFINE([HAVE_LIBCARES], [1], [Define to 1 if you have libcares.])
  168. LIBS="$LIBCARES_LIBS $LIBS"
  169. CPPFLAGS="$LIBCARES_CFLAGS $CPPFLAGS"
  170. AC_CHECK_TYPES([ares_addr_node], [], [], [[#include <ares.h>]])
  171. AC_CHECK_FUNCS([ares_set_servers])
  172. else
  173. AC_MSG_WARN([$LIBCARES_PKG_ERRORS])
  174. if test "x$with_libcares_requested" = "xyes"; then
  175. ARIA2_DEP_NOT_MET([libcares])
  176. fi
  177. fi
  178. fi
  179. # Check availability of libz
  180. if test "x$with_libz" = "xyes"; then
  181. PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3], [have_zlib=yes], [have_zlib=no])
  182. if test "x$have_zlib" = "xyes"; then
  183. AC_DEFINE([HAVE_ZLIB], [1], [Define to 1 if you have zlib.])
  184. LIBS="$ZLIB_LIBS $LIBS"
  185. CPPFLAGS="$ZLIB_CFLAGS $CPPFLAGS"
  186. else
  187. AC_MSG_WARN([$ZLIB_PKG_ERRORS])
  188. if test "x$with_libz_requested" = "xyes"; then
  189. ARIA2_DEP_NOT_MET([libz])
  190. fi
  191. fi
  192. fi
  193. # Define variables based on the result of the checks for libraries.
  194. if test "x$have_libgnutls" = "xyes" || test "x$have_openssl" = "xyes"; then
  195. AC_DEFINE([ENABLE_SSL], [1], [Define to 1 if ssl support is enabled.])
  196. AM_CONDITIONAL([ENABLE_SSL], true)
  197. AC_SUBST([ca_bundle])
  198. else
  199. AM_CONDITIONAL([ENABLE_SSL], false)
  200. fi
  201. AM_CONDITIONAL([HAVE_LIBGNUTLS], [ test "x$have_libgnutls" = "xyes" ])
  202. AM_CONDITIONAL([HAVE_LIBNETTLE], [ test "x$have_libnettle" = "xyes" ])
  203. AM_CONDITIONAL([HAVE_LIBGMP], [ test "x$have_libgmp" = "xyes" ])
  204. AM_CONDITIONAL([HAVE_LIBGCRYPT], [ test "x$have_libgcrypt" = "xyes" ])
  205. AM_CONDITIONAL([HAVE_OPENSSL], [ test "x$have_openssl" = "xyes" ])
  206. if test "x$have_libnettle" = "xyes" || test "x$have_libgcrypt" = "xyes" ||
  207. test "x$have_openssl" = "xyes"; then
  208. AC_DEFINE([ENABLE_MESSAGE_DIGEST], [1],
  209. [Define to 1 if message digest support is enabled.])
  210. AM_CONDITIONAL([ENABLE_MESSAGE_DIGEST], true)
  211. enable_message_digest=yes
  212. else
  213. AM_CONDITIONAL([ENABLE_MESSAGE_DIGEST], false)
  214. fi
  215. if test "x$have_libnettle" = "xyes" && test "x$have_libgmp" = "xyes" ||
  216. test "x$have_libgcrypt" = "xyes" || test "x$have_openssl" = "xyes"; then
  217. enable_bignum=yes
  218. fi
  219. if test "x$enable_bittorrent" = "xyes" &&
  220. test "x$enable_message_digest" = "xyes" &&
  221. test "x$enable_bignum" = "xyes"; then
  222. AC_DEFINE([ENABLE_BITTORRENT], [1],
  223. [Define to 1 if BitTorrent support is enabled.])
  224. AM_CONDITIONAL([ENABLE_BITTORRENT], true)
  225. else
  226. if test "x$enable_bittorrent_requested" = "xyes"; then
  227. ARIA2_FET_NOT_SUPPORTED([bittorrent])
  228. fi
  229. enable_bittorrent=no
  230. AM_CONDITIONAL([ENABLE_BITTORRENT], false)
  231. fi
  232. if (test "x$have_libxml2" = "xyes" || test "x$have_libexpat" = "xyes") &&
  233. test "x$enable_metalink" = "xyes"; then
  234. AC_DEFINE([ENABLE_METALINK], [1],
  235. [Define to 1 if Metalink support is enabled.])
  236. AM_CONDITIONAL([ENABLE_METALINK], true)
  237. else
  238. if test "x$enable_metalink_requested" = "xyes"; then
  239. ARIA2_FET_NOT_SUPPORTED([metalink])
  240. fi
  241. enable_metalink=no
  242. AM_CONDITIONAL([ENABLE_METALINK], false)
  243. fi
  244. AM_CONDITIONAL([HAVE_SOME_XMLLIB],
  245. [test "x$have_libxml2" = "xyes" || test "x$have_libexpat" = "xyes"])
  246. if test "x$have_libxml2" = "xyes" || test "x$have_libexpat" = "xyes"; then
  247. enable_xml_rpc=yes
  248. fi
  249. if test "x$enable_xml_rpc" = "xyes"; then
  250. AC_DEFINE([ENABLE_XML_RPC], [1],
  251. [Define to 1 if XML-RPC support is enabled.])
  252. fi
  253. AM_CONDITIONAL([ENABLE_XML_RPC], [test "x$enable_xml_rpc" = "xyes"])
  254. AM_CONDITIONAL([HAVE_LIBXML2], [test "x$have_libxml2" = "xyes"])
  255. AM_CONDITIONAL([HAVE_LIBEXPAT], [test "x$have_libexpat" = "xyes"])
  256. if test "x$have_libcares" = "xyes"; then
  257. AC_DEFINE([ENABLE_ASYNC_DNS], [1],
  258. [Define to 1 if asynchronous DNS support is enabled.])
  259. AM_CONDITIONAL([ENABLE_ASYNC_DNS], true)
  260. else
  261. AM_CONDITIONAL([ENABLE_ASYNC_DNS], false)
  262. fi
  263. # Set conditional for libz
  264. AM_CONDITIONAL([HAVE_ZLIB], [test "x$have_zlib" = "xyes"])
  265. # Set conditional for sqlite3
  266. AM_CONDITIONAL([HAVE_SQLITE3], [test "x$have_sqlite3" = "xyes"])
  267. AC_SEARCH_LIBS([clock_gettime], [rt])
  268. case "$target" in
  269. *solaris*)
  270. AC_SEARCH_LIBS([getaddrinfo], [nsl socket])
  271. ;;
  272. esac
  273. # Checks for header files.
  274. AC_FUNC_ALLOCA
  275. AC_HEADER_STDC
  276. case "$target" in
  277. *mingw*)
  278. AC_CHECK_HEADERS([windows.h \
  279. winsock2.h \
  280. ws2tcpip.h \
  281. mmsystem.h], [], [],
  282. [[#ifdef HAVE_WINDOWS_H
  283. # include <windows.h>
  284. #endif
  285. ]])
  286. ;;
  287. esac
  288. AC_CHECK_HEADERS([argz.h \
  289. arpa/inet.h \
  290. fcntl.h \
  291. float.h \
  292. inttypes.h \
  293. io.h \
  294. langinfo.h \
  295. libintl.h \
  296. limits.h \
  297. locale.h \
  298. malloc.h \
  299. netdb.h \
  300. netinet/in.h \
  301. netinet/tcp.h \
  302. poll.h \
  303. port.h \
  304. stddef.h \
  305. stdint.h \
  306. stdio_ext.h \
  307. stdlib.h \
  308. string.h \
  309. strings.h \
  310. sys/ioctl.h \
  311. sys/param.h \
  312. sys/socket.h \
  313. sys/time.h \
  314. termios.h \
  315. unistd.h \
  316. utime.h \
  317. wchar.h \
  318. ifaddrs.h \
  319. pwd.h])
  320. # Checks for typedefs, structures, and compiler characteristics.
  321. AC_HEADER_STDBOOL
  322. AC_C_CONST
  323. AC_C_INLINE
  324. AC_TYPE_INT16_T
  325. AC_TYPE_INT32_T
  326. AC_TYPE_INT64_T
  327. AC_TYPE_INT8_T
  328. AC_TYPE_MODE_T
  329. AC_TYPE_OFF_T
  330. AC_TYPE_SIZE_T
  331. AC_TYPE_SSIZE_T
  332. AC_HEADER_TIME
  333. AC_STRUCT_TM
  334. AC_TYPE_UINT16_T
  335. AC_TYPE_UINT32_T
  336. AC_TYPE_UINT64_T
  337. AC_TYPE_UINT8_T
  338. AC_TYPE_PID_T
  339. AC_C_VOLATILE
  340. AC_CHECK_TYPES([ptrdiff_t, struct timespec])
  341. AC_C_BIGENDIAN
  342. AC_SYS_LARGEFILE
  343. # Checks for library functions.
  344. AM_GNU_GETTEXT
  345. AM_GNU_GETTEXT_VERSION([0.18])
  346. AC_FUNC_ERROR_AT_LINE
  347. AC_PROG_GCC_TRADITIONAL
  348. AC_FUNC_MEMCMP
  349. AC_FUNC_MKTIME
  350. AC_FUNC_MMAP
  351. AC_FUNC_SELECT_ARGTYPES
  352. AC_FUNC_STAT
  353. AC_FUNC_STRFTIME
  354. AC_FUNC_VPRINTF
  355. AC_FUNC_FORK
  356. AC_FUNC_STRTOD
  357. AC_CHECK_FUNCS([__argz_count \
  358. __argz_next \
  359. __argz_stringify \
  360. atexit \
  361. ftruncate \
  362. getcwd \
  363. gethostbyaddr \
  364. gethostbyname \
  365. getifaddrs \
  366. getpagesize \
  367. memchr \
  368. memmove \
  369. mempcpy \
  370. memset \
  371. mkdir \
  372. munmap \
  373. nl_langinfo \
  374. posix_memalign \
  375. pow \
  376. putenv \
  377. rmdir \
  378. select \
  379. setlocale \
  380. sleep \
  381. socket \
  382. stpcpy \
  383. strcasecmp \
  384. strchr \
  385. strcspn \
  386. strdup \
  387. strerror \
  388. strncasecmp \
  389. strstr \
  390. strtol \
  391. strtoul \
  392. strtoull \
  393. tzset \
  394. unsetenv \
  395. usleep \
  396. utime \
  397. utimes])
  398. if test "x$enable_epoll" = "xyes"; then
  399. AC_CHECK_FUNCS([epoll_create], [have_epoll=yes])
  400. if test "x$have_epoll" = "xyes"; then
  401. AC_DEFINE([HAVE_EPOLL], [1], [Define to 1 if epoll is available.])
  402. fi
  403. fi
  404. AM_CONDITIONAL([HAVE_EPOLL], [test "x$have_epoll" = "xyes"])
  405. AC_CHECK_FUNCS([posix_fallocate],[have_posix_fallocate=yes])
  406. ARIA2_CHECK_FALLOCATE
  407. if test "x$have_posix_fallocate" = "xyes" ||
  408. test "x$have_fallocate" = "xyes" ||
  409. test "x$win_build" = "xyes"; then
  410. AC_DEFINE([HAVE_SOME_FALLOCATE], [1],
  411. [Define to 1 if *_fallocate is available.])
  412. fi
  413. AM_CONDITIONAL([HAVE_SOME_FALLOCATE],
  414. [test "x$have_posix_fallocate" = "xyes" || test "x$have_fallocate" = "xyes" \
  415. || test "x$win_build" = "xyes"])
  416. AC_CHECK_FUNCS([asctime_r],
  417. [AM_CONDITIONAL([HAVE_ASCTIME_R], true)],
  418. [AM_CONDITIONAL([HAVE_ASCTIME_R], false)])
  419. AC_CHECK_FUNCS([basename],
  420. [AM_CONDITIONAL([HAVE_BASENAME], true)],
  421. [AM_CONDITIONAL([HAVE_BASENAME], false)])
  422. AC_CHECK_FUNCS([gai_strerror],
  423. [AM_CONDITIONAL([HAVE_GAI_STRERROR], true)],
  424. [AM_CONDITIONAL([HAVE_GAI_STRERROR], false)])
  425. AC_CHECK_FUNCS([getaddrinfo],
  426. [AM_CONDITIONAL([HAVE_GETADDRINFO], true)],
  427. [AM_CONDITIONAL([HAVE_GETADDRINFO], false)])
  428. AC_CHECK_FUNCS([gettimeofday],
  429. [AM_CONDITIONAL([HAVE_GETTIMEOFDAY], true)],
  430. [AM_CONDITIONAL([HAVE_GETTIMEOFDAY], false)])
  431. AC_CHECK_FUNCS([localtime_r],
  432. [AM_CONDITIONAL([HAVE_LOCALTIME_R], true)],
  433. [AM_CONDITIONAL([HAVE_LOCALTIME_R], false)])
  434. AC_CHECK_FUNCS([strptime],
  435. [AM_CONDITIONAL([HAVE_STRPTIME], true)],
  436. [AM_CONDITIONAL([HAVE_STRPTIME], false)])
  437. AC_CHECK_FUNCS([timegm],
  438. [AM_CONDITIONAL([HAVE_TIMEGM], true)],
  439. [AM_CONDITIONAL([HAVE_TIMEGM], false)])
  440. AC_CHECK_FUNCS([daemon], [have_daemon=yes])
  441. AM_CONDITIONAL([HAVE_DAEMON], [test "x$have_daemon" = "xyes"])
  442. AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes])
  443. if test "x$have_clock_gettime" != "xyes"; then
  444. AC_CHECK_FUNCS([mach_absolute_time], [have_mach_absolute_time=yes])
  445. fi
  446. AM_CONDITIONAL([HAVE_MACH_ABSOLUTE_TIME],
  447. [test "x$have_mach_absolute_time" = "xyes"])
  448. AC_CHECK_FUNCS([poll], [have_poll=yes])
  449. AM_CONDITIONAL([HAVE_POLL], [test "x$have_poll" = "xyes"])
  450. case "$target" in
  451. *mingw*)
  452. AM_CONDITIONAL([MINGW_BUILD], true)
  453. dnl defined in ws2tcpip.h, but only if _WIN32_WINNT >= 0x0501
  454. AM_CONDITIONAL([HAVE_GETADDRINFO], true)
  455. dnl defined in ws2tcpip.h, but missing in C:\mingw\lib\libws2_32.a
  456. AM_CONDITIONAL([HAVE_GAI_STRERROR], false)
  457. if test "x$have_clock_gettime" != "xyes"; then
  458. AM_CONDITIONAL([HAVE_TIMEGETTIME], true)
  459. fi
  460. ;;
  461. *)
  462. AM_CONDITIONAL([MINGW_BUILD], false)
  463. AM_CONDITIONAL([HAVE_TIMEGETTIME], false)
  464. ;;
  465. esac
  466. AC_CHECK_FUNCS([port_associate], [have_port_associate=yes])
  467. AM_CONDITIONAL([HAVE_PORT_ASSOCIATE], [test "x$have_port_associate" = "xyes"])
  468. AC_CHECK_FUNCS([kqueue], [have_kqueue=yes])
  469. AM_CONDITIONAL([HAVE_KQUEUE], [test "x$have_kqueue" = "xyes"])
  470. if test "x$have_kqueue" = "xyes"; then
  471. AC_MSG_CHECKING([whether struct kevent.udata is intptr_t])
  472. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  473. #include <sys/types.h>
  474. #include <sys/event.h>
  475. #include <sys/time.h>
  476. ]],
  477. [[
  478. struct kevent event;
  479. event.udata = reinterpret_cast<intptr_t>(&event);
  480. ]])],
  481. [kevent_udata_intptr_t=yes], [kevent_udata_intptr_t=no])
  482. AC_MSG_RESULT([$kevent_udata_intptr_t])
  483. if test "x$kevent_udata_intptr_t" = "xyes"; then
  484. AC_DEFINE([KEVENT_UDATA_INTPTR_T], [1], [Define to 1 if struct kevent.udata is intptr_t])
  485. fi
  486. fi
  487. AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
  488. [AC_DEFINE([HAVE_SOCKADDR_IN_SIN_LEN],[1],
  489. [Define to 1 if struct sockaddr_in has sin_len member.])],
  490. [],
  491. [[
  492. #include <sys/types.h>
  493. #include <sys/socket.h>
  494. #include <netinet/in.h>
  495. ]])
  496. AC_CHECK_MEMBER([struct sockaddr_in6.sin6_len],
  497. [AC_DEFINE([HAVE_SOCKADDR_IN6_SIN6_LEN],[1],
  498. [Define to 1 if struct sockaddr_in6 has sin6_len member.])],
  499. [],
  500. [[
  501. #include <sys/types.h>
  502. #include <sys/socket.h>
  503. #include <netinet/in.h>
  504. ]])
  505. # Check struct option.name is assignable from const char*. struct
  506. # option.name in opensolaris is of type char*. In Linux, it is const
  507. # char*
  508. AC_MSG_CHECKING([whether struct option.name is assignable from const char*])
  509. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  510. #include <unistd.h>
  511. #include <getopt.h>
  512. ]],
  513. [[
  514. const char* s = "const char";
  515. option op;
  516. op.name = s;
  517. ]])],
  518. [have_option_const_name=yes], [have_option_const_name=no])
  519. AC_MSG_RESULT([$have_option_const_name])
  520. if test "x$have_option_const_name" = "xyes"; then
  521. AC_DEFINE([HAVE_OPTION_CONST_NAME], [1], [Define 1 if struct option.name is const char*])
  522. fi
  523. AC_CONFIG_SUBDIRS([deps/wslay])
  524. if test "x$enable_message_digest" = "xyes"; then
  525. enable_websocket=yes
  526. AC_DEFINE([ENABLE_WEBSOCKET], [1],
  527. [Define 1 if WebSocket support is enabled.])
  528. LIBS="\$(top_builddir)/deps/wslay/lib/libwslay.la $LIBS"
  529. # $(top_srcdir) for `make distcheck`
  530. CPPFLAGS="-I\$(top_builddir)/deps/wslay/lib/includes -I\$(top_srcdir)/deps/wslay/lib/includes $CPPFLAGS"
  531. fi
  532. AM_CONDITIONAL([ENABLE_WEBSOCKET], [test "x$enable_websocket" = "xyes"])
  533. AC_SUBST([bashcompletiondir])
  534. AC_CONFIG_FILES([Makefile
  535. src/Makefile
  536. test/Makefile
  537. po/Makefile.in
  538. intl/Makefile
  539. lib/Makefile
  540. doc/Makefile
  541. doc/manual-src/Makefile
  542. doc/manual-src/en/Makefile
  543. doc/manual-src/en/conf.py
  544. doc/manual-src/ru/Makefile
  545. doc/manual-src/ru/conf.py
  546. deps/Makefile])
  547. AC_OUTPUT
  548. echo " "
  549. echo "Build: $build"
  550. echo "Target: $target"
  551. echo "Install prefix: $prefix"
  552. echo "CXXFLAGS: $CXXFLAGS"
  553. echo "CFLAGS: $CFLAGS"
  554. echo "CPPFLAGS: $CPPFLAGS"
  555. echo "LDFLAGS: $LDFLAGS"
  556. echo "LIBS: $LIBS"
  557. echo "DEFS: $DEFS"
  558. echo "SQLite3: $have_sqlite3"
  559. echo "GnuTLS: $have_libgnutls"
  560. echo "OpenSSL: $have_openssl"
  561. echo "CA Bundle: $ca_bundle"
  562. echo "LibXML2: $have_libxml2"
  563. echo "LibExpat: $have_libexpat"
  564. echo "LibCares: $have_libcares"
  565. echo "Zlib: $have_zlib"
  566. echo "Epoll: $have_epoll"
  567. echo "Bittorrent: $enable_bittorrent"
  568. echo "Metalink: $enable_metalink"
  569. echo "XML-RPC: $enable_xml_rpc"
  570. echo "Message Digest: $enable_message_digest"
  571. echo "WebSocket: $enable_websocket"
  572. echo "bash_completion dir: $bashcompletiondir"