I solved the problems with my FBSD 5.2.1 with the following changes
of the configure.in file. Maybe it will help i your case, too.
--- configure.org Sun Oct 3 22:04:26 2004
+++ configure.in Mon Oct 4 19:10:21 2004
@@ -8,8 +8,8 @@
AM_MAINTAINER_MODE
# No -O2 by default, removing -fomit since it causes problems
-CFLAGS=" ${CFLAGS/-fomit-frame-pointer/}"
-CXXFLAGS=" ${CXXFLAGS/-fomit-frame-pointer/}"
+#CFLAGS=" ${CFLAGS/-fomit-frame-pointer/}"
+#CXXFLAGS=" ${CXXFLAGS/-fomit-frame-pointer/}"
# System detection, need AC_CANONICAL_TARGET
case "${target_os}" in
@@ -438,7 +438,7 @@
CFLAGS="$CFLAGS $DEBUG_FLAGS $OPTIMISE_FLAGS $PROFILE_FLAGS"
dnl -lpthread is needed by Debian
-LDFLAGS="$LDFLAGS $PROFILE_FLAGS -lpthread"
+LDFLAGS="$LDFLAGS $PROFILE_FLAGS"
AM_CONDITIONAL(USE_EMBEDDED_CRYPTO, test x$USE_EMBEDDED_CRYPTO = xyes)
AM_CONDITIONAL(WEB, test x$WEB = xyes)
AM_CONDITIONAL(ED2K, test x$ED2K = xyes)