Many commercial UNIXes ship without Berkeley DB support. Examples
are Solaris, HP-UX, IRIX, UNIXWARE. In order to build Postfix with
Berkeley DB support you need to download and install the source
code from
https://www.sleepycat.com/
Warning: some Linux system libraries use Berkeley DB, as do
some third-party libraries such as SASL. If you compile Postfix
with a different Berkeley DB implementation, then every Postfix
program will dump core because either the system library, SASL
library, or Postfix itself ends up using the wrong version.
The more recent Berkeley DB versions have a compile-time switch,
"--with-uniquename", which renames the symbols so that multiple
versions of Berkeley DB can co-exist in the same application.
Although wasteful, this may be the only way to keep things from
falling apart.
To build Postfix after you installed the Berkeley DB from
https://www.sleepycat.com/, use something like:
% make tidy
% make makefiles CCARGS="-DHAS_DB -I/usr/local/BerkeleyDB/include" \
AUXLIBS="-L/usr/local/BerkeleyDB/lib -ldb"
% make
Solaris needs this:
% make tidy
% make makefiles CCARGS="-DHAS_DB -I/usr/local/BerkeleyDB/include" \
AUXLIBS="-R/usr/local/BerkeleyDB/lib -L/usr/local/BerkeleyDB/lib -ldb"
% make
The exact pathnames depend on the Berkeley DB version, and on
how it was installed.
Warning: the file format produced by Berkeley DB version 1 is
not compatible with that of versions 2 and 3 (versions 2 and 3 have
the same format). If you switch between DB versions, then you may
have to rebuild all your Postfix DB files.
Warning: if you use Berkeley DB version 2 or later, do not
enable DB 1.85 compatibility mode. Doing so would break fcntl file
locking.
Warning: if you use Perl to manipulate Postfix's Berkeley DB
files, then you need to use the same Berkeley DB version in Perl
as in Postfix.