#!/bin/sh
# $Id: dmdconfig.src,v 1.7 1996/06/11 14:54:51 deaven Exp $
# Generic configuration script for codes using libdmd
# Copyright (c)1995 David Deaven

ARGS="$*"
ARG1="$1"
ECHO="echo"
SHELL=/bin/sh

PATH="/disk2/home/deaven/bin:$PATH"
export PATH

set `uname`
case $1 in
  Paragon)
	ECHO="/usr/ucb/echo"
	;;

  ULTRIX)
	SHELL="/usr/bin/ksh"
	if [ "$ARG1" != "POSIX_SHELL" ]
	then
	   exec $SHELL $0 POSIX_SHELL $ARGS
	fi
	;;

esac

pargs=""
do_local="yes"
for arg in $ARGS
do
  case $arg in 
    POSIX_SHELL)
      ;;

    --no-local)
      do_local="no"
      ;;

    *)
      pargs="$pargs $arg"
      ;;
  esac
done

# Use the local script if there is one.
if [ "$do_local" = "yes" ]
then
  if [ -x ./configure ] 
  then
    $ECHO "Using local configuration script."
    $ECHO $SHELL ./configure $pargs
    exec $SHELL ./configure $pargs
  else
    if [ ! "X$pargs" = "X" ]
    then
      $ECHO "Ignored configuration arguments: $pargs"
    fi
  fi
fi

# Default configuration action.
$ECHO "Creating Makefile"
rm -f Makefile depend.make 
touch depend.make
/disk2/home/deaven/bin/dmdpp Makefile.mk > Makefile
if [ "X$?" != "X0" ]
then
  $ECHO "You must first install libdmd"
  exit 1
fi

$ECHO "Making Makefiles"
make Makefiles
$ECHO "Making clean depend"
make clean depend

$ECHO "Done.  Type \`make' to compile."

