#! /bin/sh
#
# $Id: configure,v 1.1 1999/07/19 17:00:15 root Exp $
#
# Copyright (C) 1997-1999 by Dimitri van Heesch.
# 
# Permission to use, copy, modify, and distribute this software and its
# documentation under the terms of the GNU General Public License is hereby 
# granted. No representations are made about the suitability of this software 
# for any purpose. It is provided "as is" without express or implied warranty.
# See the GNU General Public License for more details.
# 
# All output generated with Doxygen is not covered by this license.
# 
# shell script to configure doxygen

f_prefix=/usr/local
f_insttool=install

while test -n "$1"; do
  case $1 in
    --prefix)
       shift; f_prefix=$1
       ;;
    --install)
       shift; f_insttool=$1
       ;;
    -h | -help | --help)
       f_help=y
       ;;
    *)
       echo $1: unknown argument
       f_help=y
       f_error=y
       ;;
  esac
  shift
done

if test "$f_help" = y; then
  cat <<EOF
Usage: $0 [--help] [--prefix dir] [--install name]

Options: 

  --help                Print this help

  --prefix dir          Installation prefix directory
                        [default: /usr/local]
  
  --install name        Use \`name' as the name of the GNU install tool
                        [default: install]

EOF
  test "$f_error" = y && exit 1
  exit 0;
fi

cat > .makeconfig <<EOF
RM        = rm -f
VERSION   = `cat VERSION`
INSTALL   = $f_prefix
INSTTOOL  = $f_insttool
DOXYDOCS  = ..

export TMAKEPATH
EOF

for i in Makefile.in ; do
     SRC=$i
     DST=`echo $i|sed 's%\(.*\).in$%\1%'`
     TIME=`date`
     cat > $DST <<EOF
#
# This file was generated from `basename $i` on $TIME
#

EOF
     cat .makeconfig $SRC >> $DST
     echo "  Created $DST from $SRC..."
done
