configure.ac 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. #
  4. AC_PREREQ(2.59)
  5. AC_INIT(aria2c, 0.11.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"
  15. AC_SUBST(WINSOCK_LIBS)
  16. ;;
  17. esac
  18. # Set localedir
  19. localedir=${datadir}/locale
  20. AC_SUBST(localedir)
  21. # Checks for arguments.
  22. AC_ARG_WITH([gnutls], [ --with-gnutls use gnutls library if installed. Default: yes], [with_gnutls=$withval], [with_gnutls=yes])
  23. AC_ARG_WITH([openssl], [ --with-openssl use openssl library if installed. Default: yes], [with_openssl=$withval], [with_openssl=yes])
  24. AC_ARG_WITH([libxml2], [ --with-libxml2 use libxml2 library if installed. Default: yes], [with_libxml2=$withval], [with_libxml2=yes])
  25. AC_ARG_WITH([libares], [ --with-libares use ares library if installed. Default: yes], [with_libares=$withval], [with_libares=yes])
  26. AC_ARG_WITH([libcares], [ --with-libcares use c-ares library if installed. Default: yes], [with_libcares=$withval], [with_libcares=yes])
  27. AC_ARG_ENABLE([bittorrent], [ --enable-bittorrent enable BitTorrent support. Default: yes], [enable_bittorrent=$enableval], [enable_bittorrent=yes])
  28. AC_ARG_ENABLE([metalink], [ --enable-metalink enable Metalink support. Default: yes], [enable_metalink=$enableval], [enable_metalink=yes])
  29. # Checks for programs.
  30. AC_PROG_CXX
  31. AC_PROG_CC
  32. AC_PROG_INSTALL
  33. AC_PROG_RANLIB
  34. AC_PROG_YACC
  35. # Checks for libraries.
  36. if test "x$with_libxml2" = "xyes"; then
  37. AM_PATH_XML2([2.6.24], [have_libxml2=yes])
  38. if test "x$have_libxml2" = "xyes"; then
  39. AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have libxml2.])
  40. fi
  41. fi
  42. if test "x$with_gnutls" = "xyes"; then
  43. AM_PATH_LIBGNUTLS([1.2.9], [have_libgnutls=yes])
  44. if test "x$have_libgnutls" = "xyes"; then
  45. AC_DEFINE([HAVE_LIBGNUTLS], [1], [Define to 1 if you have libgnutls.])
  46. fi
  47. fi
  48. if test "x$have_libgnutls" = "xyes"; then
  49. AM_PATH_LIBGCRYPT([1.2.2], [have_libgcrypt=yes])
  50. if test "x$have_libgcrypt" = "xyes"; then
  51. AC_DEFINE([HAVE_LIBGCRYPT], [1], [Define to 1 if you have libgcrypt.])
  52. fi
  53. fi
  54. if test "x$with_openssl" = "xyes" && test "x$have_libgnutls" != "xyes"; then
  55. AM_PATH_OPENSSL
  56. fi
  57. if test "x$with_libcares" = "xyes"; then
  58. AM_PATH_LIBCARES
  59. fi
  60. if test "x$have_libcares" = "x"; then
  61. if test "x$with_libares" = "xyes"; then
  62. AM_PATH_LIBARES
  63. fi
  64. fi
  65. # Define variables based on the result of the checks for libraries.
  66. if test "x$have_libgnutls" = "xyes" || test "x$have_openssl" = "xyes"; then
  67. AC_DEFINE([ENABLE_SSL], [1], [Define to 1 if ssl support is enabled.])
  68. fi
  69. if test "x$have_libgcrypt" = "xyes" || test "x$have_openssl" = "xyes"; then
  70. AC_DEFINE([ENABLE_MESSAGE_DIGEST], [1], [Define to 1 if message digest support is enabled.])
  71. AM_CONDITIONAL([ENABLE_MESSAGE_DIGEST], true)
  72. enable_message_digest=yes
  73. else
  74. AM_CONDITIONAL([ENABLE_MESSAGE_DIGEST], false)
  75. fi
  76. if test "x$enable_bittorrent" = "xyes" && test "x$enable_message_digest" = "xyes"; then
  77. AC_DEFINE([ENABLE_BITTORRENT], [1], [Define to 1 if BitTorrent support is enabled.])
  78. AM_CONDITIONAL([ENABLE_BITTORRENT], true)
  79. else
  80. AM_CONDITIONAL([ENABLE_BITTORRENT], false)
  81. fi
  82. if test "x$have_libxml2" = "xyes" && test "x$enable_metalink" = "xyes"; then
  83. AC_DEFINE([ENABLE_METALINK], [1], [Define to 1 if Metalink support is enabled.])
  84. AM_CONDITIONAL([ENABLE_METALINK], true)
  85. else
  86. AM_CONDITIONAL([ENABLE_METALINK], false)
  87. fi
  88. if test "x$have_libcares" = "xyes" || test "x$have_libares" = "xyes"; then
  89. AC_DEFINE([ENABLE_ASYNC_DNS], [1], [Define to 1 if asynchronous DNS support is enabled.])
  90. AM_CONDITIONAL([ENABLE_ASYNC_DNS], true)
  91. else
  92. AM_CONDITIONAL([ENABLE_ASYNC_DNS], false)
  93. fi
  94. # Checks for header files.
  95. AC_FUNC_ALLOCA
  96. #AC_HEADER_STDC
  97. AC_CHECK_HEADERS([winsock2.h ws2tcpip.h argz.h arpa/inet.h fcntl.h inttypes.h io.h langinfo.h libgen.h libintl.h limits.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdint.h stdio_ext.h stdlib.h string.h strings.h sys/param.h sys/socket.h sys/time.h unistd.h])
  98. # Checks for typedefs, structures, and compiler characteristics.
  99. AC_HEADER_STDBOOL
  100. AC_C_CONST
  101. AC_C_INLINE
  102. AC_TYPE_SIZE_T
  103. AC_HEADER_TIME
  104. AC_STRUCT_TM
  105. AC_C_VOLATILE
  106. # Checks for library functions.
  107. AM_GNU_GETTEXT
  108. AM_GNU_GETTEXT_VERSION(0.12.1)
  109. AC_FUNC_ERROR_AT_LINE
  110. case "$target" in
  111. *mingw*)
  112. ;;
  113. *)
  114. AC_FUNC_MALLOC
  115. AC_FUNC_REALLOC
  116. ;;
  117. esac
  118. AC_FUNC_MEMCMP
  119. AC_FUNC_MMAP
  120. AC_FUNC_SELECT_ARGTYPES
  121. AC_FUNC_STAT
  122. AC_FUNC_VPRINTF
  123. AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify daemon ftruncate getcwd getpagesize inet_ntoa memchr mempcpy memset mkdir munmap nl_langinfo random rmdir select setlocale setmode sigaction sleep socket srandom stpcpy strcasecmp strchr strcspn strdup strerror strstr strtol strtoul timegm usleep])
  124. AC_CHECK_FUNCS([basename],
  125. [AM_CONDITIONAL([HAVE_BASENAME], true)],
  126. [AM_CONDITIONAL([HAVE_BASENAME], false)])
  127. AC_CHECK_FUNCS([gai_strerror],
  128. [AM_CONDITIONAL([HAVE_GAI_STRERROR], true)],
  129. [AM_CONDITIONAL([HAVE_GAI_STRERROR], false)])
  130. AC_CHECK_FUNCS([getaddrinfo],
  131. [AM_CONDITIONAL([HAVE_GETADDRINFO], true)],
  132. [AM_CONDITIONAL([HAVE_GETADDRINFO], false)])
  133. AC_CHECK_FUNCS([gettimeofday],
  134. [AM_CONDITIONAL([HAVE_GETTIMEOFDAY], true)],
  135. [AM_CONDITIONAL([HAVE_GETTIMEOFDAY], false)])
  136. AC_CHECK_FUNCS([inet_aton],
  137. [AM_CONDITIONAL([HAVE_INET_ATON], true)],
  138. [AM_CONDITIONAL([HAVE_INET_ATON], false)])
  139. AC_CHECK_FUNCS([localtime_r],
  140. [AM_CONDITIONAL([HAVE_LOCALTIME_R], true)],
  141. [AM_CONDITIONAL([HAVE_LOCALTIME_R], false)])
  142. AC_CHECK_FUNCS([strptime],
  143. [AM_CONDITIONAL([HAVE_STRPTIME], true)],
  144. [AM_CONDITIONAL([HAVE_STRPTIME], false)])
  145. case "$target" in
  146. *mingw*)
  147. dnl true if _WIN32_WINNT >= 0x0501
  148. AM_CONDITIONAL([HAVE_GETADDRINFO], true)
  149. ;;
  150. esac
  151. AC_CONFIG_FILES([Makefile
  152. src/Makefile
  153. test/Makefile
  154. po/Makefile.in
  155. m4/Makefile
  156. intl/Makefile
  157. doc/Makefile])
  158. AC_OUTPUT