--- configure.orig	2001-07-23 14:55:39.000000000 +0200
+++ configure	2007-11-22 11:39:14.000000000 +0100
@@ -5982,6 +5982,7 @@
 
 # This can be used to rebuild libtool when needed
 LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+$ac_aux_dir/ltconfig $LIBTOOL_DEPS
 
 # Always use our own libtool.
 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
@@ -6322,7 +6323,7 @@
 	   LIBS="-lipc $LIBS";;
 bsdi*)	   optimize_def="-O2";;
 freebsd*)  optimize_def="-O2"
-	   CPPFLAGS="-D_THREAD_SAFE -pthread $CPPFLAGS";;
+	   CPPFLAGS=" $CPPFLAGS";;
 hpux*)	   CPPFLAGS="-D_REENTRANT $CPPFLAGS";;
 irix*)	   optimize_def="-O2"
 	   CPPFLAGS="-D_SGI_MP_SOURCE $CPPFLAGS";;
@@ -7851,7 +7852,7 @@
 
 fi
 if test "$db_cv_mutex" = no; then
-LIBS="-lpthread $LIBS"
+LIBS="-pthread $LIBS"
 if test "$cross_compiling" = yes; then
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
@@ -8354,7 +8355,7 @@
 #define HAVE_MUTEX_PTHREADS 1
 EOF
 ;;
-POSIX/pthreads/library)	LIBS="-lpthread $LIBS"
+POSIX/pthreads/library)	LIBS="-pthread $LIBS"
 			cat >> confdefs.h <<\EOF
 #define HAVE_MUTEX_PTHREAD 1
 EOF
@@ -9702,16 +9703,16 @@
 fi
 done
 
-ac_safe=`echo "fstream.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for fstream.h""... $ac_c" 1>&6
-echo "configure:9708: checking for fstream.h" >&5
+ac_safe=`echo "fstream" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for fstream""... $ac_c" 1>&6
+echo "configure:9708: checking for fstream" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
 #line 9713 "configure"
 #include "confdefs.h"
-#include <fstream.h>
+#include <fstream>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
 { (eval echo configure:9718: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
