This is how it works for me. Here are steps:
OS: RedHat 7.3 amd 7.2 on Intel
1) Berkeley DB 4.0.14 is installed in /data/db-4.0.14 with --prefix=/data/db-4.0.14
2) Add following line in /etc/ld.so.conf: /data/db-4.0.14/lib
Then # /sbin/ldconfig -v to create necessary links and cache for bdb shared libraries.
You will see /data/db-4.0.14/lib:
libdb-4.0.so -> libdb-4.0.so
3) Do quick install of openldap with following configure. I found that I do not need tcp wrapper,
but I need --enable-ldbm as it is not default anymore.
4) make depend, make, make test, then install as instructed in OpenLdap installation.
Hope this may help others. This is a great community.