configure.ac 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096
  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. # Define _POSIX_C_SOURCE to 1. This makes {asc,local}time_r available
  27. # from <time.h> even without (un)helpful interference from <pthread.h>,
  28. # and also defines __USE_MINGW_ANSI_STDIO.
  29. CPPFLAGS="-D_POSIX_C_SOURCE=1 $CPPFLAGS"
  30. # Build with ASLR (dynamicbase) and NX compatiblity (nxcompat)
  31. # Enable pie once upstream/binutils gets fixed to produce correct binaries with it.
  32. LDFLAGS="$LDFLAGS -Wl,--dynamicbase -Wl,--nxcompat"
  33. ;;
  34. esac
  35. AC_DEFINE_UNQUOTED([BUILD], ["$build"], [Define build-type])
  36. AC_DEFINE_UNQUOTED([HOST], ["$host"], [Define build-type])
  37. AC_DEFINE_UNQUOTED([TARGET], ["$target"], [Define target-type])
  38. # Checks for arguments.
  39. ARIA2_ARG_WITH([libuv])
  40. ARIA2_ARG_WITHOUT([appletls])
  41. ARIA2_ARG_WITHOUT([wintls])
  42. ARIA2_ARG_WITHOUT([gnutls])
  43. ARIA2_ARG_WITHOUT([libnettle])
  44. ARIA2_ARG_WITHOUT([libgmp])
  45. ARIA2_ARG_WITHOUT([libgcrypt])
  46. ARIA2_ARG_WITHOUT([openssl])
  47. ARIA2_ARG_WITHOUT([sqlite3])
  48. ARIA2_ARG_WITHOUT([libxml2])
  49. ARIA2_ARG_WITHOUT([libexpat])
  50. ARIA2_ARG_WITHOUT([libcares])
  51. ARIA2_ARG_WITHOUT([libz])
  52. ARIA2_ARG_WITH([tcmalloc])
  53. ARIA2_ARG_WITH([jemalloc])
  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. case "$host" in
  268. *darwin*)
  269. have_osx="yes"
  270. ;;
  271. *mingw*)
  272. AC_CHECK_HEADERS([windows.h \
  273. winsock2.h \
  274. ws2tcpip.h \
  275. mmsystem.h \
  276. io.h \
  277. iphlpapi.h\
  278. winioctl.h \
  279. share.h], [], [],
  280. [[
  281. #ifdef HAVE_WS2TCPIP_H
  282. # include <ws2tcpip.h>
  283. #endif
  284. #ifdef HAVE_WINSOCK2_H
  285. # include <winsock2.h>
  286. #endif
  287. #ifdef HAVE_WINDOWS_H
  288. # include <windows.h>
  289. #endif
  290. ]])
  291. ;;
  292. esac
  293. if test "x$enable_ssl" != "xyes"; then
  294. with_appletls=no
  295. with_wintls=no
  296. with_libnettle=no
  297. with_libgcrypt=no
  298. with_gnutls=no
  299. with_openssl=no
  300. fi
  301. if test "x$with_appletls" = "xyes"; then
  302. AC_MSG_CHECKING([whether to enable Mac OS X native SSL/TLS])
  303. if test "x$have_osx" = "xyes"; then
  304. AC_DEFINE([HAVE_APPLETLS], [1], [Define to 1 if you have Apple TLS])
  305. LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security"
  306. have_appletls="yes"
  307. have_ssl=yes
  308. have_nativetls=yes
  309. AC_MSG_RESULT(yes)
  310. else
  311. AC_MSG_RESULT(no)
  312. if test "x$with_appletls_requested" = "xyes"; then
  313. ARIA2_DEP_NOT_MET([appletls])
  314. fi
  315. fi
  316. fi
  317. if test "x$with_wintls" = "xyes"; then
  318. AC_HAVE_LIBRARY([crypt32],[have_wintls_libs=yes],[have_wintls_libs=no])
  319. AC_HAVE_LIBRARY([secur32],[have_wintls_libs=$have_wintls_libs],[have_wintls_libs=no])
  320. AC_HAVE_LIBRARY([advapi32],[have_wintls_libs=$have_wintls_libs],[have_wintls_libs=no])
  321. AC_CHECK_HEADER([wincrypt.h], [have_wintls_headers=yes], [have_wintls_headers=no], [[
  322. #ifdef HAVE_WINDOWS_H
  323. # include <windows.h>
  324. #endif
  325. ]])
  326. AC_CHECK_HEADER([security.h], [have_wintls_headers=$have_wintls_headers], [have_wintls_headers=no], [[
  327. #ifdef HAVE_WINDOWS_H
  328. # include <windows.h>
  329. #endif
  330. #ifndef SECURITY_WIN32
  331. #define SECURITY_WIN32 1
  332. #endif
  333. ]])
  334. if test "x$have_wintls_libs" = "xyes" &&
  335. test "x$have_wintls_headers" = "xyes"; then
  336. AC_DEFINE([SECURITY_WIN32], [1], [Use security.h in WIN32 mode])
  337. LIBS="$LIBS -lcrypt32 -lsecur32 -ladvapi32"
  338. have_wintls=yes
  339. have_ssl=yes
  340. have_nativetls=yes
  341. else
  342. have_wintls=no
  343. fi
  344. if test "x$have_wintls" != "xyes"; then
  345. if test "x$with_wintls_requested" = "xyes"; then
  346. ARIA2_DEP_NOT_MET([wintls])
  347. fi
  348. fi
  349. fi
  350. if test "x$with_gnutls" = "xyes" && test "x$have_ssl" != "xyes"; then
  351. # gnutls >= 2.8 doesn't have libgnutls-config anymore. We require
  352. # 2.2.0 because we use gnutls_priority_set_direct()
  353. PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.2.0],
  354. [have_libgnutls=yes], [have_libgnutls=no])
  355. if test "x$have_libgnutls" = "xyes"; then
  356. have_ssl=yes
  357. AC_DEFINE([HAVE_LIBGNUTLS], [1], [Define to 1 if you have libgnutls.])
  358. LIBS="$LIBGNUTLS_LIBS $LIBS"
  359. CPPFLAGS="$LIBGNUTLS_CFLAGS $CPPFLAGS"
  360. AC_CHECK_FUNCS([gnutls_certificate_set_x509_system_trust])
  361. else
  362. AC_MSG_WARN([$LIBGNUTLS_PKG_ERRORS])
  363. if test "x$with_gnutls_requested" = "xyes"; then
  364. ARIA2_DEP_NOT_MET([gnutls])
  365. fi
  366. fi
  367. fi
  368. if test "x$with_openssl" = "xyes" && test "x$have_ssl" != "xyes"; then
  369. PKG_CHECK_MODULES([OPENSSL], [openssl >= 0.9.8],
  370. [have_openssl=yes], [have_openssl=no])
  371. if test "x$have_openssl" = "xyes"; then
  372. have_ssl=yes
  373. AC_DEFINE([HAVE_OPENSSL], [1], [Define to 1 if you have openssl.])
  374. LIBS="$OPENSSL_LIBS $LIBS"
  375. CPPFLAGS="$OPENSSL_CFLAGS $CPPFLAGS"
  376. AC_CHECK_FUNCS([EVP_DigestInit_ex], [have_digestinit_ex=yes])
  377. if test "x$have_digestinit_ex" = "x"; then
  378. AC_DEFINE([HAVE_OLD_OPENSSL], [1], [Define to 1 if you have old openssl.])
  379. fi
  380. AC_CHECK_FUNCS([EVP_sha224])
  381. AC_CHECK_FUNCS([EVP_sha256])
  382. AC_CHECK_FUNCS([EVP_sha384])
  383. AC_CHECK_FUNCS([EVP_sha512])
  384. else
  385. AC_MSG_WARN([$OPENSSL_PKG_ERRORS])
  386. if test "x$with_openssl_requested" = "xyes"; then
  387. ARIA2_DEP_NOT_MET([openssl])
  388. fi
  389. fi
  390. fi
  391. if test "x$have_openssl" != "xyes"; then
  392. if test "x$with_libnettle" = "xyes" &&
  393. test "x$have_nativetls" != "xyes"; then
  394. AC_SEARCH_LIBS([nettle_sha1_init], [nettle],
  395. [have_libnettle=yes], [have_libnettle=no])
  396. if test "x$have_libnettle" = "xyes"; then
  397. AC_DEFINE([HAVE_LIBNETTLE], [1], [Define to 1 if you have libnettle.])
  398. fi
  399. fi
  400. if test "x$with_libgmp" = "xyes" &&
  401. (test "x$have_libnettle" = "xyes" ||
  402. test "x$have_nativetls" = "xyes") &&
  403. test "x$enable_bittorrent" = "xyes"; then
  404. AC_SEARCH_LIBS([__gmpz_init], [gmp], [have_libgmp=yes], [have_libgmp=no])
  405. if test "x$have_libgmp" = "xyes"; then
  406. AC_DEFINE([HAVE_LIBGMP], [1], [Define to 1 if you have libgmp.])
  407. AC_CHECK_FUNCS([__gmpz_powm_sec], [have_mpz_powm_sec=yes])
  408. if test "x$have_mpz_powm_sec" = "xyes"; then
  409. AC_DEFINE([HAVE_GMP_SEC], [1], [Define to 1 if you have a GMP with sec functions.])
  410. fi
  411. else
  412. AC_MSG_WARN([libgmp not found])
  413. if test "x$with_libgmp_requested" = "xyes"; then
  414. ARIA2_DEP_NOT_MET([libgmp])
  415. fi
  416. fi
  417. fi
  418. if test "x$with_libgcrypt" = "xyes" &&
  419. test "x$have_nativetls" != "xyes" &&
  420. test "x$have_libnettle" != "xyes"; then
  421. AM_PATH_LIBGCRYPT([1.2.4], [have_libgcrypt=yes])
  422. if test "x$have_libgcrypt" = "xyes"; then
  423. AC_DEFINE([HAVE_LIBGCRYPT], [1], [Define to 1 if you have libgcrypt.])
  424. LIBS="$LIBGCRYPT_LIBS $LIBS"
  425. CPPFLAGS="$LIBGCRYPT_CFLAGS $CPPFLAGS"
  426. fi
  427. fi
  428. fi
  429. if test "x$with_libcares" = "xyes"; then
  430. PKG_CHECK_MODULES([LIBCARES], [libcares >= 1.7.0], [have_libcares=yes],
  431. [have_libcares=no])
  432. if test "x$have_libcares" = "xyes"; then
  433. AC_DEFINE([HAVE_LIBCARES], [1], [Define to 1 if you have libcares.])
  434. LIBS="$LIBCARES_LIBS $LIBS"
  435. CPPFLAGS="$LIBCARES_CFLAGS $CPPFLAGS"
  436. AC_CHECK_TYPES([ares_addr_node], [], [], [[#include <ares.h>]])
  437. AC_CHECK_FUNCS([ares_set_servers])
  438. if test "x$ARIA2_STATIC" = "xyes"; then
  439. CPPFLAGS="-DCARES_STATICLIB $CPPFLAGS"
  440. fi
  441. else
  442. AC_MSG_WARN([$LIBCARES_PKG_ERRORS])
  443. if test "x$with_libcares_requested" = "xyes"; then
  444. ARIA2_DEP_NOT_MET([libcares])
  445. fi
  446. fi
  447. fi
  448. use_md=""
  449. if test "x$have_appletls" = "xyes"; then
  450. use_md="apple"
  451. AC_DEFINE([USE_APPLE_MD], [1], [What message digest implementation to use])
  452. else
  453. if test "x$have_libnettle" = "xyes"; then
  454. AC_DEFINE([USE_LIBNETTLE_MD], [1], [What message digest implementation to use])
  455. use_md="libnettle"
  456. else
  457. if test "x$have_libgcrypt" = "xyes"; then
  458. AC_DEFINE([USE_LIBGCRYPT_MD], [1], [What message digest implementation to use])
  459. use_md="libgcrypt"
  460. else
  461. if test "x$have_openssl" = "xyes"; then
  462. AC_DEFINE([USE_OPENSSL_MD], [1], [What message digest implementation to use])
  463. use_md="openssl"
  464. else
  465. AC_DEFINE([USE_INTERNAL_MD], [1], [What message digest implementation to use])
  466. use_md="internal"
  467. fi
  468. fi
  469. fi
  470. fi
  471. # Define variables based on the result of the checks for libraries.
  472. if test "x$have_ssl" = "xyes"; then
  473. AC_DEFINE([ENABLE_SSL], [1], [Define to 1 if ssl support is enabled.])
  474. AM_CONDITIONAL([ENABLE_SSL], true)
  475. else
  476. have_ssl="no"
  477. AM_CONDITIONAL([ENABLE_SSL], false)
  478. fi
  479. AM_CONDITIONAL([HAVE_OSX], [ test "x$have_osx" = "xyes" ])
  480. AM_CONDITIONAL([HAVE_APPLETLS], [ test "x$have_appletls" = "xyes" ])
  481. AM_CONDITIONAL([HAVE_WINTLS], [ test "x$have_wintls" = "xyes" ])
  482. AM_CONDITIONAL([USE_APPLE_MD], [ test "x$use_md" = "xapple" ])
  483. AM_CONDITIONAL([USE_WINDOWS_MD], [ test "x$use_md" = "xwindows" ])
  484. AM_CONDITIONAL([HAVE_LIBGNUTLS], [ test "x$have_libgnutls" = "xyes" ])
  485. AM_CONDITIONAL([HAVE_LIBNETTLE], [ test "x$have_libnettle" = "xyes" ])
  486. AM_CONDITIONAL([USE_LIBNETTLE_MD], [ test "x$use_md" = "xlibnettle"])
  487. AM_CONDITIONAL([HAVE_LIBGMP], [ test "x$have_libgmp" = "xyes" ])
  488. AM_CONDITIONAL([HAVE_LIBGCRYPT], [ test "x$have_libgcrypt" = "xyes" ])
  489. AM_CONDITIONAL([USE_LIBGCRYPT_MD], [ test "x$use_md" = "xlibgcrypt"])
  490. AM_CONDITIONAL([HAVE_OPENSSL], [ test "x$have_openssl" = "xyes" ])
  491. AM_CONDITIONAL([USE_OPENSSL_MD], [ test "x$use_md" = "xopenssl"])
  492. AM_CONDITIONAL([USE_INTERNAL_MD], [ test "x$use_md" = "xinternal"])
  493. if test "x$have_libgmp" = "xyes" ||
  494. test "x$have_libgcrypt" = "xyes" ||
  495. test "x$have_openssl" = "xyes"; then
  496. AM_CONDITIONAL([USE_INTERNAL_BIGNUM], false)
  497. else
  498. AC_DEFINE([USE_INTERNAL_BIGNUM], [1], [Define to 1 if internal BIGNUM support is enabled.])
  499. AM_CONDITIONAL([USE_INTERNAL_BIGNUM], true)
  500. fi
  501. if test "x$have_libnettle" = "xyes" ||
  502. test "x$have_libgcrypt" = "xyes" ||
  503. test "x$have_openssl" = "xyes"; then
  504. AM_CONDITIONAL([USE_INTERNAL_ARC4], false)
  505. else
  506. AC_DEFINE([USE_INTERNAL_ARC4], [1], [Define to 1 if internal ARC4 support is enabled.])
  507. AM_CONDITIONAL([USE_INTERNAL_ARC4], true)
  508. fi
  509. if test "x$enable_bittorrent" = "xyes"; then
  510. AC_DEFINE([ENABLE_BITTORRENT], [1],
  511. [Define to 1 if BitTorrent support is enabled.])
  512. AM_CONDITIONAL([ENABLE_BITTORRENT], true)
  513. else
  514. if test "x$enable_bittorrent_requested" = "xyes"; then
  515. ARIA2_FET_NOT_SUPPORTED([bittorrent])
  516. fi
  517. enable_bittorrent=no
  518. AM_CONDITIONAL([ENABLE_BITTORRENT], false)
  519. fi
  520. if (test "x$have_libxml2" = "xyes" || test "x$have_libexpat" = "xyes") &&
  521. test "x$enable_metalink" = "xyes"; then
  522. AC_DEFINE([ENABLE_METALINK], [1],
  523. [Define to 1 if Metalink support is enabled.])
  524. AM_CONDITIONAL([ENABLE_METALINK], true)
  525. else
  526. if test "x$enable_metalink_requested" = "xyes"; then
  527. ARIA2_FET_NOT_SUPPORTED([metalink])
  528. fi
  529. enable_metalink=no
  530. AM_CONDITIONAL([ENABLE_METALINK], false)
  531. fi
  532. AM_CONDITIONAL([HAVE_SOME_XMLLIB],
  533. [test "x$have_libxml2" = "xyes" || test "x$have_libexpat" = "xyes"])
  534. if test "x$have_libxml2" = "xyes" || test "x$have_libexpat" = "xyes"; then
  535. enable_xml_rpc=yes
  536. fi
  537. if test "x$enable_xml_rpc" = "xyes"; then
  538. AC_DEFINE([ENABLE_XML_RPC], [1],
  539. [Define to 1 if XML-RPC support is enabled.])
  540. fi
  541. AM_CONDITIONAL([ENABLE_XML_RPC], [test "x$enable_xml_rpc" = "xyes"])
  542. AM_CONDITIONAL([HAVE_LIBXML2], [test "x$have_libxml2" = "xyes"])
  543. AM_CONDITIONAL([HAVE_LIBEXPAT], [test "x$have_libexpat" = "xyes"])
  544. if test "x$have_libcares" = "xyes"; then
  545. AC_DEFINE([ENABLE_ASYNC_DNS], [1],
  546. [Define to 1 if asynchronous DNS support is enabled.])
  547. AM_CONDITIONAL([ENABLE_ASYNC_DNS], true)
  548. else
  549. AM_CONDITIONAL([ENABLE_ASYNC_DNS], false)
  550. fi
  551. # Set conditional for libz
  552. AM_CONDITIONAL([HAVE_ZLIB], [test "x$have_zlib" = "xyes"])
  553. # Set conditional for sqlite3
  554. AM_CONDITIONAL([HAVE_SQLITE3], [test "x$have_sqlite3" = "xyes"])
  555. AC_SEARCH_LIBS([clock_gettime], [rt])
  556. case "$host" in
  557. *solaris*)
  558. AC_SEARCH_LIBS([getaddrinfo], [nsl socket])
  559. ;;
  560. esac
  561. # Checks for header files.
  562. AC_FUNC_ALLOCA
  563. AC_HEADER_STDC
  564. AC_CHECK_HEADERS([argz.h \
  565. arpa/inet.h \
  566. fcntl.h \
  567. float.h \
  568. inttypes.h \
  569. langinfo.h \
  570. libintl.h \
  571. limits.h \
  572. locale.h \
  573. malloc.h \
  574. netdb.h \
  575. netinet/in.h \
  576. netinet/tcp.h \
  577. poll.h \
  578. port.h \
  579. signal.h \
  580. stddef.h \
  581. stdint.h \
  582. stdio_ext.h \
  583. stdlib.h \
  584. string.h \
  585. strings.h \
  586. sys/ioctl.h \
  587. sys/param.h \
  588. sys/resource.h \
  589. sys/signal.h \
  590. sys/socket.h \
  591. sys/time.h \
  592. sys/types.h \
  593. sys/uio.h \
  594. sys/utsname.h \
  595. termios.h \
  596. unistd.h \
  597. utime.h \
  598. wchar.h \
  599. ifaddrs.h \
  600. pwd.h])
  601. # Checks for typedefs, structures, and compiler characteristics.
  602. AC_HEADER_STDBOOL
  603. AC_C_CONST
  604. AC_C_INLINE
  605. AC_TYPE_INT16_T
  606. AC_TYPE_INT32_T
  607. AC_TYPE_INT64_T
  608. AC_TYPE_INT8_T
  609. AC_TYPE_MODE_T
  610. AC_TYPE_OFF_T
  611. AC_TYPE_SIZE_T
  612. AC_TYPE_SSIZE_T
  613. AC_HEADER_TIME
  614. AC_STRUCT_TM
  615. AC_TYPE_UINT16_T
  616. AC_TYPE_UINT32_T
  617. AC_TYPE_UINT64_T
  618. AC_TYPE_UINT8_T
  619. AC_TYPE_PID_T
  620. AC_C_VOLATILE
  621. AC_CHECK_TYPES([ptrdiff_t])
  622. AC_CHECK_TYPE([struct timespec], [have_timespec=yes], [have_timespec=no])
  623. AC_C_BIGENDIAN
  624. AC_SYS_LARGEFILE
  625. if test "x$have_timespec" = "xyes"; then
  626. AC_DEFINE([HAVE_A2_STRUCT_TIMESPEC], [1],
  627. [Define to 1 if the system has the type `struct timespec'.])
  628. fi
  629. # Checks for library functions.
  630. AM_GNU_GETTEXT([external])
  631. AM_GNU_GETTEXT_VERSION([0.18])
  632. AC_FUNC_ERROR_AT_LINE
  633. AC_PROG_GCC_TRADITIONAL
  634. AC_FUNC_MEMCMP
  635. AC_FUNC_MKTIME
  636. AC_FUNC_SELECT_ARGTYPES
  637. AC_FUNC_STAT
  638. AC_FUNC_STRFTIME
  639. AC_FUNC_VPRINTF
  640. AC_FUNC_FORK
  641. AC_FUNC_STRTOD
  642. # Don't use AC_FUNC_MMAP becaue it fails on some platforms (e.g.,
  643. # OpenWRT) which have mmap and it works in the way we use in aria2.
  644. # Instead use mmap in AC_CHECK_FUNCS list.
  645. AC_CHECK_FUNCS([__argz_count \
  646. __argz_next \
  647. __argz_stringify \
  648. atexit \
  649. ftruncate \
  650. getcwd \
  651. gethostbyaddr \
  652. gethostbyname \
  653. getifaddrs \
  654. getpagesize \
  655. getrandom \
  656. memchr \
  657. memmove \
  658. mempcpy \
  659. memset \
  660. mkdir \
  661. mmap \
  662. munmap \
  663. nl_langinfo \
  664. posix_fadvise \
  665. posix_memalign \
  666. pow \
  667. putenv \
  668. rmdir \
  669. select \
  670. setlocale \
  671. sigaction \
  672. sleep \
  673. socket \
  674. stpcpy \
  675. strcasecmp \
  676. strchr \
  677. strcspn \
  678. strdup \
  679. strerror \
  680. strncasecmp \
  681. strstr \
  682. strtol \
  683. strtoul \
  684. strtoull \
  685. tzset \
  686. unsetenv \
  687. usleep \
  688. utime \
  689. utimes])
  690. AC_MSG_CHECKING([for getrandom linux syscall interface])
  691. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  692. #include <sys/syscall.h>
  693. #include <linux/random.h>
  694. ]],
  695. [[
  696. int x = GRND_NONBLOCK;
  697. int y = (int)SYS_getrandom;
  698. ]])],
  699. [have_getrandom_interface=yes
  700. AC_DEFINE([HAVE_GETRANDOM_INTERFACE], [1], [Define to 1 if getrandom linux syscall interface is available.])],
  701. [have_getrandom_interface=no])
  702. AC_MSG_RESULT([$have_getrandom_interface])
  703. AM_CONDITIONAL([HAVE_GETRANDOM_INTERFACE], [test "x$have_getrandom_interface" = "xyes"])
  704. dnl Put tcmalloc/jemalloc checks after the posix_memalign check.
  705. dnl These libraries may implement posix_memalign, while the usual CRT may not
  706. dnl (e.g. mingw). Since we aren't including the corresponding library headers
  707. dnl this will lead to undefined posix_memalign() errors when compiling
  708. if test "x$with_tcmalloc_requested" = "xyes" &&
  709. test "x$with_jemalloc_requested" = "xyes"; then
  710. AC_MSG_FAILURE([Cannot use both, tcmalloc and jemalloc!])
  711. fi
  712. if test "x$with_tcmalloc" = "xyes"; then
  713. dnl Important: put malloc libs at the very end.
  714. dnl Only newish versions have a .pc, thus try CHECK_LIB as well.
  715. PKG_CHECK_MODULES([TCMALLOC], [libtcmalloc_minimal], [have_tcmalloc=yes], [have_tcmalloc=no])
  716. if test "x$have_tcmalloc" = "xyes"; then
  717. CPPFLAGS="$TCMALLOC_CFLAGS $CPPFLAGS"
  718. LIBS="$LIBS $TCMALLOC_LIBS"
  719. else
  720. AC_CHECK_LIB([tcmalloc_minimal], [malloc], [have_tcmalloc=yes], [have_tcmalloc=no])
  721. if test "x$have_tcmalloc" = "xyes"; then
  722. LIBS="$LIBS -ltcmalloc_minimal"
  723. else
  724. if test "x$with_tcmalloc_requested" = "xyes"; then
  725. ARIA2_DEP_NOT_MET([tcmalloc_minimal])
  726. fi
  727. fi
  728. fi
  729. fi
  730. if test "x$have_tcmalloc" != "xyes" && test "x$with_jemalloc" = "xyes"; then
  731. dnl Important: put malloc libs at the very end.
  732. dnl Usually jemalloc does not come with a .pc, as the official source does not
  733. dnl generate one.
  734. PKG_CHECK_MODULES([JEMALLOC], [jemalloc], [have_jemalloc=yes], [have_jemalloc=no])
  735. if test "x$have_jemalloc" = "xyes"; then
  736. CPPFLAGS="$JEMALLOC_CFLAGS $CPPFLAGS"
  737. LIBS="$LIBS $JEMALLOC_LIBS"
  738. else
  739. AC_CHECK_LIB([jemalloc], [malloc], [have_jemalloc=yes], [have_jemalloc=no])
  740. if test "x$have_jemalloc" = "xyes"; then
  741. LIBS="$LIBS -ljemalloc"
  742. else
  743. if test "x$with_jemalloc_requested" = "xyes"; then
  744. ARIA2_DEP_NOT_MET([jemalloc (unprefixed)])
  745. fi
  746. fi
  747. fi
  748. fi
  749. if test "x$enable_epoll" = "xyes"; then
  750. AC_CHECK_FUNCS([epoll_create], [have_epoll=yes])
  751. if test "x$have_epoll" = "xyes"; then
  752. AC_DEFINE([HAVE_EPOLL], [1], [Define to 1 if epoll is available.])
  753. fi
  754. fi
  755. AM_CONDITIONAL([HAVE_EPOLL], [test "x$have_epoll" = "xyes"])
  756. AC_CHECK_FUNCS([posix_fallocate],[have_posix_fallocate=yes])
  757. ARIA2_CHECK_FALLOCATE
  758. if test "x$have_posix_fallocate" = "xyes" ||
  759. test "x$have_fallocate" = "xyes" ||
  760. test "x$have_osx" = "xyes" ||
  761. test "x$win_build" = "xyes"; then
  762. AC_DEFINE([HAVE_SOME_FALLOCATE], [1],
  763. [Define to 1 if *_fallocate is available.])
  764. fi
  765. AM_CONDITIONAL([HAVE_SOME_FALLOCATE],
  766. [test "x$have_posix_fallocate" = "xyes" || test "x$have_fallocate" = "xyes" \
  767. || test "x$have_osx" = "xyes" || test "x$win_build" = "xyes"])
  768. AC_MSG_CHECKING([for asctime_r])
  769. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  770. #include <time.h>
  771. ]], [[
  772. struct tm r; char *c;
  773. asctime_r(&r, c);
  774. ]])],
  775. [AM_CONDITIONAL([HAVE_ASCTIME_R], true)
  776. AC_MSG_RESULT([yes])
  777. AC_DEFINE([HAVE_ASCTIME_R], [1], [Define to 1 if you have the `asctime_r' function or macro.])],
  778. [AC_MSG_RESULT([no])
  779. AM_CONDITIONAL([HAVE_ASCTIME_R], false)])
  780. AC_MSG_CHECKING([for localtime_r])
  781. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  782. #include <time.h>
  783. ]], [[
  784. time_t t; struct tm r;
  785. localtime_r(&t, &r);
  786. ]])],
  787. [AM_CONDITIONAL([HAVE_LOCALTIME_R], true)
  788. AC_MSG_RESULT([yes])
  789. AC_DEFINE([HAVE_LOCALTIME_R], [1], [Define to 1 if you have the `localtime_r' function or macro.])],
  790. [AC_MSG_RESULT([no])
  791. AM_CONDITIONAL([HAVE_LOCALTIME_R], false)])
  792. AC_CHECK_FUNCS([basename],
  793. [AM_CONDITIONAL([HAVE_BASENAME], true)],
  794. [AM_CONDITIONAL([HAVE_BASENAME], false)])
  795. AC_CHECK_FUNCS([gai_strerror],
  796. [AM_CONDITIONAL([HAVE_GAI_STRERROR], true)],
  797. [AM_CONDITIONAL([HAVE_GAI_STRERROR], false)])
  798. AC_CHECK_FUNCS([getaddrinfo],
  799. [AM_CONDITIONAL([HAVE_GETADDRINFO], true)],
  800. [AM_CONDITIONAL([HAVE_GETADDRINFO], false)])
  801. AC_CHECK_FUNCS([gettimeofday],
  802. [AM_CONDITIONAL([HAVE_GETTIMEOFDAY], true)],
  803. [AM_CONDITIONAL([HAVE_GETTIMEOFDAY], false)])
  804. AC_CHECK_FUNCS([strptime],
  805. [AM_CONDITIONAL([HAVE_STRPTIME], true)],
  806. [AM_CONDITIONAL([HAVE_STRPTIME], false)])
  807. AC_CHECK_FUNCS([timegm],
  808. [AM_CONDITIONAL([HAVE_TIMEGM], true)],
  809. [AM_CONDITIONAL([HAVE_TIMEGM], false)])
  810. AC_CHECK_FUNCS([daemon], [have_daemon=yes])
  811. AM_CONDITIONAL([HAVE_DAEMON], [test "x$have_daemon" = "xyes"])
  812. AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes])
  813. if test "x$have_clock_gettime" != "xyes"; then
  814. AC_CHECK_FUNCS([mach_absolute_time], [have_mach_absolute_time=yes])
  815. fi
  816. AM_CONDITIONAL([HAVE_MACH_ABSOLUTE_TIME],
  817. [test "x$have_mach_absolute_time" = "xyes"])
  818. AC_CHECK_FUNCS([poll], [have_poll=yes])
  819. AM_CONDITIONAL([HAVE_POLL], [test "x$have_poll" = "xyes"])
  820. case "$host" in
  821. *mingw*)
  822. AM_CONDITIONAL([MINGW_BUILD], true)
  823. dnl defined in ws2tcpip.h, but only if _WIN32_WINNT >= 0x0501
  824. AM_CONDITIONAL([HAVE_GETADDRINFO], true)
  825. dnl defined in ws2tcpip.h, but missing in C:\mingw\lib\libws2_32.a
  826. AM_CONDITIONAL([HAVE_GAI_STRERROR], false)
  827. AM_CONDITIONAL([HAVE_TIMEGETTIME], [test "x$have_clock_gettime" != "xyes"])
  828. ;;
  829. *)
  830. AM_CONDITIONAL([MINGW_BUILD], false)
  831. AM_CONDITIONAL([HAVE_TIMEGETTIME], false)
  832. ;;
  833. esac
  834. AC_CHECK_FUNCS([port_associate], [have_port_associate=yes])
  835. AM_CONDITIONAL([HAVE_PORT_ASSOCIATE], [test "x$have_port_associate" = "xyes"])
  836. AC_CHECK_FUNCS([kqueue], [have_kqueue=yes])
  837. AM_CONDITIONAL([HAVE_KQUEUE], [test "x$have_kqueue" = "xyes"])
  838. if test "x$have_kqueue" = "xyes"; then
  839. AC_MSG_CHECKING([whether struct kevent.udata is intptr_t])
  840. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  841. #include <sys/types.h>
  842. #include <sys/event.h>
  843. #include <sys/time.h>
  844. ]],
  845. [[
  846. struct kevent event;
  847. event.udata = reinterpret_cast<intptr_t>(&event);
  848. ]])],
  849. [kevent_udata_intptr_t=yes], [kevent_udata_intptr_t=no])
  850. AC_MSG_RESULT([$kevent_udata_intptr_t])
  851. if test "x$kevent_udata_intptr_t" = "xyes"; then
  852. AC_DEFINE([KEVENT_UDATA_INTPTR_T], [1], [Define to 1 if struct kevent.udata is intptr_t])
  853. fi
  854. fi
  855. AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
  856. [AC_DEFINE([HAVE_SOCKADDR_IN_SIN_LEN],[1],
  857. [Define to 1 if struct sockaddr_in has sin_len member.])],
  858. [],
  859. [[
  860. #include <sys/types.h>
  861. #include <sys/socket.h>
  862. #include <netinet/in.h>
  863. ]])
  864. AC_CHECK_MEMBER([struct sockaddr_in6.sin6_len],
  865. [AC_DEFINE([HAVE_SOCKADDR_IN6_SIN6_LEN],[1],
  866. [Define to 1 if struct sockaddr_in6 has sin6_len member.])],
  867. [],
  868. [[
  869. #include <sys/types.h>
  870. #include <sys/socket.h>
  871. #include <netinet/in.h>
  872. ]])
  873. # Check struct option.name is assignable from const char*. struct
  874. # option.name in opensolaris is of type char*. In Linux, it is const
  875. # char*
  876. AC_MSG_CHECKING([whether struct option.name is assignable from const char*])
  877. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  878. #include <unistd.h>
  879. #include <getopt.h>
  880. ]],
  881. [[
  882. const char* s = "const char";
  883. option op;
  884. op.name = s;
  885. ]])],
  886. [have_option_const_name=yes], [have_option_const_name=no])
  887. AC_MSG_RESULT([$have_option_const_name])
  888. if test "x$have_option_const_name" = "xyes"; then
  889. AC_DEFINE([HAVE_OPTION_CONST_NAME], [1], [Define 1 if struct option.name is const char*])
  890. fi
  891. if test "x$enable_websocket" = "xyes"; then
  892. AC_CONFIG_SUBDIRS([deps/wslay])
  893. enable_websocket=yes
  894. AC_DEFINE([ENABLE_WEBSOCKET], [1],
  895. [Define 1 if WebSocket support is enabled.])
  896. WSLAY_LIBS="\$(top_builddir)/deps/wslay/lib/libwslay.la"
  897. AC_SUBST([WSLAY_LIBS])
  898. # $(top_srcdir) for `make distcheck`
  899. CPPFLAGS="-I\$(top_builddir)/deps/wslay/lib/includes -I\$(top_srcdir)/deps/wslay/lib/includes $CPPFLAGS"
  900. fi
  901. AM_CONDITIONAL([ENABLE_WEBSOCKET], [test "x$enable_websocket" = "xyes"])
  902. AM_CONDITIONAL([ENABLE_LIBARIA2], [test "x$enable_libaria2" = "xyes"])
  903. AC_SUBST([bashcompletiondir])
  904. case "$host" in
  905. *android*)
  906. android=yes
  907. LIBS="$LIBS -lstdc++ -lsupc++"
  908. case "$host" in
  909. arm-*)
  910. android_arm=yes
  911. ;;
  912. mipsel-*)
  913. android_mips=yes
  914. ;;
  915. i686-*)
  916. android_x86=yes
  917. ;;
  918. esac
  919. ;;
  920. *)
  921. ;;
  922. esac
  923. AM_CONDITIONAL([ANDROID], [test "x$android" = "xyes"])
  924. AM_CONDITIONAL([ANDROID_ARM], [test "x$android_arm" = "xyes"])
  925. AM_CONDITIONAL([ANDROID_MIPS], [test "x$android_mips" = "xyes"])
  926. AM_CONDITIONAL([ANDROID_X86], [test "x$android_x86" = "xyes"])
  927. if test "x$ARIA2_STATIC" = "xyes"; then
  928. # -static-libgcc and -static-libstdc++ are linker flags and not for
  929. # libtool.
  930. LDFLAGS="$LDFLAGS -all-static"
  931. dnl For non-MinGW build, we need additional libs for static build.
  932. case "$host" in
  933. *mingw*|*msvc*|*darwin*)
  934. ;;
  935. *)
  936. LIBS="$LIBS -lpthread -ldl -lrt"
  937. ;;
  938. esac
  939. fi
  940. if test "x$win_build" = "xyes" && test "x$enable_libaria2" = "xyes"; then
  941. # Creating dll needs this
  942. LDFLAGS="$LDFLAGS -no-undefined"
  943. fi
  944. AC_CONFIG_FILES([Makefile
  945. src/Makefile
  946. src/libaria2.pc
  947. src/includes/Makefile
  948. test/Makefile
  949. po/Makefile.in
  950. lib/Makefile
  951. doc/Makefile
  952. doc/manual-src/Makefile
  953. doc/manual-src/en/Makefile
  954. doc/manual-src/en/conf.py
  955. doc/manual-src/ru/Makefile
  956. doc/manual-src/ru/conf.py
  957. doc/manual-src/pt/Makefile
  958. doc/manual-src/pt/conf.py
  959. deps/Makefile])
  960. AC_OUTPUT
  961. echo " "
  962. echo "Build: $build"
  963. echo "Host: $host"
  964. echo "Target: $target"
  965. echo "Install prefix: $prefix"
  966. echo "CC: $CC"
  967. echo "CXX: $CXX"
  968. echo "CPP: $CPP"
  969. echo "CXXFLAGS: $CXXFLAGS"
  970. echo "CFLAGS: $CFLAGS"
  971. echo "CPPFLAGS: $CPPFLAGS"
  972. echo "LDFLAGS: $LDFLAGS"
  973. echo "LIBS: $LIBS"
  974. echo "DEFS: $DEFS"
  975. echo "LibUV: $have_libuv"
  976. echo "SQLite3: $have_sqlite3"
  977. echo "SSL Support: $have_ssl"
  978. echo "AppleTLS: $have_appletls"
  979. echo "WinTLS: $have_wintls"
  980. echo "GnuTLS: $have_libgnutls"
  981. echo "OpenSSL: $have_openssl"
  982. echo "CA Bundle: $ca_bundle"
  983. echo "LibXML2: $have_libxml2"
  984. echo "LibExpat: $have_libexpat"
  985. echo "LibCares: $have_libcares"
  986. echo "Zlib: $have_zlib"
  987. echo "Epoll: $have_epoll"
  988. echo "Bittorrent: $enable_bittorrent"
  989. echo "Metalink: $enable_metalink"
  990. echo "XML-RPC: $enable_xml_rpc"
  991. echo "Message Digest: $use_md"
  992. echo "WebSocket: $enable_websocket"
  993. echo "Libaria2: $enable_libaria2"
  994. if test "x$enable_libaria2" = "xyes"; then
  995. echo "Library types: Shared=${enable_shared}, Static=${enable_static}"
  996. fi
  997. echo "bash_completion dir: $bashcompletiondir"
  998. echo "Static build: $ARIA2_STATIC"