You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

183 lines
4.4 KiB

12 years ago
12 years ago
10 years ago
11 years ago
12 years ago
12 years ago
12 years ago
12 years ago
11 years ago
12 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
11 years ago
12 years ago
12 years ago
11 years ago
11 years ago
12 years ago
  1. dnl -*- Autoconf -*-
  2. dnl Process this file with autoconf to produce a configure script.
  3. AC_PREREQ([2.67])
  4. AC_INIT([shadowsocks], [1.4.2], [max.c.lv@gmail.com])
  5. AC_CONFIG_SRCDIR([src/encrypt.c])
  6. AC_CONFIG_HEADERS([config.h])
  7. AM_INIT_AUTOMAKE([foreign -Wall -Werror])
  8. m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
  9. dnl Checks for crypto library
  10. AC_ARG_WITH(
  11. [crypto-library],
  12. [AS_HELP_STRING([--with-crypto-library=library], [build with the given crypto library, TYPE=openssl|polarssl @<:@default=openssl@:>@])],
  13. [
  14. case "${withval}" in
  15. openssl|polarssl) ;;
  16. *) AC_MSG_ERROR([bad value ${withval} for --with-crypto-library]) ;;
  17. esac
  18. ],
  19. [with_crypto_library="openssl"]
  20. )
  21. dnl Checks for programs.
  22. AC_PROG_CC
  23. AC_PROG_INSTALL
  24. AC_PROG_LIBTOOL
  25. AC_PROG_LN_S
  26. AC_PROG_MAKE_SET
  27. AC_LANG_SOURCE
  28. AM_PROG_CC_C_O
  29. dnl Checks for libev
  30. m4_include([libev/libev.m4])
  31. dnl Add library for mingw
  32. case $host in
  33. *-mingw*)
  34. LIBS="$LIBS -lgdi32 -lws2_32 -lcrypt32"
  35. ;;
  36. *)
  37. ;;
  38. esac
  39. dnl Checks for crypto library
  40. case "${with_crypto_library}" in
  41. openssl)
  42. ss_OPENSSL
  43. AC_DEFINE([USE_CRYPTO_OPENSSL], [1], [Use OpenSSL library])
  44. ;;
  45. polarssl)
  46. ss_POLARSSL
  47. AC_DEFINE([USE_CRYPTO_POLARSSL], [1], [Use PolarSSL library])
  48. ;;
  49. esac
  50. dnl Checks for inet_ntop
  51. ss_FUNC_INET_NTOP
  52. dnl Checks for host.
  53. AC_MSG_CHECKING(for what kind of host)
  54. case $host in
  55. *-linux*)
  56. os_support=linux
  57. AC_MSG_RESULT(Linux)
  58. ;;
  59. *-mingw*)
  60. dnl Add custom macros for libev
  61. AC_DEFINE([FD_SETSIZE], [2048], [Reset max file descriptor size.])
  62. AC_DEFINE([EV_FD_TO_WIN32_HANDLE(fd)], [(fd)], [Override libev default fd conversion macro.])
  63. AC_DEFINE([EV_WIN32_HANDLE_TO_FD(handle)], [(handle)], [Override libev default handle conversion macro.])
  64. AC_DEFINE([EV_WIN32_CLOSE_FD(fd)], [closesocket(fd)], [Override libev default fd close macro.])
  65. os_support=mingw
  66. AC_MSG_RESULT(MinGW)
  67. ;;
  68. *)
  69. AC_MSG_RESULT(transparent proxy does not support for $host)
  70. ;;
  71. esac
  72. AM_CONDITIONAL(BUILD_REDIRECTOR, test "$os_support" = "linux")
  73. AM_CONDITIONAL(BUILD_WINCOMPAT, test "$os_support" = "mingw")
  74. dnl Checks for header files.
  75. AC_CHECK_HEADERS([stdint.h inttypes.h arpa/inet.h fcntl.h langinfo.h locale.h netdb.h netinet/in.h stdlib.h string.h strings.h unistd.h sys/ioctl.h])
  76. case $host in
  77. *-mingw*)
  78. AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h], [], [AC_MSG_ERROR([Missing MinGW headers])], [])
  79. ;;
  80. *)
  81. # These are POSIX-like systems using BSD-like sockets API.
  82. ;;
  83. esac
  84. dnl A special check required for <net/if.h> on Darwin. See
  85. dnl http://www.gnu.org/software/autoconf/manual/html_node/Header-Portability.html.
  86. AC_CHECK_HEADERS([sys/socket.h])
  87. AC_CHECK_HEADERS([net/if.h], [], [],
  88. [
  89. #include <stdio.h>
  90. #ifdef STDC_HEADERS
  91. # include <stdlib.h>
  92. # include <stddef.h>
  93. #else
  94. # ifdef HAVE_STDLIB_H
  95. # include <stdlib.h>
  96. # endif
  97. #endif
  98. #ifdef HAVE_SYS_SOCKET_H
  99. # include <sys/socket.h>
  100. #endif
  101. ])
  102. AC_C_BIGENDIAN
  103. dnl Checks for typedefs, structures, and compiler characteristics.
  104. AC_C_INLINE
  105. AC_TYPE_SSIZE_T
  106. dnl Checks for header files.
  107. AC_HEADER_ASSERT
  108. AC_HEADER_STDC
  109. AC_HEADER_SYS_WAIT
  110. dnl Checks for typedefs, structures, and compiler characteristics.
  111. AC_C_CONST
  112. AC_TYPE_PID_T
  113. AC_TYPE_SIZE_T
  114. AC_TYPE_SSIZE_T
  115. AC_TYPE_UINT16_T
  116. AC_TYPE_UINT8_T
  117. AC_HEADER_TIME
  118. dnl Checks for library functions.
  119. AC_FUNC_FORK
  120. AC_FUNC_SELECT_ARGTYPES
  121. AC_TYPE_SIGNAL
  122. AC_CHECK_FUNCS([memset select setresuid setreuid strerror])
  123. dnl Check for select() into ws2_32 for Msys/Mingw
  124. if test "$ac_cv_func_select" != "yes"; then
  125. AC_MSG_CHECKING([for select in ws2_32])
  126. AC_TRY_LINK([
  127. #ifdef HAVE_WINSOCK2_H
  128. #ifndef WIN32_LEAN_AND_MEAN
  129. #define WIN32_LEAN_AND_MEAN
  130. #endif
  131. #include <winsock2.h>
  132. #endif
  133. ],[
  134. select(0,(fd_set *)NULL,(fd_set *)NULL,(fd_set *)NULL,(struct timeval *)NULL);
  135. ],[
  136. AC_MSG_RESULT([yes])
  137. HAVE_SELECT="1"
  138. AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
  139. [Define to 1 if you have the `select' function.])
  140. HAVE_SYS_SELECT_H="1"
  141. AC_DEFINE_UNQUOTED(HAVE_SYS_SELECT_H, 1,
  142. [Define to 1 if you have the <sys/select.h> header file.])
  143. ],[
  144. AC_MSG_ERROR([no])
  145. ])
  146. fi
  147. AC_SYS_LARGEFILE
  148. AC_CHECK_LIB(socket, connect)
  149. dnl Checks for library functions.
  150. AC_CHECK_FUNCS([malloc memset socket])
  151. ACX_PTHREAD
  152. AC_CONFIG_MACRO_DIR([m4])
  153. AC_CONFIG_FILES([Makefile
  154. libasyncns/Makefile
  155. libev/Makefile
  156. src/Makefile])
  157. AC_OUTPUT