configure.ac 33 KB

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