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.

161 lines
3.8 KiB

12 years ago
12 years ago
11 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
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.0], [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 programs.
  10. AC_PROG_CC
  11. AC_PROG_INSTALL
  12. AC_PROG_LIBTOOL
  13. AC_PROG_LN_S
  14. AC_PROG_MAKE_SET
  15. AC_LANG_SOURCE
  16. AM_PROG_CC_C_O
  17. dnl Checks for libev
  18. m4_include([libev/libev.m4])
  19. dnl Add library for mingw
  20. case $host in
  21. *-mingw*)
  22. LIBS="$LIBS -lgdi32 -lws2_32"
  23. ;;
  24. *)
  25. ;;
  26. esac
  27. dnl Checks for openssl
  28. ss_OPENSSL
  29. dnl Checks for inet_ntop
  30. ss_FUNC_INET_NTOP
  31. dnl Checks for host.
  32. AC_MSG_CHECKING(for what kind of host)
  33. case $host in
  34. *-linux*)
  35. os_support=linux
  36. AC_MSG_RESULT(Linux)
  37. ;;
  38. *-mingw*)
  39. dnl Add custom macros for libev
  40. AC_DEFINE([FD_SETSIZE], [2048], [Reset max file descriptor size.])
  41. AC_DEFINE([EV_FD_TO_WIN32_HANDLE(fd)], [(fd)], [Override libev default fd conversion macro.])
  42. AC_DEFINE([EV_WIN32_HANDLE_TO_FD(handle)], [(handle)], [Override libev default handle conversion macro.])
  43. AC_DEFINE([EV_WIN32_CLOSE_FD(fd)], [closesocket(fd)], [Override libev default fd close macro.])
  44. os_support=mingw
  45. AC_MSG_RESULT(MinGW)
  46. ;;
  47. *)
  48. AC_MSG_RESULT(transparent proxy does not support for $host)
  49. ;;
  50. esac
  51. AM_CONDITIONAL(BUILD_REDIRECTOR, test "$os_support" = "linux")
  52. AM_CONDITIONAL(BUILD_WINCOMPAT, test "$os_support" = "mingw")
  53. dnl Checks for header files.
  54. 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])
  55. case $host in
  56. *-mingw*)
  57. AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h], [], [AC_MSG_ERROR([Missing MinGW headers])], [])
  58. ;;
  59. *)
  60. # These are POSIX-like systems using BSD-like sockets API.
  61. ;;
  62. esac
  63. dnl A special check required for <net/if.h> on Darwin. See
  64. dnl http://www.gnu.org/software/autoconf/manual/html_node/Header-Portability.html.
  65. AC_CHECK_HEADERS([sys/socket.h])
  66. AC_CHECK_HEADERS([net/if.h], [], [],
  67. [
  68. #include <stdio.h>
  69. #ifdef STDC_HEADERS
  70. # include <stdlib.h>
  71. # include <stddef.h>
  72. #else
  73. # ifdef HAVE_STDLIB_H
  74. # include <stdlib.h>
  75. # endif
  76. #endif
  77. #ifdef HAVE_SYS_SOCKET_H
  78. # include <sys/socket.h>
  79. #endif
  80. ])
  81. AC_C_BIGENDIAN
  82. dnl Checks for typedefs, structures, and compiler characteristics.
  83. AC_C_INLINE
  84. AC_TYPE_SSIZE_T
  85. dnl Checks for header files.
  86. AC_HEADER_ASSERT
  87. AC_HEADER_STDC
  88. AC_HEADER_SYS_WAIT
  89. dnl Checks for typedefs, structures, and compiler characteristics.
  90. AC_C_CONST
  91. AC_TYPE_PID_T
  92. AC_TYPE_SIZE_T
  93. AC_TYPE_SSIZE_T
  94. AC_TYPE_UINT16_T
  95. AC_TYPE_UINT8_T
  96. AC_HEADER_TIME
  97. dnl Checks for library functions.
  98. AC_FUNC_FORK
  99. AC_FUNC_SELECT_ARGTYPES
  100. AC_TYPE_SIGNAL
  101. AC_CHECK_FUNCS([memset select setresuid setreuid strerror])
  102. dnl Check for select() into ws2_32 for Msys/Mingw
  103. if test "$ac_cv_func_select" != "yes"; then
  104. AC_MSG_CHECKING([for select in ws2_32])
  105. AC_TRY_LINK([
  106. #ifdef HAVE_WINSOCK2_H
  107. #ifndef WIN32_LEAN_AND_MEAN
  108. #define WIN32_LEAN_AND_MEAN
  109. #endif
  110. #include <winsock2.h>
  111. #endif
  112. ],[
  113. select(0,(fd_set *)NULL,(fd_set *)NULL,(fd_set *)NULL,(struct timeval *)NULL);
  114. ],[
  115. AC_MSG_RESULT([yes])
  116. HAVE_SELECT="1"
  117. AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
  118. [Define to 1 if you have the `select' function.])
  119. HAVE_SYS_SELECT_H="1"
  120. AC_DEFINE_UNQUOTED(HAVE_SYS_SELECT_H, 1,
  121. [Define to 1 if you have the <sys/select.h> header file.])
  122. ],[
  123. AC_MSG_ERROR([no])
  124. ])
  125. fi
  126. AC_SYS_LARGEFILE
  127. AC_CHECK_LIB(socket, connect)
  128. dnl Checks for library functions.
  129. AC_CHECK_FUNCS([malloc memset socket])
  130. ACX_PTHREAD
  131. AC_CONFIG_MACRO_DIR([m4])
  132. AC_CONFIG_FILES([Makefile
  133. libasyncns/Makefile
  134. libev/Makefile
  135. src/Makefile])
  136. AC_OUTPUT