The attached patch adds support to configure for linking in the SOCKS
library. The configure script must be regenerated using autoconf after
applying this patch.
-- 
Jens-Uwe Mager  <pgp-mailto:62CFDB25> <jabber:[EMAIL PROTECTED]>
diff -ruN cvs-1.11.2/config.h.in cvs-1.11.2.socks/config.h.in
--- cvs-1.11.2/config.h.in      Fri Mar 22 17:39:37 2002
+++ cvs-1.11.2.socks/config.h.in        Mon Apr 22 00:33:44 2002
@@ -346,3 +346,7 @@
 when using GSSAPI. */
 #undef GSS_C_NT_HOSTBASED_SERVICE
 
+/* Define this if compiling with SOCKS (the firewall traversal library). */
+#undef SOCKS
+#undef SOCKS4
+#undef SOCKS5
diff -ruN cvs-1.11.2/configure.in cvs-1.11.2.socks/configure.in
--- cvs-1.11.2/configure.in     Thu Apr 18 17:31:39 2002
+++ cvs-1.11.2.socks/configure.in       Mon Apr 22 00:31:59 2002
@@ -312,6 +312,136 @@
   AC_DEFINE(ENCRYPTION)
 fi
 
+AC_MSG_CHECKING(whether to support SOCKS)
+AC_ARG_WITH(socks,
+[  --with-socks            Compile with SOCKS firewall traversal support.],
+[ case "$withval" in
+  no)
+    AC_MSG_RESULT(no)
+    ;;
+  yes)
+    AC_MSG_RESULT(yes)
+    AC_CHECK_LIB(socks5, SOCKSconnect, [
+           socks=5
+           LIBS="-lsocks5 $LIBS"], [
+       AC_CHECK_LIB(socks, Rconnect, [
+           socks=4
+           LIBS="-lsocks $LIBS"], [
+               AC_MSG_ERROR(Could not find socks library.  You must first install 
+socks.) ] ) ] )
+    ;;
+  esac ],
+  AC_MSG_RESULT(no)
+)
+
+if test "x$socks" = "x"; then
+       AC_MSG_CHECKING(whether to support SOCKS5)
+       AC_ARG_WITH(socks5,
+       [  --with-socks5[=PATH]    Compile with SOCKS5 firewall traversal support.],
+       [ case "$withval" in
+         no)
+           AC_MSG_RESULT(no)
+           ;;
+         *)
+           AC_MSG_RESULT(yes)
+           socks=5
+           if test "x$withval" = "xyes"; then
+             withval="-lsocks5"
+           else
+             if test -d "$withval"; then
+               if test -d "$withval/include"; then
+                 CFLAGS="$CFLAGS -I$withval/include"
+               else
+                 CFLAGS="$CFLAGS -I$withval"
+               fi
+               if test -d "$withval/lib"; then
+                 withval="-L$withval/lib -lsocks5"
+               else
+                 withval="-L$withval -lsocks5"
+               fi
+             fi
+           fi
+           LIBS="$withval $LIBS"
+           # If Socks was compiled with Kerberos support, we will need
+           # to link against kerberos libraries.  Temporarily append
+           # to LIBS.  This is harmless if there is no kerberos support.
+           TMPLIBS="$LIBS"
+           LIBS="$LIBS $KERBEROS_LIBS"
+           AC_TRY_LINK([],
+                       [ SOCKSconnect(); ],
+                       [],
+                       [ AC_MSG_ERROR(Could not find the $withval library.  You must 
+first install socks5.) ])
+           LIBS="$TMPLIBS"
+           ;;
+         esac ],
+         AC_MSG_RESULT(no)
+       )
+fi
+
+if test "x$socks" = "x"; then
+       AC_MSG_CHECKING(whether to support SOCKS4)
+       AC_ARG_WITH(socks4,
+       [  --with-socks4[=PATH]    Compile with SOCKS4 firewall traversal support.],
+       [ case "$withval" in
+         no)
+           AC_MSG_RESULT(no)
+           ;;
+         *)
+           AC_MSG_RESULT(yes)
+           socks=4
+           if test "x$withval" = "xyes"; then
+             withval="-lsocks"
+           else
+             if test -d "$withval"; then
+               withval="-L$withval -lsocks"
+             fi
+           fi
+           LIBS="$withval $LIBS"
+           AC_TRY_LINK([],
+                       [ Rconnect(); ],
+                       [],
+                       [ AC_MSG_ERROR(Could not find the $withval library.  You must 
+first install socks.) ])
+           ;;
+         esac ],
+         AC_MSG_RESULT(no)
+       )
+fi
+
+
+
+if test "x$socks" = "x4"; then
+    AC_DEFINE(SOCKS)
+    AC_DEFINE(SOCKS4)
+fi
+
+if test "x$socks" = "x5"; then
+    AC_DEFINE(SOCKS)
+    AC_DEFINE(SOCKS5)
+    AC_CHECK_HEADERS(socks.h)
+    if test "x$ac_cv_header_socks_h" != "xyes"; then
+      AC_DEFINE(Rconnect,SOCKSconnect)
+      AC_DEFINE(Rgetsockname,SOCKSgetsockname)
+      AC_DEFINE(Rgetpeername,SOCKSgetpeername)
+      AC_DEFINE(Rbind,SOCKSbind)
+      AC_DEFINE(Raccept,SOCKSaccept)
+      AC_DEFINE(Rlisten,SOCKSlisten)
+      AC_DEFINE(Rselect,SOCKSselect)
+      AC_DEFINE(Rrecvfrom,SOCKSrecvfrom)
+      AC_DEFINE(Rsendto,SOCKSsendto)
+      AC_DEFINE(Rrecv,SOCKSrecv)
+      AC_DEFINE(Rsend,SOCKSsend)
+      AC_DEFINE(Rread,SOCKSread)
+      AC_DEFINE(Rwrite,SOCKSwrite)
+      AC_DEFINE(Rrresvport,SOCKSrresvport)
+      AC_DEFINE(Rshutdown,SOCKSshutdown)
+      AC_DEFINE(Rlisten,SOCKSlisten)
+      AC_DEFINE(Rclose,SOCKSclose)
+      AC_DEFINE(Rdup,SOCKSdup)
+      AC_DEFINE(Rdup2,SOCKSdup2)
+      AC_DEFINE(Rfclose,SOCKSfclose)
+      AC_DEFINE(Rgethostbyname,SOCKSgethostbyname)
+    fi
+fi
+
 AC_CHECK_FUNC(gethostname, :, LIBOBJS="$LIBOBJS hostname.o")
 
 # Check for options requesting client and server feature. If none are
diff -ruN cvs-1.11.2/src/client.c cvs-1.11.2.socks/src/client.c
--- cvs-1.11.2/src/client.c     Thu Aug  9 22:27:26 2001
+++ cvs-1.11.2.socks/src/client.c       Mon Apr 22 00:35:47 2002
@@ -86,6 +86,10 @@
 
 # endif /* HAVE_GSSAPI */
 
+# ifdef SOCKS
+#  include "socks.h"
+# endif
+
 static void add_prune_candidate PROTO((char *));
 
 /* All the commands.  */


Reply via email to