#! /bin/sh

# Configuration utility for Octave
#
# Copyright (C) 2000 by Grigori G.Fursin
#
# http://www.dcs.ed.ac.uk/home/fgg
#
# ICSA, Division of Informatics,
# University of Edinburgh, UK

echo "********** Configuring Octave: **********"
echo

root=`pwd`
ext=''

if test "$1" = 1; then 
 ext='gcc';
fi

if test "$1" = 2; then
 ext='alpha_unix_cxx';
fi

if test -z "$1"; then
 echo "Usage:"
 echo
 echo "./config_unix 1"
 echo "                    - configuring Octave for gcc (3.3.3)"
 echo "./config_unix 2"
 echo "                    - configuring Octave for Alpha Unix cxx"
 exit 0;
fi

if [ -d ${root}/bin ]; then 
 (cd bin; rm -f *);
else 
 mkdir ${root}/bin;
fi

if [ -d ${root}/lib ]; then 
 (cd lib; rm -f *);
else 
 mkdir ${root}/lib;
fi

#echo "********** Configuring bison: **********"
#echo
#(cd src/tools/bison-1.22e; rm -f Makefile; 
#./configure -prefix=../../..; make clean)

#echo
#echo "********** Configuring flex: **********"
#echo
#(cd src/tools/flex-2.4.6; rm -f Makefile; 
#./configure -prefix=../../..; make clean)

echo
echo "********** Configuring lib base: **********"
echo
(cd src/lib/Base; rm -f Makefile; 
cp Makefile.${ext} Makefile; make clean)

echo
echo "********** Configuring lib fortran: **********"
echo
(cd src/lib/Fortran; rm -f Makefile; 
cp Makefile.${ext} Makefile; make clean)

echo
echo "********** Configuring test base: **********"
echo
(cd src/tests/Base; rm -f Makefile; 
cp Makefile.${ext} Makefile; make clean)

echo
echo "********** Configuring test fortran: **********"
echo
(cd src/tests/Fortran; rm -f Makefile; 
cp Makefile.${ext} Makefile; make clean)

echo
echo "********** End of configuration **********"
