configure.ac 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. #
  4. AC_PREREQ(2.61)
  5. AC_INIT(aria2c, 1.0.0a, 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. AM_CONDITIONAL([ENABLE_SSL], true)
  91. else
  92. AM_CONDITIONAL([ENABLE_SSL], false)
  93. fi
  94. AM_CONDITIONAL([HAVE_LIBGNUTLS], [ test "x$have_libgnutls" = "xyes" ])
  95. AM_CONDITIONAL([HAVE_LIBSSL], [ test "x$have_openssl" = "xyes" ])
  96. if test "x$have_libgcrypt" = "xyes" || test "x$have_openssl" = "xyes"; then
  97. AC_DEFINE([ENABLE_MESSAGE_DIGEST], [1],
  98. [Define to 1 if message digest support is enabled.])
  99. AM_CONDITIONAL([ENABLE_MESSAGE_DIGEST], true)
  100. enable_message_digest=yes
  101. else
  102. AM_CONDITIONAL([ENABLE_MESSAGE_DIGEST], false)
  103. fi
  104. if test "x$enable_bittorrent" = "xyes" &&
  105. test "x$enable_message_digest" = "xyes"; then
  106. AC_DEFINE([ENABLE_BITTORRENT], [1],
  107. [Define to 1 if BitTorrent support is enabled.])
  108. AM_CONDITIONAL([ENABLE_BITTORRENT], true)
  109. else
  110. enable_bittorrent=no
  111. AM_CONDITIONAL([ENABLE_BITTORRENT], false)
  112. fi
  113. if (test "x$have_libxml2" = "xyes" || test "x$have_libexpat" = "xyes") &&
  114. test "x$enable_metalink" = "xyes"; then
  115. AC_DEFINE([ENABLE_METALINK], [1],
  116. [Define to 1 if Metalink support is enabled.])
  117. AM_CONDITIONAL([ENABLE_METALINK], true)
  118. else
  119. enable_metalink=no
  120. AM_CONDITIONAL([ENABLE_METALINK], false)
  121. fi
  122. AM_CONDITIONAL([ENABLE_LIBXML2],
  123. [test "x$enable_metalink" = "xyes" && test "x$have_libxml2" = "xyes"])
  124. AM_CONDITIONAL([ENABLE_LIBEXPAT],
  125. [test "x$enable_metalink" = "xyes" && test "x$have_libexpat" = "xyes"])
  126. if test "x$have_libcares" = "xyes" || test "x$have_libares" = "xyes"; then
  127. AC_DEFINE([ENABLE_ASYNC_DNS], [1],
  128. [Define to 1 if asynchronous DNS support is enabled.])
  129. AM_CONDITIONAL([ENABLE_ASYNC_DNS], true)
  130. else
  131. AM_CONDITIONAL([ENABLE_ASYNC_DNS], false)
  132. fi
  133. # Set conditional for libz
  134. AM_CONDITIONAL([HAVE_LIBZ], [test "x$have_libz" = "xyes"])
  135. # Set conditional for sqlite3
  136. AM_CONDITIONAL([HAVE_SQLITE3], [test "x$have_sqlite3" = "xyes"])
  137. # Checks for header files.
  138. AC_FUNC_ALLOCA
  139. AC_HEADER_STDC
  140. case "$target" in
  141. *mingw*)
  142. AC_CHECK_HEADERS([winsock2.h \
  143. ws2tcpip.h])
  144. ;;
  145. esac
  146. AC_CHECK_HEADERS([argz.h \
  147. arpa/inet.h \
  148. fcntl.h \
  149. float.h \
  150. inttypes.h \
  151. io.h \
  152. langinfo.h \
  153. libintl.h \
  154. limits.h \
  155. locale.h \
  156. malloc.h \
  157. netdb.h \
  158. netinet/in.h \
  159. stddef.h \
  160. stdint.h \
  161. stdio_ext.h \
  162. stdlib.h \
  163. string.h \
  164. strings.h \
  165. sys/ioctl.h \
  166. sys/param.h \
  167. sys/socket.h \
  168. sys/time.h \
  169. termios.h \
  170. unistd.h \
  171. wchar.h])
  172. # Checks for typedefs, structures, and compiler characteristics.
  173. AC_HEADER_STDBOOL
  174. AC_C_CONST
  175. AC_C_INLINE
  176. AC_TYPE_INT16_T
  177. AC_TYPE_INT32_T
  178. AC_TYPE_INT64_T
  179. AC_TYPE_INT8_T
  180. AC_TYPE_MODE_T
  181. AC_TYPE_OFF_T
  182. AC_TYPE_SIZE_T
  183. AC_TYPE_SSIZE_T
  184. AC_HEADER_TIME
  185. AC_STRUCT_TM
  186. AC_TYPE_UINT16_T
  187. AC_TYPE_UINT32_T
  188. AC_TYPE_UINT64_T
  189. AC_TYPE_UINT8_T
  190. AC_C_VOLATILE
  191. AC_CHECK_TYPES([ptrdiff_t])
  192. AC_C_BIGENDIAN
  193. AC_SYS_LARGEFILE
  194. # Checks for library functions.
  195. AM_GNU_GETTEXT
  196. AM_GNU_GETTEXT_VERSION([0.17])
  197. AC_FUNC_ERROR_AT_LINE
  198. AC_PROG_GCC_TRADITIONAL
  199. case "$target" in
  200. *mingw*)
  201. ;;
  202. *)
  203. AC_FUNC_MALLOC
  204. AC_FUNC_REALLOC
  205. ;;
  206. esac
  207. AC_FUNC_MEMCMP
  208. AC_FUNC_MKTIME
  209. AC_FUNC_MMAP
  210. AC_FUNC_SELECT_ARGTYPES
  211. AC_TYPE_SIGNAL
  212. AC_FUNC_STAT
  213. AC_FUNC_STRFTIME
  214. AC_FUNC_VPRINTF
  215. AC_CHECK_FUNCS([__argz_count \
  216. __argz_next \
  217. __argz_stringify \
  218. atexit \
  219. daemon \
  220. ftruncate \
  221. getcwd \
  222. gethostbyaddr \
  223. gethostbyname \
  224. getpagesize \
  225. inet_ntoa \
  226. memchr \
  227. memmove \
  228. mempcpy \
  229. memset \
  230. mkdir \
  231. munmap \
  232. nl_langinfo \
  233. posix_memalign \
  234. putenv \
  235. rmdir \
  236. select \
  237. setlocale \
  238. sleep \
  239. socket \
  240. stpcpy \
  241. strcasecmp \
  242. strchr \
  243. strcspn \
  244. strdup \
  245. strerror \
  246. strncasecmp \
  247. strstr \
  248. strtol \
  249. strtoul \
  250. strtoull \
  251. tzset \
  252. unsetenv \
  253. usleep])
  254. if test "x$enable_epoll" = "xyes"; then
  255. AC_CHECK_FUNCS([epoll_create])
  256. fi
  257. AC_CHECK_FUNCS([asctime_r],
  258. [AM_CONDITIONAL([HAVE_ASCTIME_R], true)],
  259. [AM_CONDITIONAL([HAVE_ASCTIME_R], false)])
  260. AC_CHECK_FUNCS([basename],
  261. [AM_CONDITIONAL([HAVE_BASENAME], true)],
  262. [AM_CONDITIONAL([HAVE_BASENAME], false)])
  263. AC_CHECK_FUNCS([gai_strerror],
  264. [AM_CONDITIONAL([HAVE_GAI_STRERROR], true)],
  265. [AM_CONDITIONAL([HAVE_GAI_STRERROR], false)])
  266. AC_CHECK_FUNCS([getaddrinfo],
  267. [AM_CONDITIONAL([HAVE_GETADDRINFO], true)],
  268. [AM_CONDITIONAL([HAVE_GETADDRINFO], false)])
  269. AC_CHECK_FUNCS([gettimeofday],
  270. [AM_CONDITIONAL([HAVE_GETTIMEOFDAY], true)],
  271. [AM_CONDITIONAL([HAVE_GETTIMEOFDAY], false)])
  272. AC_CHECK_FUNCS([inet_aton],
  273. [AM_CONDITIONAL([HAVE_INET_ATON], true)],
  274. [AM_CONDITIONAL([HAVE_INET_ATON], false)])
  275. AC_CHECK_FUNCS([localtime_r],
  276. [AM_CONDITIONAL([HAVE_LOCALTIME_R], true)],
  277. [AM_CONDITIONAL([HAVE_LOCALTIME_R], false)])
  278. AC_CHECK_FUNCS([strptime],
  279. [AM_CONDITIONAL([HAVE_STRPTIME], true)],
  280. [AM_CONDITIONAL([HAVE_STRPTIME], false)])
  281. AC_CHECK_FUNCS([timegm],
  282. [AM_CONDITIONAL([HAVE_TIMEGM], true)],
  283. [AM_CONDITIONAL([HAVE_TIMEGM], false)])
  284. case "$target" in
  285. *mingw*)
  286. dnl defined in ws2tcpip.h, but only if _WIN32_WINNT >= 0x0501
  287. AM_CONDITIONAL([HAVE_GETADDRINFO], true)
  288. dnl defined in ws2tcpip.h, but missing in C:\mingw\lib\libws2_32.a
  289. AM_CONDITIONAL([HAVE_GAI_STRERROR], false)
  290. ;;
  291. esac
  292. AC_CONFIG_FILES([Makefile
  293. src/Makefile
  294. test/Makefile
  295. po/Makefile.in
  296. m4/Makefile
  297. intl/Makefile
  298. lib/Makefile
  299. doc/Makefile])
  300. AC_OUTPUT
  301. echo " "
  302. echo "Build: $build"
  303. echo "Target: $target"
  304. echo "Install prefix: $prefix"
  305. echo "CFLAGS: $CFLAGS"
  306. echo "CPPFLAGS: $CPPFLAGS"
  307. echo "LDFLAGS: $LDFLAGS"
  308. echo "LIBS: $LIBS"
  309. echo "SQLite3: $have_sqlite3"
  310. echo "GnuTLS: $have_libgnutls"
  311. echo "OpenSSL: $have_openssl"
  312. echo "LibXML2: $have_libxml2"
  313. echo "LibExpat: $have_libexpat"
  314. echo "LibAres: $have_libares"
  315. echo "LibCares: $have_libcares"
  316. echo "Libz: $have_libz"
  317. echo "Bittorrent: $enable_bittorrent"
  318. echo "Metalink: $enable_metalink"