configure.ac 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  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+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. AC_CHECK_HEADERS([winsock2.h \
  136. ws2tcpip.h \
  137. argz.h \
  138. arpa/inet.h \
  139. fcntl.h \
  140. float.h \
  141. inttypes.h \
  142. io.h \
  143. langinfo.h \
  144. libintl.h \
  145. limits.h \
  146. locale.h \
  147. malloc.h \
  148. netdb.h \
  149. netinet/in.h \
  150. stddef.h \
  151. stdint.h \
  152. stdio_ext.h \
  153. stdlib.h \
  154. string.h \
  155. strings.h \
  156. sys/ioctl.h \
  157. sys/param.h \
  158. sys/socket.h \
  159. sys/time.h \
  160. termios.h \
  161. unistd.h \
  162. wchar.h])
  163. # Checks for typedefs, structures, and compiler characteristics.
  164. AC_HEADER_STDBOOL
  165. AC_C_CONST
  166. AC_C_INLINE
  167. AC_TYPE_INT16_T
  168. AC_TYPE_INT32_T
  169. AC_TYPE_INT64_T
  170. AC_TYPE_INT8_T
  171. AC_TYPE_MODE_T
  172. AC_TYPE_OFF_T
  173. AC_TYPE_SIZE_T
  174. AC_TYPE_SSIZE_T
  175. AC_HEADER_TIME
  176. AC_STRUCT_TM
  177. AC_TYPE_UINT16_T
  178. AC_TYPE_UINT32_T
  179. AC_TYPE_UINT64_T
  180. AC_TYPE_UINT8_T
  181. AC_C_VOLATILE
  182. AC_CHECK_TYPES([ptrdiff_t])
  183. AC_C_BIGENDIAN
  184. AC_SYS_LARGEFILE
  185. # Checks for library functions.
  186. AM_GNU_GETTEXT
  187. AM_GNU_GETTEXT_VERSION([0.17])
  188. AC_FUNC_ERROR_AT_LINE
  189. AC_PROG_GCC_TRADITIONAL
  190. case "$target" in
  191. *mingw*)
  192. ;;
  193. *)
  194. AC_FUNC_MALLOC
  195. AC_FUNC_REALLOC
  196. ;;
  197. esac
  198. AC_FUNC_MEMCMP
  199. AC_FUNC_MKTIME
  200. AC_FUNC_MMAP
  201. AC_FUNC_SELECT_ARGTYPES
  202. AC_TYPE_SIGNAL
  203. AC_FUNC_STAT
  204. AC_FUNC_STRFTIME
  205. AC_FUNC_VPRINTF
  206. AC_CHECK_FUNCS([__argz_count \
  207. __argz_next \
  208. __argz_stringify \
  209. atexit \
  210. daemon \
  211. ftruncate \
  212. getcwd \
  213. gethostbyaddr \
  214. gethostbyname \
  215. getpagesize \
  216. inet_ntoa \
  217. memchr \
  218. memmove \
  219. mempcpy \
  220. memset \
  221. mkdir \
  222. munmap \
  223. nl_langinfo \
  224. posix_memalign \
  225. putenv \
  226. rmdir \
  227. select \
  228. setlocale \
  229. sleep \
  230. socket \
  231. stpcpy \
  232. strcasecmp \
  233. strchr \
  234. strcspn \
  235. strdup \
  236. strerror \
  237. strncasecmp \
  238. strstr \
  239. strtol \
  240. strtoul \
  241. strtoull \
  242. tzset \
  243. unsetenv \
  244. usleep])
  245. if test "x$enable_epoll" = "xyes"; then
  246. AC_CHECK_FUNCS([epoll_create])
  247. fi
  248. AC_CHECK_FUNCS([asctime_r],
  249. [AM_CONDITIONAL([HAVE_ASCTIME_R], true)],
  250. [AM_CONDITIONAL([HAVE_ASCTIME_R], false)])
  251. AC_CHECK_FUNCS([basename],
  252. [AM_CONDITIONAL([HAVE_BASENAME], true)],
  253. [AM_CONDITIONAL([HAVE_BASENAME], false)])
  254. AC_CHECK_FUNCS([gai_strerror],
  255. [AM_CONDITIONAL([HAVE_GAI_STRERROR], true)],
  256. [AM_CONDITIONAL([HAVE_GAI_STRERROR], false)])
  257. AC_CHECK_FUNCS([getaddrinfo],
  258. [AM_CONDITIONAL([HAVE_GETADDRINFO], true)],
  259. [AM_CONDITIONAL([HAVE_GETADDRINFO], false)])
  260. AC_CHECK_FUNCS([gettimeofday],
  261. [AM_CONDITIONAL([HAVE_GETTIMEOFDAY], true)],
  262. [AM_CONDITIONAL([HAVE_GETTIMEOFDAY], false)])
  263. AC_CHECK_FUNCS([inet_aton],
  264. [AM_CONDITIONAL([HAVE_INET_ATON], true)],
  265. [AM_CONDITIONAL([HAVE_INET_ATON], false)])
  266. AC_CHECK_FUNCS([localtime_r],
  267. [AM_CONDITIONAL([HAVE_LOCALTIME_R], true)],
  268. [AM_CONDITIONAL([HAVE_LOCALTIME_R], false)])
  269. AC_CHECK_FUNCS([strptime],
  270. [AM_CONDITIONAL([HAVE_STRPTIME], true)],
  271. [AM_CONDITIONAL([HAVE_STRPTIME], false)])
  272. AC_CHECK_FUNCS([timegm],
  273. [AM_CONDITIONAL([HAVE_TIMEGM], true)],
  274. [AM_CONDITIONAL([HAVE_TIMEGM], false)])
  275. case "$target" in
  276. *mingw*)
  277. dnl defined in ws2tcpip.h, but only if _WIN32_WINNT >= 0x0501
  278. AM_CONDITIONAL([HAVE_GETADDRINFO], true)
  279. dnl defined in ws2tcpip.h, but missing in C:\mingw\lib\libws2_32.a
  280. AM_CONDITIONAL([HAVE_GAI_STRERROR], false)
  281. ;;
  282. esac
  283. AC_CONFIG_FILES([Makefile
  284. src/Makefile
  285. test/Makefile
  286. po/Makefile.in
  287. m4/Makefile
  288. intl/Makefile
  289. lib/Makefile
  290. doc/Makefile])
  291. AC_OUTPUT
  292. echo " "
  293. echo "Build: $build"
  294. echo "Target: $target"
  295. echo "Install prefix: $prefix"
  296. echo "CFLAGS: $CFLAGS"
  297. echo "CPPFLAGS: $CPPFLAGS"
  298. echo "LDFLAGS: $LDFLAGS"
  299. echo "LIBS: $LIBS"
  300. echo "SQLite3: $have_sqlite3"
  301. echo "GnuTLS: $have_libgnutls"
  302. echo "OpenSSL: $have_openssl"
  303. echo "LibXML2: $have_libxml2"
  304. echo "LibExpat: $have_libexpat"
  305. echo "LibAres: $have_libares"
  306. echo "LibCares: $have_libcares"
  307. echo "Libz: $have_libz"
  308. echo "Bittorrent: $enable_bittorrent"
  309. echo "Metalink: $enable_metalink"