Look or tweak and use SlackBuild script found in Slackware's source/l/db4 directory.
There is something like this construction:
Code:
../dist/configure \
--prefix=/usr \
--enable-shared \
--enable-rpc \
--enable-compat185 \
$ARCH-slackware-linux
make -j3
make install DESTDIR=$PKG