configure.in
上传用户:sddyfurun
上传日期:2007-01-04
资源大小:525k
文件大小:10k
源码类别:

代理服务器

开发平台:

Unix_Linux

  1. AC_INIT(README)
  2. AC_PREREQ(2.4)
  3. AC_CONFIG_HEADER(include/config.h)
  4. dnl Need these for some of the things we'll do in configure, so define them now
  5. dnl We want to put the -g -O stuff from AC_PROG_CC in CDEBUG_FLAGS, not CFLAGS, so 
  6. dnl store the old ones...then switch back
  7. OS=`uname -s`
  8. AC_PROG_ANSI_CC
  9. AC_PROG_GCC_TRADITIONAL
  10. AC_C_CONST
  11. AC_C_INLINE
  12. echo
  13. AC_PROG_RANLIB
  14. AC_PROG_INSTALL
  15. AC_CHECK_PROG(MAKED,    makedepend, makedepend, true)
  16. AC_CHECK_PROG(AUTOCONF, autoconf,   autoconf,   true)
  17. AC_CHECK_PROG(AUTOHDR,  autoheader, autoheader, true)
  18. echo 
  19. AC_CHECK_HEADERS(fcntl.h memory.h unistd.h string.h strings.h bstring.h varargs.h stdarg.h stdlib.h time.h syslog.h ifaddrs.h crypt.h)
  20. AC_CHECK_HEADERS(sys/stat.h sys/param.h sys/signal.h sys/resource.h sys/socket.h sys/uio.h sys/time.h sys/wait.h)
  21. AC_CHECK_HEADERS(sys/ttychars.h sys/ipc.h sys/bitypes.h sys/mbuf.h sys/sem.h sys/select.h)
  22. AC_CHECK_HEADERS(sys/file.h sys/ioctl.h sys/fcntl.h sys/filio.h sys/sockio.h)
  23. AC_CHECK_HEADERS(sys/termios.h sys/termio.h termios.h termio.h sys/un.h)
  24. AC_CHECK_HEADERS(netinet/in_systm.h net/route.h machine/endian.h paths.h nl_types.h)
  25. AC_HEADER_TIME
  26. AC_HEADER_STDC
  27. AC_HEADER_DIRENT
  28. echo
  29. if test "$OS" != "IRIX"; then
  30. AC_CHECK_LIB(socket,  main)
  31. dnl usual lib for dlopen
  32. AC_CHECK_LIB(dl,      main)
  33. fi
  34. dnl AC_CHECK_LIB(sun,     main)
  35. dnl lib for HP's shl_load
  36. AC_CHECK_LIB(dld,     main)
  37. dnl AIX lib for dlopen
  38. AC_CHECK_LIB(svld,     main)
  39. AC_CHECK_LIB(termcap, setupterm, [TELNET_LIBS="$TELNET_LIBS -ltermcap"; TELNET_DEFS="$TELNET_DEFS -DHAVE_SETUPTERM"], 
  40.  AC_CHECK_LIB(curses, setupterm, [TELNET_LIBS="$TELNET_LIBS -lcurses"; TELNET_DEFS="$TELNET_DEFS -DHAVE_SETUPTERM"], 
  41.   AC_CHECK_LIB(ncurses, setupterm, [TELNET_LIBS="$TELNET_LIBS -lncurses"; TELNET_DEFS="$TELNET_DEFS -DHAVE_SETUPTERM"],
  42.    AC_CHECK_LIB(termcap, tgetent, [TELNET_LIBS="$TELNET_LIBS -ltermcap"],
  43.     AC_CHECK_LIB(curses, tgetent, [TELNET_LIBS="$TELNET_LIBS -lcurses"], 
  44.      AC_CHECK_LIB(ncurses, tgetent, [TELNET_LIBS="$TELNET_LIBS -lncurses"])
  45. )))))
  46. AC_CHECK_LIB(c,  gethostbyname, [STATIC_LIBS=""], AC_CHECK_LIB(resolv,  gethostbyname, [STATIC_LIBS="-lresolv"]))
  47. AC_MSG_CHECKING(if we can use -lnsl)
  48. AC_CACHE_VAL(r_cv_use_libnsl, [AC_TRY_RUN(main() { if (gethostbyname("localhost")) exit(0); exit(-1); }, r_cv_use_libnsl=no, r_cv_use_libnsl=yes, r_cv_use_libnsl=yes)])
  49. AC_MSG_RESULT($r_cv_use_libnsl)
  50. if test "$r_cv_use_libnsl" = "yes"; then LIBS="$LIBS -lnsl"; fi
  51. AC_CHECK_SHLIBS(libc libnsl libsocket libresolv libdgc)
  52. dnl just a trick to get these into include/config.h
  53. if test "yes" = "no"; then
  54. AC_DEFINE_UNQUOTED(LIBC_NAME)
  55. AC_DEFINE_UNQUOTED(LIBNSL_NAME)
  56. AC_DEFINE_UNQUOTED(LIBRESOLV_NAME)
  57. AC_DEFINE_UNQUOTED(LIBSOCKET_NAME)
  58. AC_DEFINE_UNQUOTED(LIBDGC_NAME)
  59. fi
  60. echo
  61. AC_TYPE_PID_T
  62. AC_TYPE_SIZE_T
  63. AC_TYPE_SIGNAL
  64. AC_SOCKADDR_SUN_LEN
  65. AC_MSG_CHECKING(for sig_atomic_t)
  66. AC_CACHE_VAL(r_cv_type_sig_atomic_t,
  67. [AC_EGREP_CPP(sig_atomic_t, [
  68. #include <sys/types.h>
  69. #include <signal.h>
  70. #if HAVE_SYS_SIGNAL_H
  71. #include <sys/signal.h>
  72. #endif], r_cv_type_sig_atomic_t=yes, r_cv_type_sig_atomic_t=no)])dnl
  73. AC_MSG_RESULT($r_cv_type_sig_atomic_t)
  74. if test "$r_cv_type_sig_atomic_t" = "no"; then
  75. AC_DEFINE(sig_atomic_t, int)
  76. fi
  77. AC_MSG_CHECKING(for cc_t)
  78. AC_CACHE_VAL(r_cv_have_cct, AC_TRY_LINK([cc_t],[#include <termio.h>],[cc_t foo;],r_cv_have_cct=yes,r_cv_have_cct=no))
  79. if test $r_cv_have_cct = no; then AC_DEFINE(NO_CC_T) fi
  80. AC_MSG_RESULT($r_cv_have_cct)
  81. AC_MSG_CHECKING(for sig_t)
  82. AC_CACHE_VAL(r_cv_have_sigt, AC_TRY_LINK([#include <signal.h>], [sig_t i = (sig_t)0;], r_cv_have_sigt=yes, r_cv_have_sigt=no))
  83. if test "$r_cv_have_sigt" = "no"; then [FTPDEFS="$FTPDEFS -DCOMPAT"]; fi
  84. AC_MSG_RESULT($r_cv_have_sigt)
  85. echo
  86. AC_MSG_CHECKING(for sys_errlist)
  87. AC_CACHE_VAL(r_cv_have_sysel, AC_TRY_LINK(,[extern char **sys_errlist;char **foo = sys_errlist;], r_cv_have_sysel=yes, r_cv_have_sysel=no))
  88. if test "$r_cv_have_sysel" = "yes"; then AC_DEFINE(HAVE_SYSERRLIST) fi
  89. AC_MSG_RESULT($r_cv_have_sysel)
  90. AC_CHECK_FUNCS(dlopen shl_load) 
  91. saved_libs="$LIBS"
  92. LIBS="$LIBS $TELNET_LIBS"
  93. AC_CHECK_FUNCS(setupterm)
  94. AC_CHECK_FUNCS(tgetent)
  95. LIBS="$saved_libs"
  96. AC_CHECK_FUNCS(gethostbyname_r gethostbyaddr_r getpwuid_r getservbyname_r)
  97. AC_CHECK_FUNCS(memset memcmp memmove strchr strrchr strdup strerror)
  98. AC_CHECK_FUNCS(bcopy bcmp bzero index rindex)
  99. AC_CHECK_FUNCS(setenv putenv unsetenv getenv)
  100. AC_CHECK_FUNCS(getdomainname rresvport sendmsg setsid setpgid setpgrp getifaddrs)
  101. AC_CHECK_FUNCS(waitpid flock dgettext sigaction sigprocmask)
  102. AC_CHECK_FUNCS(re_comp strspn getcwd vfork herror genget getopt)
  103. AC_VPRINTF
  104. AC_FUNC_SETPGRP
  105. AC_KERBEROS5
  106. AC_IDENT
  107. echo
  108. dnl If your path doesn't have these, some of the respective clients won't work.
  109. AC_PATH_PROG(ORIG_FINGER, finger)
  110. AC_PATH_PROG(TROUTEPROG,  traceroute)
  111. if test "$TROUTEPROG" != ""; then 
  112. AC_DEFINE_UNQUOTED(TROUTEPROG,  "$TROUTEPROG") 
  113. fi
  114. AC_PATH_PROG(PINGPROG, ping)
  115. if test "$PINGPROG" != "";  then 
  116. AC_DEFINE_UNQUOTED(PINGPROG, "$PINGPROG") 
  117. fi
  118. echo
  119. SRVPID_FILE="/tmp/socks5.pid"
  120. SRVCONF_FILE="/etc/socks5.conf"
  121. SRVIDT_FILE="/tmp/socks5.ident"
  122. LIBCONF_FILE="/etc/libsocks5.conf"
  123. PINCONF_FILE="/etc/socks5.plugins"
  124. AC_ARG_WITH(debug,           --with-debug Turn on debugging and compile time warnings,  [if test "$GCC" = "yes"; then CDEBUG_FLAGS="-g -Wall -Wno-comment"; else CDEBUG_FLAGS="-g"; fi])
  125. AC_ARG_WITH(static,          --with-static Turn on static compiling,  [if test "$withval" != "yes"; then CC="$CC $withval" ; else CC="$CC -static" ;  fi])
  126. AC_ARG_WITH(threads,         --with-threads Turn on threading in the server if possible, [threads="$withval"], [threads="no"])
  127. if test "$threads" != "no"; then
  128.         CFLAGS="$CFLAGS -D_THREAD_SAFE"
  129. if test "$threads" != "yes"; then
  130.                 CFLAGS="$CFLAGS -D_THREAD_SAFE -I$threads/include"
  131.                 LDFLAGS="$LDFLAGS -L$threads/lib"
  132. fi;
  133. AC_DEFINE(USE_THREADS)
  134. S5_CHECK_HEADERS(pthread.h, $threads)
  135. saved_libs="$LIBS"
  136.         AC_CHECK_LIB(pthreads, main, [LIBS="-lpthreads $LIBS";SERVER_LIBS="-lpthreads"])
  137.         AC_CHECK_LIB(pthread, main, [LIBS="-lpthread $LIBS";SERVER_LIBS="-lpthread"])
  138.         if test "$GCC" = "yes"; then
  139.             if test "$OS" = "AIX"; then
  140.                     SERVER_LIBS="$SERVER_LIBS -lc_r"
  141.                     EXTRA_LDFLAGS="-nostartfiles"
  142.                     EXTRA_OBJS="/lib/crt0_r.o"
  143.             fi;
  144.             if test "$OS" = "OSF1"; then
  145.                     SERVER_LIBS="$SERVER_LIBS -lmach -lc_r"
  146.             fi;
  147.             if test "$OS" = "HP-UX"; then
  148.                 case "$OSVER" in
  149.                 *10.*)
  150.                     SERVER_LIBS="$SERVER_LIBS -lcma -lc_r"
  151.                 esac
  152.             fi;
  153.         fi;
  154.         AC_CHECK_FUNCS(pthread_create pthread_self pthread_exit)
  155.         AC_CHECK_FUNCS(pthread_attr_init pthread_attr_setscope)
  156.         AC_CHECK_FUNCS(pthread_attr_setdetachstate)
  157.         AC_CHECK_FUNCS(pthread_detach)
  158.         AC_CHECK_FUNCS(pthread_sigmask pthread_kill)
  159. LIBS="$saved_libs"
  160. fi
  161. AC_ARG_WITH(libconffile,     --with-libconffile=val Set the location of the library config file,  [LIBCONF_FILE="$withval"]; AC_DEFINE_UNQUOTED(LIBCONF_FILE, "$withval"))
  162. AC_ARG_WITH(srvconffile,     --with-srvconffile=val Set the location of the server config file,   [SRVCONF_FILE="$withval"]; AC_DEFINE_UNQUOTED(SRVCONF_FILE, "$withval"))
  163. AC_ARG_WITH(srvpidfile,      --with-srvpidfile=val Set the location of the server pid file,         [SRVPID_FILE="$withval" ]; AC_DEFINE_UNQUOTED(SRVPID_FILE,  "$withval"))
  164. AC_ARG_WITH(srvidtfile,      --with-srvidtfile=val Set the location of the server ident file,   [SRVIDT_FILE="$withval" ]; AC_DEFINE_UNQUOTED(SRVIDT_FILE,  "$withval"))
  165. AC_ARG_WITH(srvpwdfile,      --with-srvpwdfile=val Set the location of the server password file,   [SRVPWD_FILE="$withval" ]; AC_DEFINE_UNQUOTED(SRVPWD_FILE,  "$withval"))
  166. AC_ARG_WITH(default-port,    --with-default-port=val  Set the default socks port,  [SOCKS_DEFAULT_PORT="$withval"]; AC_DEFINE_UNQUOTED(SOCKS_DEFAULT_PORT, $withval))
  167. AC_ARG_WITH(default-server,  --with-default-server=val  Set the default socks server,  AC_DEFINE_UNQUOTED(SOCKS_DEFAULT_SERVER, "$withval"))
  168. AC_ARG_WITH(default-version, --with-default-version=val Set the default socks version,  AC_DEFINE_UNQUOTED(SOCKS_DEFAULT_VERSION, $withval))
  169. AC_ARG_WITH(syslog-facility, --with-syslog-facility=val Set the syslog facility for socks5,  syslog_fac="$withval")
  170. if test "$syslog_fac" != "no"; then
  171. if test "$syslog_fac" = "yes" -o "$syslog_fac" = ""; then
  172. syslog_fac=LOG_DAEMON
  173. fi
  174. AC_DEFINE_UNQUOTED(SYSLOG_FAC, $syslog_fac)
  175. fi
  176. AC_ARG_WITH(monitor,         --with-monitor=val         Turn on monitoring,
  177. [MON_DIR="$withval"; MON_LIBS="-L$(MON_DIR)/lib -lmon";
  178.  AC_CHECK_LIB(ipc, main)
  179.  AC_CHECK_LIB(compat, main)
  180.  MON_CFLAGS="-I$(MON_DIR)/include"];
  181. AC_DEFINE(MONITOR))
  182. AC_ARG_WITH(passwd,          --with-passwd=val          Turn on use of passwd file for passwords,        AC_DEFINE(USE_PASSWD))
  183. AC_ARG_WITH(shadow-passwd,          --with-shadow-passwd=val          Turn on use of shadow passwd file for passwords,        AC_DEFINE(USE_SHADOW_PASSWD))
  184. AC_ARG_WITH(plugins,         --with-plugins             Turn on NEC internal plug-in support,           AC_DEFINE(USE_PLUGINS))
  185. AC_ARG_WITH(pinconffile,     --with-pinconffile=val   Set the location of the plug-in config file,      [PINCONFF_ILE="$withval" ]; AC_DEFINE_UNQUOTED(PINCONF_FILE, "$withval"))
  186. AC_MAKE_SHAREDLIB
  187. AC_CC_EXPORT_SYMBOL
  188. AC_SUBST(SHLIB_LFLAGS)
  189. AC_SUBST(SHLIB_LIBS)
  190. BINRM="/bin/rm -f"
  191. LIBS="$LIBS $STATIC_LIBS"
  192. AC_SUBST(MON_DIR)
  193. AC_SUBST(MON_LIBS)
  194. AC_SUBST(MON_CFLAGS)
  195. AC_SUBST(SOCKS_DEFAULT_PORT)
  196. AC_SUBST(SRVPID_FILE)
  197. AC_SUBST(SRVCONF_FILE)
  198. AC_SUBST(LIBCONF_FILE)
  199. AC_SUBST(CDEBUG_FLAGS)
  200. AC_SUBST(LDFLAGS)
  201. AC_SUBST(CFLAGS)
  202. AC_SUBST(BINRM)
  203. AC_SUBST(LIBS)
  204. AC_SUBST(DEFS)
  205. AC_SUBST(SERVER_DEFS)
  206. AC_SUBST(SERVER_LIBS)
  207. AC_SUBST(EXTRA_OBJS)
  208. AC_SUBST(EXTRA_LDFLAGS)
  209. AC_SUBST(EXPORT_LDFLAGS)
  210. AC_SUBST(TELNET_DEFS)
  211. AC_SUBST(TELNET_LIBS)
  212. AC_SUBST(FTPDEFS)
  213. AC_OUTPUT(Makefile
  214. lib/Makefile
  215. test/Makefile
  216. shlib/Makefile
  217. shlib/runsocks
  218. server/Makefile
  219. server/stopsocks
  220. include/Makefile
  221. clients/Makefile
  222. clients/pt/Makefile
  223. clients/ftp/Makefile 
  224. clients/finger/Makefile
  225. clients/archie/Makefile 
  226. clients/telnet/Makefile
  227. clients/telnet/libtelnet/Makefile
  228. stamp-h)