configure.ac 8.6 KB

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