configure.ac 22 KB

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