OPENLDAP_VERSION=$1
BDB_PREFIX="/usr"
SSL_PREFIX="/usr"

#export CFLAGS="-g -O4"
export CFLAGS="-g -O0"
export CPPFLAGS="-I${SSL_PREFIX}/include -I${BDB_PREFIX}/include" 
export LDFLAGS="-L${SSL_PREFIX}/lib -L${BDB_PREFIX}/lib -Wl,-R${SSL_PREFIX}/lib -Wl,-R${BDB_PREFIX}/lib"

make distclean

./configure \
  --prefix=/opt/openldap-${OPENLDAP_VERSION} \
  --enable-dynamic \
  --enable-backends=mod \
  --enable-overlays=mod \
  --enable-sql=no \
  --enable-perl=no \
  --enable-shell=no \
  --enable-local=yes \
  --with-cyrus-sasl=yes \
  --with-kerberos=yes \
  --with-tls=yes \
  --with-threads=yes \
  --enable-shared

make
make test
