configure.ac 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. #
  4. AC_PREREQ([2.67])
  5. AC_INIT([aria2],[1.18.10],[https://github.com/tatsuhiro-t/aria2/issues],[aria2],[http://aria2.sourceforge.net/])
  6. AC_CANONICAL_HOST
  7. AC_CANONICAL_TARGET
  8. AM_INIT_AUTOMAKE([subdir-objects])
  9. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  10. AC_USE_SYSTEM_EXTENSIONS
  11. LT_PREREQ([2.2.6])
  12. LT_INIT([disable-static])
  13. dnl See versioning rule:
  14. dnl http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
  15. AC_SUBST(LT_CURRENT, 0)
  16. AC_SUBST(LT_REVISION, 0)
  17. AC_SUBST(LT_AGE, 0)
  18. AC_CONFIG_MACRO_DIR([m4])
  19. AM_PATH_CPPUNIT(1.10.2)
  20. AC_CONFIG_SRCDIR([src/a2io.h])
  21. AC_CONFIG_HEADERS([config.h])
  22. case "$host" in
  23. *mingw*)
  24. win_build=yes
  25. LIBS="$LIBS -lws2_32 -lwsock32 -lgdi32 -lwinmm -liphlpapi -lpsapi"
  26. # C++ headers defines __USE_MINGW_ANSI_STDIO to 1 unconditionally.
  27. # We have to use it as well nonetheless.
  28. CPPFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $CPPFLAGS"
  29. # Build with ASLR (dynamicbase) and NX compatiblity (nxcompat)
  30. # Enable pie once upstream/binutils gets fixed to produce correct binaries with it.
  31. LDFLAGS="$LDFLAGS -Wl,--dynamicbase -Wl,--nxcompat"
  32. ;;
  33. esac
  34. AC_DEFINE_UNQUOTED([BUILD], ["$build"], [Define build-type])
  35. AC_DEFINE_UNQUOTED([HOST], ["$host"], [Define build-type])
  36. AC_DEFINE_UNQUOTED([TARGET], ["$target"], [Define target-type])
  37. # Checks for arguments.
  38. ARIA2_ARG_WITH([libuv])
  39. ARIA2_ARG_WITHOUT([appletls])
  40. ARIA2_ARG_WITHOUT([wintls])
  41. ARIA2_ARG_WITHOUT([gnutls])
  42. ARIA2_ARG_WITHOUT([libnettle])
  43. ARIA2_ARG_WITHOUT([libgmp])
  44. ARIA2_ARG_WITHOUT([libgcrypt])
  45. ARIA2_ARG_WITHOUT([openssl])
  46. ARIA2_ARG_WITHOUT([sqlite3])
  47. ARIA2_ARG_WITHOUT([libxml2])
  48. ARIA2_ARG_WITHOUT([libexpat])
  49. ARIA2_ARG_WITHOUT([libcares])
  50. ARIA2_ARG_WITHOUT([libz])
  51. ARIA2_ARG_WITH([tcmalloc])
  52. ARIA2_ARG_WITH([jemalloc])
  53. ARIA2_ARG_WITHOUT([libssh2])
  54. ARIA2_ARG_DISABLE([ssl])
  55. ARIA2_ARG_DISABLE([bittorrent])
  56. ARIA2_ARG_DISABLE([metalink])
  57. ARIA2_ARG_DISABLE([websocket])
  58. ARIA2_ARG_DISABLE([epoll])
  59. ARIA2_ARG_ENABLE([libaria2])
  60. AC_ARG_WITH([ca-bundle],
  61. AS_HELP_STRING([--with-ca-bundle=FILE],[Use FILE as default CA bundle.]),
  62. [AC_DEFINE_UNQUOTED([CA_BUNDLE], ["$withval"], [Define to choose default CA bundle.])
  63. ca_bundle=$withval
  64. ], [])
  65. AC_ARG_WITH([disk-cache],
  66. AS_HELP_STRING([--with-disk-cache=SIZE],[Use SIZE as the default disk-cache size.]),
  67. [AC_DEFINE_UNQUOTED([DEFAULT_DISK_CACHE], ["$withval"], [Define to choose default disk-cache size])],
  68. [])
  69. AC_ARG_WITH([bashcompletiondir],
  70. AS_HELP_STRING([--with-bashcompletiondir=DIR],
  71. [Directory to install bash_completion file]),
  72. [bashcompletiondir=$withval], [bashcompletiondir=$docdir/bash_completion])
  73. AC_ARG_VAR([ARIA2_STATIC], [Set 'yes' to build a statically linked aria2])
  74. # Checks for programs.
  75. AC_PROG_CXX
  76. AC_PROG_CC
  77. AC_PROG_INSTALL
  78. AC_PROG_MKDIR_P
  79. AC_PROG_YACC
  80. AM_PROG_AS
  81. # Speed GCC compilation up.
  82. if test "$GCC" = yes; then
  83. CFLAGS="$CFLAGS -pipe"
  84. fi
  85. if test "$GXX" = yes; then
  86. CXXFLAGS="$CXXFLAGS -pipe"
  87. fi
  88. AC_CHECK_TOOL([AR], [ar], [:])
  89. if test "x$AR" = "x:"; then
  90. AC_MSG_FAILURE([ar is not found in the system.])
  91. fi
  92. AC_SUBST([AR])
  93. AC_PATH_PROG([A2X], [a2x])
  94. AC_SUBST([A2X])
  95. AM_CONDITIONAL([HAVE_A2X], [ test "x$A2X" != "x" ])
  96. AC_PATH_PROG([ASCIIDOC], [asciidoc])
  97. AC_SUBST([ASCIIDOC])
  98. AM_CONDITIONAL([HAVE_ASCIIDOC], [ test "x$ASCIIDOC" != "x" ])
  99. AC_PATH_PROGS([SPHINXBUILD], [sphinx-build])
  100. AC_SUBST([SPHINXBUILD])
  101. AM_CONDITIONAL([HAVE_SPHINXBUILD], [ test "x$SPHINXBUILD" != "x" ])
  102. AC_PATH_PROGS([RST2HTML], [rst2html.py rst2html])
  103. AC_SUBST([RST2HTML])
  104. AM_CONDITIONAL([HAVE_RST2HTML], [ test "x$RST2HTML" != "x" ])
  105. # Setting language choice
  106. AC_LANG([C++])
  107. # Check pkg-config is available
  108. PKG_PROG_PKG_CONFIG([0.20])
  109. # Check C++ compiler supports C++0x/C++11 feature
  110. AX_CXX_COMPILE_STDCXX_11([noext], [mandatory])
  111. # i686-w64-mingw32-g++ 4.6 does not support override keyword. For
  112. # those compilers, define CXX11_OVERRIDE to empty string. Otherwise
  113. # define it as override. Use CXX11_OVERRIDE instead of override.
  114. AC_MSG_CHECKING([whether the C++ compiler supports `override` keyword])
  115. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  116. struct Base {
  117. virtual void f() = 0;
  118. };
  119. struct Derived : Base {
  120. virtual void f() override {}
  121. };
  122. ]],
  123. [[
  124. Derived x;
  125. ]])],
  126. [cxx11_override=override
  127. AC_MSG_RESULT([yes])],
  128. [AC_MSG_RESULT([no])])
  129. AC_DEFINE_UNQUOTED([CXX11_OVERRIDE], [$cxx11_override],
  130. [Define `override` keyword if the compiler supports it])
  131. # Check static build is requested
  132. if test "x$ARIA2_STATIC" = "xyes"; then
  133. case "$host" in
  134. i686*mingw*)
  135. dnl Define _USE_32BIT_TIME_T because 32bit library of MinGW-w64
  136. dnl does not implement many 64bit version functions.
  137. CPPFLAGS="-D_USE_32BIT_TIME_T $CPPFLAGS"
  138. ;;
  139. esac
  140. # Make pkg-config produce static linking variables
  141. PKG_CONFIG="$PKG_CONFIG --static"
  142. else
  143. dnl Make variable empty to avoid confusion
  144. ARIA2_STATIC=
  145. fi
  146. # Checks for libraries.
  147. # Check availability of libz
  148. if test "x$with_libz" = "xyes"; then
  149. PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3], [have_zlib=yes], [have_zlib=no])
  150. if test "x$have_zlib" = "xyes"; then
  151. LIBS="$ZLIB_LIBS $LIBS"
  152. CPPFLAGS="$ZLIB_CFLAGS $CPPFLAGS"
  153. else
  154. AC_MSG_WARN([$ZLIB_PKG_ERRORS])
  155. AC_CHECK_LIB([z], [zlibVersion], [have_zlib=yes], [have_zlib=no])
  156. if test "x$have_zlib" = "xyes"; then
  157. LIBS="-lz $LIBS"
  158. elif test "x$with_libz_requested" = "xyes"; then
  159. ARIA2_DEP_NOT_MET([libz])
  160. fi
  161. fi
  162. if test "x$have_zlib" = "xyes"; then
  163. AC_DEFINE([HAVE_ZLIB], [1], [Define to 1 if you have zlib.])
  164. # Android NDK arch-mips contains gzbuffer symbol but it is missing
  165. # in zlib.h
  166. AC_CHECK_DECL([gzbuffer], [have_decl_gzbuffer=yes], [],
  167. [[#include <zlib.h>]])
  168. if test "x$have_decl_gzbuffer" = "xyes"; then
  169. AC_CHECK_FUNC([gzbuffer])
  170. fi
  171. AC_CHECK_FUNCS([gzsetparams])
  172. fi
  173. fi
  174. if test "x$with_libuv" = "xyes"; then
  175. case "$host" in
  176. *mingw*|*msvc*)
  177. old_CPPFLAGS=$CPPFLAGS
  178. CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0600"
  179. AC_SEARCH_LIBS([uv_poll_init_socket], [uv], [
  180. AC_CHECK_HEADER([uv.h], [have_libuv=yes], [have_libuv=no])
  181. break;
  182. ], [have_libuv=no])
  183. if test "x$have_libuv" != "xyes"; then
  184. CPPFLAGS=$old_CPPFLAGS
  185. fi
  186. ;;
  187. *darwin*)
  188. old_LDFLAGS=$LDFLAGS
  189. LDFLAGS="$LDFLAGS -framework Foundation -framework CoreServices -framework ApplicationServices"
  190. old_LIBS=$LIBS
  191. LIBS="$LIBS -lm"
  192. AC_SEARCH_LIBS([uv_poll_init_socket], [uv], [
  193. AC_CHECK_HEADER([uv.h], [have_libuv=yes], [have_libuv=no])
  194. break;
  195. ], [have_libuv=no])
  196. if test "x$have_libuv" != "xyes"; then
  197. LDFLAGS=$old_LDFLAGS
  198. LIBS=$old_LIBS
  199. fi
  200. ;;
  201. *)
  202. dnl Yeah, sucks that luv does not bring a pkg-config or config-tool
  203. AC_MSG_CHECKING([for libuv])
  204. for combo in "" "-lrt" "-ldl -lrt" "-ldl -lrt -lpthread" "-lkvm"; do
  205. old_LIBS=$LIBS
  206. LIBS="-luv $combo $LIBS -lm"
  207. AC_LINK_IFELSE([AC_LANG_SOURCE([
  208. extern "C" int uv_poll_init_socket(void);
  209. int main() { return uv_poll_init_socket(); }
  210. ])], [
  211. AC_MSG_RESULT(-luv $combo -lm)
  212. AC_CHECK_HEADER([uv.h], [have_libuv=yes], [have_libuv=no])
  213. break;
  214. ], [have_libuv=no])
  215. if test "x$have_libuv" = "xyes"; then
  216. break;
  217. else
  218. LIBS=$old_LIBS
  219. fi
  220. done
  221. if test "x$have_libuv" != "xyes"; then
  222. AC_MSG_RESULT("no")
  223. fi
  224. ;;
  225. esac
  226. if test "x$have_libuv" = "xyes"; then
  227. AC_DEFINE([HAVE_LIBUV], [1], [Define to 1 if you have libuv.])
  228. AC_CHECK_FUNCS([uv_last_error])
  229. elif test "x$with_libuv_requested" = "xyes"; then
  230. ARIA2_DEP_NOT_MET([libuv])
  231. fi
  232. fi
  233. AM_CONDITIONAL([HAVE_LIBUV], [test "x$have_libuv" = "xyes"])
  234. if test "x$with_libxml2" = "xyes"; then
  235. AM_PATH_XML2([2.6.24], [have_libxml2=yes])
  236. if test "x$have_libxml2" = "xyes"; then
  237. AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have libxml2.])
  238. LIBS="$XML_LIBS $LIBS"
  239. CPPFLAGS="$XML_CPPFLAGS $CPPFLAGS"
  240. elif test "x$with_libxml2_requested" = "xyes"; then
  241. ARIA2_DEP_NOT_MET([libxml2])
  242. fi
  243. fi
  244. if test "x$with_libexpat" = "xyes" && test "x$have_libxml2" != "xyes"; then
  245. AM_PATH_LIBEXPAT
  246. if test "x$have_libexpat" = "xyes"; then
  247. LIBS="$EXPAT_LIBS $LIBS"
  248. CPPFLAGS="$EXPAT_CFLAGS $CPPFLAGS"
  249. elif test "x$with_libexpat_requested" = "xyes"; then
  250. ARIA2_DEP_NOT_MET([libexpat])
  251. fi
  252. fi
  253. if test "x$with_sqlite3" = "xyes"; then
  254. PKG_CHECK_MODULES([SQLITE3],[sqlite3],[have_sqlite3=yes],[have_sqlite3=no])
  255. if test "x$have_sqlite3" = "xyes"; then
  256. AC_DEFINE([HAVE_SQLITE3], [1], [Define to 1 if you have sqlite3.])
  257. LIBS="$SQLITE3_LIBS $LIBS"
  258. CPPFLAGS="$SQLITE3_CFLAGS $CPPFLAGS"
  259. AC_CHECK_FUNCS([sqlite3_open_v2])
  260. else
  261. AC_MSG_WARN([$SQLITE3_PKG_ERRORS])
  262. if test "x$with_sqlite3_requested" = "xyes"; then
  263. ARIA2_DEP_NOT_MET([sqlite3])
  264. fi
  265. fi
  266. fi
  267. if test "x$with_libssh2" = "xyes"; then
  268. PKG_CHECK_MODULES([LIBSSH2], [libssh2], [have_libssh2=yes], [have_libssh2=no])
  269. if test "x$have_libssh2" = "xyes"; then
  270. AC_DEFINE([HAVE_LIBSSH2], [1], [Define to 1 if you have libssh2.])
  271. LIBS="$LIBSSH2_LIBS $LIBS"
  272. CPPFLAGS="$LIBSSH2_CFLAGS $CPPFLAGS"
  273. else
  274. AC_MSG_WARN([$LIBSSH2_PKG_ERRORS])
  275. if test "x$with_libssh2_requested" = "yes"; then
  276. ARIA2_DEP_NOT_MET([libssh2])
  277. fi
  278. fi
  279. fi
  280. case "$host" in
  281. *darwin*)
  282. have_osx="yes"
  283. ;;
  284. *mingw*)
  285. AC_CHECK_HEADERS([windows.h \
  286. winsock2.h \
  287. ws2tcpip.h \
  288. mmsystem.h \
  289. io.h \
  290. iphlpapi.h\
  291. winioctl.h \
  292. share.h], [], [],
  293. [[
  294. #ifdef HAVE_WS2TCPIP_H
  295. # include <ws2tcpip.h>
  296. #endif
  297. #ifdef HAVE_WINSOCK2_H
  298. # include <winsock2.h>
  299. #endif
  300. #ifdef HAVE_WINDOWS_H
  301. # include <windows.h>
  302. #endif
  303. ]])
  304. ;;
  305. esac
  306. if test "x$enable_ssl" != "xyes"; then
  307. with_appletls=no
  308. with_wintls=no
  309. with_libnettle=no
  310. with_libgcrypt=no
  311. with_gnutls=no
  312. with_openssl=no
  313. fi
  314. if test "x$with_appletls" = "xyes"; then
  315. AC_MSG_CHECKING([whether to enable Mac OS X native SSL/TLS])
  316. if test "x$have_osx" = "xyes"; then
  317. AC_DEFINE([HAVE_APPLETLS], [1], [Define to 1 if you have Apple TLS])
  318. LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security"
  319. have_appletls="yes"
  320. have_ssl=yes
  321. have_nativetls=yes
  322. AC_MSG_RESULT(yes)
  323. else
  324. AC_MSG_RESULT(no)
  325. if test "x$with_appletls_requested" = "xyes"; then
  326. ARIA2_DEP_NOT_MET([appletls])
  327. fi
  328. fi
  329. fi
  330. if test "x$with_wintls" = "xyes"; then
  331. AC_HAVE_LIBRARY([crypt32],[have_wintls_libs=yes],[have_wintls_libs=no])
  332. AC_HAVE_LIBRARY([secur32],[have_wintls_libs=$have_wintls_libs],[have_wintls_libs=no])
  333. AC_HAVE_LIBRARY([advapi32],[have_wintls_libs=$have_wintls_libs],[have_wintls_libs=no])
  334. AC_CHECK_HEADER([wincrypt.h], [have_wintls_headers=yes], [have_wintls_headers=no], [[
  335. #ifdef HAVE_WINDOWS_H
  336. # include <windows.h>
  337. #endif
  338. ]])
  339. AC_CHECK_HEADER([security.h], [have_wintls_headers=$have_wintls_headers], [have_wintls_headers=no], [[
  340. #ifdef HAVE_WINDOWS_H
  341. # include <windows.h>
  342. #endif
  343. #ifndef SECURITY_WIN32
  344. #define SECURITY_WIN32 1
  345. #endif
  346. ]])
  347. if test "x$have_wintls_libs" = "xyes" &&
  348. test "x$have_wintls_headers" = "xyes"; then
  349. AC_DEFINE([SECURITY_WIN32], [1], [Use security.h in WIN32 mode])
  350. LIBS="$LIBS -lcrypt32 -lsecur32 -ladvapi32"
  351. have_wintls=yes
  352. have_ssl=yes
  353. have_nativetls=yes
  354. else
  355. have_wintls=no
  356. fi
  357. if test "x$have_wintls" != "xyes"; then
  358. if test "x$with_wintls_requested" = "xyes"; then
  359. ARIA2_DEP_NOT_MET([wintls])
  360. fi
  361. fi
  362. fi
  363. if test "x$with_gnutls" = "xyes" && test "x$have_ssl" != "xyes"; then
  364. # gnutls >= 2.8 doesn't have libgnutls-config anymore. We require
  365. # 2.2.0 because we use gnutls_priority_set_direct()
  366. PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.2.0],
  367. [have_libgnutls=yes], [have_libgnutls=no])
  368. if test "x$have_libgnutls" = "xyes"; then
  369. have_ssl=yes
  370. AC_DEFINE([HAVE_LIBGNUTLS], [1], [Define to 1 if you have libgnutls.])
  371. LIBS="$LIBGNUTLS_LIBS $LIBS"
  372. CPPFLAGS="$LIBGNUTLS_CFLAGS $CPPFLAGS"
  373. AC_CHECK_FUNCS([gnutls_certificate_set_x509_system_trust])
  374. else
  375. AC_MSG_WARN([$LIBGNUTLS_PKG_ERRORS])
  376. if test "x$with_gnutls_requested" = "xyes"; then
  377. ARIA2_DEP_NOT_MET([gnutls])
  378. fi
  379. fi
  380. fi
  381. if test "x$with_openssl" = "xyes" && test "x$have_ssl" != "xyes"; then
  382. PKG_CHECK_MODULES([OPENSSL], [openssl >= 0.9.8],
  383. [have_openssl=yes], [have_openssl=no])
  384. if test "x$have_openssl" = "xyes"; then
  385. have_ssl=yes
  386. AC_DEFINE([HAVE_OPENSSL], [1], [Define to 1 if you have openssl.])
  387. LIBS="$OPENSSL_LIBS $LIBS"
  388. CPPFLAGS="$OPENSSL_CFLAGS $CPPFLAGS"
  389. AC_CHECK_FUNCS([EVP_DigestInit_ex], [have_digestinit_ex=yes])
  390. if test "x$have_digestinit_ex" = "x"; then
  391. AC_DEFINE([HAVE_OLD_OPENSSL], [1], [Define to 1 if you have old openssl.])
  392. fi
  393. AC_CHECK_FUNCS([EVP_sha224])
  394. AC_CHECK_FUNCS([EVP_sha256])
  395. AC_CHECK_FUNCS([EVP_sha384])
  396. AC_CHECK_FUNCS([EVP_sha512])
  397. else
  398. AC_MSG_WARN([$OPENSSL_PKG_ERRORS])
  399. if test "x$with_openssl_requested" = "xyes"; then
  400. ARIA2_DEP_NOT_MET([openssl])
  401. fi
  402. fi
  403. fi
  404. if test "x$have_openssl" != "xyes"; then
  405. if test "x$with_libnettle" = "xyes" &&
  406. test "x$have_nativetls" != "xyes"; then
  407. AC_SEARCH_LIBS([nettle_sha1_init], [nettle],
  408. [have_libnettle=yes], [have_libnettle=no])
  409. if test "x$have_libnettle" = "xyes"; then
  410. AC_DEFINE([HAVE_LIBNETTLE], [1], [Define to 1 if you have libnettle.])
  411. fi
  412. fi
  413. if test "x$with_libgmp" = "xyes" &&
  414. (test "x$have_libnettle" = "xyes" ||
  415. test "x$have_nativetls" = "xyes") &&
  416. test "x$enable_bittorrent" = "xyes"; then
  417. AC_SEARCH_LIBS([__gmpz_init], [gmp], [have_libgmp=yes], [have_libgmp=no])
  418. if test "x$have_libgmp" = "xyes"; then
  419. AC_DEFINE([HAVE_LIBGMP], [1], [Define to 1 if you have libgmp.])
  420. AC_CHECK_FUNCS([__gmpz_powm_sec], [have_mpz_powm_sec=yes])
  421. if test "x$have_mpz_powm_sec" = "xyes"; then
  422. AC_DEFINE([HAVE_GMP_SEC], [1], [Define to 1 if you have a GMP with sec functions.])
  423. fi
  424. else
  425. AC_MSG_WARN([libgmp not found])
  426. if test "x$with_libgmp_requested" = "xyes"; then
  427. ARIA2_DEP_NOT_MET([libgmp])
  428. fi
  429. fi
  430. fi
  431. if test "x$with_libgcrypt" = "xyes" &&
  432. test "x$have_nativetls" != "xyes" &&
  433. test "x$have_libnettle" != "xyes"; then
  434. AM_PATH_LIBGCRYPT([1.2.4], [have_libgcrypt=yes])
  435. if test "x$have_libgcrypt" = "xyes"; then
  436. AC_DEFINE([HAVE_LIBGCRYPT], [1], [Define to 1 if you have libgcrypt.])
  437. LIBS="$LIBGCRYPT_LIBS $LIBS"
  438. CPPFLAGS="$LIBGCRYPT_CFLAGS $CPPFLAGS"
  439. fi
  440. fi
  441. fi
  442. if test "x$with_libcares" = "xyes"; then
  443. PKG_CHECK_MODULES([LIBCARES], [libcares >= 1.7.0], [have_libcares=yes],
  444. [have_libcares=no])
  445. if test "x$have_libcares" = "xyes"; then
  446. AC_DEFINE([HAVE_LIBCARES], [1], [Define to 1 if you have libcares.])
  447. LIBS="$LIBCARES_LIBS $LIBS"
  448. CPPFLAGS="$LIBCARES_CFLAGS $CPPFLAGS"
  449. AC_CHECK_TYPES([ares_addr_node], [], [], [[#include <ares.h>]])
  450. AC_CHECK_FUNCS([ares_set_servers])
  451. if test "x$ARIA2_STATIC" = "xyes"; then
  452. CPPFLAGS="-DCARES_STATICLIB $CPPFLAGS"
  453. fi
  454. else
  455. AC_MSG_WARN([$LIBCARES_PKG_ERRORS])
  456. if test "x$with_libcares_requested" = "xyes"; then
  457. ARIA2_DEP_NOT_MET([libcares])
  458. fi
  459. fi
  460. fi
  461. use_md=""
  462. if test "x$have_appletls" = "xyes"; then
  463. use_md="apple"
  464. AC_DEFINE([USE_APPLE_MD], [1], [What message digest implementation to use])
  465. else
  466. if test "x$have_libnettle" = "xyes"; then
  467. AC_DEFINE([USE_LIBNETTLE_MD], [1], [What message digest implementation to use])
  468. use_md="libnettle"
  469. else
  470. if test "x$have_libgcrypt" = "xyes"; then
  471. AC_DEFINE([USE_LIBGCRYPT_MD], [1], [What message digest implementation to use])
  472. use_md="libgcrypt"
  473. else
  474. if test "x$have_openssl" = "xyes"; then
  475. AC_DEFINE([USE_OPENSSL_MD], [1], [What message digest implementation to use])
  476. use_md="openssl"
  477. else
  478. AC_DEFINE([USE_INTERNAL_MD], [1], [What message digest implementation to use])
  479. use_md="internal"
  480. fi
  481. fi
  482. fi
  483. fi
  484. # Define variables based on the result of the checks for libraries.
  485. if test "x$have_ssl" = "xyes"; then
  486. AC_DEFINE([ENABLE_SSL], [1], [Define to 1 if ssl support is enabled.])
  487. AM_CONDITIONAL([ENABLE_SSL], true)
  488. else
  489. have_ssl="no"
  490. AM_CONDITIONAL([ENABLE_SSL], false)
  491. fi
  492. AM_CONDITIONAL([HAVE_OSX], [ test "x$have_osx" = "xyes" ])
  493. AM_CONDITIONAL([HAVE_APPLETLS], [ test "x$have_appletls" = "xyes" ])
  494. AM_CONDITIONAL([HAVE_WINTLS], [ test "x$have_wintls" = "xyes" ])
  495. AM_CONDITIONAL([USE_APPLE_MD], [ test "x$use_md" = "xapple" ])
  496. AM_CONDITIONAL([USE_WINDOWS_MD], [ test "x$use_md" = "xwindows" ])
  497. AM_CONDITIONAL([HAVE_LIBGNUTLS], [ test "x$have_libgnutls" = "xyes" ])
  498. AM_CONDITIONAL([HAVE_LIBNETTLE], [ test "x$have_libnettle" = "xyes" ])
  499. AM_CONDITIONAL([USE_LIBNETTLE_MD], [ test "x$use_md" = "xlibnettle"])
  500. AM_CONDITIONAL([HAVE_LIBGMP], [ test "x$have_libgmp" = "xyes" ])
  501. AM_CONDITIONAL([HAVE_LIBGCRYPT], [ test "x$have_libgcrypt" = "xyes" ])
  502. AM_CONDITIONAL([USE_LIBGCRYPT_MD], [ test "x$use_md" = "xlibgcrypt"])
  503. AM_CONDITIONAL([HAVE_OPENSSL], [ test "x$have_openssl" = "xyes" ])
  504. AM_CONDITIONAL([USE_OPENSSL_MD], [ test "x$use_md" = "xopenssl"])
  505. AM_CONDITIONAL([USE_INTERNAL_MD], [ test "x$use_md" = "xinternal"])
  506. if test "x$have_libgmp" = "xyes" ||
  507. test "x$have_libgcrypt" = "xyes" ||
  508. test "x$have_openssl" = "xyes"; then
  509. AM_CONDITIONAL([USE_INTERNAL_BIGNUM], false)
  510. else
  511. AC_DEFINE([USE_INTERNAL_BIGNUM], [1], [Define to 1 if internal BIGNUM support is enabled.])
  512. AM_CONDITIONAL([USE_INTERNAL_BIGNUM], true)
  513. fi
  514. if test "x$have_libnettle" = "xyes" ||
  515. test "x$have_libgcrypt" = "xyes" ||
  516. test "x$have_openssl" = "xyes"; then
  517. AM_CONDITIONAL([USE_INTERNAL_ARC4], false)
  518. else
  519. AC_DEFINE([USE_INTERNAL_ARC4], [1], [Define to 1 if internal ARC4 support is enabled.])
  520. AM_CONDITIONAL([USE_INTERNAL_ARC4], true)
  521. fi
  522. if test "x$enable_bittorrent" = "xyes"; then
  523. AC_DEFINE([ENABLE_BITTORRENT], [1],
  524. [Define to 1 if BitTorrent support is enabled.])
  525. AM_CONDITIONAL([ENABLE_BITTORRENT], true)
  526. else
  527. if test "x$enable_bittorrent_requested" = "xyes"; then
  528. ARIA2_FET_NOT_SUPPORTED([bittorrent])
  529. fi
  530. enable_bittorrent=no
  531. AM_CONDITIONAL([ENABLE_BITTORRENT], false)
  532. fi
  533. if (test "x$have_libxml2" = "xyes" || test "x$have_libexpat" = "xyes") &&
  534. test "x$enable_metalink" = "xyes"; then
  535. AC_DEFINE([ENABLE_METALINK], [1],
  536. [Define to 1 if Metalink support is enabled.])
  537. AM_CONDITIONAL([ENABLE_METALINK], true)
  538. else
  539. if test "x$enable_metalink_requested" = "xyes"; then
  540. ARIA2_FET_NOT_SUPPORTED([metalink])
  541. fi
  542. enable_metalink=no
  543. AM_CONDITIONAL([ENABLE_METALINK], false)
  544. fi
  545. AM_CONDITIONAL([HAVE_SOME_XMLLIB],
  546. [test "x$have_libxml2" = "xyes" || test "x$have_libexpat" = "xyes"])
  547. if test "x$have_libxml2" = "xyes" || test "x$have_libexpat" = "xyes"; then
  548. enable_xml_rpc=yes
  549. fi
  550. if test "x$enable_xml_rpc" = "xyes"; then
  551. AC_DEFINE([ENABLE_XML_RPC], [1],
  552. [Define to 1 if XML-RPC support is enabled.])
  553. fi
  554. AM_CONDITIONAL([ENABLE_XML_RPC], [test "x$enable_xml_rpc" = "xyes"])
  555. AM_CONDITIONAL([HAVE_LIBXML2], [test "x$have_libxml2" = "xyes"])
  556. AM_CONDITIONAL([HAVE_LIBEXPAT], [test "x$have_libexpat" = "xyes"])
  557. if test "x$have_libcares" = "xyes"; then
  558. AC_DEFINE([ENABLE_ASYNC_DNS], [1],
  559. [Define to 1 if asynchronous DNS support is enabled.])
  560. AM_CONDITIONAL([ENABLE_ASYNC_DNS], true)
  561. else
  562. AM_CONDITIONAL([ENABLE_ASYNC_DNS], false)
  563. fi
  564. # Set conditional for libz
  565. AM_CONDITIONAL([HAVE_ZLIB], [test "x$have_zlib" = "xyes"])
  566. # Set conditional for sqlite3
  567. AM_CONDITIONAL([HAVE_SQLITE3], [test "x$have_sqlite3" = "xyes"])
  568. # Set conditional for libssh2
  569. AM_CONDITIONAL([HAVE_LIBSSH2], [test "x$have_libssh2" = "xyes"])
  570. AC_SEARCH_LIBS([clock_gettime], [rt])
  571. case "$host" in
  572. *solaris*)
  573. AC_SEARCH_LIBS([getaddrinfo], [nsl socket])
  574. ;;
  575. esac
  576. # Checks for header files.
  577. AC_FUNC_ALLOCA
  578. AC_HEADER_STDC
  579. AC_CHECK_HEADERS([argz.h \
  580. arpa/inet.h \
  581. fcntl.h \
  582. float.h \
  583. inttypes.h \
  584. langinfo.h \
  585. libintl.h \
  586. limits.h \
  587. locale.h \
  588. malloc.h \
  589. netdb.h \
  590. netinet/in.h \
  591. netinet/tcp.h \
  592. poll.h \
  593. port.h \
  594. signal.h \
  595. stddef.h \
  596. stdint.h \
  597. stdio_ext.h \
  598. stdlib.h \
  599. string.h \
  600. strings.h \
  601. sys/ioctl.h \
  602. sys/param.h \
  603. sys/resource.h \
  604. sys/signal.h \
  605. sys/socket.h \
  606. sys/time.h \
  607. sys/types.h \
  608. sys/uio.h \
  609. sys/utsname.h \
  610. termios.h \
  611. unistd.h \
  612. utime.h \
  613. wchar.h \
  614. ifaddrs.h \
  615. pwd.h])
  616. # Checks for typedefs, structures, and compiler characteristics.
  617. AC_HEADER_STDBOOL
  618. AC_C_CONST
  619. AC_C_INLINE
  620. AC_TYPE_INT16_T
  621. AC_TYPE_INT32_T
  622. AC_TYPE_INT64_T
  623. AC_TYPE_INT8_T
  624. AC_TYPE_MODE_T
  625. AC_TYPE_OFF_T
  626. AC_TYPE_SIZE_T
  627. AC_TYPE_SSIZE_T
  628. AC_HEADER_TIME
  629. AC_STRUCT_TM
  630. AC_TYPE_UINT16_T
  631. AC_TYPE_UINT32_T
  632. AC_TYPE_UINT64_T
  633. AC_TYPE_UINT8_T
  634. AC_TYPE_PID_T
  635. AC_C_VOLATILE
  636. AC_CHECK_TYPES([ptrdiff_t])
  637. AC_CHECK_TYPE([struct timespec], [have_timespec=yes], [have_timespec=no])
  638. AC_C_BIGENDIAN
  639. AC_SYS_LARGEFILE
  640. if test "x$have_timespec" = "xyes"; then
  641. AC_DEFINE([HAVE_A2_STRUCT_TIMESPEC], [1],
  642. [Define to 1 if the system has the type `struct timespec'.])
  643. fi
  644. # Checks for library functions.
  645. AM_GNU_GETTEXT([external])
  646. AM_GNU_GETTEXT_VERSION([0.18])
  647. AC_FUNC_ERROR_AT_LINE
  648. AC_PROG_GCC_TRADITIONAL
  649. AC_FUNC_MEMCMP
  650. AC_FUNC_MKTIME
  651. AC_FUNC_SELECT_ARGTYPES
  652. AC_FUNC_STAT
  653. AC_FUNC_STRFTIME
  654. AC_FUNC_VPRINTF
  655. AC_FUNC_FORK
  656. AC_FUNC_STRTOD
  657. # Don't use AC_FUNC_MMAP becaue it fails on some platforms (e.g.,
  658. # OpenWRT) which have mmap and it works in the way we use in aria2.
  659. # Instead use mmap in AC_CHECK_FUNCS list.
  660. AC_CHECK_FUNCS([__argz_count \
  661. __argz_next \
  662. __argz_stringify \
  663. atexit \
  664. ftruncate \
  665. getcwd \
  666. gethostbyaddr \
  667. gethostbyname \
  668. getifaddrs \
  669. getpagesize \
  670. getrandom \
  671. memchr \
  672. memmove \
  673. mempcpy \
  674. memset \
  675. mkdir \
  676. mmap \
  677. munmap \
  678. nl_langinfo \
  679. posix_fadvise \
  680. posix_memalign \
  681. pow \
  682. putenv \
  683. rmdir \
  684. select \
  685. setlocale \
  686. sigaction \
  687. sleep \
  688. socket \
  689. stpcpy \
  690. strcasecmp \
  691. strchr \
  692. strcspn \
  693. strdup \
  694. strerror \
  695. strncasecmp \
  696. strstr \
  697. strtol \
  698. strtoul \
  699. strtoull \
  700. tzset \
  701. unsetenv \
  702. usleep \
  703. utime \
  704. utimes])
  705. AC_MSG_CHECKING([for getrandom linux syscall interface])
  706. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  707. #include <sys/syscall.h>
  708. #include <linux/random.h>
  709. ]],
  710. [[
  711. int x = GRND_NONBLOCK;
  712. int y = (int)SYS_getrandom;
  713. ]])],
  714. [have_getrandom_interface=yes
  715. AC_DEFINE([HAVE_GETRANDOM_INTERFACE], [1], [Define to 1 if getrandom linux syscall interface is available.])],
  716. [have_getrandom_interface=no])
  717. AC_MSG_RESULT([$have_getrandom_interface])
  718. AM_CONDITIONAL([HAVE_GETRANDOM_INTERFACE], [test "x$have_getrandom_interface" = "xyes"])
  719. dnl Put tcmalloc/jemalloc checks after the posix_memalign check.
  720. dnl These libraries may implement posix_memalign, while the usual CRT may not
  721. dnl (e.g. mingw). Since we aren't including the corresponding library headers
  722. dnl this will lead to undefined posix_memalign() errors when compiling
  723. if test "x$with_tcmalloc_requested" = "xyes" &&
  724. test "x$with_jemalloc_requested" = "xyes"; then
  725. AC_MSG_FAILURE([Cannot use both, tcmalloc and jemalloc!])
  726. fi
  727. if test "x$with_tcmalloc" = "xyes"; then
  728. dnl Important: put malloc libs at the very end.
  729. dnl Only newish versions have a .pc, thus try CHECK_LIB as well.
  730. PKG_CHECK_MODULES([TCMALLOC], [libtcmalloc_minimal], [have_tcmalloc=yes], [have_tcmalloc=no])
  731. if test "x$have_tcmalloc" = "xyes"; then
  732. CPPFLAGS="$TCMALLOC_CFLAGS $CPPFLAGS"
  733. LIBS="$LIBS $TCMALLOC_LIBS"
  734. else
  735. AC_CHECK_LIB([tcmalloc_minimal], [malloc], [have_tcmalloc=yes], [have_tcmalloc=no])
  736. if test "x$have_tcmalloc" = "xyes"; then
  737. LIBS="$LIBS -ltcmalloc_minimal"
  738. else
  739. if test "x$with_tcmalloc_requested" = "xyes"; then
  740. ARIA2_DEP_NOT_MET([tcmalloc_minimal])
  741. fi
  742. fi
  743. fi
  744. fi
  745. if test "x$have_tcmalloc" != "xyes" && test "x$with_jemalloc" = "xyes"; then
  746. dnl Important: put malloc libs at the very end.
  747. dnl Usually jemalloc does not come with a .pc, as the official source does not
  748. dnl generate one.
  749. PKG_CHECK_MODULES([JEMALLOC], [jemalloc], [have_jemalloc=yes], [have_jemalloc=no])
  750. if test "x$have_jemalloc" = "xyes"; then
  751. CPPFLAGS="$JEMALLOC_CFLAGS $CPPFLAGS"
  752. LIBS="$LIBS $JEMALLOC_LIBS"
  753. else
  754. AC_CHECK_LIB([jemalloc], [malloc], [have_jemalloc=yes], [have_jemalloc=no])
  755. if test "x$have_jemalloc" = "xyes"; then
  756. LIBS="$LIBS -ljemalloc"
  757. else
  758. if test "x$with_jemalloc_requested" = "xyes"; then
  759. ARIA2_DEP_NOT_MET([jemalloc (unprefixed)])
  760. fi
  761. fi
  762. fi
  763. fi
  764. if test "x$enable_epoll" = "xyes"; then
  765. AC_CHECK_FUNCS([epoll_create], [have_epoll=yes])
  766. if test "x$have_epoll" = "xyes"; then
  767. AC_DEFINE([HAVE_EPOLL], [1], [Define to 1 if epoll is available.])
  768. fi
  769. fi
  770. AM_CONDITIONAL([HAVE_EPOLL], [test "x$have_epoll" = "xyes"])
  771. AC_CHECK_FUNCS([posix_fallocate],[have_posix_fallocate=yes])
  772. ARIA2_CHECK_FALLOCATE
  773. if test "x$have_posix_fallocate" = "xyes" ||
  774. test "x$have_fallocate" = "xyes" ||
  775. test "x$have_osx" = "xyes" ||
  776. test "x$win_build" = "xyes"; then
  777. AC_DEFINE([HAVE_SOME_FALLOCATE], [1],
  778. [Define to 1 if *_fallocate is available.])
  779. fi
  780. AM_CONDITIONAL([HAVE_SOME_FALLOCATE],
  781. [test "x$have_posix_fallocate" = "xyes" || test "x$have_fallocate" = "xyes" \
  782. || test "x$have_osx" = "xyes" || test "x$win_build" = "xyes"])
  783. AC_CHECK_FUNCS([asctime_r],
  784. [AM_CONDITIONAL([HAVE_ASCTIME_R], true)],
  785. [AM_CONDITIONAL([HAVE_ASCTIME_R], false)])
  786. AC_CHECK_FUNCS([basename],
  787. [AM_CONDITIONAL([HAVE_BASENAME], true)],
  788. [AM_CONDITIONAL([HAVE_BASENAME], false)])
  789. AC_CHECK_FUNCS([gai_strerror],
  790. [AM_CONDITIONAL([HAVE_GAI_STRERROR], true)],
  791. [AM_CONDITIONAL([HAVE_GAI_STRERROR], false)])
  792. AC_CHECK_FUNCS([getaddrinfo],
  793. [AM_CONDITIONAL([HAVE_GETADDRINFO], true)],
  794. [AM_CONDITIONAL([HAVE_GETADDRINFO], false)])
  795. AC_CHECK_FUNCS([gettimeofday],
  796. [AM_CONDITIONAL([HAVE_GETTIMEOFDAY], true)],
  797. [AM_CONDITIONAL([HAVE_GETTIMEOFDAY], false)])
  798. AC_CHECK_FUNCS([localtime_r],
  799. [AM_CONDITIONAL([HAVE_LOCALTIME_R], true)],
  800. [AM_CONDITIONAL([HAVE_LOCALTIME_R], false)])
  801. AC_CHECK_FUNCS([strptime],
  802. [AM_CONDITIONAL([HAVE_STRPTIME], true)],
  803. [AM_CONDITIONAL([HAVE_STRPTIME], false)])
  804. AC_CHECK_FUNCS([timegm],
  805. [AM_CONDITIONAL([HAVE_TIMEGM], true)],
  806. [AM_CONDITIONAL([HAVE_TIMEGM], false)])
  807. AC_CHECK_FUNCS([daemon], [have_daemon=yes])
  808. AM_CONDITIONAL([HAVE_DAEMON], [test "x$have_daemon" = "xyes"])
  809. AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes])
  810. if test "x$have_clock_gettime" != "xyes"; then
  811. AC_CHECK_FUNCS([mach_absolute_time], [have_mach_absolute_time=yes])
  812. fi
  813. AM_CONDITIONAL([HAVE_MACH_ABSOLUTE_TIME],
  814. [test "x$have_mach_absolute_time" = "xyes"])
  815. AC_CHECK_FUNCS([poll], [have_poll=yes])
  816. AM_CONDITIONAL([HAVE_POLL], [test "x$have_poll" = "xyes"])
  817. case "$host" in
  818. *mingw*)
  819. AM_CONDITIONAL([MINGW_BUILD], true)
  820. dnl defined in ws2tcpip.h, but only if _WIN32_WINNT >= 0x0501
  821. AM_CONDITIONAL([HAVE_GETADDRINFO], true)
  822. dnl defined in ws2tcpip.h, but missing in C:\mingw\lib\libws2_32.a
  823. AM_CONDITIONAL([HAVE_GAI_STRERROR], false)
  824. AM_CONDITIONAL([HAVE_TIMEGETTIME], [test "x$have_clock_gettime" != "xyes"])
  825. ;;
  826. *)
  827. AM_CONDITIONAL([MINGW_BUILD], false)
  828. AM_CONDITIONAL([HAVE_TIMEGETTIME], false)
  829. ;;
  830. esac
  831. AC_CHECK_FUNCS([port_associate], [have_port_associate=yes])
  832. AM_CONDITIONAL([HAVE_PORT_ASSOCIATE], [test "x$have_port_associate" = "xyes"])
  833. AC_CHECK_FUNCS([kqueue], [have_kqueue=yes])
  834. AM_CONDITIONAL([HAVE_KQUEUE], [test "x$have_kqueue" = "xyes"])
  835. if test "x$have_kqueue" = "xyes"; then
  836. AC_MSG_CHECKING([whether struct kevent.udata is intptr_t])
  837. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  838. #include <sys/types.h>
  839. #include <sys/event.h>
  840. #include <sys/time.h>
  841. ]],
  842. [[
  843. struct kevent event;
  844. event.udata = reinterpret_cast<intptr_t>(&event);
  845. ]])],
  846. [kevent_udata_intptr_t=yes], [kevent_udata_intptr_t=no])
  847. AC_MSG_RESULT([$kevent_udata_intptr_t])
  848. if test "x$kevent_udata_intptr_t" = "xyes"; then
  849. AC_DEFINE([KEVENT_UDATA_INTPTR_T], [1], [Define to 1 if struct kevent.udata is intptr_t])
  850. fi
  851. fi
  852. AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
  853. [AC_DEFINE([HAVE_SOCKADDR_IN_SIN_LEN],[1],
  854. [Define to 1 if struct sockaddr_in has sin_len member.])],
  855. [],
  856. [[
  857. #include <sys/types.h>
  858. #include <sys/socket.h>
  859. #include <netinet/in.h>
  860. ]])
  861. AC_CHECK_MEMBER([struct sockaddr_in6.sin6_len],
  862. [AC_DEFINE([HAVE_SOCKADDR_IN6_SIN6_LEN],[1],
  863. [Define to 1 if struct sockaddr_in6 has sin6_len member.])],
  864. [],
  865. [[
  866. #include <sys/types.h>
  867. #include <sys/socket.h>
  868. #include <netinet/in.h>
  869. ]])
  870. # Check struct option.name is assignable from const char*. struct
  871. # option.name in opensolaris is of type char*. In Linux, it is const
  872. # char*
  873. AC_MSG_CHECKING([whether struct option.name is assignable from const char*])
  874. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  875. #include <unistd.h>
  876. #include <getopt.h>
  877. ]],
  878. [[
  879. const char* s = "const char";
  880. option op;
  881. op.name = s;
  882. ]])],
  883. [have_option_const_name=yes], [have_option_const_name=no])
  884. AC_MSG_RESULT([$have_option_const_name])
  885. if test "x$have_option_const_name" = "xyes"; then
  886. AC_DEFINE([HAVE_OPTION_CONST_NAME], [1], [Define 1 if struct option.name is const char*])
  887. fi
  888. if test "x$enable_websocket" = "xyes"; then
  889. AC_CONFIG_SUBDIRS([deps/wslay])
  890. enable_websocket=yes
  891. AC_DEFINE([ENABLE_WEBSOCKET], [1],
  892. [Define 1 if WebSocket support is enabled.])
  893. WSLAY_LIBS="\$(top_builddir)/deps/wslay/lib/libwslay.la"
  894. AC_SUBST([WSLAY_LIBS])
  895. # $(top_srcdir) for `make distcheck`
  896. CPPFLAGS="-I\$(top_builddir)/deps/wslay/lib/includes -I\$(top_srcdir)/deps/wslay/lib/includes $CPPFLAGS"
  897. fi
  898. AM_CONDITIONAL([ENABLE_WEBSOCKET], [test "x$enable_websocket" = "xyes"])
  899. AM_CONDITIONAL([ENABLE_LIBARIA2], [test "x$enable_libaria2" = "xyes"])
  900. AC_SUBST([bashcompletiondir])
  901. case "$host" in
  902. *android*)
  903. android=yes
  904. LIBS="$LIBS -lstdc++ -lsupc++"
  905. case "$host" in
  906. arm-*)
  907. android_arm=yes
  908. ;;
  909. mipsel-*)
  910. android_mips=yes
  911. ;;
  912. i686-*)
  913. android_x86=yes
  914. ;;
  915. esac
  916. ;;
  917. *)
  918. ;;
  919. esac
  920. AM_CONDITIONAL([ANDROID], [test "x$android" = "xyes"])
  921. AM_CONDITIONAL([ANDROID_ARM], [test "x$android_arm" = "xyes"])
  922. AM_CONDITIONAL([ANDROID_MIPS], [test "x$android_mips" = "xyes"])
  923. AM_CONDITIONAL([ANDROID_X86], [test "x$android_x86" = "xyes"])
  924. if test "x$ARIA2_STATIC" = "xyes"; then
  925. # -static-libgcc and -static-libstdc++ are linker flags and not for
  926. # libtool.
  927. LDFLAGS="$LDFLAGS -all-static"
  928. dnl For non-MinGW build, we need additional libs for static build.
  929. case "$host" in
  930. *mingw*|*msvc*|*darwin*)
  931. ;;
  932. *)
  933. LIBS="$LIBS -lpthread -ldl -lrt"
  934. ;;
  935. esac
  936. fi
  937. if test "x$win_build" = "xyes" && test "x$enable_libaria2" = "xyes"; then
  938. # Creating dll needs this
  939. LDFLAGS="$LDFLAGS -no-undefined"
  940. fi
  941. AC_CONFIG_FILES([Makefile
  942. src/Makefile
  943. src/libaria2.pc
  944. src/includes/Makefile
  945. test/Makefile
  946. po/Makefile.in
  947. lib/Makefile
  948. doc/Makefile
  949. doc/manual-src/Makefile
  950. doc/manual-src/en/Makefile
  951. doc/manual-src/en/conf.py
  952. doc/manual-src/ru/Makefile
  953. doc/manual-src/ru/conf.py
  954. doc/manual-src/pt/Makefile
  955. doc/manual-src/pt/conf.py
  956. deps/Makefile])
  957. AC_OUTPUT
  958. echo " "
  959. echo "Build: $build"
  960. echo "Host: $host"
  961. echo "Target: $target"
  962. echo "Install prefix: $prefix"
  963. echo "CC: $CC"
  964. echo "CXX: $CXX"
  965. echo "CPP: $CPP"
  966. echo "CXXFLAGS: $CXXFLAGS"
  967. echo "CFLAGS: $CFLAGS"
  968. echo "CPPFLAGS: $CPPFLAGS"
  969. echo "LDFLAGS: $LDFLAGS"
  970. echo "LIBS: $LIBS"
  971. echo "DEFS: $DEFS"
  972. echo "LibUV: $have_libuv"
  973. echo "SQLite3: $have_sqlite3"
  974. echo "SSL Support: $have_ssl"
  975. echo "AppleTLS: $have_appletls"
  976. echo "WinTLS: $have_wintls"
  977. echo "GnuTLS: $have_libgnutls"
  978. echo "OpenSSL: $have_openssl"
  979. echo "CA Bundle: $ca_bundle"
  980. echo "LibXML2: $have_libxml2"
  981. echo "LibExpat: $have_libexpat"
  982. echo "LibCares: $have_libcares"
  983. echo "Zlib: $have_zlib"
  984. echo "Libssh2: $have_libssh2"
  985. echo "Epoll: $have_epoll"
  986. echo "Bittorrent: $enable_bittorrent"
  987. echo "Metalink: $enable_metalink"
  988. echo "XML-RPC: $enable_xml_rpc"
  989. echo "Message Digest: $use_md"
  990. echo "WebSocket: $enable_websocket"
  991. echo "Libaria2: $enable_libaria2"
  992. if test "x$enable_libaria2" = "xyes"; then
  993. echo "Library types: Shared=${enable_shared}, Static=${enable_static}"
  994. fi
  995. echo "bash_completion dir: $bashcompletiondir"
  996. echo "Static build: $ARIA2_STATIC"