How about this:
ldd slapd
libdb-4.2.so => /usr/local/BerkeleyDB.4.2/lib/libdb-4.2.so
(0x40019000)
libssl.so.2 => /lib/libssl.so.2 (0x400c5000)
libcrypto.so.2 => /lib/libcrypto.so.2 (0x400f2000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x401b5000)
libresolv.so.2 => /lib/libresolv.so.2 (0x401e2000)
libdl.so.2 => /lib/libdl.so.2 (0x401f3000)
libpthread.so.0 => /lib/i686/libpthread.so.0 (0x401f6000)
libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
Also, during the build the gcc arguments where for
/usr/local/BerkeleyDB.4.2/.