configure.ac 3.9 KB

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