diff -ur torsocks-1.2/configure.in torsocks-1.2-haiku/configure.in
--- torsocks-1.2/configure.in	2011-10-24 22:30:58.009175040 +0300
+++ torsocks-1.2-haiku/configure.in	2015-01-13 21:59:38.462684160 +0200
@@ -82,30 +82,19 @@
 dnl list) but that isn't a problem
 OLDLIBS="${LIBS}"
 LIBS=
-CONNECTLIB=
-for LIB in c socket; do
-  AC_CHECK_LIB("${LIB}",connect,[
-    CONNECTLIB="${LIB}"
-    break
-  ],)
-done
-LIBS="${OLDLIBS} -l${CONNECTLIB}"
-if test "${CONNECTLIB}" = ""; then
-  AC_MSG_ERROR('Could not find library containing connect()')
-fi
-
+AC_SEARCH_LIBS(connect,[c socket network],,[AC_MSG_ERROR('Could not find library containing connect()')])
 
 dnl Check for socket
 AC_CHECK_FUNC(socket,, [
-  AC_CHECK_LIB(socket, socket,,AC_MSG_ERROR("socket function not found"))])
+  AC_SEARCH_LIBS(socket, [socket network],[],[AC_MSG_ERROR("socket function not found")])])
 
 dnl Check for a function to convert an ascii ip address
-dnl to a sin_addr. 
+dnl to a sin_addr.
 AC_CHECK_FUNC(inet_aton, AC_DEFINE([HAVE_INET_ATON],[],[Description]), [
   AC_CHECK_FUNC(inet_addr, AC_DEFINE([HAVE_INET_ADDR],[],[Description]), [
-    AC_CHECK_LIB(nsl, inet_addr, [ AC_DEFINE([HAVE_INET_ADDR],[],[Description])
-                                   LIBS="${LIBS} -lnsl" ], [
-		AC_MSG_ERROR("Neither inet_aton or inet_addr present")])])])
+    AC_SEARCH_LIBS(inet_aton, [nsl network], [
+      AC_DEFINE([HAVE_INET_ADDR],[],[Description])
+      LIBS="${LIBS} ${ac_cv_search_inet_aton}"], [AC_MSG_ERROR("Neither inet_aton or inet_addr present")])])])
 
 
 dnl Look for gethostbyname (needed by torsocks)
diff -ur torsocks-1.2/Makefile.am torsocks-1.2-haiku/Makefile.am
--- torsocks-1.2/Makefile.am	2011-03-05 18:38:11.007864320 +0200
+++ torsocks-1.2-haiku/Makefile.am	2015-01-13 21:59:38.463994880 +0200
@@ -2,4 +2,4 @@
 # have all needed files, that a GNU package needs
 AUTOMAKE_OPTIONS = foreign 1.4
 
-SUBDIRS = src doc test
+SUBDIRS = src doc
diff -ur torsocks-1.2/src/torsocks.in torsocks-1.2-haiku/src/torsocks.in
--- torsocks-1.2/src/torsocks.in	2011-10-24 00:12:13.014942208 +0300
+++ torsocks-1.2-haiku/src/torsocks.in	2015-01-13 22:01:14.478412800 +0200
@@ -28,34 +28,34 @@
 #
 # There are three forms of usage for this script:
 #
-# @prefix@/bin/torsocks program [program arguments...]
+# @bindir@/torsocks program [program arguments...]
 #
 # This form sets the users @LDPRELOAD@ environment variable so that torsocks(8)
 # will be loaded to socksify the application then executes the specified 
 # program (with the provided arguments). The following simple example might 
 # be used to telnet to www.foo.org via a torsocks.conf(5) configured socks server:
 #
-# @prefix@/bin/torsocks telnet www.foo.org
+# @bindir@/torsocks telnet www.foo.org
 #
 # The second form allows for torsocks(8) to be switched on and off for a
 # session (that is, it adds and removes torsocks from the @LDPRELOAD@ environment
 # variable). This form must be _sourced_ into the user's existing session
 # (and will only work with bourne shell users):
 #
-# . @prefix@/bin/torsocks on
+# . @bindir@/torsocks on
 # telnet www.foo.org 
-# . @prefix@/bin/torsocks off
+# . @bindir@/torsocks off
 # 
 # Or
 # 
-# source @prefix@/bin/torsocks on
+# source @bindir@/torsocks on
 # telnet www.foo.org
-# source @prefix@/bin/torsocks off
+# source @bindir@/torsocks off
 #
 # The third form creates a new shell with @LDPRELOAD@ set and is achieved
 # simply by running the script with no arguments 
 # 
-# @prefix@/bin/torsocks
+# @bindir@/torsocks
 #
 # When finished the user can simply terminate the shell with 'exit'
 # 
@@ -73,7 +73,7 @@
    exit
 fi
 
-LIBDIR="@prefix@/lib/torsocks"
+LIBDIR="@libdir@/torsocks"
 LIB_NAME="libtorsocks"
 SHLIB_EXT="@SHLIB_EXT@"
 SHLIB="${LIBDIR}/${LIB_NAME}.${SHLIB_EXT}"
@@ -101,7 +101,7 @@
     #replace '/' with '\/' in @prefix@
     # escprefix=`echo '@prefix@' |sed 's/\\//\\\\\//g'`
     # export @LDPRELOAD@=`echo -n $@LDPRELOAD@ | sed "s/$escprefix\/lib\/torsocks\/libtorsocks.so \?//"`
-    export @LDPRELOAD@=`echo -n $@LDPRELOAD@ | sed "s#@prefix@/lib/torsocks/libtorsocks\.@SHLIB_EXT@ *##"`
+    export @LDPRELOAD@=`echo -n $@LDPRELOAD@ | sed "s#@libdir@/torsocks/libtorsocks\.@SHLIB_EXT@ *##"`
     if [ -z "$@LDPRELOAD@" ]
       then
         unset @LDPRELOAD@
