diff --git a/configure.ac b/configure.ac
index 377ab5e..9f2e5e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,6 +142,12 @@ AC_CONFIG_HEADERS(config.h)
 
 
 #
+# Ask autoconf to detect the platform type
+#
+AC_CANONICAL_TARGET
+
+
+#
 # This adds markup to the code that results in a few extra compile
 # time checks on recent GCC versions. It helps stop a few common bugs.
 #
@@ -319,7 +325,13 @@ if test "$GCC" = yes; then
 	# This is needed in order to get the really cool backtraces
 	#
 
-	LDFLAGS_FISH="$LDFLAGS_FISH -rdynamic"
+	case $target_os in
+		haiku*)
+			;;
+		*)
+			LDFLAGS_FISH="$LDFLAGS_FISH -rdynamic"
+			;;
+	esac
 
 fi
 
@@ -378,8 +390,6 @@ fi
 # seems that tputs is never really needed.
 #
 
-AC_CANONICAL_TARGET
-
 if test $target_cpu = powerpc; then
 	AC_DEFINE([TPUTS_KLUDGE],[1],[Evil kludge to get Power based machines to work])
 fi
@@ -510,7 +520,7 @@ AC_DEFINE(
 # Check for os dependant libraries for all binaries.
 LIBS_COMMON=$LIBS
 LIBS=""
-AC_SEARCH_LIBS( connect, socket, , [AC_MSG_ERROR([Cannot find the socket library, needed to build this package.] )] )
+AC_SEARCH_LIBS( connect, network socket, , [AC_MSG_ERROR([Cannot find the socket library, needed to build this package.] )] )
 AC_SEARCH_LIBS( nanosleep, rt, , [AC_MSG_ERROR([Cannot find the rt library, needed to build this package.] )] )
 AC_SEARCH_LIBS( setupterm, [ncurses curses], , [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish])] )
 AC_SEARCH_LIBS( [nan], [m], [AC_DEFINE( [HAVE_NAN], [1], [Define to 1 if you have the nan function])] )
@@ -555,7 +565,7 @@ LIBS="$LIBS_SHARED"
 if test x$local_gettext != xno; then
 	AC_SEARCH_LIBS( gettext, intl,,)
 fi
-AC_SEARCH_LIBS( iconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )
+AC_SEARCH_LIBS( iconv_open, iconv, , [AC_SEARCH_LIBS( libiconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )] )
 LIBS_FISH_PAGER=$LIBS
 LIBS=$LIBS_COMMON
 
@@ -568,7 +578,7 @@ LIBS="$LIBS_SHARED"
 if test x$local_gettext != xno; then
 	AC_SEARCH_LIBS( gettext, intl,,)
 fi
-AC_SEARCH_LIBS( iconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )
+AC_SEARCH_LIBS( iconv_open, iconv, , [AC_SEARCH_LIBS( libiconv_open, iconv, , [AC_MSG_ERROR([Could not find an iconv implementation, needed to build fish])] )] )
 LIBS_FISHD=$LIBS
 LIBS=$LIBS_COMMON
 
