configure.ac 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. #
  4. AC_PREREQ(2.59)
  5. AC_INIT(aria2c, 0.7.2, tujikawa@rednoah.com)
  6. AM_INIT_AUTOMAKE()
  7. AM_PATH_CPPUNIT(1.10.2)
  8. AC_CONFIG_SRCDIR([src/Socket.h])
  9. AC_CONFIG_HEADERS([config.h])
  10. # Set localedir
  11. localedir=${datadir}/locale
  12. AC_SUBST(localedir)
  13. # Checks for arguments.
  14. AC_ARG_WITH([gnutls], [ --with-gnutls use gnutls library if installed. Default: yes], [with_gnutls=$withval], [with_gnutls=yes])
  15. AC_ARG_WITH([openssl], [ --with-openssl use openssl library if installed. Default: yes], [with_openssl=$withval], [with_openssl=yes])
  16. AC_ARG_WITH([libxml2], [ --with-libxml2 use libxml2 library if installed. Default: yes], [with_libxml2=$withval], [with_libxml2=yes])
  17. AC_ARG_WITH([libares], [ --with-libares use ares library if installed. Default: yes], [with_libares=$withval], [with_libares=yes])
  18. AC_ARG_WITH([libcares], [ --with-libcares use c-ares library if installed. Default: yes], [with_libcares=$withval], [with_libcares=yes])
  19. AC_ARG_ENABLE([bittorrent], [ --enable-bittorrent enable BitTorrent support. Default: yes], [enable_bittorrent=$enableval], [enable_bittorrent=yes])
  20. AC_ARG_ENABLE([metalink], [ --enable-metalink enable Metalink support. Default: yes], [enable_metalink=$enableval], [enable_metalink=yes])
  21. # Checks for programs.
  22. AC_PROG_CXX
  23. AC_PROG_CC
  24. AC_PROG_INSTALL
  25. AC_PROG_RANLIB
  26. AC_PROG_YACC
  27. # Checks for libraries.
  28. if test "x$with_libxml2" = "xyes"; then
  29. AM_PATH_XML2([2.6.26], [have_libxml2=yes])
  30. if test "x$have_libxml2" = "xyes"; then
  31. AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have libxml2.])
  32. fi
  33. fi
  34. if test "x$with_gnutls" = "xyes"; then
  35. AM_PATH_LIBGNUTLS([1.2.9], [have_libgnutls=yes])
  36. if test "x$have_libgnutls" = "xyes"; then
  37. AC_DEFINE([HAVE_LIBGNUTLS], [1], [Define to 1 if you have libgnutls.])
  38. fi
  39. fi
  40. if test "x$have_libgnutls" = "xyes"; then
  41. AM_PATH_LIBGCRYPT([1.2.2], [have_libgcrypt=yes])
  42. if test "x$have_libgcrypt" = "xyes"; then
  43. AC_DEFINE([HAVE_LIBGCRYPT], [1], [Define to 1 if you have libgcrypt.])
  44. fi
  45. fi
  46. if test "x$with_openssl" = "xyes" && test "x$have_libgnutls" != "xyes"; then
  47. AM_PATH_OPENSSL
  48. fi
  49. if test "x$with_libcares" = "xyes"; then
  50. AM_PATH_LIBCARES
  51. fi
  52. if test "x$have_libcares" = "x"; then
  53. if test "x$with_libares" = "xyes"; then
  54. AM_PATH_LIBARES
  55. fi
  56. fi
  57. # Define variables based on the result of the checks for libraries.
  58. if test "x$have_libgnutls" = "xyes" || test "x$have_openssl" = "xyes"; then
  59. AC_DEFINE([ENABLE_SSL], [1], [Define to 1 if ssl support is enabled.])
  60. fi
  61. if test "x$have_libgcrypt" = "xyes" || test "x$have_openssl" = "xyes"; then
  62. AC_DEFINE([ENABLE_MESSAGE_DIGEST], [1], [Define to 1 if message digest support is enabled.])
  63. enable_message_digest=yes
  64. fi
  65. if test "x$enable_bittorrent" = "xyes" && test "x$enable_message_digest" = "xyes"; then
  66. AC_DEFINE([ENABLE_BITTORRENT], [1], [Define to 1 if BitTorrent support is enabled.])
  67. AM_CONDITIONAL([ENABLE_BITTORRENT], true)
  68. else
  69. AM_CONDITIONAL([ENABLE_BITTORRENT], false)
  70. fi
  71. if test "x$have_libxml2" = "xyes" && test "x$enable_metalink" = "xyes"; then
  72. AC_DEFINE([ENABLE_METALINK], [1], [Define to 1 if Metalink support is enabled.])
  73. AM_CONDITIONAL([ENABLE_METALINK], true)
  74. else
  75. AM_CONDITIONAL([ENABLE_METALINK], false)
  76. fi
  77. if test "x$have_libcares" = "xyes" || test "x$have_libares" = "xyes"; then
  78. AC_DEFINE([ENABLE_ASYNC_DNS], [1], [Define to 1 if asynchronous DNS support is enabled.])
  79. AM_CONDITIONAL([ENABLE_ASYNC_DNS], true)
  80. else
  81. AM_CONDITIONAL([ENABLE_ASYNC_DNS], false)
  82. fi
  83. # Checks for header files.
  84. AC_FUNC_ALLOCA
  85. #AC_HEADER_STDC
  86. AC_CHECK_HEADERS([argz.h arpa/inet.h fcntl.h inttypes.h langinfo.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])
  87. # Checks for typedefs, structures, and compiler characteristics.
  88. AC_HEADER_STDBOOL
  89. AC_C_CONST
  90. AC_C_INLINE
  91. AC_TYPE_SIZE_T
  92. AC_HEADER_TIME
  93. AC_STRUCT_TM
  94. AC_C_VOLATILE
  95. # Checks for library functions.
  96. AM_GNU_GETTEXT
  97. AM_GNU_GETTEXT_VERSION(0.12.1)
  98. AC_FUNC_ERROR_AT_LINE
  99. AC_FUNC_MALLOC
  100. AC_FUNC_MEMCMP
  101. AC_FUNC_MMAP
  102. AC_FUNC_REALLOC
  103. AC_FUNC_SELECT_ARGTYPES
  104. AC_FUNC_STAT
  105. AC_FUNC_VPRINTF
  106. AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify ftruncate getcwd getpagesize gettimeofday inet_ntoa memchr mempcpy memset mkdir munmap nl_langinfo rmdir select setlocale socket stpcpy strcasecmp strchr strcspn strdup strerror strstr strtol strtoul])
  107. AC_CONFIG_FILES([Makefile
  108. src/Makefile
  109. test/Makefile
  110. po/Makefile.in
  111. m4/Makefile
  112. intl/Makefile])
  113. AC_OUTPUT