set -e

temp_path=${PWD}/temp
mkdir -p $temp_path

tar xf autoconf-*.tar.gz

pushd autoconf-*/
  ./configure --prefix=${temp_path}
  make
  make install
  export PATH=${PATH}:${temp_path}/bin
popd

tar xf automake/automake-*.tar.gz

pushd automake-*/
  ./configure --prefix=${temp_path}
  make
  make install
popd

tar xf libtool/libtool*.tar.gz

pushd libtool-*/
  ./configure --prefix=${temp_path}
  make
  make install
popd

tar xf talloc*.tar.gz

pushd talloc*/
  set +e
  ./configure --prefix=${temp_path}
  make
  make install
popd

tar xf pkg-config*.tar.gz

pushd pkg-config*/
  ./configure --prefix=${temp_path} --with-internal-glib
  make
  make install
popd

tar jxf cifs-utils*.tar.bz2

pushd cifs-utils*/
  autoreconf -i -I "${temp_path}/share/aclocal"
  ./configure --prefix=${temp_path}
  make CPPFLAGS="-I${temp_path}/include"
  cp mount.cifs ${BOSH_INSTALL_TARGET}
popd
