on Gentoo/FreeBSD we cannot trust on the symlink /usr/include/db.h to determine the latest sys-libs/db installed on the system (as happen for the Gentoo/Linux) because that symlink do not exists. We need to esplicitely declare the absolute path for sys-libs/db: /usr/include/db*/db.h. The attached patch fix the problem for dev-perl/BerkeleyDB changing the path into config.in with sed and using db-use.eclass to determine the last berkdb installed version. Reproducible: Always
Created attachment 122236 [details, diff] BerkeleyDB-0.31.ebuild.patch
Use $(db_includedir) function rather than the mess you made with variables and substitution.
Created attachment 122241 [details, diff] BerkeleyDB-0.31.ebuild.patch a more cleaned patch as required by Flameeyes (thank you for the support).
updated and committed. thanks!