#!/bin/sh
# script recreate all configure stuff from their sources
#
file=../public/.htaccess
echo "preparing ${file}.in for autoconf"
if ! test -e $file; then
 echo "${file} doesn't exist"
else
 cat $file | sed -e "s/\(SetEnv APPLICATION_ENV\).*/\1 @APPENV@/" \
  -e "s/\(SetEnv ZF_PATH\).*/\1 @ZFLIB@/" \
  -e "s/\(RewriteBase\).*/\1 @BASEURL@/" \
  > $file.in
fi

file=../application/configs/application.ini
echo "preparing ${file}.in for autoconf"
if ! test -e $file; then
 echo "${file} doesn't exist"
else
 cat $file | sed -e "s/\(resources.db.params.host\).*/\1 = @DBHOST@/" \
  -e "s/\(resources.db.params.username\).*/\1 = @DBUSERNAME@/" \
  -e "s/\(resources.db.params.password\).*/\1 = @DBPASSWORD@/" \
  -e "s/\(resources.db.params.dbname\).*/\1 = @DBNAME@/" \
  > $file.in
fi

echo "- removing old autoconf data"
rm -rf config.log configure autom4te.cache config.status
echo "- autoconf"
autoconf
