Index: configure
--- configure.orig	2011-08-18 03:57:34.000000000 +0200
+++ configure	2012-06-03 11:44:07.000000000 +0200
@@ -14249,7 +14249,7 @@
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_readline" >&5
 $as_echo "$ac_cv_lib_readline_readline" >&6; }
 if test "x$ac_cv_lib_readline_readline" = x""yes; then :
-  LIBS="$LIBS -lreadline"
+  LIBS="-lreadline $LIBS"
 
 $as_echo "#define HAVE_READLINE 1" >>confdefs.h
 
Index: src/apps/Makefile.in
--- src/apps/Makefile.in.orig	2011-08-18 03:57:35.000000000 +0200
+++ src/apps/Makefile.in	2012-06-03 11:44:30.000000000 +0200
@@ -140,7 +140,7 @@
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	--mode=link $(CCLD) -static $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = bsqldb.c bsqlodbc.c $(datacopy_SOURCES) defncopy.c \
 	$(freebcp_SOURCES) tsql.c
Index: src/pool/Makefile.in
--- src/pool/Makefile.in.orig	2011-08-18 03:57:36.000000000 +0200
+++ src/pool/Makefile.in	2012-06-03 11:44:43.000000000 +0200
@@ -83,7 +83,7 @@
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	--mode=link $(CCLD) -static $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(tdspool_SOURCES)
 DIST_SOURCES = $(tdspool_SOURCES)
