configure.ac 33 KB

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