pushd "$SRCDIR"/build_unix

# The following configuration:
#
# 1. Enables compatibility for old version Berkeley DBs (probably before Oracle);
# 2. Enables DB manager libraries and utilities;
# 3. Enables CXX programs (disable --enable-cxx if you do think it is necessary);
# 4. Enables shared libraries (if you need static libraries, add --enable-static);
# 5. Disables Tcl bindings (it is not necessary so far, at least in AOSC OS);
abinfo "Configuring Berkeley DB ..."
"$SRCDIR"/dist/configure \
    --prefix=/usr \
    --enable-compat185 \
    --enable-dbm \
    --enable-cxx \
    --enable-shared \
    --disable-tcl \
    --with-mutex=POSIX/pthreads/library

# Enables POSIX thread library linkage (in glibc, no need to remove).
abinfo "Building threaded runtime libraries ..."
make LIBSO_LIBS="-lpthread"

abinfo "Installing Berkeley DB ..."
make install \
    DESTDIR="$PKGDIR"

# Note: Per the Styling Manual.
abinfo "Removing HTML documentation..."
rm -rv "$PKGDIR"/usr/docs

popd
