Mathias, please look if you have db3/ and/or db.h in /usr/include. If yes: move them elsewhere while ./configuring and compiling. when configuring, try
--with-bdb-libdir=/usr/local/BerkeleyDB.4.0/lib and --with-bdb-incdir=/usr/local/BerkeleyDB.4.0/include (or whereever your db-4 files reside). Cheers Olaf