configure.ac 8.9 KB

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