#!/bin/sh
#
# Copyright (C) 2004 Florian Briegel / MPIA <briegel@mpia.de>
#  
# copyright conditions offered by the company MPIA
#  
# file <reconf> version <#0.1.0#> of project <LGCS>

#!/bin/sh


#DELCONF_FILES=`ls config.*`
DELETE_FILES=" config.cache    acconfig.h    Makefile    Makefile.in    aclocal.m4    configure    ${DELCONF_FILES}"
for DF in ${DELETE_FILES}; 
do
  echo "deleting ${DF}"
  find . -name ${DF} -exec rm \{\} \;
done

# Alexey: Commented it while we would like to keep our soflinks...;-)
# find . -type l -exec rm \{\} \;


M4_FILES=`ls config/m4/*.m4`
echo "- creating acinclude.m4 with $M4_FILES"
cat $M4_FILES > acinclude.m4
echo "- aclocal."
aclocal 

if test `uname` = "Darwin"; then
    echo "- glibtoolize"
    glibtoolize --force
else
    echo "- libtoolize"
    libtoolize --force
fi

echo "- autoconf."
autoconf
echo "- autoheader."
autoheader
echo "- automake."
automake
echo "- automake --add-missing."
automake --add-missing


if test -n "$INSROOT"; then
  echo "Now its time for ./configure --prefix=$INSROOT"
elif test -n "$LNROOT"; then
  echo "Now its time for ./configure --prefix=$LNROOT"
  echo "Please change your enviroment from LNROOT to INSROOT\!"
else
  echo
  echo "Please add the following enviroment variables to .bashrc:"
  echo "  export INSROOT=your_install_path"
  echo "  export LD_LIBRARY_PATH=\$INSROOT/lib"
  echo "  export PATH=\$INSROOT/bin:\$PATH"
  echo "  export MANPATH=\$INSROOT/man:\$MANPATH"
  echo "  export USERNAME=\"John Doe\""
  echo "  export USEREMAIL=doe@the.end"
fi

#test -d `uname -m` || mkdir `uname -m`
#cd `uname -m`
#echo "- configure."
#../configure $* 
#exit
