configure.ac 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  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.0],[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. # Checks for programs.
  41. AC_PROG_CXX
  42. AC_PROG_CC
  43. AC_PROG_INSTALL
  44. AC_PROG_MKDIR_P
  45. AC_PROG_YACC
  46. AC_CHECK_TOOL([AR], [ar], [:])
  47. if test "x$AR" = "x:"; then
  48. AC_MSG_FAILURE([ar is not found in the system.])
  49. fi
  50. AC_SUBST([AR])
  51. AC_PATH_PROG([A2X], [a2x])
  52. AC_SUBST([A2X])
  53. AM_CONDITIONAL([HAVE_A2X], [ test "x$A2X" != "x" ])
  54. AC_PATH_PROG([ASCIIDOC], [asciidoc])
  55. AC_SUBST([ASCIIDOC])
  56. AM_CONDITIONAL([HAVE_ASCIIDOC], [ test "x$ASCIIDOC" != "x" ])
  57. # Setting language choice
  58. AC_LANG([C++])
  59. # Check pkg-config is available
  60. PKG_PROG_PKG_CONFIG([0.20])
  61. # Checks for libraries.
  62. if test "x$with_libxml2" = "xyes"; then
  63. AM_PATH_XML2([2.6.24], [have_libxml2=yes])
  64. if test "x$have_libxml2" = "xyes"; then
  65. AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have libxml2.])
  66. LIBS="$XML_LIBS $LIBS"
  67. CPPFLAGS="$XML_CPPFLAGS $CPPFLAGS"
  68. elif test "x$with_libxml2_requested" = "xyes"; then
  69. ARIA2_DEP_NOT_MET([libxml2])
  70. fi
  71. fi
  72. if test "x$with_libexpat" = "xyes" && test "x$have_libxml2" != "xyes"; then
  73. AM_PATH_LIBEXPAT
  74. if test "x$have_libexpat" = "xyes"; then
  75. LIBS="$EXPAT_LIBS $LIBS"
  76. CPPFLAGS="$EXPAT_CFLAGS $CPPFLAGS"
  77. elif test "x$with_libexpat_requested" = "xyes"; then
  78. ARIA2_DEP_NOT_MET([libexpat])
  79. fi
  80. fi
  81. if test "x$with_sqlite3" = "xyes"; then
  82. PKG_CHECK_MODULES([SQLITE3],[sqlite3],[have_sqlite3=yes],[have_sqlite3=no])
  83. if test "x$have_sqlite3" = "xyes"; then
  84. AC_DEFINE([HAVE_SQLITE3], [1], [Define to 1 if you have sqlite3.])
  85. LIBS="$SQLITE3_LIBS $LIBS"
  86. CPPFLAGS="$SQLITE3_CFLAGS $CPPFLAGS"
  87. AC_CHECK_FUNCS([sqlite3_open_v2])
  88. else
  89. AC_MSG_WARN([$SQLITE3_PKG_ERRORS])
  90. if test "x$with_sqlite3_requested" = "xyes"; then
  91. ARIA2_DEP_NOT_MET([sqlite3])
  92. fi
  93. fi
  94. fi
  95. if test "x$with_gnutls" = "xyes"; then
  96. # gnutls >= 2.8 doesn't have libgnutls-config anymore. We require
  97. # 2.2.0 because we use gnutls_priority_set_direct()
  98. PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.2.0],
  99. [have_libgnutls=yes], [have_libgnutls=no])
  100. if test "x$have_libgnutls" = "xyes"; then
  101. AC_DEFINE([HAVE_LIBGNUTLS], [1], [Define to 1 if you have libgnutls.])
  102. LIBS="$LIBGNUTLS_LIBS $LIBS"
  103. CPPFLAGS="$LIBGNUTLS_CFLAGS $CPPFLAGS"
  104. else
  105. AC_MSG_WARN([$LIBGNUTLS_PKG_ERRORS])
  106. if test "x$with_gnutls_requested" = "xyes"; then
  107. ARIA2_DEP_NOT_MET([gnutls])
  108. fi
  109. fi
  110. fi
  111. if test "x$with_openssl" = "xyes" && test "x$have_libgnutls" != "xyes"; then
  112. PKG_CHECK_MODULES([OPENSSL], [openssl >= 0.9.8],
  113. [have_openssl=yes], [have_openssl=no])
  114. if test "x$have_openssl" = "xyes"; then
  115. AC_DEFINE([HAVE_OPENSSL], [1], [Define to 1 if you have openssl.])
  116. LIBS="$OPENSSL_LIBS $LIBS"
  117. CPPFLAGS="$OPENSSL_CFLAGS $CPPFLAGS"
  118. AC_CHECK_FUNCS([EVP_DigestInit_ex], [have_digestinit_ex=yes])
  119. if test "x$have_digestinit_ex" = "x"; then
  120. AC_DEFINE([HAVE_OLD_OPENSSL], [1], [Define to 1 if you have old openssl.])
  121. fi
  122. AC_CHECK_FUNCS([EVP_sha224])
  123. AC_CHECK_FUNCS([EVP_sha256])
  124. AC_CHECK_FUNCS([EVP_sha384])
  125. AC_CHECK_FUNCS([EVP_sha512])
  126. else
  127. AC_MSG_WARN([$OPENSSL_PKG_ERRORS])
  128. if test "x$with_openssl_requested" = "xyes"; then
  129. ARIA2_DEP_NOT_MET([openssl])
  130. fi
  131. fi
  132. fi
  133. if test "x$have_openssl" != "xyes"; then
  134. if test "x$with_libnettle" = "xyes"; then
  135. AC_SEARCH_LIBS([nettle_sha1_init], [nettle],
  136. [have_libnettle=yes], [have_libnettle=no])
  137. if test "x$have_libnettle" = "xyes"; then
  138. AC_DEFINE([HAVE_LIBNETTLE], [1], [Define to 1 if you have libnettle.])
  139. fi
  140. fi
  141. if test "x$with_libgmp" = "xyes" &&
  142. test "x$have_libnettle" = "xyes" &&
  143. test "x$enable_bittorrent" = "xyes"; then
  144. AC_SEARCH_LIBS([__gmpz_init], [gmp], [have_libgmp=yes], [have_libgmp=no])
  145. if test "x$have_libgmp" = "xyes"; then
  146. AC_DEFINE([HAVE_LIBGMP], [1], [Define to 1 if you have libgmp.])
  147. fi
  148. fi
  149. if test "x$with_libgcrypt" = "xyes" &&
  150. test "x$have_libnettle" != "xyes"; then
  151. AM_PATH_LIBGCRYPT([1.2.4], [have_libgcrypt=yes])
  152. if test "x$have_libgcrypt" = "xyes"; then
  153. AC_DEFINE([HAVE_LIBGCRYPT], [1], [Define to 1 if you have libgcrypt.])
  154. LIBS="$LIBGCRYPT_LIBS $LIBS"
  155. CPPFLAGS="$LIBGCRYPT_CFLAGS $CPPFLAGS"
  156. fi
  157. fi
  158. fi
  159. if test "x$with_libcares" = "xyes"; then
  160. PKG_CHECK_MODULES([LIBCARES], [libcares >= 1.7.0], [have_libcares=yes],
  161. [have_libcares=no])
  162. if test "x$have_libcares" = "xyes"; then
  163. AC_DEFINE([HAVE_LIBCARES], [1], [Define to 1 if you have libcares.])
  164. LIBS="$LIBCARES_LIBS $LIBS"
  165. CPPFLAGS="$LIBCARES_CFLAGS $CPPFLAGS"
  166. AC_CHECK_TYPES([ares_addr_node], [], [], [[#include <ares.h>]])
  167. AC_CHECK_FUNCS([ares_set_servers])
  168. else
  169. AC_MSG_WARN([$LIBCARES_PKG_ERRORS])
  170. if test "x$with_libcares_requested" = "xyes"; then
  171. ARIA2_DEP_NOT_MET([libcares])
  172. fi
  173. fi
  174. fi
  175. # Check availability of libz
  176. if test "x$with_libz" = "xyes"; then
  177. PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3], [have_zlib=yes], [have_zlib=no])
  178. if test "x$have_zlib" = "xyes"; then
  179. AC_DEFINE([HAVE_ZLIB], [1], [Define to 1 if you have zlib.])
  180. LIBS="$ZLIB_LIBS $LIBS"
  181. CPPFLAGS="$ZLIB_CFLAGS $CPPFLAGS"
  182. else
  183. AC_MSG_WARN([$ZLIB_PKG_ERRORS])
  184. if test "x$with_libz_requested" = "xyes"; then
  185. ARIA2_DEP_NOT_MET([libz])
  186. fi
  187. fi
  188. fi
  189. # Define variables based on the result of the checks for libraries.
  190. if test "x$have_libgnutls" = "xyes" || test "x$have_openssl" = "xyes"; then
  191. AC_DEFINE([ENABLE_SSL], [1], [Define to 1 if ssl support is enabled.])
  192. AM_CONDITIONAL([ENABLE_SSL], true)
  193. AC_SUBST([ca_bundle])
  194. else
  195. AM_CONDITIONAL([ENABLE_SSL], false)
  196. fi
  197. AM_CONDITIONAL([HAVE_LIBGNUTLS], [ test "x$have_libgnutls" = "xyes" ])
  198. AM_CONDITIONAL([HAVE_LIBNETTLE], [ test "x$have_libnettle" = "xyes" ])
  199. AM_CONDITIONAL([HAVE_LIBGMP], [ test "x$have_libgmp" = "xyes" ])
  200. AM_CONDITIONAL([HAVE_LIBGCRYPT], [ test "x$have_libgcrypt" = "xyes" ])
  201. AM_CONDITIONAL([HAVE_OPENSSL], [ test "x$have_openssl" = "xyes" ])
  202. if test "x$have_libnettle" = "xyes" || test "x$have_libgcrypt" = "xyes" ||
  203. test "x$have_openssl" = "xyes"; then
  204. AC_DEFINE([ENABLE_MESSAGE_DIGEST], [1],
  205. [Define to 1 if message digest support is enabled.])
  206. AM_CONDITIONAL([ENABLE_MESSAGE_DIGEST], true)
  207. enable_message_digest=yes
  208. else
  209. AM_CONDITIONAL([ENABLE_MESSAGE_DIGEST], false)
  210. fi
  211. if test "x$have_libnettle" = "xyes" && test "x$have_libgmp" = "xyes" ||
  212. test "x$have_libgcrypt" = "xyes" || test "x$have_openssl" = "xyes"; then
  213. enable_bignum=yes
  214. fi
  215. if test "x$enable_bittorrent" = "xyes" &&
  216. test "x$enable_message_digest" = "xyes" &&
  217. test "x$enable_bignum" = "xyes"; then
  218. AC_DEFINE([ENABLE_BITTORRENT], [1],
  219. [Define to 1 if BitTorrent support is enabled.])
  220. AM_CONDITIONAL([ENABLE_BITTORRENT], true)
  221. else
  222. if test "x$enable_bittorrent_requested" = "xyes"; then
  223. ARIA2_FET_NOT_SUPPORTED([bittorrent])
  224. fi
  225. enable_bittorrent=no
  226. AM_CONDITIONAL([ENABLE_BITTORRENT], false)
  227. fi
  228. if (test "x$have_libxml2" = "xyes" || test "x$have_libexpat" = "xyes") &&
  229. test "x$enable_metalink" = "xyes"; then
  230. AC_DEFINE([ENABLE_METALINK], [1],
  231. [Define to 1 if Metalink support is enabled.])
  232. AM_CONDITIONAL([ENABLE_METALINK], true)
  233. else
  234. if test "x$enable_metalink_requested" = "xyes"; then
  235. ARIA2_FET_NOT_SUPPORTED([metalink])
  236. fi
  237. enable_metalink=no
  238. AM_CONDITIONAL([ENABLE_METALINK], false)
  239. fi
  240. AM_CONDITIONAL([HAVE_SOME_XMLLIB],
  241. [test "x$have_libxml2" = "xyes" || test "x$have_libexpat" = "xyes"])
  242. if test "x$have_libxml2" = "xyes" || test "x$have_libexpat" = "xyes"; then
  243. enable_xml_rpc=yes
  244. fi
  245. if test "x$enable_xml_rpc" = "xyes"; then
  246. AC_DEFINE([ENABLE_XML_RPC], [1],
  247. [Define to 1 if XML-RPC support is enabled.])
  248. fi
  249. AM_CONDITIONAL([ENABLE_XML_RPC], [test "x$enable_xml_rpc" = "xyes"])
  250. AM_CONDITIONAL([HAVE_LIBXML2], [test "x$have_libxml2" = "xyes"])
  251. AM_CONDITIONAL([HAVE_LIBEXPAT], [test "x$have_libexpat" = "xyes"])
  252. if test "x$have_libcares" = "xyes"; then
  253. AC_DEFINE([ENABLE_ASYNC_DNS], [1],
  254. [Define to 1 if asynchronous DNS support is enabled.])
  255. AM_CONDITIONAL([ENABLE_ASYNC_DNS], true)
  256. else
  257. AM_CONDITIONAL([ENABLE_ASYNC_DNS], false)
  258. fi
  259. # Set conditional for libz
  260. AM_CONDITIONAL([HAVE_ZLIB], [test "x$have_zlib" = "xyes"])
  261. # Set conditional for sqlite3
  262. AM_CONDITIONAL([HAVE_SQLITE3], [test "x$have_sqlite3" = "xyes"])
  263. AC_SEARCH_LIBS([clock_gettime], [rt])
  264. case "$target" in
  265. *solaris*)
  266. AC_SEARCH_LIBS([getaddrinfo], [nsl socket])
  267. AC_SEARCH_LIBS([inet_aton], [nsl socket])
  268. ;;
  269. esac
  270. # Checks for header files.
  271. AC_FUNC_ALLOCA
  272. AC_HEADER_STDC
  273. case "$target" in
  274. *mingw*)
  275. AC_CHECK_HEADERS([windows.h \
  276. winsock2.h \
  277. ws2tcpip.h \
  278. mmsystem.h], [], [],
  279. [[#ifdef HAVE_WINDOWS_H
  280. # include <windows.h>
  281. #endif
  282. ]])
  283. ;;
  284. esac
  285. AC_CHECK_HEADERS([argz.h \
  286. arpa/inet.h \
  287. fcntl.h \
  288. float.h \
  289. inttypes.h \
  290. io.h \
  291. langinfo.h \
  292. libintl.h \
  293. limits.h \
  294. locale.h \
  295. malloc.h \
  296. netdb.h \
  297. netinet/in.h \
  298. netinet/tcp.h \
  299. poll.h \
  300. port.h \
  301. stddef.h \
  302. stdint.h \
  303. stdio_ext.h \
  304. stdlib.h \
  305. string.h \
  306. strings.h \
  307. sys/ioctl.h \
  308. sys/param.h \
  309. sys/socket.h \
  310. sys/time.h \
  311. termios.h \
  312. unistd.h \
  313. utime.h \
  314. wchar.h \
  315. ifaddrs.h \
  316. pwd.h])
  317. # Checks for typedefs, structures, and compiler characteristics.
  318. AC_HEADER_STDBOOL
  319. AC_C_CONST
  320. AC_C_INLINE
  321. AC_TYPE_INT16_T
  322. AC_TYPE_INT32_T
  323. AC_TYPE_INT64_T
  324. AC_TYPE_INT8_T
  325. AC_TYPE_MODE_T
  326. AC_TYPE_OFF_T
  327. AC_TYPE_SIZE_T
  328. AC_TYPE_SSIZE_T
  329. AC_HEADER_TIME
  330. AC_STRUCT_TM
  331. AC_TYPE_UINT16_T
  332. AC_TYPE_UINT32_T
  333. AC_TYPE_UINT64_T
  334. AC_TYPE_UINT8_T
  335. AC_TYPE_PID_T
  336. AC_C_VOLATILE
  337. AC_CHECK_TYPES([ptrdiff_t, struct timespec])
  338. AC_C_BIGENDIAN
  339. AC_SYS_LARGEFILE
  340. # Checks for library functions.
  341. AM_GNU_GETTEXT
  342. AM_GNU_GETTEXT_VERSION([0.18])
  343. AC_FUNC_ERROR_AT_LINE
  344. AC_PROG_GCC_TRADITIONAL
  345. AC_FUNC_MEMCMP
  346. AC_FUNC_MKTIME
  347. AC_FUNC_MMAP
  348. AC_FUNC_SELECT_ARGTYPES
  349. AC_FUNC_STAT
  350. AC_FUNC_STRFTIME
  351. AC_FUNC_VPRINTF
  352. AC_FUNC_FORK
  353. AC_FUNC_STRTOD
  354. AC_CHECK_FUNCS([__argz_count \
  355. __argz_next \
  356. __argz_stringify \
  357. atexit \
  358. ftruncate \
  359. getcwd \
  360. gethostbyaddr \
  361. gethostbyname \
  362. getifaddrs \
  363. getpagesize \
  364. memchr \
  365. memmove \
  366. mempcpy \
  367. memset \
  368. mkdir \
  369. munmap \
  370. nl_langinfo \
  371. posix_memalign \
  372. pow \
  373. putenv \
  374. rmdir \
  375. select \
  376. setlocale \
  377. sleep \
  378. socket \
  379. stpcpy \
  380. strcasecmp \
  381. strchr \
  382. strcspn \
  383. strdup \
  384. strerror \
  385. strncasecmp \
  386. strstr \
  387. strtol \
  388. strtoul \
  389. strtoull \
  390. tzset \
  391. unsetenv \
  392. usleep \
  393. utime \
  394. utimes])
  395. if test "x$enable_epoll" = "xyes"; then
  396. AC_CHECK_FUNCS([epoll_create], [have_epoll=yes])
  397. if test "x$have_epoll" = "xyes"; then
  398. AC_DEFINE([HAVE_EPOLL], [1], [Define to 1 if epoll is available.])
  399. fi
  400. fi
  401. AM_CONDITIONAL([HAVE_EPOLL], [test "x$have_epoll" = "xyes"])
  402. AC_CHECK_FUNCS([posix_fallocate],[have_posix_fallocate=yes])
  403. ARIA2_CHECK_FALLOCATE
  404. if test "x$have_posix_fallocate" = "xyes" ||
  405. test "x$have_fallocate" = "xyes" ||
  406. test "x$win_build" = "xyes"; then
  407. AC_DEFINE([HAVE_SOME_FALLOCATE], [1],
  408. [Define to 1 if *_fallocate is available.])
  409. fi
  410. AM_CONDITIONAL([HAVE_SOME_FALLOCATE],
  411. [test "x$have_posix_fallocate" = "xyes" || test "x$have_fallocate" = "xyes" \
  412. || test "x$win_build" = "xyes"])
  413. AC_CHECK_FUNCS([asctime_r],
  414. [AM_CONDITIONAL([HAVE_ASCTIME_R], true)],
  415. [AM_CONDITIONAL([HAVE_ASCTIME_R], false)])
  416. AC_CHECK_FUNCS([basename],
  417. [AM_CONDITIONAL([HAVE_BASENAME], true)],
  418. [AM_CONDITIONAL([HAVE_BASENAME], false)])
  419. AC_CHECK_FUNCS([gai_strerror],
  420. [AM_CONDITIONAL([HAVE_GAI_STRERROR], true)],
  421. [AM_CONDITIONAL([HAVE_GAI_STRERROR], false)])
  422. AC_CHECK_FUNCS([getaddrinfo],
  423. [AM_CONDITIONAL([HAVE_GETADDRINFO], true)],
  424. [AM_CONDITIONAL([HAVE_GETADDRINFO], false)])
  425. AC_CHECK_FUNCS([gettimeofday],
  426. [AM_CONDITIONAL([HAVE_GETTIMEOFDAY], true)],
  427. [AM_CONDITIONAL([HAVE_GETTIMEOFDAY], false)])
  428. AC_CHECK_FUNCS([inet_aton],
  429. [AM_CONDITIONAL([HAVE_INET_ATON], true)],
  430. [AM_CONDITIONAL([HAVE_INET_ATON], 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. [[#include <netinet/in.h>]])
  492. # Check struct option.name is assignable from const char*. struct
  493. # option.name in opensolaris is of type char*. In Linux, it is const
  494. # char*
  495. AC_MSG_CHECKING([whether struct option.name is assignable from const char*])
  496. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  497. #include <unistd.h>
  498. #include <getopt.h>
  499. ]],
  500. [[
  501. const char* s = "const char";
  502. option op;
  503. op.name = s;
  504. ]])],
  505. [have_option_const_name=yes], [have_option_const_name=no])
  506. AC_MSG_RESULT([$have_option_const_name])
  507. if test "x$have_option_const_name" = "xyes"; then
  508. AC_DEFINE([HAVE_OPTION_CONST_NAME], [1], [Define 1 if struct option.name is const char*])
  509. fi
  510. AC_CONFIG_SUBDIRS([deps/wslay])
  511. if test "x$enable_message_digest" = "xyes"; then
  512. enable_websocket=yes
  513. AC_DEFINE([ENABLE_WEBSOCKET], [1],
  514. [Define 1 if WebSocket support is enabled.])
  515. LIBS="\$(top_builddir)/deps/wslay/lib/libwslay.la $LIBS"
  516. # $(top_srcdir) for `make distcheck`
  517. CPPFLAGS="-I\$(top_builddir)/deps/wslay/lib/includes -I\$(top_srcdir)/deps/wslay/lib/includes $CPPFLAGS"
  518. fi
  519. AM_CONDITIONAL([ENABLE_WEBSOCKET], [test "x$enable_websocket" = "xyes"])
  520. AC_CONFIG_FILES([Makefile
  521. src/Makefile
  522. test/Makefile
  523. po/Makefile.in
  524. intl/Makefile
  525. lib/Makefile
  526. doc/Makefile
  527. doc/ru/Makefile
  528. deps/Makefile])
  529. AC_OUTPUT
  530. echo " "
  531. echo "Build: $build"
  532. echo "Target: $target"
  533. echo "Install prefix: $prefix"
  534. echo "CXXFLAGS: $CXXFLAGS"
  535. echo "CFLAGS: $CFLAGS"
  536. echo "CPPFLAGS: $CPPFLAGS"
  537. echo "LDFLAGS: $LDFLAGS"
  538. echo "LIBS: $LIBS"
  539. echo "DEFS: $DEFS"
  540. echo "SQLite3: $have_sqlite3"
  541. echo "GnuTLS: $have_libgnutls"
  542. echo "OpenSSL: $have_openssl"
  543. echo "CA Bundle: $ca_bundle"
  544. echo "LibXML2: $have_libxml2"
  545. echo "LibExpat: $have_libexpat"
  546. echo "LibCares: $have_libcares"
  547. echo "Zlib: $have_zlib"
  548. echo "Epoll: $have_epoll"
  549. echo "Bittorrent: $enable_bittorrent"
  550. echo "Metalink: $enable_metalink"
  551. echo "XML-RPC: $enable_xml_rpc"
  552. echo "Message Digest: $enable_message_digest"
  553. echo "WebSocket: $enable_websocket"