Configure tsocks with a simple heuristic.
Consider the proxy has to be in a 'local' network. It means it is directly
reachable by the local machine, even if the local machine has to hop through
one or more gates to reach the proxy (often the case in enterprise networks
where class A 10.0.0.0/8 is in fact sub-divided into smaller networks, each
one of them in a different location, eg. 10.1.0.0/16 in a place, while
10.2.0.0/16 would be on the other side of the world). Not being in the same
subnet does not mean the proxy is not available.
So we will build a mask with at most high bits set, which defines a network
that has both the local machine and the proxy. Because a machine may have
more than one interface, build a mask for each of them, removing 127.0.0.1
which is added automagically by tsocks, and removing duplicate masks.
If all of this does not work, then it means the local machine can NOT in fact
reach the proxy, which in turn means the user mis-configured something (most
probably a typo...).
/trunk/scripts/crosstool.sh | 61 52 9 0 +++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 52 insertions(+), 9 deletions(-)
1 diff -ur gdb-6.4/gdb/configure gdb-6.4-patched/gdb/configure
2 --- gdb-6.4/gdb/configure 2005-07-25 10:08:40.000000000 -0500
3 +++ gdb-6.4-patched/gdb/configure 2007-02-05 13:22:36.000000000 -0600
8 -ac_subdirs_all="$ac_subdirs_all doc testsuite"
9 +ac_subdirs_all="$ac_subdirs_all doc"
10 ac_subdirs_all="$ac_subdirs_all gdbtk"
11 ac_subdirs_all="$ac_subdirs_all multi-ice"
12 ac_subdirs_all="$ac_subdirs_all gdbserver"
17 -subdirs="$subdirs doc testsuite"
18 +subdirs="$subdirs doc"
21 . $srcdir/configure.host
22 diff -ur gdb-6.4/gdb/gdbserver/configure gdb-6.4-patched/gdb/gdbserver/configure
23 --- gdb-6.4/gdb/gdbserver/configure 2005-09-17 18:14:37.000000000 -0500
24 +++ gdb-6.4-patched/gdb/gdbserver/configure 2007-02-05 13:22:58.000000000 -0600
26 ac_cache_corrupted=: ;;
29 - if test "x$ac_old_val" != "x$ac_new_val"; then
30 + if test "`echo $ac_old_val`" != "`echo $ac_new_val`"; then
31 { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
32 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
33 { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
34 diff -ur gdb-6.4/gdb/testsuite/configure gdb-6.4-patched/gdb/testsuite/configure
35 --- gdb-6.4/gdb/testsuite/configure 2005-04-11 09:13:12.000000000 -0500
36 +++ gdb-6.4-patched/gdb/testsuite/configure 2007-02-05 13:22:36.000000000 -0600
38 ac_cache_corrupted=: ;;
41 - if test "x$ac_old_val" != "x$ac_new_val"; then
42 + if test "`echo $ac_old_val" != "`echo $ac_new_val"; then
43 { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
44 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
45 { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
46 diff -ur gdb-6.4/Makefile.in gdb-6.4-patched/Makefile.in
47 --- gdb-6.4/Makefile.in 2005-12-01 23:29:54.000000000 -0600
48 +++ gdb-6.4-patched/Makefile.in 2007-02-05 13:22:36.000000000 -0600
50 # CFLAGS will be just -g. We want to ensure that TARGET libraries
51 # (which we know are built with gcc) are built with optimizations so
52 # prepend -O2 when setting CFLAGS_FOR_TARGET.
53 -CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
54 +CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET))
55 SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
57 # If GCC_FOR_TARGET is not overriden on the command line, then this
62 -CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
63 +CXXFLAGS_FOR_TARGET = $(strip $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET))
64 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
66 GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET)
67 diff -ur gdb-6.4/Makefile.tpl gdb-6.4-patched/Makefile.tpl
68 --- gdb-6.4/Makefile.tpl 2005-10-22 05:37:55.000000000 -0500
69 +++ gdb-6.4-patched/Makefile.tpl 2007-02-05 13:22:36.000000000 -0600
71 # CFLAGS will be just -g. We want to ensure that TARGET libraries
72 # (which we know are built with gcc) are built with optimizations so
73 # prepend -O2 when setting CFLAGS_FOR_TARGET.
74 -CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
75 +CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET))
76 SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
78 # If GCC_FOR_TARGET is not overriden on the command line, then this
83 -CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
84 +CXXFLAGS_FOR_TARGET = $(strip $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET))
85 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
87 GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ $(FLAGS_FOR_TARGET)