#!/bin/sh

# $Id: configure.skel,v 1.18 2009/05/11 17:02:09 wspear Exp $
# $Name:  $

rm -f .last_config
echo $* > .last_config
echo $* >> .all_configs

# Record all the arguments
arguments=$*

# Default compilers and options
tauroot=/home/users/sameer/fresh/f/head/release/tau2
architecture=default
taushell=sh
targetdir=/home/users/sameer/fresh/f/head/release/tau2
serverhostname=localhost
objectport=9999
registryport=1099

# PARSE COMMAND LINE SWITCHES
###############################################################
for arg in "$@";
do
  case $arg in

  -objectport=*)
    myarg=`echo $arg | sed 's/-objectport=//'`
    objectport=$myarg
    shift
    ;;

  -registryport=*)
    myarg=`echo $arg | sed 's/-registryport=//'`
    registryport=$myarg
    shift
    ;;

  -server=*)
    myarg=`echo $arg | sed 's/-server=//'`
    serverhostname=$myarg
    shift
    ;;

  -help)
    echo "PerfExplorer Configuration Utility "
    echo "***********************************************************************"
    echo "Usage: configure [OPTIONS]"
    echo "  where [OPTIONS] are:"
    echo "-server=<hostname> ...... specify hostname for the perfexplorer server."
    echo "-registryport=<number> ............. specify port for the rmi registry."
    echo "-objectport=<number> ................ specify port for the rmi objects."
    exit
    ;;

  '')
    #echo "NULL switch!"
    # Required for HP/Compaq Tru64 machines.
    ;;

  *)
    echo "ERROR: Command line switch \`$arg' not recognized" 1>&2
    exit 1
    ;;
  esac
done

# -- set up portable echo command
case "`echo 'x\c'`" in
'x\c')  echo="echo -n"  nnl= ;;     #BSD
x)      echo="echo"     nnl="\c";;  #SysV
*)      echo 'Cannot setup echo. What weird machine do you have?' 1>2&
        exit 1;;
esac

echo
echo "Configuring Makefile to use the following values:"
echo "------------------------------------------------"
echo "tauroot = $tauroot"
echo "architecture = $architecture"
echo "taushell = $taushell"
echo "targetdir = $targetdir"
echo "server = $serverhostname"
echo

echo "TAU: installing tools in $targetdir"

cat ${tauroot}/tools/src/perfexplorer/bin/Makefile.skel | 
sed -e 's,@TAUROOT@,'$targetdir',' \
-e 's,@TAUSHELL@,'$taushell',' \
-e 's,@TAUARCH@,'$architecture',' \
 > ${tauroot}/tools/src/perfexplorer/Makefile


# bye bye
echo 
echo "Configuration complete!"
echo "   If you haven't already done so, "
echo "   Please add " $tauroot/$architecture/bin " to your path"

exit 0







