configure.ac 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. dnl Wslay - The WebSocket Library
  2. dnl Copyright (c) 2011, 2012 Tatsuhiro Tsujikawa
  3. dnl Permission is hereby granted, free of charge, to any person obtaining
  4. dnl a copy of this software and associated documentation files (the
  5. dnl "Software"), to deal in the Software without restriction, including
  6. dnl without limitation the rights to use, copy, modify, merge, publish,
  7. dnl distribute, sublicense, and/or sell copies of the Software, and to
  8. dnl permit persons to whom the Software is furnished to do so, subject to
  9. dnl the following conditions:
  10. dnl The above copyright notice and this permission notice shall be
  11. dnl included in all copies or substantial portions of the Software.
  12. dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13. dnl EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14. dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  15. dnl NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  16. dnl LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  17. dnl OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  18. dnl WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  19. AC_PREREQ(2.61)
  20. AC_INIT([wslay], [1.1.1], [t-tujikawa@users.sourceforge.net])
  21. LT_PREREQ([2.2.6])
  22. LT_INIT()
  23. AC_CONFIG_AUX_DIR([.])
  24. dnl See versioning rule:
  25. dnl http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
  26. AC_SUBST(LT_CURRENT, 1)
  27. AC_SUBST(LT_REVISION, 1)
  28. AC_SUBST(LT_AGE, 1)
  29. AC_CANONICAL_BUILD
  30. AC_CANONICAL_HOST
  31. AC_CANONICAL_TARGET
  32. AC_CONFIG_MACRO_DIR([m4])
  33. AM_INIT_AUTOMAKE()
  34. AC_CONFIG_HEADERS([config.h])
  35. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  36. # Checks for command-line options
  37. AC_ARG_ENABLE([werror],
  38. [AS_HELP_STRING([--enable-werror],
  39. [Turn on compile time warnings])],
  40. [werror=$enableval], [werror=no])
  41. dnl Checks for programs
  42. AC_PROG_CC
  43. AC_PROG_CXX
  44. AC_PROG_INSTALL
  45. AC_PROG_LN_S
  46. AC_PROG_MAKE_SET
  47. PKG_PROG_PKG_CONFIG([0.20])
  48. AC_PATH_PROG([SPHINX_BUILD], [sphinx-build])
  49. AC_SUBST([SPHINX_BUILD])
  50. AM_CONDITIONAL([HAVE_SPHINX_BUILD], [ test "x$SPHINX_BUILD" != "x" ])
  51. # Checks for libraries.
  52. # Nettle used in examples
  53. PKG_CHECK_MODULES([NETTLE], [nettle >= 2.4], [have_nettle=yes], [have_nettle=no])
  54. AC_CHECK_LIB([cunit], [CU_initialize_registry],
  55. [have_cunit=yes], [have_cunit=no])
  56. AM_CONDITIONAL([HAVE_CUNIT], [ test "x${have_cunit}" = "xyes" ])
  57. case "$target" in
  58. *mingw*)
  59. # Required for ntoh*/hton* functions.
  60. LIBS="-lws2_32 $LIBS"
  61. ;;
  62. esac
  63. # Checks for header files.
  64. AC_CHECK_HEADERS([ \
  65. arpa/inet.h \
  66. netinet/in.h \
  67. stddef.h \
  68. stdint.h \
  69. stdlib.h \
  70. string.h \
  71. unistd.h \
  72. ])
  73. # Need winsock2.h for ntoh*/hton* functions.
  74. case "$target" in
  75. *mingw*)
  76. AC_CHECK_HEADERS([winsock2.h])
  77. ;;
  78. esac
  79. # Checks for typedefs, structures, and compiler characteristics.
  80. AC_TYPE_SIZE_T
  81. AC_TYPE_SSIZE_T
  82. AC_TYPE_UINT8_T
  83. AC_TYPE_UINT16_T
  84. AC_TYPE_UINT32_T
  85. AC_TYPE_UINT64_T
  86. AC_CHECK_TYPES([ptrdiff_t])
  87. AC_C_BIGENDIAN
  88. # Checks for library functions.
  89. AC_CHECK_FUNCS([ \
  90. memmove \
  91. memset \
  92. ntohl \
  93. ntohs \
  94. htons
  95. ])
  96. build_examples=no
  97. if test "x${have_nettle}" = "xyes"; then
  98. case $host_os in
  99. linux*)
  100. # the examples uses epoll
  101. build_examples=yes
  102. ;;
  103. esac
  104. fi
  105. AM_CONDITIONAL([ENABLE_EXAMPLES], [ test "x${build_examples}" = "xyes" ])
  106. AC_CONFIG_FILES([
  107. Makefile
  108. lib/Makefile
  109. lib/libwslay.pc
  110. lib/includes/Makefile
  111. lib/includes/wslay/wslayver.h
  112. tests/Makefile
  113. ])
  114. AC_OUTPUT
  115. AC_MSG_NOTICE([summary of build options:
  116. version: ${VERSION} shared $LT_CURRENT:$LT_REVISION:$LT_AGE
  117. Host type: ${host}
  118. Install prefix: ${prefix}
  119. C compiler: ${CC}
  120. CFlags: ${CFLAGS}
  121. Library types: Shared=${enable_shared}, Static=${enable_static}
  122. CUnit: ${have_cunit}
  123. Nettle: ${have_nettle}
  124. Build examples: ${build_examples}
  125. ])