configure.ac 32 KB

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