# abort script on any command that exits with a non zero value
set -e

# FIXME: we should rebuild dependencies from source; we should NOT use
# this ugly hack to install via yum/apt-get.
if [ -f /etc/redhat-release ]; then
  yum install -y boost-devel
  export LDFLAGS="-L/usr/lib64"
elif [ -f /etc/lsb-release ]; then
  apt-get update
  apt-get install -y autoconf automake bison flex g++ git libboost-all-dev libtool make pkg-config ragel libmysqlclient-dev
fi

tar xvf pdns-3.4.6/pdns-3.4.6.tar.bz2
cd pdns-3.4.6

./configure \
  --with-modules="bind pipe remote" \
  --without-lua \
  --prefix=${BOSH_INSTALL_TARGET}

#./configure \
#  --prefix=${BOSH_INSTALL_TARGET} \
#  --sysconfdir=/var/vcap/jobs/named/etc \
#  --localstatedir=/var/vcap/sys
make
make install
