configure.ac 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. #
  4. AC_PREREQ(2.61)
  5. AC_INIT(aria2, 1.1.0, t-tujikawa@users.sourceforge.net)
  6. AC_CANONICAL_HOST
  7. AC_CANONICAL_SYSTEM
  8. AM_INIT_AUTOMAKE()
  9. AM_PATH_CPPUNIT(1.10.2)
  10. AC_CONFIG_SRCDIR([src/Socket.h])
  11. AC_CONFIG_HEADERS([config.h])
  12. case "$target" in
  13. *mingw*|*cygwin*)
  14. WINSOCK_LIBS="-lws2_32 -lpthread"
  15. AC_SUBST(WINSOCK_LIBS)
  16. ;;
  17. esac
  18. AC_DEFINE_UNQUOTED([TARGET], ["$target"], [Define target-type])
  19. # Set localedir
  20. localedir=${datadir}/locale
  21. AC_SUBST(localedir)
  22. # Checks for arguments.
  23. ARIA2_ARG_WITH([gnutls])
  24. ARIA2_ARG_WITH([openssl])
  25. ARIA2_ARG_WITH([sqlite3])
  26. ARIA2_ARG_WITH([libxml2])
  27. ARIA2_ARG_WITH([libexpat])
  28. ARIA2_ARG_WITH([libcares])
  29. ARIA2_ARG_WITH([libz])
  30. ARIA2_ARG_ENABLE([bittorrent])
  31. ARIA2_ARG_ENABLE([metalink])
  32. ARIA2_ARG_ENABLE([epoll])
  33. AC_ARG_WITH([ca-bundle],
  34. AC_HELP_STRING([--with-ca-bundle=FILE], [Use FILE as default CA bundle.]),
  35. [ca_bundle=$withval], [ca_bundle=""])
  36. # Checks for programs.
  37. AC_PROG_CXX
  38. AC_PROG_CC
  39. AC_PROG_INSTALL
  40. AC_PROG_MKDIR_P
  41. AC_PROG_RANLIB
  42. AC_PROG_YACC
  43. # Setting language choice
  44. AC_LANG([C++])
  45. # Check for GNU library
  46. AC_GNU_SOURCE
  47. # Enable system extensions
  48. AC_USE_SYSTEM_EXTENSIONS
  49. # Checks for libraries.
  50. if test "x$with_libxml2" = "xyes"; then
  51. AM_PATH_XML2([2.6.24], [have_libxml2=yes])
  52. if test "x$have_libxml2" = "xyes"; then
  53. AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have libxml2.])
  54. fi
  55. fi
  56. if test "x$with_libexpat" = "xyes" && test "x$have_libxml2" != "xyes"; then
  57. AM_PATH_LIBEXPAT
  58. fi
  59. if test "x$with_sqlite3" = "xyes"; then
  60. AM_PATH_SQLITE3
  61. fi
  62. if test "x$with_gnutls" = "xyes"; then
  63. AM_PATH_LIBGNUTLS([1.2.9], [have_libgnutls=yes])
  64. if test "x$have_libgnutls" = "xyes"; then
  65. AC_DEFINE([HAVE_LIBGNUTLS], [1], [Define to 1 if you have libgnutls.])
  66. fi
  67. fi
  68. if test "x$have_libgnutls" = "xyes"; then
  69. AM_PATH_LIBGCRYPT([1.2.2], [have_libgcrypt=yes])
  70. if test "x$have_libgcrypt" = "xyes"; then
  71. AC_DEFINE([HAVE_LIBGCRYPT], [1], [Define to 1 if you have libgcrypt.])
  72. fi
  73. fi
  74. if test "x$with_openssl" = "xyes" && test "x$have_libgnutls" != "xyes"; then
  75. AM_PATH_OPENSSL
  76. fi
  77. if test "x$with_libcares" = "xyes"; then
  78. AM_PATH_LIBCARES
  79. fi
  80. # Check availability of libz
  81. if test "x$with_libz" = "xyes"; then
  82. AM_PATH_LIBZ
  83. fi
  84. # Define variables based on the result of the checks for libraries.
  85. if test "x$have_libgnutls" = "xyes" || test "x$have_openssl" = "xyes"; then
  86. AC_DEFINE([ENABLE_SSL], [1], [Define to 1 if ssl support is enabled.])
  87. AM_CONDITIONAL([ENABLE_SSL], true)
  88. AC_SUBST([ca_bundle])
  89. else
  90. AM_CONDITIONAL([ENABLE_SSL], false)
  91. fi
  92. AM_CONDITIONAL([HAVE_LIBGNUTLS], [ test "x$have_libgnutls" = "xyes" ])
  93. AM_CONDITIONAL([HAVE_LIBSSL], [ test "x$have_openssl" = "xyes" ])
  94. if test "x$have_libgcrypt" = "xyes" || test "x$have_openssl" = "xyes"; then
  95. AC_DEFINE([ENABLE_MESSAGE_DIGEST], [1],
  96. [Define to 1 if message digest support is enabled.])
  97. AM_CONDITIONAL([ENABLE_MESSAGE_DIGEST], true)
  98. enable_message_digest=yes
  99. else
  100. AM_CONDITIONAL([ENABLE_MESSAGE_DIGEST], false)
  101. fi
  102. if test "x$enable_bittorrent" = "xyes" &&
  103. test "x$enable_message_digest" = "xyes"; then
  104. AC_DEFINE([ENABLE_BITTORRENT], [1],
  105. [Define to 1 if BitTorrent support is enabled.])
  106. AM_CONDITIONAL([ENABLE_BITTORRENT], true)
  107. else
  108. enable_bittorrent=no
  109. AM_CONDITIONAL([ENABLE_BITTORRENT], false)
  110. fi
  111. if (test "x$have_libxml2" = "xyes" || test "x$have_libexpat" = "xyes") &&
  112. test "x$enable_metalink" = "xyes"; then
  113. AC_DEFINE([ENABLE_METALINK], [1],
  114. [Define to 1 if Metalink support is enabled.])
  115. AM_CONDITIONAL([ENABLE_METALINK], true)
  116. else
  117. enable_metalink=no
  118. AM_CONDITIONAL([ENABLE_METALINK], false)
  119. fi
  120. AM_CONDITIONAL([ENABLE_LIBXML2],
  121. [test "x$enable_metalink" = "xyes" && test "x$have_libxml2" = "xyes"])
  122. AM_CONDITIONAL([ENABLE_LIBEXPAT],
  123. [test "x$enable_metalink" = "xyes" && test "x$have_libexpat" = "xyes"])
  124. if test "x$have_libcares" = "xyes"; then
  125. AC_DEFINE([ENABLE_ASYNC_DNS], [1],
  126. [Define to 1 if asynchronous DNS support is enabled.])
  127. AM_CONDITIONAL([ENABLE_ASYNC_DNS], true)
  128. else
  129. AM_CONDITIONAL([ENABLE_ASYNC_DNS], false)
  130. fi
  131. # Set conditional for libz
  132. AM_CONDITIONAL([HAVE_LIBZ], [test "x$have_libz" = "xyes"])
  133. # Set conditional for sqlite3
  134. AM_CONDITIONAL([HAVE_SQLITE3], [test "x$have_sqlite3" = "xyes"])
  135. # Checks for header files.
  136. AC_FUNC_ALLOCA
  137. AC_HEADER_STDC
  138. case "$target" in
  139. *mingw*)
  140. AC_CHECK_HEADERS([winsock2.h \
  141. ws2tcpip.h])
  142. ;;
  143. esac
  144. AC_CHECK_HEADERS([argz.h \
  145. arpa/inet.h \
  146. fcntl.h \
  147. float.h \
  148. inttypes.h \
  149. io.h \
  150. langinfo.h \
  151. libintl.h \
  152. limits.h \
  153. locale.h \
  154. malloc.h \
  155. netdb.h \
  156. netinet/in.h \
  157. stddef.h \
  158. stdint.h \
  159. stdio_ext.h \
  160. stdlib.h \
  161. string.h \
  162. strings.h \
  163. sys/ioctl.h \
  164. sys/param.h \
  165. sys/socket.h \
  166. sys/time.h \
  167. termios.h \
  168. unistd.h \
  169. wchar.h])
  170. # Checks for typedefs, structures, and compiler characteristics.
  171. AC_HEADER_STDBOOL
  172. AC_C_CONST
  173. AC_C_INLINE
  174. AC_TYPE_INT16_T
  175. AC_TYPE_INT32_T
  176. AC_TYPE_INT64_T
  177. AC_TYPE_INT8_T
  178. AC_TYPE_MODE_T
  179. AC_TYPE_OFF_T
  180. AC_TYPE_SIZE_T
  181. AC_TYPE_SSIZE_T
  182. AC_HEADER_TIME
  183. AC_STRUCT_TM
  184. AC_TYPE_UINT16_T
  185. AC_TYPE_UINT32_T
  186. AC_TYPE_UINT64_T
  187. AC_TYPE_UINT8_T
  188. AC_C_VOLATILE
  189. AC_CHECK_TYPES([ptrdiff_t])
  190. AC_C_BIGENDIAN
  191. AC_SYS_LARGEFILE
  192. # Checks for library functions.
  193. AM_GNU_GETTEXT
  194. AM_GNU_GETTEXT_VERSION([0.17])
  195. AC_FUNC_ERROR_AT_LINE
  196. AC_PROG_GCC_TRADITIONAL
  197. case "$target" in
  198. *mingw*)
  199. ;;
  200. *)
  201. AC_FUNC_MALLOC
  202. AC_FUNC_REALLOC
  203. ;;
  204. esac
  205. AC_FUNC_MEMCMP
  206. AC_FUNC_MKTIME
  207. AC_FUNC_MMAP
  208. AC_FUNC_SELECT_ARGTYPES
  209. AC_TYPE_SIGNAL
  210. AC_FUNC_STAT
  211. AC_FUNC_STRFTIME
  212. AC_FUNC_VPRINTF
  213. AC_CHECK_FUNCS([__argz_count \
  214. __argz_next \
  215. __argz_stringify \
  216. atexit \
  217. daemon \
  218. ftruncate \
  219. getcwd \
  220. gethostbyaddr \
  221. gethostbyname \
  222. getpagesize \
  223. inet_ntoa \
  224. memchr \
  225. memmove \
  226. mempcpy \
  227. memset \
  228. mkdir \
  229. munmap \
  230. nl_langinfo \
  231. posix_memalign \
  232. putenv \
  233. rmdir \
  234. select \
  235. setlocale \
  236. sleep \
  237. socket \
  238. stpcpy \
  239. strcasecmp \
  240. strchr \
  241. strcspn \
  242. strdup \
  243. strerror \
  244. strncasecmp \
  245. strstr \
  246. strtol \
  247. strtoul \
  248. strtoull \
  249. tzset \
  250. unsetenv \
  251. usleep])
  252. if test "x$enable_epoll" = "xyes"; then
  253. AC_CHECK_FUNCS([epoll_create])
  254. fi
  255. AC_CHECK_FUNCS([asctime_r],
  256. [AM_CONDITIONAL([HAVE_ASCTIME_R], true)],
  257. [AM_CONDITIONAL([HAVE_ASCTIME_R], false)])
  258. AC_CHECK_FUNCS([basename],
  259. [AM_CONDITIONAL([HAVE_BASENAME], true)],
  260. [AM_CONDITIONAL([HAVE_BASENAME], false)])
  261. AC_CHECK_FUNCS([gai_strerror],
  262. [AM_CONDITIONAL([HAVE_GAI_STRERROR], true)],
  263. [AM_CONDITIONAL([HAVE_GAI_STRERROR], false)])
  264. AC_CHECK_FUNCS([getaddrinfo],
  265. [AM_CONDITIONAL([HAVE_GETADDRINFO], true)],
  266. [AM_CONDITIONAL([HAVE_GETADDRINFO], false)])
  267. AC_CHECK_FUNCS([gettimeofday],
  268. [AM_CONDITIONAL([HAVE_GETTIMEOFDAY], true)],
  269. [AM_CONDITIONAL([HAVE_GETTIMEOFDAY], false)])
  270. AC_CHECK_FUNCS([inet_aton],
  271. [AM_CONDITIONAL([HAVE_INET_ATON], true)],
  272. [AM_CONDITIONAL([HAVE_INET_ATON], false)])
  273. AC_CHECK_FUNCS([localtime_r],
  274. [AM_CONDITIONAL([HAVE_LOCALTIME_R], true)],
  275. [AM_CONDITIONAL([HAVE_LOCALTIME_R], false)])
  276. AC_CHECK_FUNCS([strptime],
  277. [AM_CONDITIONAL([HAVE_STRPTIME], true)],
  278. [AM_CONDITIONAL([HAVE_STRPTIME], false)])
  279. AC_CHECK_FUNCS([timegm],
  280. [AM_CONDITIONAL([HAVE_TIMEGM], true)],
  281. [AM_CONDITIONAL([HAVE_TIMEGM], false)])
  282. case "$target" in
  283. *mingw*)
  284. dnl defined in ws2tcpip.h, but only if _WIN32_WINNT >= 0x0501
  285. AM_CONDITIONAL([HAVE_GETADDRINFO], true)
  286. dnl defined in ws2tcpip.h, but missing in C:\mingw\lib\libws2_32.a
  287. AM_CONDITIONAL([HAVE_GAI_STRERROR], false)
  288. ;;
  289. esac
  290. AC_CONFIG_FILES([Makefile
  291. src/Makefile
  292. test/Makefile
  293. po/Makefile.in
  294. m4/Makefile
  295. intl/Makefile
  296. lib/Makefile
  297. doc/Makefile])
  298. AC_OUTPUT
  299. echo " "
  300. echo "Build: $build"
  301. echo "Target: $target"
  302. echo "Install prefix: $prefix"
  303. echo "CFLAGS: $CFLAGS"
  304. echo "CPPFLAGS: $CPPFLAGS"
  305. echo "LDFLAGS: $LDFLAGS"
  306. echo "LIBS: $LIBS"
  307. echo "SQLite3: $have_sqlite3"
  308. echo "GnuTLS: $have_libgnutls"
  309. echo "OpenSSL: $have_openssl"
  310. echo "CA Bundle: $ca_bundle"
  311. echo "LibXML2: $have_libxml2"
  312. echo "LibExpat: $have_libexpat"
  313. echo "LibCares: $have_libcares"
  314. echo "Libz: $have_libz"
  315. echo "Bittorrent: $enable_bittorrent"
  316. echo "Metalink: $enable_metalink"