configure.ac 34 KB

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