configure.ac 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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.0, 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([ares], [ --with-ares use ares library if installed. Default: yes], [with_libares=$withval], [with_libares=yes])
  18. AC_ARG_ENABLE([bittorrent], [ --enable-bittorrent enable BitTorrent support. Default: yes], [enable_bittorrent=$enableval], [enable_bittorrent=yes])
  19. AC_ARG_ENABLE([metalink], [ --enable-metalink enable Metalink support. Default: yes], [enable_metalink=$enableval], [enable_metalink=yes])
  20. # Checks for programs.
  21. AC_PROG_CXX
  22. AC_PROG_CC
  23. AC_PROG_INSTALL
  24. AC_PROG_RANLIB
  25. AC_PROG_YACC
  26. # Checks for libraries.
  27. if test "x$with_libxml2" = "xyes"; then
  28. AM_PATH_XML2([2.6.26], [have_libxml2=yes])
  29. if test "x$have_libxml2" = "xyes"; then
  30. AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have libxml2.])
  31. fi
  32. fi
  33. if test "x$with_gnutls" = "xyes"; then
  34. AM_PATH_LIBGNUTLS([1.2.9], [have_libgnutls=yes])
  35. if test "x$have_libgnutls" = "xyes"; then
  36. AC_DEFINE([HAVE_LIBGNUTLS], [1], [Define to 1 if you have libgnutls.])
  37. fi
  38. fi
  39. if test "x$have_libgnutls" = "xyes"; then
  40. AM_PATH_LIBGCRYPT([1.2.2], [have_libgcrypt=yes])
  41. if test "x$have_libgcrypt" = "xyes"; then
  42. AC_DEFINE([HAVE_LIBGCRYPT], [1], [Define to 1 if you have libgcrypt.])
  43. fi
  44. fi
  45. if test "x$with_openssl" = "xyes" && test "x$have_libgnutls" != "xyes"; then
  46. AM_PATH_OPENSSL
  47. fi
  48. if test "x$with_libares" = "xyes"; then
  49. AM_PATH_LIBARES
  50. fi
  51. # Define variables based on the result of the checks for libraries.
  52. if test "x$have_libgnutls" = "xyes" || test "x$have_openssl" = "xyes"; then
  53. AC_DEFINE([ENABLE_SSL], [1], [Define to 1 if ssl support is enabled.])
  54. fi
  55. if test "x$have_libgcrypt" = "xyes" || test "x$have_openssl" = "xyes"; then
  56. AC_DEFINE([ENABLE_MESSAGE_DIGEST], [1], [Define to 1 if message digest support is enabled.])
  57. enable_message_digest=yes
  58. fi
  59. if test "x$enable_bittorrent" = "xyes" && test "x$enable_message_digest" = "xyes"; then
  60. AC_DEFINE([ENABLE_BITTORRENT], [1], [Define to 1 if BitTorrent support is enabled.])
  61. AM_CONDITIONAL([ENABLE_BITTORRENT], true)
  62. else
  63. AM_CONDITIONAL([ENABLE_BITTORRENT], false)
  64. fi
  65. if test "x$have_libxml2" = "xyes" && test "x$enable_metalink" = "xyes"; then
  66. AC_DEFINE([ENABLE_METALINK], [1], [Define to 1 if Metalink support is enabled.])
  67. AM_CONDITIONAL([ENABLE_METALINK], true)
  68. else
  69. AM_CONDITIONAL([ENABLE_METALINK], false)
  70. fi
  71. if test "x$have_libares" = "xyes"; then
  72. AM_CONDITIONAL([HAVE_LIBARES], true)
  73. else
  74. AM_CONDITIONAL([HAVE_LIBARES], false)
  75. fi
  76. # Checks for header files.
  77. AC_FUNC_ALLOCA
  78. #AC_HEADER_STDC
  79. 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])
  80. # Checks for typedefs, structures, and compiler characteristics.
  81. AC_HEADER_STDBOOL
  82. AC_C_CONST
  83. AC_C_INLINE
  84. AC_TYPE_SIZE_T
  85. AC_HEADER_TIME
  86. AC_STRUCT_TM
  87. AC_C_VOLATILE
  88. # Checks for library functions.
  89. AM_GNU_GETTEXT
  90. AM_GNU_GETTEXT_VERSION(0.12.1)
  91. AC_FUNC_ERROR_AT_LINE
  92. AC_FUNC_MALLOC
  93. AC_FUNC_MEMCMP
  94. AC_FUNC_MMAP
  95. AC_FUNC_REALLOC
  96. AC_FUNC_SELECT_ARGTYPES
  97. AC_FUNC_STAT
  98. AC_FUNC_VPRINTF
  99. 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])
  100. AC_CONFIG_FILES([Makefile
  101. src/Makefile
  102. test/Makefile
  103. po/Makefile.in
  104. m4/Makefile
  105. intl/Makefile])
  106. AC_OUTPUT