Building OpenLDAP on Solaris hosts that use /opt as their software repository can sometimes be a chore. In case anyone finds this useful, here is the procedure I use:
$ LD_LIBRARY_PATH=/opt/openssl/lib:/opt/BerkeleyDB/lib:/usr/sfw/lib:/usr/lib
$ export LD_LIBRARY_PATH
$ export LDFLAGS="-L/opt/BerkeleyDB/lib -L/opt/openssl/lib"
$ export LDFLAGS
$ export CPPFLAGS="-I/opt/BerkeleyDB/include -I/opt/openssl/include"
$ export CPPFLAGS
$ configure --prefix=/opt/openldap-2.3.24 --enable-bdb --with-tls --enable --monitor --disable-ipv6
$ make depend && make