#!/bin/sh
#
#   configure name -- edit Makefile for certain predefined configurations
#
#	configure dist	    for making a formal distribution
#	configure azvax	    for /usr/local on a Vax at Arizona
#	configure azsun	    for /usr/local on a Sun at Arizona
#	configure srbin	    for /usr/sr/bin (Vax or Sun) at Arizona
#	configure none	    for direct use from development area
#	configure gcc	    as with "none", but using the GNU C Compiler
#	configure bobcat    as with "none", but for HP Bobcat (9000s300)
#
#   This is mainly a tool for SR development.  See the installation guide for
#   instructions about how to edit the Makefile to define a configuration.
#
#   WARNING -- this script overwrites the srmap file

SRC=`pwd | sed -e 's=/R/.../=/r/=' -e 's=/usr[0-9]*/=/usr/='`
CMD=/usr/local/bin
LIB=/usr/local/lib/sr
MAN1=/usr/man/manl
MAN5=/usr/man/manl
MANEXT=l
ELISP=
SRMAP=srmap.az
CC=cc
CFLAGS=-g
CCPATH=/bin/cc
RSHPATH=/usr/ucb/rsh

VFPATH=/usr/lib/vfontedpr
if [ ! -f "$VFPATH" ]; then VFPATH=; fi

case ${1-MISSING} in
    dist)
	SRC=/usr/local/src/sr
	SRMAP=srmap.min
	VFPATH=/usr/lib/vfontedpr
	;;
    srbin)
	CMD=/usr/sr/bin
	LIB=/usr/sr/bin
	MAN1=/usr/sr/bin
	MAN5=/usr/sr/bin
	MANEXT=1
	ELISP=/usr/sr/bin
	;;
    none) 
	CMD=
	LIB=
	MAN1=
	MAN5=
	MANEXT=1
	;;
    gcc)
	CMD=
	LIB=
	MAN1=
	MAN5=
	MANEXT=1
	CC=gcc
	CCPATH=/usr/local/gcc
	;;
    next)
	CMD=
	LIB=
	MAN1=
	MAN5=
	MANEXT=1
	CCPATH=/usr/local/gcc
	;;
    bobcat) 
	CMD=
	LIB=
	MAN1=
	MAN5=
	MANEXT=1
	RSHPATH=/usr/bin/remsh
	CFLAGS="+Np300"
	# and don't use -g, else it won't compile sr/{main,presym}.c
	SRMAP=srmap.min
	;;
    azvax)
	CMD=/usr/local
	MAN1=/usr/man.az/man1
	MAN5=/usr/man.az/man5
	MANEXT=1
	ELISP=/usr/local/lib/gnuemacs/lisp
	;;
    azsun)
	CMD=/usr/local
	ELISP=/usr/local/lib/gnuemacs/lisp
	;;
    MISSING)
	echo 1>&2 "usage:  $0 name"
	exit 1
	;;
    *)
	echo 1>&2 "${0}:  $1 unrecognized"
	exit 1
	;;
    esac
cp Makefile Makefile.new
ed Makefile.new <<==EOF==
/^SRC *=/s|.*|SRC = $SRC|
/^CMD *=/s|.*|CMD = $CMD|
/^LIB *=/s|.*|LIB = $LIB|
/^MAN1 *=/s|.*|MAN1 = $MAN1|
/^MAN5 *=/s|.*|MAN5 = $MAN5|
/^MANEXT *=/s|.*|MANEXT = $MANEXT|
/^ELISP *=/s|.*|ELISP = $ELISP|
/^CC *=/s|.*|CC = $CC|
/^CFLAGS *=/s|.*|CFLAGS = $CFLAGS|
/^CCPATH *=/s|.*|CCPATH = $CCPATH|
/^RSHPATH *=/s|.*|RSHPATH = $RSHPATH|
/^VFPATH *=/s|.*|VFPATH = $VFPATH|
w
q
==EOF==
diff Makefile Makefile.new
mv Makefile.new Makefile
cp $SRMAP srmap
